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

[WIP] ClusterClass support in CAPX #334

Closed

Conversation

deepakm-ntnx
Copy link
Contributor

@deepakm-ntnx deepakm-ntnx commented Nov 22, 2023

Ref: #333
https://kubebuilder.io/plugins/go-v4-plugin

What this PR does / why we need it:

 deepak.muley@C02ZG5BMLVDL  ~/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix   clusterclassv4  kubebuilder create api --group infrastructure --version v1beta1 --kind NutanixClusterTemplate
INFO Create Resource [y/n]                        
y
INFO Create Controller [y/n]                      
y
INFO Writing kustomize manifests for you to edit... 
INFO Writing scaffold for you to edit...          
INFO api/infrastructure/v1beta1/nutanixclustertemplate_types.go 
INFO api/infrastructure/v1beta1/groupversion_info.go 
INFO internal/controller/infrastructure/suite_test.go 
INFO internal/controller/infrastructure/nutanixclustertemplate_controller.go 
INFO Update dependencies:
$ go mod tidy           
INFO Running make:
$ make generate                
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
Next: implement your new API and generate the manifests (e.g. CRDs,CRs) with:
$ make manifests
 kubebuilder create webhook --group  infrastructure --version v1beta1 --kind NutanixClusterTemplate --defaulting --programmatic-validation --force
INFO Writing kustomize manifests for you to edit... 
ERRO Unable to find the target #- path: manager_webhook_patch.yaml to uncomment in the file config/default/kustomization.yaml. 
INFO Writing scaffold for you to edit...          
INFO api/infrastructure/v1beta1/nutanixclustertemplate_webhook.go 
INFO api/infrastructure/v1beta1/webhook_suite_test.go 
INFO Update dependencies:
$ go mod tidy           
go: finding module for package sigs.k8s.io/controller-runtime/pkg/metrics/server
go: found sigs.k8s.io/controller-runtime/pkg/metrics/server in sigs.k8s.io/controller-runtime v0.16.3
go: finding module for package gotest.tools/v3/skip
go: finding module for package gotest.tools/v3/assert
go: finding module for package gotest.tools/v3/env
go: finding module for package gotest.tools/v3/assert/cmp
go: found gotest.tools/v3/assert in gotest.tools/v3 v3.5.1
go: found gotest.tools/v3/assert/cmp in gotest.tools/v3 v3.5.1
go: found gotest.tools/v3/env in gotest.tools/v3 v3.5.1
go: found gotest.tools/v3/skip in gotest.tools/v3 v3.5.1
INFO Running make:
$ make generate                
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
Next: implement your new Webhook and generate the manifests with:
$ make manifests

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?:

 ✘ deepak.muley@C02ZG5BMLVDL  ~/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix   clusterclassv4  make manifests
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/controller-gen-v0.8.0 "crd:crdVersions=v1" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
 deepak.muley@C02ZG5BMLVDL  ~/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix   clusterclassv4  make cluster-templates
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 sigs.k8s.io/kustomize/kustomize/v4 kustomize v4.5.4
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v4.5.4 build templates/base > templates/cluster-template.yaml
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v4.5.4 build templates/csi > templates/cluster-template-csi.yaml
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v4.5.4 build templates/ccm > templates/cluster-template-ccm.yaml
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v4.5.4 build templates/clusterclass > templates/cluster-template-clusterclass.yaml
 deepak.muley@C02ZG5BMLVDL  ~/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix   clusterclassv4  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 ./...
go build -o bin/manager cmd/main.go
 deepak.muley@C02ZG5BMLVDL  ~/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix   clusterclassv4  clusterctl generate cluster ccls-test1 --from ./templates/cluster-template-clusterclass.yaml -n workloads > ccls-test1.yaml
Using configuration File="/Users/deepak.muley/.cluster-api/clusterctl.yaml"
Using configuration File="/Users/deepak.muley/.cluster-api/clusterctl.yaml"
kustomize edit fix
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.

Fixed fields:
  patchesJson6902 -> patches
  patchesStrategicMerge -> patches
  commonLabels -> labels

To convert vars -> replacements, run the command `kustomize edit fix --vars`

