Skip to content

Commit

Permalink
Add multiple fields to GCPManagedMachinePool
Browse files Browse the repository at this point in the history
Signed-off-by: Akshay Gaikwad <akshay.gaikwad@rafay.co>
  • Loading branch information
akshay196-rafay committed Jun 6, 2023
1 parent 328e0b5 commit 9228eed
Show file tree
Hide file tree
Showing 3 changed files with 245 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,30 @@ spec:
GCP resources managed by the GCP provider, in addition to the ones
added by default.
type: object
diskSizeGB:
description: DiskSizeGB is size of the disk attached to each node,
specified in GB.
format: int64
type: integer
diskType:
description: DiskType is type of the disk attached to each node.
enum:
- pd-standard
- pd-ssd
- pd-balanced
type: string
imageType:
description: ImageType is image type to use for this nodepool.
type: string
instanceMetadata:
additionalProperties:
type: string
description: InstanceMetadata is metadata key/value pairs assigned
to instances in the cluster.
type: object
instanceType:
description: InstanceType is name of Compute Engine machine type.
type: string
kubernetesLabels:
additionalProperties:
type: string
Expand Down Expand Up @@ -82,12 +106,79 @@ spec:
- value
type: object
type: array
maxPodsPerNode:
description: MaxPodsPerNode is constraint enforced on the max num
of pods per node.
format: int64
type: integer
nodeLocations:
description: NodeLocations is the list of zones in which the NodePool's
nodes should be located.
items:
type: string
type: array
nodeNetwork:
description: NodeNetwork specifies the node network configuration
options.
properties:
createPodRange:
description: CreatePodRange specifies whether to create a new
range for pod IPs in this node pool.
type: boolean
podRangeCidrBlock:
description: PodRangeCidrBlock is the IP address range for pod
IPs in this node pool.
type: string
podRangeName:
description: PodRangeName is ID of the secondary range for pod
IPs.
type: string
tags:
description: Tags is list of instance tags applied to all nodes.
Tags are used to identify valid sources or targets for network
firewalls.
items:
type: string
type: array
type: object
nodePoolName:
description: NodePoolName specifies the name of the GKE node pool
corresponding to this MachinePool. If you don't specify a name then
a default name will be created based on the namespace and name of
the managed machine pool.
type: string
nodeSecurity:
description: NodeSecurity specifies the node security options.
properties:
enableIntegrityMonitoring:
description: EnableIntegrityMonitoring defines whether the instance
has integrity monitoring enabled.
type: boolean
enableSecureBoot:
description: EnableSecureBoot defines whether the instance has
Secure Boot enabled.
type: boolean
sandboxType:
description: SandboxType is type of the sandbox to use for the
node.
type: string
serviceAccount:
description: ServiceAccount specifies the identity details for
node pool.
properties:
email:
description: Email is the Google Cloud Platform Service Account
to be used by the node VMs.
type: string
scopes:
description: Scopes is a set of Google API scopes to be made
available on all of the node VMs under the "default" service
account.
items:
type: string
type: array
type: object
type: object
providerIDList:
description: ProviderIDList are the provider IDs of instances in the
managed instance group corresponding to the nodegroup represented
Expand Down
84 changes: 84 additions & 0 deletions exp/api/v1beta1/gcpmanagedmachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,39 @@ type GCPManagedMachinePoolSpec struct {
// Scaling specifies scaling for the node pool
// +optional
Scaling *NodePoolAutoScaling `json:"scaling,omitempty"`
// NodeLocations is the list of zones in which the NodePool's
// nodes should be located.
// +optional
NodeLocations []string `json:"nodeLocations,omitempty"`
// ImageType is image type to use for this nodepool.
// +optional
ImageType string `json:"imageType,omitempty"`
// InstanceType is name of Compute Engine machine type.
// +optional
InstanceType string `json:"instanceType,omitempty"`
// DiskType is type of the disk attached to each node.
// +kubebuilder:validation:Enum=pd-standard;pd-ssd;pd-balanced
// +optional
DiskType string `json:"diskType,omitempty"`
// DiskSizeGB is size of the disk attached to each node,
// specified in GB.
// +optional
DiskSizeGB int64 `json:"diskSizeGB,omitempty"`
// MaxPodsPerNode is constraint enforced on the max num of
// pods per node.
// +optional
MaxPodsPerNode int64 `json:"maxPodsPerNode,omitempty"`
// NodeNetwork specifies the node network configuration
// options.
// +optional
NodeNetwork NodeNetworkConfig `json:"nodeNetwork,omitempty"`
// NodeSecurity specifies the node security options.
// +optional
NodeSecurity NodeSecurityConfig `json:"nodeSecurity,omitempty"`
// InstanceMetadata is metadata key/value pairs assigned to
// instances in the cluster.
// +optional
InstanceMetadata map[string]string `json:"instanceMetadata"`
// KubernetesLabels specifies the labels to apply to the nodes of the node pool.
// +optional
KubernetesLabels infrav1.Labels `json:"kubernetesLabels,omitempty"`
Expand All @@ -54,6 +87,57 @@ type GCPManagedMachinePoolSpec struct {
ProviderIDList []string `json:"providerIDList,omitempty"`
}

// NodeNetworkConfig encapsulates node network configurations.
type NodeNetworkConfig struct {
// Tags is list of instance tags applied to all nodes. Tags
// are used to identify valid sources or targets for network
// firewalls.
// +optional
Tags []string `json:"tags,omitempty"`
// CreatePodRange specifies whether to create a new range for
// pod IPs in this node pool.
// +optional
CreatePodRange bool `json:"createPodRange,omitempty"`
// PodRangeName is ID of the secondary range for pod IPs.
// +optional
PodRangeName string `json:"podRangeName,omitempty"`
// PodRangeCidrBlock is the IP address range for pod IPs in
// this node pool.
// +optional
PodRangeCidrBlock string `json:"podRangeCidrBlock"`
}

// NodeSecurityConfig encapsulates node security configurations.
type NodeSecurityConfig struct {
// ServiceAccount specifies the identity details for node
// pool.
// +optional
ServiceAccount ServiceAccountConfig `json:"serviceAccount,omitempty"`
// SandboxType is type of the sandbox to use for the node.
// +optional
SandboxType string `json:"sandboxType,omitempty"`
// EnableSecureBoot defines whether the instance has Secure
// Boot enabled.
// +optional
EnableSecureBoot bool `json:"enableSecureBoot,omitempty"`
// EnableIntegrityMonitoring defines whether the instance has
// integrity monitoring enabled.
// +optional
EnableIntegrityMonitoring bool `json:"enableIntegrityMonitoring,omitempty"`
}

// ServiceAccountConfig encapsulates service account options.
type ServiceAccountConfig struct {
// Email is the Google Cloud Platform Service Account to be
// used by the node VMs.
// +optional
Email string `json:"email,omitempty"`
// Scopes is a set of Google API scopes to be made available
// on all of the node VMs under the "default" service account.
// +optional
Scopes []string `json:"scopes,omitempty"`
}

// GCPManagedMachinePoolStatus defines the observed state of GCPManagedMachinePool.
type GCPManagedMachinePoolStatus struct {
Ready bool `json:"ready"`
Expand Down
70 changes: 70 additions & 0 deletions exp/api/v1beta1/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 9228eed

Please sign in to comment.