Skip to content

Commit

Permalink
added cluster config variables
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakm-ntnx committed Feb 29, 2024
1 parent 2383635 commit 63c80b2
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 29 deletions.
42 changes: 36 additions & 6 deletions api/v1alpha1/nutanix_clusterconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (NutanixSpec) VariableSchema() clusterv1.VariableSchema {
Properties: map[string]clusterv1.JSONSchemaProps{
"prismCentralEndpoint": NutanixPrismCentralEndpointSpec{}.VariableSchema().OpenAPIV3Schema,
"controlPlaneEndpoint": NutanixControlPlaneEndpointSpec{}.VariableSchema().OpenAPIV3Schema,
// TODO "failureDomains": []NutanixFailureDomain{}.VariableSchema().OpenAPIV3Schema,
"failureDomains": NutanixFailureDomains{}.VariableSchema().OpenAPIV3Schema,
},
},
}
Expand Down Expand Up @@ -85,6 +85,20 @@ func (NutanixControlPlaneEndpointSpec) VariableSchema() clusterv1.VariableSchema
}
}

type NutanixFailureDomains []NutanixFailureDomain

func (NutanixFailureDomains) VariableSchema() clusterv1.VariableSchema {
resourceSchema := NutanixFailureDomain{}.VariableSchema().OpenAPIV3Schema

return clusterv1.VariableSchema{
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
Description: "Nutanix failure domains",
Type: "array",
Items: &resourceSchema,
},
}
}

type NutanixFailureDomain struct {
// name defines the unique name of a failure domain.
// Name is required and must be at most 64 characters in length.
Expand Down Expand Up @@ -112,16 +126,32 @@ func (NutanixFailureDomain) VariableSchema() clusterv1.VariableSchema {
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
Description: "Nutanix Failure Domain",
Type: "object",
Properties: map[string]clusterv1.JSONSchemaProps{
Properties: map[string]clusterv1.JSONSchemaProps{
"name": {
Description: "name of failure domain",
Type: "string",
},
"cluster": {
Description: "",
Type: "integer",
"cluster": NutanixResourceIdentifier{}.VariableSchema().OpenAPIV3Schema,
"subnets": NutanixResourceIdentifiers{}.VariableSchema().OpenAPIV3Schema,
"controlPlane": {
Description: "indicates if a failure domain is suited for control plane nodes",
Type: "boolean",
},
},
},
},
}
}

type NutanixResourceIdentifiers []NutanixResourceIdentifier

func (NutanixResourceIdentifiers) VariableSchema() clusterv1.VariableSchema {
resourceSchema := NutanixResourceIdentifier{}.VariableSchema().OpenAPIV3Schema

return clusterv1.VariableSchema{
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
Description: "Nutanix resource identifier",
Type: "array",
Items: &resourceSchema,
},
}
}
94 changes: 71 additions & 23 deletions api/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit 63c80b2

Please sign in to comment.