Skip to content

Commit

Permalink
add new types -> AcceleratorType, OnHostMaintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
SubhasmitaSw committed Jul 22, 2022
1 parent b008844 commit 350b655
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 897 deletions.
1 change: 0 additions & 1 deletion api/v1alpha3/zz_generated.conversion.go

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

1 change: 0 additions & 1 deletion api/v1alpha4/zz_generated.conversion.go

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

46 changes: 30 additions & 16 deletions api/v1beta1/gcpmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,39 @@ const (
IPForwardingDisabled IPForwarding = "Disabled"
)

// AcceleratorType is a type to use to define which accelerator type will be used.
type AcceleratorType string

const (
// All supported GPU accelerator types.
NVIDIA_K80_GPUS AcceleratorType = "nvidia-tesla-k80"
NVIDIA_P100_GPUS AcceleratorType = "nvidia-tesla-p100"
NVIDIA_V100_GPUS AcceleratorType = "nvidia-tesla-v100"
NVIDIA_A100_GPUS AcceleratorType = "nvidia-tesla-a100"
NVIDIA_P4_GPUS AcceleratorType = "nvidia-tesla-p4"
NVIDIA_T4_GPUS AcceleratorType = "nvidia-tesla-t4"
)

// AcceleratorConfig is the GPU accelerator configuration for the GCP machine.
type AcceleratorConfig struct {
// Type is the type of the GPU accelerator to be used for the GCP machine.
// +required
Type string `json:"acceleratorType"`
// +kubebuilder:required
// +kubebuilder:validation:Enum
Type AcceleratorType `json:"type"`

// Count is the number of accelerators to be used for the GCP machine.
// Defaults to 1.
// +optional
Count int64 `json:"acceleratorCount,omitempty"`
// +kubebuilder:default:=1
// +kubebuilder:validation:Minimum=1
Count int `json:"acceleratorCount,omitempty"`
}

type OnHostMaintenance string

const (
// DefaultAcceleratorType is the default type of GPU acclerator to be used for the GCP machine if not specified.
DefaultAcceleratorType = "nvidia-tesla-k80"
// DefaultAcceleratorCount is the default number of accelerators to be used for the GCP machine if not specified.
DefaultAcceleratorCount = 1
// OnHostMaintenanceMigrate is the on-host maintenance action to migrate the VM to a new host when the host is down.
OnHostMaintenanceMigrate OnHostMaintenance = "MIGRATE"
// OnHostMaintenanceTerminate is the on-host maintenance action to terminate the VM when the preemptible VM host is down.
OnHostMaintenanceTerminate OnHostMaintenance = "TERMINATE"
)

