-
Notifications
You must be signed in to change notification settings - Fork 22
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
[WIP] ClusterClass support in CAPX #334
[WIP] ClusterClass support in CAPX #334
Conversation
@deepakm-ntnx: The following test failed, say
Full PR test history. Your PR dashboard. 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 kubernetes/test-infra repository. I understand the commands that are listed here. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #334 +/- ##
=========================================
- Coverage 10.99% 8.65% -2.34%
=========================================
Files 4 13 +9
Lines 1046 1375 +329
=========================================
+ Hits 115 119 +4
- Misses 931 1256 +325 ☔ View full report in Codecov by Sentry. |
To remove following errors, trying to upgrade cluster-api to 1.4.7 make all GOBIN=/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin /Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/scripts/go_install.sh k8s.io/code-generator/cmd/conversion-gen conversion-gen v0.23.6 /Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/controller-gen-v0.8.0 object:headerFile="hack/boilerplate.go.txt" paths="./..." /Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/conversion-gen \ --input-dirs=./api/infrastructure/v1alpha4 \ --input-dirs=./api/infrastructure/v1beta1 \ --build-tag=ignore_autogenerated_core \ --output-file-base=zz_generated.conversion \ --go-header-file=./hack/boilerplate.go.txt go fmt ./... go vet ./... # sigs.k8s.io/cluster-api/api/v1beta1 ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.3.5/api/v1beta1/machine_webhook.go:45:27: cannot use &Machine{} (value of type *Machine) as admission.Validator value in variable declaration: *Machine does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error) ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.3.5/api/v1beta1/machinedeployment_webhook.go:47:27: cannot use &MachineDeployment{} (value of type *MachineDeployment) as admission.Validator value in variable declaration: *MachineDeployment does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error) ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.3.5/api/v1beta1/machinehealthcheck_webhook.go:63:27: cannot use &MachineHealthCheck{} (value of type *MachineHealthCheck) as admission.Validator value in variable declaration: *MachineHealthCheck does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error) ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.3.5/api/v1beta1/machineset_webhook.go:45:27: cannot use &MachineSet{} (value of type *MachineSet) as admission.Validator value in variable declaration: *MachineSet does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error) ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.3.5/api/v1beta1/machineset_types.go:184:83: not enough arguments in call to metav1validation.ValidateLabelSelector have (*"k8s.io/apimachinery/pkg/apis/meta/v1".LabelSelector, *"k8s.io/apimachinery/pkg/util/validation/field".Path) want (*"k8s.io/apimachinery/pkg/apis/meta/v1".LabelSelector, "k8s.io/apimachinery/pkg/apis/meta/v1/validation".LabelSelectorValidationOptions, *"k8s.io/apimachinery/pkg/util/validation/field".Path) but that did not help, # sigs.k8s.io/cluster-api/api/v1beta1 ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.4.8/api/v1beta1/machine_webhook.go:45:27: cannot use &Machine{} (value of type *Machine) as admission.Validator value in variable declaration: *Machine does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error) ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.4.8/api/v1beta1/machinedeployment_webhook.go:56:27: cannot use &MachineDeployment{} (value of type *MachineDeployment) as admission.Validator value in variable declaration: *MachineDeployment does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error) ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.4.8/api/v1beta1/machinedeployment_webhook.go:61:16: assignment mismatch: 2 variables but admission.NewDecoder returns 1 value ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.4.8/api/v1beta1/machinehealthcheck_webhook.go:63:27: cannot use &MachineHealthCheck{} (value of type *MachineHealthCheck) as admission.Validator value in variable declaration: *MachineHealthCheck does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error) ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.4.8/api/v1beta1/machineset_webhook.go:45:27: cannot use &MachineSet{} (value of type *MachineSet) as admission.Validator value in variable declaration: *MachineSet does not implement admission.Validator (wrong type for method ValidateCreate) have ValidateCreate() error want ValidateCreate() (admission.Warnings, error) make: *** [vet] Error 1 here is the snippet from cluster-api slack channel seems like https://github.com/kubernetes-sigs/cluster-api/blob/16a153cd37ff8f2b734c5d46b9ebe414e46f9f94/docs/book/src/developer/providers/migrations/v1.4-to-v1.5.md has mention of these changes Notes about the controller-runtime bump This section shares our learnings of bumping controller-runtime to v0.15 in core Cluster API. It highlights the most relevant changes and pitfalls for Cluster API providers. For the full list of changes please see the [controller-runtime release notes](https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.15.0). Webhooks can now also return warnings, this requires adding an additional admission.Warnings return parameter to all webhooks. new errors with 1.5.3 make all GOBIN=/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin /Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/scripts/go_install.sh k8s.io/code-generator/cmd/conversion-gen conversion-gen v0.23.6 /Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/controller-gen-v0.8.0 object:headerFile="hack/boilerplate.go.txt" paths="./..." /Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/conversion-gen \ --input-dirs=./api/infrastructure/v1alpha4 \ --input-dirs=./api/infrastructure/v1beta1 \ --build-tag=ignore_autogenerated_core \ --output-file-base=zz_generated.conversion \ --go-header-file=./hack/boilerplate.go.txt go fmt ./... go vet ./... # sigs.k8s.io/cluster-api/internal/topology/variables ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.5.3/internal/topology/variables/cluster_variable_validation.go:142:53: cannot use &apiextensions.CustomResourceValidation{…} (value of type *apiextensions.CustomResourceValidation) as *apiextensions.JSONSchemaProps value in argument to validation.NewSchemaValidator ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.5.3/internal/topology/variables/clusterclass_variable_validation.go:149:48: cannot use &apiextensions.CustomResourceValidation{…} (value of type *apiextensions.CustomResourceValidation) as *apiextensions.JSONSchemaProps value in argument to validation.NewSchemaValidator ../../../../pkg/mod/sigs.k8s.io/cluster-api@v1.5.3/internal/topology/variables/clusterclass_variable_validation.go:171:53: cannot use &apiextensions.CustomResourceValidation{…} (value of type *apiextensions.CustomResourceValidation) as *apiextensions.JSONSchemaProps value in argument to validation.NewSchemaValidator # github.com/nutanix-cloud-native/cluster-api-provider-nutanix/internal/controller/infrastructure internal/controller/infrastructure/nutanixcluster_controller.go:88:4: source.Kind (value of type func(cache "sigs.k8s.io/controller-runtime/pkg/cache".Cache, object "sigs.k8s.io/controller-runtime/pkg/client".Object) source.SyncingSource) is not a type internal/controller/infrastructure/nutanixmachine_controller.go:105:5: source.Kind (value of type func(cache "sigs.k8s.io/controller-runtime/pkg/cache".Cache, object "sigs.k8s.io/controller-runtime/pkg/client".Object) source.SyncingSource) is not a type internal/controller/infrastructure/nutanixmachine_controller.go:111:5: source.Kind (value of type func(cache "sigs.k8s.io/controller-runtime/pkg/cache".Cache, object "sigs.k8s.io/controller-runtime/pkg/client".Object) source.SyncingSource) is not a type internal/controller/infrastructure/nutanixmachine_controller.go:119:9: cannot use func(o client.Object) []ctrl.Request {…} (value of type func(o "sigs.k8s.io/controller-runtime/pkg/client".Object) []reconcile.Request) as handler.MapFunc value in return statement # github.com/nutanix-cloud-native/cluster-api-provider-nutanix/internal/controller/infrastructure vet: internal/controller/infrastructure/nutanixcluster_controller.go:88:4: source.Kind (value of type func(cache "sigs.k8s.io/controller-runtime/pkg/cache".Cache, object "sigs.k8s.io/controller-runtime/pkg/client".Object) source.SyncingSource) is not a type make: *** [vet] Error 1 |
b5350e0
to
70c18dd
Compare
6474cce
to
a7911fa
Compare
@deepakm-ntnx I'm going to look at this on Monday, but is there any chance you could split this PR up into smaller, logical chunks? It would make reviewing much easier, especially coming at it with little context like me 😅 I was thinking it could be broken down into: kustomization edit fixes; kubebuilder plugin v4 layout changes (including moving api package); adding ClusterClass template API kinds. WDYT? |
also ran `kustomize edit fix` to remove warnings in build
This is required for alpha topology plan to not give error Error: failed defaulting and validation on input objects: failed to run defaulting and validation on ClusterClasses: failed validation of cluster.x-k8s.io/v1beta1, Kind=ClusterClass workloads/my-test-cluster-template: ClusterClass.cluster.x-k8s.io "my-test-cluster-template" is invalid: []: Internal error: Clusters using ClusterClass my-test-cluster-template can not be retrieved: List on GroupVersionKind cluster.x-k8s.io/v1beta1, Kind=Cluster specifies selector on field spec.topology.class, but no index with name spec.topology.class has been registered for GroupVersionKind cluster.x-k8s.io/v1beta1, Kind=Cluster
also more progress on webhook installations
36927a0
to
9cfc372
Compare
Sure, but its still WIP. will do that once tests are working. wasn't planning to add reviewers yet |
Ah sorry! I was asked to take a look, but I can wait :) Let me know when you want eyes on it. |
GOOS=linux GOARCH=${shell go env GOARCH} KO_DOCKER_REPO=ko.local ${KO} build -B -t ${IMG_TAG} -L . | ||
docker tag ko.local/cluster-api-provider-nutanix:${IMG_TAG} ${IMG} | ||
GOOS=linux GOARCH=${shell go env GOARCH} KO_DOCKER_REPO=ko.local ${KO} build -B -t ${IMG_TAG} -L ./cmd | ||
docker tag ko.local/cmd:${IMG_TAG} ${IMG} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy paste mistake.
KO_DOCKER_REPO=ko.local GOFLAGS="-ldflags=-X=main.gitCommitHash=$${GIT_COMMIT_HASH}" $(KO) build -B --platform=${PLATFORMS_E2E} -t e2e -L . | ||
docker tag ko.local/cluster-api-provider-nutanix:e2e ${IMG_REPO}:e2e | ||
KO_DOCKER_REPO=ko.local GOFLAGS="-ldflags=-X=main.gitCommitHash=$${GIT_COMMIT_HASH}" $(KO) build -B --platform=${PLATFORMS_E2E} -t e2e -L ./cmd | ||
docker tag ko.local/cmd:e2e ${IMG_REPO}:e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy paste mistake
Ref: #333
https://kubebuilder.io/plugins/go-v4-plugin
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
How Has This Been Tested?:
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and test output
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
Release note: