Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UCP: support setting discovery resources #2434

Merged
merged 20 commits into from
Jun 2, 2020

Conversation

shonge
Copy link
Member

@shonge shonge commented May 11, 2020

What problem does this PR solve?

UCP: #2393
Close: #2393

What is changed and how does it work?

support setting discovery resources.
By manual test, deployment/basic-discovery for controller TidbCluster/basic was successfully created when I don't set resources requirements.

Check List

Tests

  • Unit test
  • E2E test

Code changes

  • Has Go code change

Side effects

  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Does this PR introduce a user-facing change?:

support setting discovery resources

@sre-bot
Copy link
Contributor

sre-bot commented May 11, 2020

Thanks for your contribution. If your PR get merged, you will be rewarded 50 points.

@shonge shonge changed the title UCP: support setting discovery resources [WIP]UCP: support setting discovery resources May 12, 2020
@Yisaer
Copy link
Contributor

Yisaer commented May 12, 2020

@shonge It seems your generated code is wrong in this request. Please follow these steps:

  1. execute ./hack/update-codegen.sh
  2. execute ./hack/update-openapi-spec.sh
  3. execute ./hack/update-crd-groups.sh

@shonge
Copy link
Member Author

shonge commented May 12, 2020

When running ./hack/update-crd-groups.sh got these errors:

Installing gen_crd_api_references_docs v0.2.1...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   658  100   658    0     0    414      0  0:00:01  0:00:01 --:--:--   414
100 6347k  100 6347k    0     0  1153k      0  0:00:05  0:00:05 --:--:-- 1634k
gen-crd-api-reference-docs
I0512 14:49:48.544916   62817 main.go:127] parsing go packages in directory github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1
W0512 14:49:48.550151   62817 parse.go:224] Ignoring directory github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1: unable to import "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1": go/build: importGo github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1: exit status 2
go: cannot find GOROOT directory: /Users/yisa/Downloads/GOVERSION/go1.13.4

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x81ce95]

goroutine 1 [running]:
k8s.io/gengo/parser.(*Builder).AddDirRecursive(0xc0000c5540, 0x7ffc1d0345ba, 0x3a, 0x87, 0xdb)
        /Users/yisa/Downloads/Github/GoProject/pkg/mod/k8s.io/gengo@v0.0.0-20190128074634-0689ccc1d7d6/parser/parse.go:229 +0xb5
main.parseAPIPackages(0x7ffc1d0345ba, 0x3a, 0x93c01a, 0x23, 0xc000113f10, 0x1, 0x1)
        /Users/yisa/Downloads/Github/gen-crd-api-reference-docs/main.go:201 +0x60
main.main()
        /Users/yisa/Downloads/Github/gen-crd-api-reference-docs/main.go:128 +0x2ca

@shonge
Copy link
Member Author

shonge commented May 12, 2020

[root@localhost tidb-operator]# rm output/bin/gen-crd-api-reference-docs
rm: remove regular file ‘output/bin/gen-crd-api-reference-docs’? yes
[root@localhost tidb-operator]# ./hack/update-crd-groups.sh
Installing gen_crd_api_references_docs v0.2.1...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   658  100   658    0     0    481      0  0:00:01  0:00:01 --:--:--   480
100 6347k  100 6347k    0     0  1133k      0  0:00:05  0:00:05 --:--:-- 1836k
gen-crd-api-reference-docs
I0512 15:16:29.276614   87759 main.go:127] parsing go packages in directory github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1
W0512 15:16:29.280993   87759 parse.go:224] Ignoring directory github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1: unable to import "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1": go/build: importGo github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1: exit status 2
go: cannot find GOROOT directory: /Users/yisa/Downloads/GOVERSION/go1.13.4

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x81ce95]

goroutine 1 [running]:
k8s.io/gengo/parser.(*Builder).AddDirRecursive(0xc0000b9540, 0x7fffc0a5f5ba, 0x3a, 0x87, 0xdb)
        /Users/yisa/Downloads/Github/GoProject/pkg/mod/k8s.io/gengo@v0.0.0-20190128074634-0689ccc1d7d6/parser/parse.go:229 +0xb5
main.parseAPIPackages(0x7fffc0a5f5ba, 0x3a, 0x93c01a, 0x23, 0xc0000fff10, 0x1, 0x1)
        /Users/yisa/Downloads/Github/gen-crd-api-reference-docs/main.go:201 +0x60
main.main()
        /Users/yisa/Downloads/Github/gen-crd-api-reference-docs/main.go:128 +0x2ca
[root@localhost tidb-operator]# go version
go version go1.13.1 linux/amd64
[root@localhost tidb-operator]# go env GOPATH
/root/go
[root@localhost tidb-operator]# go env GOROOT
/usr/local/go
[root@localhost tidb-operator]# pwd
/root/go/src/github.com/pingcap/tidb-operator

@vincent178
Copy link
Contributor

vincent178 commented May 12, 2020

I have a temporary solution for that, will investigate a long-term solution here, but for now you could:

  1. download source code from https://github.com/Yisaer/gen-crd-api-reference-docs/releases
  2. cd into folder
$ go install .
  1. update the ./hack/update-crd-group.sh
    change ${DOCS_BIN} to the gen-crd-api-reference-docs binary you just create, it's under $GOPATH/bin/gen-crd-api-reference-docs, you have to use absolute path here.
  2. run ./hack/update-crd-group.sh

cc: @Yisaer

@Yisaer
Copy link
Contributor

Yisaer commented May 12, 2020

@vincent178 Thanks for your solution. We will investigate it sooner.

@shonge
Copy link
Member Author

shonge commented May 12, 2020

Temporary solution is work!
BTW,go env output like this:

[root@localhost tidb-operator]# go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/root/go/src/github.com/pingcap/tidb-operator/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build269335278=/tmp/go-build -gno-record-gcc-switches"

@shonge shonge changed the title [WIP]UCP: support setting discovery resources UCP: support setting discovery resources May 12, 2020
@shonge
Copy link
Member Author

shonge commented May 12, 2020

@DanielZhangQD PTAL

@Yisaer Yisaer requested review from cofyc and weekface May 14, 2020 11:37
@Yisaer Yisaer requested a review from DanielZhangQD May 14, 2020 11:37
DanielZhangQD
DanielZhangQD previously approved these changes May 16, 2020
Copy link
Contributor

@DanielZhangQD DanielZhangQD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cofyc cofyc merged commit d2eefc7 into pingcap:master Jun 2, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Jun 2, 2020

Team TiCloud complete task #2393 and get 50 score, current score 150

@cofyc
Copy link
Contributor

cofyc commented Jun 2, 2020

cc @you06 @sre-bot does not create a cherry-pick PR for this?

sre-bot pushed a commit to sre-bot/tidb-operator that referenced this pull request Jun 2, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Jun 2, 2020

cherry pick to release-1.1 in PR #2603

@shonge shonge deleted the ucp_tidb-discovery_resources branch June 2, 2020 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UCP: support setting resources for tidb-discovery deployment
6 participants