Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
refactor: remove unused types
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoshkin committed Mar 29, 2024
1 parent 2ed4aec commit 1bc4015
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 279 deletions.
57 changes: 0 additions & 57 deletions api/v1alpha1/nutanix_clusterconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ type NutanixSpec struct {

// Nutanix Prism Central endpoint configuration.
PrismCentralEndpoint NutanixPrismCentralEndpointSpec `json:"prismCentralEndpoint"`

// 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.
FailureDomains []NutanixFailureDomain `json:"failureDomains"`
}

func (NutanixSpec) VariableSchema() clusterv1.VariableSchema {
Expand All @@ -31,7 +26,6 @@ func (NutanixSpec) VariableSchema() clusterv1.VariableSchema {
Properties: map[string]clusterv1.JSONSchemaProps{
"controlPlaneEndpoint": ControlPlaneEndpointSpec{}.VariableSchema().OpenAPIV3Schema,
"prismCentralEndpoint": NutanixPrismCentralEndpointSpec{}.VariableSchema().OpenAPIV3Schema,
"failureDomains": NutanixFailureDomains{}.VariableSchema().OpenAPIV3Schema,
},
},
}
Expand Down Expand Up @@ -108,54 +102,3 @@ func (NutanixPrismCentralEndpointSpec) 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 capxv1.NutanixFailureDomain

func (NutanixFailureDomain) VariableSchema() clusterv1.VariableSchema {
return clusterv1.VariableSchema{
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
Description: "Nutanix Failure Domain",
Type: "object",
Properties: map[string]clusterv1.JSONSchemaProps{
"name": {
Description: "name of failure domain",
Type: "string",
},
"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,
},
}
}
89 changes: 4 additions & 85 deletions api/v1alpha1/nutanix_node_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,12 @@ type NutanixNodeSpec struct {
// or using the prism_central API.
Subnets NutanixResourceIdentifiers `json:"subnet"`

// List of categories that need to be added to the machines. Categories must already exist in Prism Central
AdditionalCategories []NutanixCategoryIdentifier `json:"additionalCategories,omitempty"`

// Add the machine resources to a Prism Central project
Project NutanixResourceIdentifier `json:"project,omitempty"`

// Defines the boot type of the virtual machine. Only supports UEFI and Legacy
BootType NutanixBootType `json:"bootType,omitempty"`

// systemDiskSize is size (in Quantity format) of the system disk of the VM
// The minimum systemDiskSize is 20Gi bytes
SystemDiskSize string `json:"systemDiskSize"`

// List of GPU devices that need to be added to the machines.
GPUs []NutanixGPU `json:"gpus,omitempty"`
}

func (NutanixNodeSpec) VariableSchema() clusterv1.VariableSchema {
Expand Down Expand Up @@ -78,9 +69,6 @@ func (NutanixNodeSpec) VariableSchema() clusterv1.VariableSchema {
Description: "systemDiskSize is size (in Quantity format) of the system disk of the VM eg. 20Gi",
Type: "string",
},
"project": NutanixResourceIdentifier{}.VariableSchema().OpenAPIV3Schema,
"additionalCategories": NutanixCategoryIdentifiers{}.VariableSchema().OpenAPIV3Schema,
"gpus": NutanixGPUs{}.VariableSchema().OpenAPIV3Schema,
},
},
}
Expand Down Expand Up @@ -110,18 +98,6 @@ func (NutanixBootType) VariableSchema() clusterv1.VariableSchema {
}
}

// NutanixGPUIdentifierType is an enumeration of different resource identifier types for GPU entities.
type NutanixGPUIdentifierType capxv1.NutanixGPUIdentifierType

func (NutanixGPUIdentifierType) VariableSchema() clusterv1.VariableSchema {
return clusterv1.VariableSchema{
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
Type: "string",
Description: "NutanixGPUIdentifierType is an enumeration of different resource identifier types for GPU entities.",
},
}
}

type NutanixResourceIdentifier capxv1.NutanixResourceIdentifier

func (NutanixResourceIdentifier) VariableSchema() clusterv1.VariableSchema {
Expand All @@ -144,71 +120,14 @@ func (NutanixResourceIdentifier) VariableSchema() clusterv1.VariableSchema {
}
}

type NutanixCategoryIdentifier capxv1.NutanixCategoryIdentifier

func (NutanixCategoryIdentifier) VariableSchema() clusterv1.VariableSchema {
return clusterv1.VariableSchema{
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
Description: "Nutanix Category Identifier",
Type: "object",
Properties: map[string]clusterv1.JSONSchemaProps{
"key": {
Type: "string",
Description: "key is the Key of category in PC.",
},
"value": {
Type: "string",
Description: "value is the category value linked to the category key in PC",
},
},
},
}
}

type NutanixCategoryIdentifiers []NutanixCategoryIdentifier

func (NutanixCategoryIdentifiers) VariableSchema() clusterv1.VariableSchema {
resourceSchema := NutanixCategoryIdentifier{}.VariableSchema().OpenAPIV3Schema

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

type NutanixGPU capxv1.NutanixGPU

func (NutanixGPU) VariableSchema() clusterv1.VariableSchema {
return clusterv1.VariableSchema{
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
Description: "Nutanix GPU type",
Type: "object",
Properties: map[string]clusterv1.JSONSchemaProps{
"type": NutanixGPUIdentifierType("name").VariableSchema().OpenAPIV3Schema,
"deviceID": {
Type: "int64",
Description: "deviceID is the id of the GPU entity.",
},
"name": {
Type: "string",
Description: "name is the GPU name.",
},
},
},
}
}

type NutanixGPUs []NutanixGPU
type NutanixResourceIdentifiers []NutanixResourceIdentifier

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

return clusterv1.VariableSchema{
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
Description: "Nutanix GPU identifier",
Description: "Nutanix resource identifier",
Type: "array",
Items: &resourceSchema,
},
Expand Down
137 changes: 0 additions & 137 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 1bc4015

Please sign in to comment.