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

first version of failure domain support for CAPX #335

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ cluster-e2e-templates-v1beta1: $(KUSTOMIZE) ## Generate cluster templates for v1
$(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml
$(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in.yaml
$(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi.yaml
$(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-failure-domains --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-failure-domains.yaml

cluster-e2e-templates-no-kubeproxy: $(KUSTOMIZE) ##Generate cluster templates without kubeproxy
# v1alpha4
Expand All @@ -321,6 +322,7 @@ cluster-e2e-templates-no-kubeproxy: $(KUSTOMIZE) ##Generate cluster templates wi
$(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml
$(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in.yaml
$(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-csi --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi.yaml
$(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-failure-domains --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-failure-domains.yaml

cluster-templates: $(KUSTOMIZE) ## Generate cluster templates for all flavors
$(KUSTOMIZE) build $(TEMPLATES_DIR)/base > $(TEMPLATES_DIR)/cluster-template.yaml
Expand Down
41 changes: 41 additions & 0 deletions api/v1alpha4/nutanixcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ type NutanixClusterSpec struct {
// proxy spec.noProxy list.
// +optional
PrismCentral *credentialTypes.NutanixPrismEndpoint `json:"prismCentral"`

// 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.
// +listType=map
// +listMapKey=name
// +optional
FailureDomains []NutanixFailureDomain `json:"failureDomains"`
}

// NutanixClusterStatus defines the observed state of NutanixCluster
Expand Down Expand Up @@ -90,6 +98,39 @@ type NutanixCluster struct {
Status NutanixClusterStatus `json:"status,omitempty"`
}

// NutanixFailureDomain configures failure domain information for Nutanix.
type NutanixFailureDomain struct {
// 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.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=64
// +kubebuilder:validation:Pattern=`[a-z0-9]([-a-z0-9]*[a-z0-9])?`
Name string `json:"name"`

// 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.
// +kubebuilder:validation:Required
Cluster NutanixResourceIdentifier `json:"cluster"`

// 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.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
// +listType=map
// +listMapKey=type
Subnets []NutanixResourceIdentifier `json:"subnets"`

// indicates if a failure domain is suited for control plane nodes
// +kubebuilder:validation:Required
ControlPlane bool `json:"controlPlane,omitempty"`
}

// GetConditions returns the set of conditions for this object.
func (ncl *NutanixCluster) GetConditions() capiv1.Conditions {
return ncl.Status.Conditions
Expand Down
5 changes: 2 additions & 3 deletions api/v1alpha4/nutanixmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ type NutanixMachineSpec struct {
// 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.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Optional
yannickstruyf3 marked this conversation as resolved.
Show resolved Hide resolved
Cluster NutanixResourceIdentifier `json:"cluster"`
// subnet is to identify the cluster's network subnet to use for the Machine's VM
// The cluster identifier (uuid or name) can be obtained from the Prism Central console
// or using the prism_central API.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:Optional
yannickstruyf3 marked this conversation as resolved.
Show resolved Hide resolved
Subnets []NutanixResourceIdentifier `json:"subnet"`
// List of categories that need to be added to the machines. Categories must already exist in Prism Central
// +kubebuilder:validation:Optional
Expand Down
42 changes: 42 additions & 0 deletions api/v1alpha4/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions api/v1alpha4/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions api/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ const (
DeletionFailed = "DeletionFailed"
)

const (
// FailureDomainsReconciled indicates the status of the failure domain reconciliation
FailureDomainsReconciled capiv1.ConditionType = "FailureDomainsReconciled"

// NoFailureDomainsReconciled indicates no failure domains have been defined
NoFailureDomainsReconciled capiv1.ConditionType = "NoFailureDomainsReconciled"

// FailureDomainsReconciliationFailed indicates the failure domain reconciliation failed
FailureDomainsReconciliationFailed = "FailureDomainsReconciliationFailed"
yannickstruyf3 marked this conversation as resolved.
Show resolved Hide resolved
)

const (
// ClusterCategoryCreatedCondition indicates the status of the category linked to the NutanixCluster
ClusterCategoryCreatedCondition capiv1.ConditionType = "ClusterCategoryCreated"
Expand Down
41 changes: 41 additions & 0 deletions api/v1beta1/nutanixcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ type NutanixClusterSpec struct {
// proxy spec.noProxy list.
// +optional
PrismCentral *credentialTypes.NutanixPrismEndpoint `json:"prismCentral"`

// 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.
// +listType=map
// +listMapKey=name
// +optional
FailureDomains []NutanixFailureDomain `json:"failureDomains"`
yannickstruyf3 marked this conversation as resolved.
Show resolved Hide resolved
}

// NutanixClusterStatus defines the observed state of NutanixCluster
Expand Down Expand Up @@ -91,6 +99,39 @@ type NutanixCluster struct {
Status NutanixClusterStatus `json:"status,omitempty"`
}

// NutanixFailureDomain configures failure domain information for Nutanix.
type NutanixFailureDomain struct {
// 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.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=64
// +kubebuilder:validation:Pattern=`[a-z0-9]([-a-z0-9]*[a-z0-9])?`
Name string `json:"name"`

// 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.
// +kubebuilder:validation:Required
Cluster NutanixResourceIdentifier `json:"cluster"`
yannickstruyf3 marked this conversation as resolved.
Show resolved Hide resolved

// 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.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
// +listType=map
// +listMapKey=type
Subnets []NutanixResourceIdentifier `json:"subnets"`

// indicates if a failure domain is suited for control plane nodes
// +kubebuilder:validation:Required
ControlPlane bool `json:"controlPlane,omitempty"`
}

// GetConditions returns the set of conditions for this object.
func (ncl *NutanixCluster) GetConditions() capiv1.Conditions {
return ncl.Status.Conditions
Expand Down
5 changes: 2 additions & 3 deletions api/v1beta1/nutanixmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ type NutanixMachineSpec struct {
// 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.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Optional
yannickstruyf3 marked this conversation as resolved.
Show resolved Hide resolved
Cluster NutanixResourceIdentifier `json:"cluster"`
// subnet is to identify the cluster's network subnet to use for the Machine's VM
// The cluster identifier (uuid or name) can be obtained from the Prism Central console
// or using the prism_central API.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:Optional
yannickstruyf3 marked this conversation as resolved.
Show resolved Hide resolved
Subnets []NutanixResourceIdentifier `json:"subnet"`
// List of categories that need to be added to the machines. Categories must already exist in Prism Central
// +kubebuilder:validation:Optional
Expand Down
30 changes: 30 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading