-
Notifications
You must be signed in to change notification settings - Fork 245
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
[WIP] MGMT-19741: Add Nutanix support #2550
Open
eliorerz
wants to merge
8
commits into
openshift:master
Choose a base branch
from
eliorerz:NO-ISSUE-add-nutanix-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0b458c4
Add nutanix support
eliorerz 9f40403
Add nutanix support
eliorerz 70b9256
Add nutanix support
eliorerz 73e2a91
Add nutanix support
eliorerz 5995726
Remove gpu and datadisks from nutanix machinepool
eliorerz cdcb035
Add Nutanix PC certificate
eliorerz 3584490
Update MachinePool
eliorerz fa1957c
Set region
eliorerz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Package nutanix contains API Schema definitions for Nutanix clusters. | ||
// +k8s:deepcopy-gen=package | ||
package nutanix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package nutanix | ||
|
||
import ( | ||
machinev1 "github.com/openshift/api/machine/v1" | ||
) | ||
|
||
// MachinePool stores the configuration for a machine pool installed | ||
// on Nutanix. | ||
type MachinePool struct { | ||
// NumCPUs is the total number of virtual processor cores to assign a vm. | ||
// | ||
// +optional | ||
NumCPUs int64 `json:"cpus,omitempty"` | ||
|
||
// NumCoresPerSocket is the number of cores per socket in a vm. The number | ||
// of vCPUs on the vm will be NumCPUs times NumCoresPerSocket. | ||
// For example: 4 CPUs and 4 Cores per socket will result in 16 VPUs. | ||
// The AHV scheduler treats socket and core allocation exactly the same | ||
// so there is no benefit to configuring cores over CPUs. | ||
// | ||
// +optional | ||
NumCoresPerSocket int64 `json:"coresPerSocket,omitempty"` | ||
|
||
// Memory is the size of a VM's memory in MiB. | ||
// | ||
// +optional | ||
MemoryMiB int64 `json:"memoryMiB,omitempty"` | ||
|
||
// OSDisk defines the storage for instance. | ||
// | ||
// +optional | ||
OSDisk `json:"osDisk,omitempty"` | ||
|
||
// BootType indicates the boot type (Legacy, UEFI or SecureBoot) the Machine's VM uses to boot. | ||
// If this field is empty or omitted, the VM will use the default boot type "Legacy" to boot. | ||
// "SecureBoot" depends on "UEFI" boot, i.e., enabling "SecureBoot" means that "UEFI" boot is also enabled. | ||
// +kubebuilder:validation:Enum="";Legacy;UEFI;SecureBoot | ||
// +optional | ||
BootType machinev1.NutanixBootType `json:"bootType,omitempty"` | ||
2uasimojo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Project optionally identifies a Prism project for the Machine's VM to associate with. | ||
// +optional | ||
Project *machinev1.NutanixResourceIdentifier `json:"project,omitempty"` | ||
|
||
// Categories optionally adds one or more prism categories (each with key and value) for | ||
// the Machine's VM to associate with. All the category key and value pairs specified must | ||
// already exist in the prism central. | ||
// +listType=map | ||
// +listMapKey=key | ||
// +optional | ||
Categories []machinev1.NutanixCategory `json:"categories,omitempty"` | ||
|
||
// GPUs is a list of GPU devices to attach to the machine's VM. | ||
// +kubebuilder:validation:X-KubernetesListType=set | ||
// +kubebuilder:validation:X-KubernetesMapType=atomic | ||
// +optional | ||
GPUs []machinev1.NutanixGPU `json:"gpus,omitempty"` | ||
|
||
// DataDisks holds information of the data disks to attach to the Machine's VM | ||
// +kubebuilder:validation:X-KubernetesListType=set | ||
// +optional | ||
DataDisks []machinev1.NutanixVMDisk `json:"dataDisks,omitempty"` | ||
|
||
// FailureDomains optionally configures a list of failure domain names | ||
// that will be applied to the MachinePool | ||
// +listType=set | ||
// +optional | ||
FailureDomains []string `json:"failureDomains,omitempty"` | ||
} | ||
|
||
// OSDisk defines the system disk for a Machine VM. | ||
type OSDisk struct { | ||
// DiskSizeGiB defines the size of disk in GiB. | ||
// | ||
// +optional | ||
DiskSizeGiB int64 `json:"diskSizeGiB,omitempty"` | ||
} | ||
|
||
// StorageConfig specifies the storage configuration parameters for VM disks. | ||
type StorageConfig struct { | ||
// diskMode specifies the disk mode. | ||
// The valid values are Standard and Flash, and the default is Standard. | ||
// +kubebuilder:default=Standard | ||
// +kubebuilder:validation:Enum=Standard;Flash | ||
DiskMode machinev1.NutanixDiskMode `json:"diskMode"` | ||
|
||
// storageContainer refers to the storage_container used by the VM disk. | ||
// +optional | ||
StorageContainer *StorageResourceReference `json:"storageContainer,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
package nutanix | ||
|
||
import ( | ||
configv1 "github.com/openshift/api/config/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
) | ||
|
||
// CredentialsSecretName is the default nutanix credentials secret name. | ||
// | ||
//nolint:gosec | ||
const CredentialsSecretName = "nutanix-credentials" | ||
|
||
// Platform stores any global configuration used for Nutanix platforms. | ||
type Platform struct { | ||
// PrismCentral is the endpoint (address and port) and credentials to connect to the Prism Central. | ||
// This serves as the default Prism-Central. | ||
PrismCentral PrismCentral `json:"prismCentral"` | ||
|
||
// PrismElements holds a list of Prism Elements (clusters). A Prism Element encompasses all Nutanix resources (VMs, subnets, etc.) | ||
// used to host the OpenShift cluster. Currently only a single Prism Element may be defined. | ||
// This serves as the default Prism-Element. | ||
PrismElements []PrismElement `json:"prismElements"` | ||
|
||
// CredentialsSecretRef refers to a secret that contains the Nutanix account access | ||
// credentials. | ||
CredentialsSecretRef corev1.LocalObjectReference `json:"credentialsSecretRef"` | ||
|
||
// CertificatesSecretRef refers to a secret that contains the Prism Central CA certificates | ||
// necessary for communicating with the Prism Central. | ||
CertificatesSecretRef corev1.LocalObjectReference `json:"certificatesSecretRef"` | ||
|
||
// ClusterOSImage overrides the url provided in rhcos.json to download the RHCOS Image. | ||
// | ||
// +optional | ||
ClusterOSImage string `json:"clusterOSImage,omitempty"` | ||
|
||
// DefaultMachinePlatform is the default configuration used when | ||
// installing on Nutanix for machine pools which do not define their own | ||
// platform configuration. | ||
// +optional | ||
DefaultMachinePlatform *MachinePool `json:"defaultMachinePlatform,omitempty"` | ||
|
||
// SubnetUUIDs identifies the network subnets to be used by the cluster. | ||
// Currently, we only support one subnet for an OpenShift cluster. | ||
SubnetUUIDs []string `json:"subnetUUIDs"` | ||
|
||
// LoadBalancer defines how the load balancer used by the cluster is configured. | ||
// LoadBalancer is available in TechPreview. | ||
// +optional | ||
LoadBalancer *configv1.NutanixPlatformLoadBalancer `json:"loadBalancer,omitempty"` | ||
|
||
// FailureDomains configures failure domains for the Nutanix platform. | ||
// +optional | ||
FailureDomains []FailureDomain `json:"failureDomains,omitempty"` | ||
} | ||
|
||
// PrismCentral holds the endpoint and credentials data used to connect to the Prism Central | ||
type PrismCentral struct { | ||
// Endpoint holds the address and port of the Prism Central | ||
Endpoint PrismEndpoint `json:"endpoint"` | ||
} | ||
|
||
// PrismElement holds the uuid, endpoint of the Prism Element (cluster) | ||
type PrismElement struct { | ||
// UUID is the UUID of the Prism Element (cluster) | ||
UUID string `json:"uuid"` | ||
|
||
// Endpoint holds the address and port of the Prism Element | ||
// +optional | ||
Endpoint PrismEndpoint `json:"endpoint,omitempty"` | ||
|
||
// Name is prism endpoint Name | ||
Name string `json:"name,omitempty"` | ||
} | ||
|
||
// PrismEndpoint holds the endpoint address and port to access the Nutanix Prism Central or Element (cluster) | ||
type PrismEndpoint struct { | ||
// address is the endpoint address (DNS name or IP address) of the Nutanix Prism Central or Element (cluster) | ||
Address string `json:"address"` | ||
|
||
// port is the port number to access the Nutanix Prism Central or Element (cluster) | ||
Port int32 `json:"port"` | ||
} | ||
|
||
// FailureDomain configures failure domain information for the Nutanix platform. | ||
type FailureDomain struct { | ||
// Name defines the unique name of a failure domain. | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=64 | ||
// +kubebuilder:validation:Pattern=`^[0-9A-Za-z_.-@/]+$` | ||
Name string `json:"name"` | ||
|
||
// prismElement holds the identification (name, uuid) and the optional endpoint address and port of the Nutanix Prism Element. | ||
// When a cluster-wide proxy is installed, by default, this endpoint will be accessed via the proxy. | ||
// Should you wish for communication with this endpoint not to be proxied, please add the endpoint to the | ||
// proxy spec.noProxy list. | ||
// +kubebuilder:validation:Required | ||
PrismElement PrismElement `json:"prismElement"` | ||
|
||
// SubnetUUIDs identifies the network subnets of the Prism Element. | ||
// Currently we only support one subnet for a failure domain. | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:MinItems=1 | ||
// +listType=set | ||
SubnetUUIDs []string `json:"subnetUUIDs"` | ||
|
||
// StorageContainers identifies the storage containers in the Prism Element. | ||
// +optional | ||
StorageContainers []StorageResourceReference `json:"storageContainers,omitempty"` | ||
|
||
// DataSourceImages identifies the datasource images in the Prism Element. | ||
// +optional | ||
DataSourceImages []StorageResourceReference `json:"dataSourceImages,omitempty"` | ||
} | ||
|
||
// StorageResourceReference holds reference information of a storage resource (storage container, data source image, etc.) | ||
type StorageResourceReference struct { | ||
// ReferenceName is the identifier of the storage resource configured in the FailureDomain. | ||
// +optional | ||
ReferenceName string `json:"referenceName,omitempty"` | ||
|
||
// UUID is the UUID of the storage container resource in the Prism Element. | ||
// +kubebuilder:validation:Required | ||
UUID string `json:"uuid"` | ||
|
||
// Name is the name of the storage container resource in the Prism Element. | ||
// +optional | ||
Name string `json:"name,omitempty"` | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest adding a nutanix SME to help review this and the CD Platform file, as I don't have the context to know whether these fields are correct and necessary/sufficient.
Also wouldn't be a terrible idea to get an API reviewer's eyes on this. I'm not an expert, but I think it may be best practice to include a
+optional
/+required
tag even when it's the default; and it may be appropriate for some of the fields to be pointers rather than scalars if "unspecified" has different semantics than the nil value.