WARNING: Converting vars to replacements will potentially overwrite many resource files 
and the resulting files may not produce the same output when `kustomize build` is run. 
We recommend doing this in a clean git repository where the change is easy to undo.
 deepak.muley@C02ZG5BMLVDL  ~/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix   clusterclassv4 ±  make cluster-templates
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v5.2.1 build templates/base > templates/cluster-template.yaml
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v5.2.1 build templates/csi > templates/cluster-template-csi.yaml
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v5.2.1 build templates/ccm > templates/cluster-template-ccm.yaml
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v5.2.1 build templates/clusterclass > templates/cluster-template-clusterclass.yaml

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

 deepak.muley@C02ZG5BMLVDL  ~/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix   clusterclassv4 ±  make test-clusterclass-create
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v5.2.1 build templates/base > templates/cluster-template.yaml
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v5.2.1 build templates/csi > templates/cluster-template-csi.yaml
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v5.2.1 build templates/ccm > templates/cluster-template-ccm.yaml
/Users/deepak.muley/go/src/github.com/deepakm-ntnx/cluster-api-provider-nutanix/hack/tools/bin/kustomize-v5.2.1 build templates/clusterclass > templates/cluster-template-clusterclass.yaml
clusterctl generate cluster ccls-test1 --from ./templates/cluster-template-clusterclass.yaml -n capx-test-ns > ccls-test1.yaml
Using configuration File="/Users/deepak.muley/.cluster-api/clusterctl.yaml"
Using configuration File="/Users/deepak.muley/.cluster-api/clusterctl.yaml"
kubectl create ns capx-test-ns || true
Error from server (AlreadyExists): namespaces "capx-test-ns" already exists
kubectl apply -f ./ccls-test1.yaml
configmap/user-ca-bundle created
secret/ccls-test1 configured
kubeadmconfigtemplate.bootstrap.cluster.x-k8s.io/my-test-cluster-template-md-kcfgt created
Warning: Cluster refers to ClusterClass my-test-cluster-template in the topology but it does not exist. Cluster topology has not been fully validated. The ClusterClass must be created to reconcile the Cluster
cluster.cluster.x-k8s.io/ccls-test1 created
clusterclass.cluster.x-k8s.io/my-test-cluster-template created
kubeadmcontrolplanetemplate.controlplane.cluster.x-k8s.io/my-test-cluster-template-kcpt created
nutanixclustertemplate.infrastructure.cluster.x-k8s.io/my-test-cluster-template-nct created
nutanixmachinetemplate.infrastructure.cluster.x-k8s.io/my-test-cluster-template-cp-nmt created
nutanixmachinetemplate.infrastructure.cluster.x-k8s.io/my-test-cluster-template-md-nmt created
first nutanix clusterclass based cluster is getting created now
NAME                                                     AGE
clusterclass.cluster.x-k8s.io/my-test-cluster-template   3m55s
NAME                                  CLUSTERCLASS               PHASE         AGE     VERSION
cluster.cluster.x-k8s.io/ccls-test1   my-test-cluster-template   Provisioned   2m45s   v1.28.4
NAME                                                                         ADDRESS        READY   PROVIDERID                                       NODEREF
nutanixmachine.infrastructure.cluster.x-k8s.io/ccls-test1-md-0-9lpt8-5dztl   10.45.63.87    true    nutanix://41d77d9a-6052-49df-bc74-5500620fdcd4   ccls-test1-md-0-tfftv-sr46w-nf7hb
nutanixmachine.infrastructure.cluster.x-k8s.io/ccls-test1-md-0-9lpt8-f65j6   10.45.63.110   true    nutanix://aa7b4b68-adde-46e8-b25d-40305fcf419d   
nutanixmachine.infrastructure.cluster.x-k8s.io/ccls-test1-zzmcp-z2qzm        10.45.63.77    true    nutanix://264e38d1-30fb-4be3-bca7-30a39d980561   ccls-test1-cck8w-t6w2m

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:


@nutanix-cn-prow-bot
Copy link

@deepakm-ntnx: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-ncn-1-calico-k8s-v1.26.1 3153672 link false /test e2e-ncn-1-calico-k8s-v1.26.1

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.

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Attention: 77 lines in your changes are missing coverage. Please review.

Comparison is base (3226563) 10.99% compared to head (7293c11) 8.65%.
Report is 7 commits behind head on main.

Files Patch % Lines
...pi/infrastructure/v1beta1/zz_generated.deepcopy.go 0.00% 48 Missing ⚠️
...i/infrastructure/v1beta1/nutanixcluster_webhook.go 0.00% 8 Missing ⚠️
...tructure/v1beta1/nutanixclustertemplate_webhook.go 0.00% 8 Missing ⚠️
...tructure/v1beta1/nutanixmachinetemplate_webhook.go 0.00% 8 Missing ⚠️
...nfrastructure/nutanixclustertemplate_controller.go 0.00% 3 Missing ⚠️
...roller/infrastructure/nutanixmachine_controller.go 0.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@deepakm-ntnx deepakm-ntnx changed the title [WIP] added NutanixClusterTemplate api [WIP] added ClusterClass support in CAPX Nov 27, 2023
@deepakm-ntnx deepakm-ntnx changed the title [WIP] added ClusterClass support in CAPX [WIP] ClusterClass support in CAPX Nov 27, 2023
@deepakm-ntnx
Copy link
Contributor Author

deepakm-ntnx commented Nov 28, 2023

To remove following errors, trying to upgrade cluster-api to 1.4.7
https://github.com/kubernetes-sigs/cluster-api/blob/16a153cd37ff8f2b734c5d46b9ebe414e46f9f94/docs/book/src/developer/providers/migrations/v1.3-to-v1.4.md?plain=1#L53

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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/api/v1beta1/machinedeployment_webhook.go:61:16: assignment mismatch: 2 variables but admission.NewDecoder returns 1 value
../../../../pkg/mod/sigs.k8s.io/[email protected]/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/[email protected]/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
Screen Shot 2023-11-28 at 11 02 23 AM

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/[email protected]/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/[email protected]/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/[email protected]/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

@deepakm-ntnx deepakm-ntnx marked this pull request as draft November 28, 2023 18:55
@deepakm-ntnx deepakm-ntnx force-pushed the clusterclassv4 branch 2 times, most recently from 6474cce to a7911fa Compare December 7, 2023 23:25
@deepakm-ntnx deepakm-ntnx marked this pull request as ready for review December 7, 2023 23:25
@tuxtof tuxtof requested a review from jimmidyson December 8, 2023 05:07
@jimmidyson
Copy link
Member

@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
@deepakm-ntnx
Copy link
Contributor Author

@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?

Sure, but its still WIP. will do that once tests are working. wasn't planning to add reviewers yet

@deepakm-ntnx deepakm-ntnx marked this pull request as draft December 9, 2023 01:39
@jimmidyson
Copy link
Member

@deepakm-ntnx

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}
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

copy paste mistake

@tuxtof tuxtof closed this Jan 18, 2024
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.

4 participants