...

Source file src/github.com/openshift/api/machine/v1/types_nutanixprovider.go

Documentation: github.com/openshift/api/machine/v1

     1  package v1
     2  
     3  import (
     4  	corev1 "k8s.io/api/core/v1"
     5  	"k8s.io/apimachinery/pkg/api/resource"
     6  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     7  )
     8  
     9  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    10  
    11  // NutanixMachineProviderConfig is the Schema for the nutanixmachineproviderconfigs API
    12  // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
    13  // +openshift:compatibility-gen:level=1
    14  // +k8s:openapi-gen=true
    15  type NutanixMachineProviderConfig struct {
    16  	metav1.TypeMeta `json:",inline"`
    17  
    18  	// metadata is the standard object's metadata.
    19  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    20  	metav1.ObjectMeta `json:"metadata,omitempty"`
    21  
    22  	// cluster is to identify the cluster (the Prism Element under management
    23  	// of the Prism Central), in which the Machine's VM will be created.
    24  	// The cluster identifier (uuid or name) can be obtained from the Prism Central console
    25  	// or using the prism_central API.
    26  	// +kubebuilder:validation:Required
    27  	Cluster NutanixResourceIdentifier `json:"cluster"`
    28  
    29  	// image is to identify the rhcos image uploaded to the Prism Central (PC)
    30  	// The image identifier (uuid or name) can be obtained from the Prism Central console
    31  	// or using the prism_central API.
    32  	// +kubebuilder:validation:Required
    33  	Image NutanixResourceIdentifier `json:"image"`
    34  
    35  	// subnets holds a list of identifiers (one or more) of the cluster's network subnets
    36  	// for the Machine's VM to connect to. The subnet identifiers (uuid or name) can be
    37  	// obtained from the Prism Central console or using the prism_central API.
    38  	// +kubebuilder:validation:Required
    39  	// +kubebuilder:validation:MinItems=1
    40  	Subnets []NutanixResourceIdentifier `json:"subnets"`
    41  
    42  	// vcpusPerSocket is the number of vCPUs per socket of the VM
    43  	// +kubebuilder:validation:Required
    44  	// +kubebuilder:validation:Minimum=1
    45  	VCPUsPerSocket int32 `json:"vcpusPerSocket"`
    46  
    47  	// vcpuSockets is the number of vCPU sockets of the VM
    48  	// +kubebuilder:validation:Required
    49  	// +kubebuilder:validation:Minimum=1
    50  	VCPUSockets int32 `json:"vcpuSockets"`
    51  
    52  	// memorySize is the memory size (in Quantity format) of the VM
    53  	// The minimum memorySize is 2Gi bytes
    54  	// +kubebuilder:validation:Required
    55  	MemorySize resource.Quantity `json:"memorySize"`
    56  
    57  	// systemDiskSize is size (in Quantity format) of the system disk of the VM
    58  	// The minimum systemDiskSize is 20Gi bytes
    59  	// +kubebuilder:validation:Required
    60  	SystemDiskSize resource.Quantity `json:"systemDiskSize"`
    61  
    62  	// bootType indicates the boot type (Legacy, UEFI or SecureBoot) the Machine's VM uses to boot.
    63  	// If this field is empty or omitted, the VM will use the default boot type "Legacy" to boot.
    64  	// "SecureBoot" depends on "UEFI" boot, i.e., enabling "SecureBoot" means that "UEFI" boot is also enabled.
    65  	// +kubebuilder:validation:Enum="";Legacy;UEFI;SecureBoot
    66  	// +optional
    67  	BootType NutanixBootType `json:"bootType"`
    68  
    69  	// project optionally identifies a Prism project for the Machine's VM to associate with.
    70  	// +optional
    71  	Project NutanixResourceIdentifier `json:"project"`
    72  
    73  	// categories optionally adds one or more prism categories (each with key and value) for
    74  	// the Machine's VM to associate with. All the category key and value pairs specified must
    75  	// already exist in the prism central.
    76  	// +listType=map
    77  	// +listMapKey=key
    78  	// +optional
    79  	Categories []NutanixCategory `json:"categories"`
    80  
    81  	// userDataSecret is a local reference to a secret that contains the
    82  	// UserData to apply to the VM
    83  	UserDataSecret *corev1.LocalObjectReference `json:"userDataSecret,omitempty"`
    84  
    85  	// credentialsSecret is a local reference to a secret that contains the
    86  	// credentials data to access Nutanix PC client
    87  	// +kubebuilder:validation:Required
    88  	CredentialsSecret *corev1.LocalObjectReference `json:"credentialsSecret"`
    89  }
    90  
    91  // NutanixCategory identifies a pair of prism category key and value
    92  type NutanixCategory struct {
    93  	// key is the prism category key name
    94  	// +kubebuilder:validation:MinLength=1
    95  	// +kubebuilder:validation:MaxLength=64
    96  	// +kubebuilder:validation:Required
    97  	Key string `json:"key"`
    98  
    99  	// value is the prism category value associated with the key
   100  	// +kubebuilder:validation:MinLength=1
   101  	// +kubebuilder:validation:MaxLength=64
   102  	// +kubebuilder:validation:Required
   103  	Value string `json:"value"`
   104  }
   105  
   106  // NutanixBootType is an enumeration of different boot types for Nutanix VM.
   107  type NutanixBootType string
   108  
   109  const (
   110  	// NutanixLegacyBoot is the legacy BIOS boot type
   111  	NutanixLegacyBoot NutanixBootType = "Legacy"
   112  
   113  	// NutanixUEFIBoot is the UEFI boot type
   114  	NutanixUEFIBoot NutanixBootType = "UEFI"
   115  
   116  	// NutanixSecureBoot is the Secure boot type
   117  	NutanixSecureBoot NutanixBootType = "SecureBoot"
   118  )
   119  
   120  // NutanixIdentifierType is an enumeration of different resource identifier types.
   121  type NutanixIdentifierType string
   122  
   123  const (
   124  	// NutanixIdentifierUUID is a resource identifier identifying the object by UUID.
   125  	NutanixIdentifierUUID NutanixIdentifierType = "uuid"
   126  
   127  	// NutanixIdentifierName is a resource identifier identifying the object by Name.
   128  	NutanixIdentifierName NutanixIdentifierType = "name"
   129  )
   130  
   131  // NutanixResourceIdentifier holds the identity of a Nutanix PC resource (cluster, image, subnet, etc.)
   132  // +union
   133  type NutanixResourceIdentifier struct {
   134  	// Type is the identifier type to use for this resource.
   135  	// +unionDiscriminator
   136  	// +kubebuilder:validation:Required
   137  	// +kubebuilder:validation:Enum:=uuid;name
   138  	Type NutanixIdentifierType `json:"type"`
   139  
   140  	// uuid is the UUID of the resource in the PC.
   141  	// +optional
   142  	UUID *string `json:"uuid,omitempty"`
   143  
   144  	// name is the resource name in the PC
   145  	// +optional
   146  	Name *string `json:"name,omitempty"`
   147  }
   148  
   149  // NutanixMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field.
   150  // It contains nutanix-specific status information.
   151  // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
   152  // +openshift:compatibility-gen:level=1
   153  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   154  type NutanixMachineProviderStatus struct {
   155  	metav1.TypeMeta `json:",inline"`
   156  
   157  	// conditions is a set of conditions associated with the Machine to indicate
   158  	// errors or other status
   159  	// +optional
   160  	Conditions []metav1.Condition `json:"conditions,omitempty"`
   161  
   162  	// vmUUID is the Machine associated VM's UUID
   163  	// The field is missing before the VM is created.
   164  	// Once the VM is created, the field is filled with the VM's UUID and it will not change.
   165  	// The vmUUID is used to find the VM when updating the Machine status,
   166  	// and to delete the VM when the Machine is deleted.
   167  	// +optional
   168  	VmUUID *string `json:"vmUUID,omitempty"`
   169  }
   170  

View as plain text