// GCPMachineSpec defines the desired state of GCPMachine.
Expand All @@ -109,18 +125,20 @@ type GCPMachineSpec struct {
Image *string `json:"image,omitempty"`

// AcceleratorConfig is the accelerator configuration for the GCP machine.
// +optional
AcceleratorConfig *AcceleratorConfig `json:"acceleratorConfig,omitempty"`

// OnHostMaintenance is the action to take when the host machine is being upgraded.
// It is either "TERMINATE" or "MIGRATE" depending on the machine type and preemptibility.
// Default=TERMINATE
// +kubebuilder:validation:Enum=TERMINATE;MIGRATE
// +kubernetes:default=MIGRATE
// +optional
OnHostMaintenance string `json:"onHostMaintenance,omitempty"`

// AutomaticRestart is whether the instance should be automatically restarted if it is terminated by GCP.
// Default=true
// +kubebuilder:default=true
// +optional
AutomaticRestart *bool `json:"automaticRestart,omitempty"`
AutomaticRestart bool `json:"automaticRestart"`

// AdditionalLabels is an optional set of tags to add to an instance, in addition to the ones added by default by the
// GCP provider. If both the GCPCluster and the GCPMachine specify the same tag name with different values, the
Expand All @@ -135,10 +153,6 @@ type GCPMachineSpec struct {
// +optional
AdditionalMetadata []MetadataItem `json:"additionalMetadata,omitempty"`

// BuildName is the name of the build to use for the GCP instance.
// +optional
BuildName string `json:"buildName,omitempty"`

// IAMInstanceProfile is a name of an IAM instance profile to assign to the instance
// +optional
// IAMInstanceProfile string `json:"iamInstanceProfile,omitempty"`
Expand Down
5 changes: 0 additions & 5 deletions api/v1beta1/zz_generated.deepcopy.go

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

222 changes: 0 additions & 222 deletions config/crd/bases/infrastructure.cluster.x-k8s.io_gcpclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -461,228 +461,6 @@ spec:
storage: false
subresources:
status: {}
- additionalPrinterColumns:
- description: Cluster to which this GCPCluster belongs
jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name
name: Cluster
type: string
- description: Cluster infrastructure is ready for GCE instances
jsonPath: .status.ready
name: Ready
type: string
- description: GCP network the cluster is using
jsonPath: .spec.network.name
name: Network
type: string
- description: API Endpoint
jsonPath: .status.apiEndpoints[0]
name: Endpoint
priority: 1
type: string
name: v1beta1
schema:
openAPIV3Schema:
description: GCPCluster is the Schema for the gcpclusters API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: GCPClusterSpec defines the desired state of GCPCluster.
properties:
additionalLabels:
additionalProperties:
type: string
description: AdditionalLabels is an optional set of tags to add to
GCP resources managed by the GCP provider, in addition to the ones
added by default.
type: object
controlPlaneEndpoint:
description: ControlPlaneEndpoint represents the endpoint used to
communicate with the control plane.
properties:
host:
description: The hostname on which the API server is serving.
type: string
port:
description: The port on which the API server is serving.
format: int32
type: integer
required:
- host
- port
type: object
failureDomains:
description: FailureDomains is an optional field which is used to
assign selected availability zones to a cluster FailureDomains if
empty, defaults to all the zones in the selected region and if specified
would override the default zones.
items:
type: string
type: array
network:
description: NetworkSpec encapsulates all things related to GCP network.
properties:
autoCreateSubnetworks:
description: "AutoCreateSubnetworks: When set to true, the VPC
network is created in \"auto\" mode. When set to false, the
VPC network is created in \"custom\" mode. \n An auto mode VPC
network starts with one subnet per region. Each subnet has a
predetermined range as described in Auto mode VPC network IP
ranges. \n Defaults to true."
type: boolean
loadBalancerBackendPort:
description: Allow for configuration of load balancer backend
(useful for changing apiserver port)
format: int32
type: integer
name:
description: Name is the name of the network to be used.
type: string
subnets:
description: Subnets configuration.
items:
description: SubnetSpec configures an GCP Subnet.
properties:
cidrBlock:
description: CidrBlock is the range of internal addresses
that are owned by this subnetwork. Provide this property
when you create the subnetwork. For example, 10.0.0.0/8
or 192.168.0.0/16. Ranges must be unique and non-overlapping
within a network. Only IPv4 is supported. This field can
be set only at resource creation time.
type: string
description:
description: Description is an optional description associated
with the resource.
type: string
name:
description: Name defines a unique identifier to reference
this resource.
type: string
privateGoogleAccess:
description: PrivateGoogleAccess defines whether VMs in
this subnet can access Google services without assigning
external IP addresses
type: boolean
region:
description: Region is the name of the region where the
Subnetwork resides.
type: string
routeTableId:
description: 'EnableFlowLogs: Whether to enable flow logging
for this subnetwork. If this field is not explicitly set,
it will not appear in get listings. If not set the default
behavior is to disable flow logging.'
type: boolean
secondaryCidrBlocks:
additionalProperties:
type: string
description: SecondaryCidrBlocks defines secondary CIDR
ranges, from which secondary IP ranges of a VM may be
allocated
type: object
type: object
type: array
type: object
project:
description: Project is the name of the project to deploy the cluster
to.
type: string
region:
description: The GCP Region the cluster lives in.
type: string
required:
- project
- region
type: object
status:
description: GCPClusterStatus defines the observed state of GCPCluster.
properties:
failureDomains:
additionalProperties:
description: FailureDomainSpec is the Schema for Cluster API failure
domains. It allows controllers to understand how many failure
domains a cluster can optionally span across.
properties:
attributes:
additionalProperties:
type: string
description: Attributes is a free form map of attributes an
infrastructure provider might use or require.
type: object
controlPlane:
description: ControlPlane determines if this failure domain
is suitable for use by control plane machines.
type: boolean
type: object
description: FailureDomains is a slice of FailureDomains.
type: object
network:
description: Network encapsulates GCP networking resources.
properties:
apiServerBackendService:
description: APIServerBackendService is the full reference to
the backend service created for the API Server.
type: string
apiServerForwardingRule:
description: APIServerForwardingRule is the full reference to
the forwarding rule created for the API Server.
type: string
apiServerHealthCheck:
description: APIServerHealthCheck is the full reference to the
health check created for the API Server.
type: string
apiServerInstanceGroups:
additionalProperties:
type: string
description: APIServerInstanceGroups is a map from zone to the
full reference to the instance groups created for the control
plane nodes created in the same zone.
type: object
apiServerIpAddress:
description: APIServerAddress is the IPV4 global address assigned
to the load balancer created for the API Server.
type: string
apiServerTargetProxy:
description: APIServerTargetProxy is the full reference to the
target proxy created for the API Server.
type: string
firewallRules:
additionalProperties:
type: string
description: FirewallRules is a map from the name of the rule
to its full reference.
type: object
router:
description: Router is the full reference to the router created
within the network it'll contain the cloud nat gateway
type: string
selfLink:
description: SelfLink is the link to the Network used for this
cluster.
type: string
type: object
ready:
description: Bastion Instance `json:"bastion,omitempty"`
type: boolean
required:
- ready
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
Expand Down
Loading

0 comments on commit 350b655

Please sign in to comment.