diff --git a/api/infrastructure/v1beta1/nutanixcluster_webhook.go b/api/infrastructure/v1beta1/nutanixcluster_webhook.go index f6f53bd5be..a4b4a42968 100644 --- a/api/infrastructure/v1beta1/nutanixcluster_webhook.go +++ b/api/infrastructure/v1beta1/nutanixcluster_webhook.go @@ -36,7 +36,7 @@ func (r *NutanixCluster) SetupWebhookWithManager(mgr ctrl.Manager) error { // TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -//+kubebuilder:webhook:path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixcluster,mutating=true,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixclusters,verbs=create;update,versions=v1beta1,name=mnutanixcluster.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixcluster,mutating=true,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixclusters,verbs=create;update,versions=v1beta1,name=mnutanixcluster.kb.io,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &NutanixCluster{} @@ -48,7 +48,7 @@ func (r *NutanixCluster) Default() { } // TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation. -//+kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixcluster,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixclusters,verbs=create;update,versions=v1beta1,name=vnutanixcluster.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixcluster,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixclusters,verbs=create;update,versions=v1beta1,name=vnutanixcluster.kb.io,admissionReviewVersions=v1beta1 var _ webhook.Validator = &NutanixCluster{} diff --git a/api/infrastructure/v1beta1/nutanixclustertemplate_webhook.go b/api/infrastructure/v1beta1/nutanixclustertemplate_webhook.go index f4987a0a8f..a547e39eb2 100644 --- a/api/infrastructure/v1beta1/nutanixclustertemplate_webhook.go +++ b/api/infrastructure/v1beta1/nutanixclustertemplate_webhook.go @@ -36,7 +36,7 @@ func (r *NutanixClusterTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error // TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -//+kubebuilder:webhook:path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixclustertemplate,mutating=true,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixclustertemplates,verbs=create;update,versions=v1beta1,name=mnutanixclustertemplate.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixclustertemplate,mutating=true,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixclustertemplates,verbs=create;update,versions=v1beta1,name=mnutanixclustertemplate.kb.io,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &NutanixClusterTemplate{} @@ -48,7 +48,7 @@ func (r *NutanixClusterTemplate) Default() { } // TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation. -//+kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixclustertemplate,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixclustertemplates,verbs=create;update,versions=v1beta1,name=vnutanixclustertemplate.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixclustertemplate,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixclustertemplates,verbs=create;update,versions=v1beta1,name=vnutanixclustertemplate.kb.io,admissionReviewVersions=v1beta1 var _ webhook.Validator = &NutanixClusterTemplate{} diff --git a/api/infrastructure/v1beta1/nutanixmachinetemplate_webhook.go b/api/infrastructure/v1beta1/nutanixmachinetemplate_webhook.go index 581032a87f..dca3ffc69b 100644 --- a/api/infrastructure/v1beta1/nutanixmachinetemplate_webhook.go +++ b/api/infrastructure/v1beta1/nutanixmachinetemplate_webhook.go @@ -36,7 +36,7 @@ func (r *NutanixMachineTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error // TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -//+kubebuilder:webhook:path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixmachinetemplate,mutating=true,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixmachinetemplates,verbs=create;update,versions=v1beta1,name=mnutanixmachinetemplate.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixmachinetemplate,mutating=true,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixmachinetemplates,verbs=create;update,versions=v1beta1,name=mnutanixmachinetemplate.kb.io,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &NutanixMachineTemplate{} @@ -48,7 +48,7 @@ func (r *NutanixMachineTemplate) Default() { } // TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation. -//+kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixmachinetemplate,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixmachinetemplates,verbs=create;update,versions=v1beta1,name=vnutanixmachinetemplate.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-nutanixmachinetemplate,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=nutanixmachinetemplates,verbs=create;update,versions=v1beta1,name=vnutanixmachinetemplate.kb.io,admissionReviewVersions=v1beta1 var _ webhook.Validator = &NutanixMachineTemplate{} diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclustertemplates.yaml index cdff930f16..79793a1456 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclustertemplates.yaml @@ -58,6 +58,98 @@ spec: - host - port type: object + failureDomains: + description: failureDomains configures failure domains information + for the Nutanix platform. When set, the failure domains + defined here may be used to spread Machines across prism + element clusters to improve fault tolerance of the cluster. + items: + description: NutanixFailureDomain configures failure domain + information for Nutanix. + properties: + cluster: + description: cluster is to identify the cluster (the + Prism Element under management of the Prism Central), + in which the Machine's VM will be created. The cluster + identifier (uuid or name) can be obtained from the + Prism Central console or using the prism_central API. + properties: + name: + description: name is the resource name in the PC + type: string + type: + description: Type is the identifier type to use + for this resource. + enum: + - uuid + - name + type: string + uuid: + description: uuid is the UUID of the resource in + the PC. + type: string + required: + - type + type: object + controlPlane: + description: indicates if a failure domain is suited + for control plane nodes + type: boolean + name: + description: name defines the unique name of a failure + domain. Name is required and must be at most 64 characters + in length. It must consist of only lower case alphanumeric + characters and hyphens (-). It must start and end + with an alphanumeric character. This value is arbitrary + and is used to identify the failure domain within + the platform. + maxLength: 64 + minLength: 1 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + type: string + subnets: + description: subnets holds a list of identifiers (one + or more) of the cluster's network subnets for the + Machine's VM to connect to. The subnet identifiers + (uuid or name) can be obtained from the Prism Central + console or using the prism_central API. + items: + description: NutanixResourceIdentifier holds the identity + of a Nutanix PC resource (cluster, image, subnet, + etc.) + properties: + name: + description: name is the resource name in the + PC + type: string + type: + description: Type is the identifier type to use + for this resource. + enum: + - uuid + - name + type: string + uuid: + description: uuid is the UUID of the resource + in the PC. + type: string + required: + - type + type: object + minItems: 1 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + required: + - cluster + - name + - subnets + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map prismCentral: description: prismCentral holds the endpoint address and port to access the Nutanix Prism Central. When a cluster-wide diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index 099a18f7ef..b7478794bc 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -5,7 +5,7 @@ metadata: name: mutating-webhook-configuration webhooks: - admissionReviewVersions: - - v1 + - v1beta1 clientConfig: service: name: webhook-service @@ -25,7 +25,7 @@ webhooks: - nutanixclusters sideEffects: None - admissionReviewVersions: - - v1 + - v1beta1 clientConfig: service: name: webhook-service @@ -45,7 +45,7 @@ webhooks: - nutanixclustertemplates sideEffects: None - admissionReviewVersions: - - v1 + - v1beta1 clientConfig: service: name: webhook-service @@ -71,7 +71,7 @@ metadata: name: validating-webhook-configuration webhooks: - admissionReviewVersions: - - v1 + - v1beta1 clientConfig: service: name: webhook-service @@ -91,7 +91,7 @@ webhooks: - nutanixclusters sideEffects: None - admissionReviewVersions: - - v1 + - v1beta1 clientConfig: service: name: webhook-service @@ -111,7 +111,7 @@ webhooks: - nutanixclustertemplates sideEffects: None - admissionReviewVersions: - - v1 + - v1beta1 clientConfig: service: name: webhook-service diff --git a/templates/base/cluster-with-kcp.yaml b/templates/base/cluster-with-kcp.yaml index 052cf488fb..a20c48f7f7 100644 --- a/templates/base/cluster-with-kcp.yaml +++ b/templates/base/cluster-with-kcp.yaml @@ -4,6 +4,7 @@ metadata: name: "${CLUSTER_NAME}" namespace: "${NAMESPACE}" spec: + failureDomains: [] prismCentral: address: "${NUTANIX_ENDPOINT}" port: ${NUTANIX_PORT=9440}