-
Notifications
You must be signed in to change notification settings - Fork 28
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
MGMT-18232: Avoid controller-gen
crash
#108
MGMT-18232: Avoid controller-gen
crash
#108
Conversation
Version of `controller-gen` 0.13.0 crashes like this when we execute `make install`: ``` /home/user/repos/oran-o2ims/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa0de0f]goroutine 1 [running]: go/types.(*Checker).handleBailout(0xc0004aa600, 0xc000e42a18) /usr/lib/golang/src/go/types/check.go:367 +0x88 panic({0xbc7860?, 0x12b48a0?}) /usr/lib/golang/src/runtime/panic.go:770 +0x132 go/types.(*StdSizes).Sizeof(0x0, {0xdc35b8, 0x12bd080}) /usr/lib/golang/src/go/types/sizes.go:228 +0x30f go/types.(*Config).sizeof(...) /usr/lib/golang/src/go/types/sizes.go:333 go/types.representableConst.func1({0xdc35b8?, 0x12bd080?}) /usr/lib/golang/src/go/types/const.go:76 +0x9e go/types.representableConst({0xdc9990, 0x1287f80}, 0xc0004aa600, 0x12bd080, 0xc000e42188) /usr/lib/golang/src/go/types/const.go:92 +0x192 go/types.(*Checker).representation(0xc0004aa600, 0xc000f397c0, 0x12bd080) /usr/lib/golang/src/go/types/const.go:256 +0x65 go/types.(*Checker).implicitTypeAndValue(0xc0004aa600, 0xc000f397c0, {0xdc35e0, 0xc0000b2700}) /usr/lib/golang/src/go/types/expr.go:375 +0x2d7 go/types.(*Checker).assignment(0xc0004aa600, 0xc000f397c0, {0xdc35e0, 0xc0000b2700}, {0xc9528c, 0x14}) /usr/lib/golang/src/go/types/assignments.go:52 +0x2e5 go/types.(*Checker).initConst(0xc0004aa600, 0xc00138f1a0, 0xc000f397c0) /usr/lib/golang/src/go/types/assignments.go:126 +0x2c5 go/types.(*Checker).constDecl(0xc0004aa600, 0xc00138f1a0, {0xdc6200, 0xc0006f9dc0}, {0xdc6200, 0xc0006f9de0}, 0x0) /usr/lib/golang/src/go/types/decl.go:490 +0x311 go/types.(*Checker).objDecl(0xc0004aa600, {0xdcf120, 0xc00138f1a0}, 0x0) /usr/lib/golang/src/go/types/decl.go:191 +0xa49 go/types.(*Checker).packageObjects(0xc0004aa600) /usr/lib/golang/src/go/types/resolver.go:693 +0x4dd go/types.(*Checker).checkFiles(0xc0004aa600, {0xc00027e870, 0x2, 0x2}) /usr/lib/golang/src/go/types/check.go:408 +0x1a5 go/types.(*Checker).Files(...) /usr/lib/golang/src/go/types/check.go:372 sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc00023f440, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:286 +0x36a sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:99 +0x39 sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc000f3b560, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:268 +0x2b7 sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).Check(...) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:216 sigs.k8s.io/controller-tools/pkg/crd.(*Parser).AddPackage(0xc00108d2c0, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:224 +0xfd sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedPackage(0xc00108d2c0, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:242 +0xee sigs.k8s.io/controller-tools/pkg/crd.Generator.Generate({0x0, 0x0, 0x0, {0x0, 0x0, 0x0}, 0x0, {0x0, 0x0}, {0x0, ...}}, ...) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/gen.go:116 +0x128 sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0xc000468ab0) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:273 +0x23d main.main.func1(0xc00050c300?, {0xc0002346e0?, 0x4?, 0xc8af70?}) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0x6a github.com/spf13/cobra.(*Command).execute(0xc000202c08, {0xc0000361f0, 0x5, 0x5}) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:940 +0x882 github.com/spf13/cobra.(*Command).ExecuteC(0xc000202c08) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3a5 github.com/spf13/cobra.(*Command).Execute(...) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:992 main.main() /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x2f6 make: *** [Makefile:113: manifests] Error 2 ``` I didn't find a bug report for this, but the latest version (0.15.0) works correctly. This patch updates the project to use that version. Note that that has some minor effects in the generated custom resource definitions: the newer version uses `description: |-` instead of just `description: ...`. That is also included in the patch. Related: https://issues.redhat.com/browse/MGMT-18232 Signed-off-by: Juan Hernandez <[email protected]>
@jhernand: This pull request references MGMT-18232 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.17.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: irinamihai The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* MGMT-18232: Avoid `controller-gen` crash (#108) Version of `controller-gen` 0.13.0 crashes like this when we execute `make install`: ``` /home/user/repos/oran-o2ims/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa0de0f]goroutine 1 [running]: go/types.(*Checker).handleBailout(0xc0004aa600, 0xc000e42a18) /usr/lib/golang/src/go/types/check.go:367 +0x88 panic({0xbc7860?, 0x12b48a0?}) /usr/lib/golang/src/runtime/panic.go:770 +0x132 go/types.(*StdSizes).Sizeof(0x0, {0xdc35b8, 0x12bd080}) /usr/lib/golang/src/go/types/sizes.go:228 +0x30f go/types.(*Config).sizeof(...) /usr/lib/golang/src/go/types/sizes.go:333 go/types.representableConst.func1({0xdc35b8?, 0x12bd080?}) /usr/lib/golang/src/go/types/const.go:76 +0x9e go/types.representableConst({0xdc9990, 0x1287f80}, 0xc0004aa600, 0x12bd080, 0xc000e42188) /usr/lib/golang/src/go/types/const.go:92 +0x192 go/types.(*Checker).representation(0xc0004aa600, 0xc000f397c0, 0x12bd080) /usr/lib/golang/src/go/types/const.go:256 +0x65 go/types.(*Checker).implicitTypeAndValue(0xc0004aa600, 0xc000f397c0, {0xdc35e0, 0xc0000b2700}) /usr/lib/golang/src/go/types/expr.go:375 +0x2d7 go/types.(*Checker).assignment(0xc0004aa600, 0xc000f397c0, {0xdc35e0, 0xc0000b2700}, {0xc9528c, 0x14}) /usr/lib/golang/src/go/types/assignments.go:52 +0x2e5 go/types.(*Checker).initConst(0xc0004aa600, 0xc00138f1a0, 0xc000f397c0) /usr/lib/golang/src/go/types/assignments.go:126 +0x2c5 go/types.(*Checker).constDecl(0xc0004aa600, 0xc00138f1a0, {0xdc6200, 0xc0006f9dc0}, {0xdc6200, 0xc0006f9de0}, 0x0) /usr/lib/golang/src/go/types/decl.go:490 +0x311 go/types.(*Checker).objDecl(0xc0004aa600, {0xdcf120, 0xc00138f1a0}, 0x0) /usr/lib/golang/src/go/types/decl.go:191 +0xa49 go/types.(*Checker).packageObjects(0xc0004aa600) /usr/lib/golang/src/go/types/resolver.go:693 +0x4dd go/types.(*Checker).checkFiles(0xc0004aa600, {0xc00027e870, 0x2, 0x2}) /usr/lib/golang/src/go/types/check.go:408 +0x1a5 go/types.(*Checker).Files(...) /usr/lib/golang/src/go/types/check.go:372 sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc00023f440, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:286 +0x36a sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:99 +0x39 sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc000f3b560, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:268 +0x2b7 sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).Check(...) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:216 sigs.k8s.io/controller-tools/pkg/crd.(*Parser).AddPackage(0xc00108d2c0, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:224 +0xfd sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedPackage(0xc00108d2c0, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:242 +0xee sigs.k8s.io/controller-tools/pkg/crd.Generator.Generate({0x0, 0x0, 0x0, {0x0, 0x0, 0x0}, 0x0, {0x0, 0x0}, {0x0, ...}}, ...) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/gen.go:116 +0x128 sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0xc000468ab0) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:273 +0x23d main.main.func1(0xc00050c300?, {0xc0002346e0?, 0x4?, 0xc8af70?}) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0x6a github.com/spf13/cobra.(*Command).execute(0xc000202c08, {0xc0000361f0, 0x5, 0x5}) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:940 +0x882 github.com/spf13/cobra.(*Command).ExecuteC(0xc000202c08) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3a5 github.com/spf13/cobra.(*Command).Execute(...) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:992 main.main() /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x2f6 make: *** [Makefile:113: manifests] Error 2 ``` I didn't find a bug report for this, but the latest version (0.15.0) works correctly. This patch updates the project to use that version. Note that that has some minor effects in the generated custom resource definitions: the newer version uses `description: |-` instead of just `description: ...`. That is also included in the patch. Related: https://issues.redhat.com/browse/MGMT-18232 Signed-off-by: Juan Hernandez <[email protected]> * NO-ISSUE: Use Go 1.21 in all modules (#110) The recently added `api/hardwaremanagement` module uses Go 1.22. That wasn't intentional. This patch changes it to use Go 1.21 and the same dependencies than the rest of the project. Related: #109 Signed-off-by: Juan Hernandez <[email protected]> * NO-ISSUE: Move selector logic from handlers to adapter (#117) Currently we apply the selector (the `filter` query parameter) in all the handlers. This patch moves the logic to the adapter, which is where it belongs. Signed-off-by: Juan Hernandez <[email protected]> * NO-ISSUE: remove redundant jsonAPI from handlers (#119) Removed unsed `jsonAPI` from handlers (can be added ad-hoc when needed). * NO-ISSUE: fix typos related to alarms (#112) * Supports for alarm notification server: (#102) - Create the alarm notification handler and alarm notification server. - Add user passed in optional namespace and configmap_name for subscription server and notification server - Manage alarm subscriptions in memory base on persist storage (configuration map populated by alarm subscription server). - Prebuilt subscription filter terms - Accept the alarts from alertManager, map the received alert to alarm, match the filters and build and send out notification packet based on matched subscription - Daniel E authored the alert to alarm mapping portion in this commit, and the same code used by alarm server. - Enhanced subscription handler * CNF-13590: Use the vendor directory when building images (#128) Description: - remove the vendor directory from .gitignore and .containerignore so that it gets copied into the image with the rest of the content - add -mod=vendor to go build commands * Add repo owners * Add .gitattributes (#130) --------- Signed-off-by: Juan Hernandez <[email protected]> Co-authored-by: Juan Hernández <[email protected]> Co-authored-by: Daniel Erez <[email protected]> Co-authored-by: Jennifer-chen-rh <[email protected]> Co-authored-by: Irina Mihai <[email protected]>
* MGMT-18232: Avoid `controller-gen` crash (openshift-kni#108) Version of `controller-gen` 0.13.0 crashes like this when we execute `make install`: ``` /home/user/repos/oran-o2ims/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa0de0f]goroutine 1 [running]: go/types.(*Checker).handleBailout(0xc0004aa600, 0xc000e42a18) /usr/lib/golang/src/go/types/check.go:367 +0x88 panic({0xbc7860?, 0x12b48a0?}) /usr/lib/golang/src/runtime/panic.go:770 +0x132 go/types.(*StdSizes).Sizeof(0x0, {0xdc35b8, 0x12bd080}) /usr/lib/golang/src/go/types/sizes.go:228 +0x30f go/types.(*Config).sizeof(...) /usr/lib/golang/src/go/types/sizes.go:333 go/types.representableConst.func1({0xdc35b8?, 0x12bd080?}) /usr/lib/golang/src/go/types/const.go:76 +0x9e go/types.representableConst({0xdc9990, 0x1287f80}, 0xc0004aa600, 0x12bd080, 0xc000e42188) /usr/lib/golang/src/go/types/const.go:92 +0x192 go/types.(*Checker).representation(0xc0004aa600, 0xc000f397c0, 0x12bd080) /usr/lib/golang/src/go/types/const.go:256 +0x65 go/types.(*Checker).implicitTypeAndValue(0xc0004aa600, 0xc000f397c0, {0xdc35e0, 0xc0000b2700}) /usr/lib/golang/src/go/types/expr.go:375 +0x2d7 go/types.(*Checker).assignment(0xc0004aa600, 0xc000f397c0, {0xdc35e0, 0xc0000b2700}, {0xc9528c, 0x14}) /usr/lib/golang/src/go/types/assignments.go:52 +0x2e5 go/types.(*Checker).initConst(0xc0004aa600, 0xc00138f1a0, 0xc000f397c0) /usr/lib/golang/src/go/types/assignments.go:126 +0x2c5 go/types.(*Checker).constDecl(0xc0004aa600, 0xc00138f1a0, {0xdc6200, 0xc0006f9dc0}, {0xdc6200, 0xc0006f9de0}, 0x0) /usr/lib/golang/src/go/types/decl.go:490 +0x311 go/types.(*Checker).objDecl(0xc0004aa600, {0xdcf120, 0xc00138f1a0}, 0x0) /usr/lib/golang/src/go/types/decl.go:191 +0xa49 go/types.(*Checker).packageObjects(0xc0004aa600) /usr/lib/golang/src/go/types/resolver.go:693 +0x4dd go/types.(*Checker).checkFiles(0xc0004aa600, {0xc00027e870, 0x2, 0x2}) /usr/lib/golang/src/go/types/check.go:408 +0x1a5 go/types.(*Checker).Files(...) /usr/lib/golang/src/go/types/check.go:372 sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc00023f440, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:286 +0x36a sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:99 +0x39 sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc000f3b560, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:268 +0x2b7 sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).Check(...) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:216 sigs.k8s.io/controller-tools/pkg/crd.(*Parser).AddPackage(0xc00108d2c0, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:224 +0xfd sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedPackage(0xc00108d2c0, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:242 +0xee sigs.k8s.io/controller-tools/pkg/crd.Generator.Generate({0x0, 0x0, 0x0, {0x0, 0x0, 0x0}, 0x0, {0x0, 0x0}, {0x0, ...}}, ...) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/gen.go:116 +0x128 sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0xc000468ab0) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:273 +0x23d main.main.func1(0xc00050c300?, {0xc0002346e0?, 0x4?, 0xc8af70?}) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0x6a github.com/spf13/cobra.(*Command).execute(0xc000202c08, {0xc0000361f0, 0x5, 0x5}) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:940 +0x882 github.com/spf13/cobra.(*Command).ExecuteC(0xc000202c08) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3a5 github.com/spf13/cobra.(*Command).Execute(...) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:992 main.main() /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x2f6 make: *** [Makefile:113: manifests] Error 2 ``` I didn't find a bug report for this, but the latest version (0.15.0) works correctly. This patch updates the project to use that version. Note that that has some minor effects in the generated custom resource definitions: the newer version uses `description: |-` instead of just `description: ...`. That is also included in the patch. Related: https://issues.redhat.com/browse/MGMT-18232 Signed-off-by: Juan Hernandez <[email protected]> * NO-ISSUE: Use Go 1.21 in all modules (openshift-kni#110) The recently added `api/hardwaremanagement` module uses Go 1.22. That wasn't intentional. This patch changes it to use Go 1.21 and the same dependencies than the rest of the project. Related: openshift-kni#109 Signed-off-by: Juan Hernandez <[email protected]> * NO-ISSUE: Move selector logic from handlers to adapter (openshift-kni#117) Currently we apply the selector (the `filter` query parameter) in all the handlers. This patch moves the logic to the adapter, which is where it belongs. Signed-off-by: Juan Hernandez <[email protected]> * NO-ISSUE: remove redundant jsonAPI from handlers (openshift-kni#119) Removed unsed `jsonAPI` from handlers (can be added ad-hoc when needed). * NO-ISSUE: fix typos related to alarms (openshift-kni#112) * Supports for alarm notification server: (openshift-kni#102) - Create the alarm notification handler and alarm notification server. - Add user passed in optional namespace and configmap_name for subscription server and notification server - Manage alarm subscriptions in memory base on persist storage (configuration map populated by alarm subscription server). - Prebuilt subscription filter terms - Accept the alarts from alertManager, map the received alert to alarm, match the filters and build and send out notification packet based on matched subscription - Daniel E authored the alert to alarm mapping portion in this commit, and the same code used by alarm server. - Enhanced subscription handler * CNF-13590: Use the vendor directory when building images (openshift-kni#128) Description: - remove the vendor directory from .gitignore and .containerignore so that it gets copied into the image with the rest of the content - add -mod=vendor to go build commands * Add repo owners * Add .gitattributes (openshift-kni#130) --------- Signed-off-by: Juan Hernandez <[email protected]> Co-authored-by: Juan Hernández <[email protected]> Co-authored-by: Daniel Erez <[email protected]> Co-authored-by: Jennifer-chen-rh <[email protected]> Co-authored-by: Irina Mihai <[email protected]>
* Provisioning POC: Operator boilerplate Description: - Add the boilerplate for the operator provisioning logic: * ClusterTemplate & ClusterRequest CRs * ClusterTemplate & ClusterRequest controllers * CNF-13444: ClusterTemplate CRD and controller logic Description: - add inputDataSchema to the ClusterTemplate CR - add controller logic to validate the inputDataSchema is a valid JSON and reflect the validation results in the status of the clusterTemplate CR - add unit tests * CNF-13446: ClusterRequest CRD fields Description: - add the clusterTemplateRef and clusterTemplateInput to the ClusterRequest CRD to avoid future merge conflicts * CNF-13446: Add and validate clusterTemplateInput Description - add validation for the clusterTemplateInput field of clusterRequest - save validation status to the CR's status * initial commit for siteconfig template cm * CNF-13446: ClusterRequest schema match with template Description: - match the clusterTemplateInput with the inputDataSchema of the clusterTemplateRef - automatically trigger clusterRequest reconciliation if clusterTemplates used by clusterRequests are updated or deleted - unit tests * ClusterInstance generation Signed-off-by: Angie Wang <[email protected]> * CNF-13448: Create resources needed by ClusterInstance Description: - create the namespace, BMS secrets, pull secret and extra-manifests ConfigMaps - updates for the new ClusterInstance CRD * Ensure the accurate merging of clusterTemplateInput with the default data * CNF-13447-CNF-13449: Watches and finalizer Description: - add watches for the ClusterInstance and the ManagedCluster - add finalizer for the ClusterRequest * ClusterTemplate and ClusterRequest CRDs spec updates for ClusterInstance * Change the type of clusterInstanceSchema and clusterInstanceInput to object * CNF-13706: [POC2] ACM PolicyGenerator Schema Description: - sample for ACM policy generator that would be used in the ClusterTemplate spec.inputDataSchema.policyTemplateSchema - the current sample is subject to change * Add repo owners * Add ClusterTemplate validation and status condition (#131) Signed-off-by: Angie Wang <[email protected]> * Resync POC branch with main (#136) * MGMT-18232: Avoid `controller-gen` crash (#108) Version of `controller-gen` 0.13.0 crashes like this when we execute `make install`: ``` /home/user/repos/oran-o2ims/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa0de0f]goroutine 1 [running]: go/types.(*Checker).handleBailout(0xc0004aa600, 0xc000e42a18) /usr/lib/golang/src/go/types/check.go:367 +0x88 panic({0xbc7860?, 0x12b48a0?}) /usr/lib/golang/src/runtime/panic.go:770 +0x132 go/types.(*StdSizes).Sizeof(0x0, {0xdc35b8, 0x12bd080}) /usr/lib/golang/src/go/types/sizes.go:228 +0x30f go/types.(*Config).sizeof(...) /usr/lib/golang/src/go/types/sizes.go:333 go/types.representableConst.func1({0xdc35b8?, 0x12bd080?}) /usr/lib/golang/src/go/types/const.go:76 +0x9e go/types.representableConst({0xdc9990, 0x1287f80}, 0xc0004aa600, 0x12bd080, 0xc000e42188) /usr/lib/golang/src/go/types/const.go:92 +0x192 go/types.(*Checker).representation(0xc0004aa600, 0xc000f397c0, 0x12bd080) /usr/lib/golang/src/go/types/const.go:256 +0x65 go/types.(*Checker).implicitTypeAndValue(0xc0004aa600, 0xc000f397c0, {0xdc35e0, 0xc0000b2700}) /usr/lib/golang/src/go/types/expr.go:375 +0x2d7 go/types.(*Checker).assignment(0xc0004aa600, 0xc000f397c0, {0xdc35e0, 0xc0000b2700}, {0xc9528c, 0x14}) /usr/lib/golang/src/go/types/assignments.go:52 +0x2e5 go/types.(*Checker).initConst(0xc0004aa600, 0xc00138f1a0, 0xc000f397c0) /usr/lib/golang/src/go/types/assignments.go:126 +0x2c5 go/types.(*Checker).constDecl(0xc0004aa600, 0xc00138f1a0, {0xdc6200, 0xc0006f9dc0}, {0xdc6200, 0xc0006f9de0}, 0x0) /usr/lib/golang/src/go/types/decl.go:490 +0x311 go/types.(*Checker).objDecl(0xc0004aa600, {0xdcf120, 0xc00138f1a0}, 0x0) /usr/lib/golang/src/go/types/decl.go:191 +0xa49 go/types.(*Checker).packageObjects(0xc0004aa600) /usr/lib/golang/src/go/types/resolver.go:693 +0x4dd go/types.(*Checker).checkFiles(0xc0004aa600, {0xc00027e870, 0x2, 0x2}) /usr/lib/golang/src/go/types/check.go:408 +0x1a5 go/types.(*Checker).Files(...) /usr/lib/golang/src/go/types/check.go:372 sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc00023f440, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:286 +0x36a sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:99 +0x39 sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc000f3b560, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:268 +0x2b7 sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).Check(...) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:216 sigs.k8s.io/controller-tools/pkg/crd.(*Parser).AddPackage(0xc00108d2c0, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:224 +0xfd sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedPackage(0xc00108d2c0, 0xc000992e00) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/parser.go:242 +0xee sigs.k8s.io/controller-tools/pkg/crd.Generator.Generate({0x0, 0x0, 0x0, {0x0, 0x0, 0x0}, 0x0, {0x0, 0x0}, {0x0, ...}}, ...) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/crd/gen.go:116 +0x128 sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0xc000468ab0) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/genall/genall.go:273 +0x23d main.main.func1(0xc00050c300?, {0xc0002346e0?, 0x4?, 0xc8af70?}) /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:176 +0x6a github.com/spf13/cobra.(*Command).execute(0xc000202c08, {0xc0000361f0, 0x5, 0x5}) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:940 +0x882 github.com/spf13/cobra.(*Command).ExecuteC(0xc000202c08) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3a5 github.com/spf13/cobra.(*Command).Execute(...) /home/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:992 main.main() /home/user/go/pkg/mod/sigs.k8s.io/[email protected]/cmd/controller-gen/main.go:200 +0x2f6 make: *** [Makefile:113: manifests] Error 2 ``` I didn't find a bug report for this, but the latest version (0.15.0) works correctly. This patch updates the project to use that version. Note that that has some minor effects in the generated custom resource definitions: the newer version uses `description: |-` instead of just `description: ...`. That is also included in the patch. Related: https://issues.redhat.com/browse/MGMT-18232 Signed-off-by: Juan Hernandez <[email protected]> * NO-ISSUE: Use Go 1.21 in all modules (#110) The recently added `api/hardwaremanagement` module uses Go 1.22. That wasn't intentional. This patch changes it to use Go 1.21 and the same dependencies than the rest of the project. Related: #109 Signed-off-by: Juan Hernandez <[email protected]> * NO-ISSUE: Move selector logic from handlers to adapter (#117) Currently we apply the selector (the `filter` query parameter) in all the handlers. This patch moves the logic to the adapter, which is where it belongs. Signed-off-by: Juan Hernandez <[email protected]> * NO-ISSUE: remove redundant jsonAPI from handlers (#119) Removed unsed `jsonAPI` from handlers (can be added ad-hoc when needed). * NO-ISSUE: fix typos related to alarms (#112) * Supports for alarm notification server: (#102) - Create the alarm notification handler and alarm notification server. - Add user passed in optional namespace and configmap_name for subscription server and notification server - Manage alarm subscriptions in memory base on persist storage (configuration map populated by alarm subscription server). - Prebuilt subscription filter terms - Accept the alarts from alertManager, map the received alert to alarm, match the filters and build and send out notification packet based on matched subscription - Daniel E authored the alert to alarm mapping portion in this commit, and the same code used by alarm server. - Enhanced subscription handler * CNF-13590: Use the vendor directory when building images (#128) Description: - remove the vendor directory from .gitignore and .containerignore so that it gets copied into the image with the rest of the content - add -mod=vendor to go build commands * Add repo owners * Add .gitattributes (#130) --------- Signed-off-by: Juan Hernandez <[email protected]> Co-authored-by: Juan Hernández <[email protected]> Co-authored-by: Daniel Erez <[email protected]> Co-authored-by: Jennifer-chen-rh <[email protected]> Co-authored-by: Irina Mihai <[email protected]> * Update vendors with missing modules (#137) Signed-off-by: Don Penney <[email protected]> * NO-ISSUE: Add POC branch to github workflows Signed-off-by: Don Penney <[email protected]> * CNF-13894: Hardware provisioning POC (#135) Signed-off-by: Tao Liu <[email protected]> * CRDs updates due to upversioned controller-gen (#140) * Set transport defaults when creating HTTP backend transport (#139) The zero value of HttpTransport doesn't include any default attribute values for setting up the HTTP transport. This prevents using the HTTPS_PROXY environment variable (and other related proxy variables) to redirect HTTP requests to a proxy. We could set this explicitly on our own, but that wouldn't pick up any future changes to the defaults made upstream in the library. This is useful when testing as a standalone binary and connecting to a system that is behind a proxy. Signed-off-by: Allain Legacy <[email protected]> * Move NodePool to the hardwaremanagement Module Update 1 (#143) Signed-off-by: Tao Liu <[email protected]> * Add support for policy template configuration (#133) * Exclude vendor directory from gofmt input parameters (#145) Now that the `vendor` directory is no longer excluded from git we need to adjust the `gofmt` input parameters to exclude it since it currently looks at any and all *.go files within the entire repo. This causes it to run on files within the vendor directory which, as it turns out, contains some *.go files that do not conform to the go formatting guidelines. Alternatively we could have explicitly listed the required source directories, but figured that this dynamic approach would be more "future-proof" and require less code maintenance. Signed-off-by: Allain Legacy <[email protected]> * Add alegacy to OWNERS_ALIASES (#147) Signed-off-by: Don Penney <[email protected]> * test: Avoid fake client server-side apply error (#141) In the current k8s dependencies, the fake client does not support server-side apply calls and returns an error in the ginkgo tests: [FAILED] Unexpected error: <*errors.errorString | 0xc00064e1a0>: apply patches are not supported in the fake client. Follow kubernetes/kubernetes#115598 for the current status { s: "apply patches are not supported in the fake client. Follow kubernetes/kubernetes#115598 for the current status", } occurred This update adds a check for this error to bypass the failure, until the k8s modules can be updated to a version that does not produce this error. Signed-off-by: Don Penney <[email protected]> * Add unittests for policytemplate configmap (#151) * NO-ISSUE: POC: workflow: Update golangci-lint to 1.59.1 (#150) * workflow: Update golangci-lint to 1.59.1 Signed-off-by: Don Penney <[email protected]> * Add initial golangci-lint config file Signed-off-by: Don Penney <[email protected]> --------- Signed-off-by: Don Penney <[email protected]> * Enable golangci-lint misspell test (#152) Signed-off-by: Don Penney <[email protected]> * CNF-13957: Enable goimports linter configuration (#153) This addresses import statement ordering/grouping violations reported by the golintci tool. Signed-off-by: Allain Legacy <[email protected]> * CNF-13961: Enable unconvert linter configuration (#154) This addresses issues with unnecessary type conversions reported by the golintci tool. Signed-off-by: Allain Legacy <[email protected]> * Enable golangci-lint goconst test (#157) Signed-off-by: Don Penney <[email protected]> * Enable golangci-lint unparam test (#155) Signed-off-by: Don Penney <[email protected]> * CNF-13953: Enable errorlint linter configuration (#156) This addresses issues with improperly unwrapped error objects reported by the golintci tool. Signed-off-by: Allain Legacy <[email protected]> * CNF-13956: Enable gocyclo linter configuration (#158) This enables the code complexity test and addresses the violations reported by the golintci tool. Signed-off-by: Allain Legacy <[email protected]> * Enable golangci-lint gocritic test (#159) Signed-off-by: Don Penney <[email protected]> * Use dev script to pin golangci-lint version for users (#162) Signed-off-by: Don Penney <[email protected]> * golangci-lint: Fix some more gocritic lints (#161) Signed-off-by: Leonardo Ochoa-Aday <[email protected]> * Enable golangci-lint for _test.go files (#163) Signed-off-by: Don Penney <[email protected]> * Enable additional golangci-lint linters (#164) The following golangci-lint linters are enabled: - errcheck - gosimple - importas - nilnil - predeclared - promlinter - sloglint - usestdlibvars Signed-off-by: Don Penney <[email protected]> * Import NodePool from the hardwaremanagement module (#160) Signed-off-by: Tao Liu <[email protected]> * Requeue and status handling in ClusterRequest controller (#144) Signed-off-by: Angie Wang <[email protected]> * CNF-13707: Policy template configMap updates (#165) Description: - update the policy template configMap keys to keep them the same as the default policy template configMap - do not check for a policy label on the clusterInstance (the user needs to make sure the labels used in the ClusterInstance and the ACM PGs match) - add unit tests * Update Dockerfile to copy vendor folder as separate layer (#166) By separating the vendor folder to its own COPY directive in the Dockerfile, the build is able to make use of the cached directory more efficiently, as the vendor files will change infrequently. Signed-off-by: Don Penney <[email protected]> * Add RBAC for nodepools (#167) Signed-off-by: Tao Liu <[email protected]> * CNF-13958: Enable gosec linter configuration (#169) This enables the code security test and addresses the violations reported by the golintci tool. Signed-off-by: Allain Legacy <[email protected]> * golangci-lint: Enable wrapcheck linter configs (#170) Signed-off-by: Leonardo Ochoa-Aday <[email protected]> Co-authored-by: Don Penney <[email protected]> * CNF-14009: Node Hostname Update and BootMacAddress Retrieval (#168) * CNF-14009: Node Hostname Update and BooMacAddress Enhanced the IMS operator to update Node status with the hostname post-BMC assignment and use the bootMacAddress from Node status to update the ClusterInstance. Signed-off-by: Tao Liu <[email protected]> * CNF-14009: Node Hostname Update and BootMacAddress Enhanced the IMS operator to update Node status with the hostname post-BMC assignment and use the bootMacAddress from Node status to update the ClusterInstance. Signed-off-by: Tao Liu <[email protected]> --------- Signed-off-by: Tao Liu <[email protected]> * Update vendor folder Signed-off-by: Don Penney <[email protected]> * Fix merge issues Signed-off-by: Don Penney <[email protected]> --------- Signed-off-by: Angie Wang <[email protected]> Signed-off-by: Juan Hernandez <[email protected]> Signed-off-by: Don Penney <[email protected]> Signed-off-by: Tao Liu <[email protected]> Signed-off-by: Allain Legacy <[email protected]> Signed-off-by: Leonardo Ochoa-Aday <[email protected]> Co-authored-by: Irina Mihai <[email protected]> Co-authored-by: Angie Wang <[email protected]> Co-authored-by: Juan Hernández <[email protected]> Co-authored-by: Daniel Erez <[email protected]> Co-authored-by: Jennifer-chen-rh <[email protected]> Co-authored-by: Tao Liu <[email protected]> Co-authored-by: Allain Legacy <[email protected]> Co-authored-by: Allain Legacy <[email protected]> Co-authored-by: Leo Ochoa <[email protected]>
Version of
controller-gen
0.13.0 crashes like this when we executemake install
:I didn't find a bug report for this, but the latest version (0.15.0) works correctly. This patch updates the project to use that version. Note that that has some minor effects in the generated custom resource definitions: the newer version uses
description: |-
instead of justdescription: ...
. That is also included in the patch.Related: https://issues.redhat.com/browse/MGMT-18232