From 42b5c1c1e26ddd84ccde3fdfd43afc319439dd4c Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Thu, 21 May 2020 10:23:06 +0100 Subject: [PATCH 1/9] wip add gke types --- api/v1alpha3/gcpmanagedcluster_types.go | 92 +++++++++ api/v1alpha3/gcpmanagedcontrolplane_types.go | 71 +++++++ api/v1alpha3/zz_generated.deepcopy.go | 188 ++++++++++++++++++ ...e.cluster.x-k8s.io_gcpmanagedclusters.yaml | 93 +++++++++ ...ster.x-k8s.io_gcpmanagedcontrolplanes.yaml | 123 ++++++++++++ 5 files changed, 567 insertions(+) create mode 100644 api/v1alpha3/gcpmanagedcluster_types.go create mode 100644 api/v1alpha3/gcpmanagedcontrolplane_types.go create mode 100644 config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml create mode 100644 config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml diff --git a/api/v1alpha3/gcpmanagedcluster_types.go b/api/v1alpha3/gcpmanagedcluster_types.go new file mode 100644 index 000000000..d6dfd51a7 --- /dev/null +++ b/api/v1alpha3/gcpmanagedcluster_types.go @@ -0,0 +1,92 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" +) + +// GCPManagedControlPlaneSpec defines the desired state of GCPManagedControlPlane +type GCPManagedControlPlaneSpec struct { + // Version defines the desired Kubernetes version. + // +kubebuilder:validation:MinLength:=2 + // +kubebuilder:validation:Pattern:=^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([-0-9a-zA-Z_\.+]*)?$ + Version string `json:"version"` + + // Project is the name of the GCP project to start the GKE cluster in. + Project string `json:"project"` + + // Region is a string matching one of the canonical GCP region names. Examples: "us-central1", "europe-west1". + Region string `json:"region"` + + // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // +optional + ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` + + // AdditionalTags is an optional set of labels to add to GCP resources managed by the GCP provider, in addition to the + // ones added by default. + // +optional + AdditionalTags map[string]string `json:"additionalTags,omitempty"` + + // SSHPublicKey is a string literal containing an ssh public key. + SSHPublicKey string `json:"sshPublicKey"` + + // DefaultPoolRef is the specification for the default pool, without which an GKE cluster cannot be created. + DefaultPoolRef corev1.LocalObjectReference `json:"defaultPoolRef"` +} + +// GCPManagedControlPlaneStatus defines the observed state of GCPManagedControlPlane +type GCPManagedControlPlaneStatus struct { + // Ready is true when the provider resource is ready. + // +optional + Ready bool `json:"ready,omitempty"` + + // Initialized is true when the the control plane is available for initial contact. + // This may occur before the control plane is fully ready. + // In the GCPManagedControlPlane implementation, these are identical. + // +optional + Initialized bool `json:"initialized,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=gcpmanagedcontrolplanes,scope=Namespaced,categories=cluster-api,shortName=amcp +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +// GCPManagedControlPlane is the Schema for the gcpmanagedcontrolplanes API +type GCPManagedControlPlane struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec GCPManagedControlPlaneSpec `json:"spec,omitempty"` + Status GCPManagedControlPlaneStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// GCPManagedControlPlaneList contains a list of GCPManagedControlPlane +type GCPManagedControlPlaneList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []GCPManagedControlPlane `json:"items"` +} + +func init() { + SchemeBuilder.Register(&GCPManagedControlPlane{}, &GCPManagedControlPlaneList{}) +} diff --git a/api/v1alpha3/gcpmanagedcontrolplane_types.go b/api/v1alpha3/gcpmanagedcontrolplane_types.go new file mode 100644 index 000000000..3da382e0c --- /dev/null +++ b/api/v1alpha3/gcpmanagedcontrolplane_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" +) + +const ( + // ManagedClusterFinalizer allows ReconcileGCPManagedCluster to clean up GCP resources associated with GCPManagedCluster before + // removing it from the apiserver. + ManagedClusterFinalizer = "gcpmanagedcluster.infrastructure.cluster.x-k8s.io" +) + +// GCPManagedClusterSpec defines the desired state of GCPManagedCluster +type GCPManagedClusterSpec struct { + // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // +optional + ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` +} + +// GCPManagedClusterStatus defines the observed state of GCPManagedCluster +type GCPManagedClusterStatus struct { + Ready bool `json:"ready"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=gcpmanagedclusters,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this GCPManagedCluster belongs" +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready for GCE instances" +// +kubebuilder:printcolumn:name="Network",type="string",JSONPath=".spec.network.name",description="GCP network the cluster is using" +// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".status.apiEndpoints[0]",description="API Endpoint",priority=1 + +// GCPManagedCluster is the Schema for the gcpmanagedclusters API +type GCPManagedCluster struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec GCPManagedClusterSpec `json:"spec,omitempty"` + Status GCPManagedClusterStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// GCPManagedClusterList contains a list of GCPManagedCluster +type GCPManagedClusterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []GCPManagedCluster `json:"items"` +} + +func init() { + SchemeBuilder.Register(&GCPManagedCluster{}, &GCPManagedClusterList{}) +} diff --git a/api/v1alpha3/zz_generated.deepcopy.go b/api/v1alpha3/zz_generated.deepcopy.go index ce76efd2c..29ab86a0a 100644 --- a/api/v1alpha3/zz_generated.deepcopy.go +++ b/api/v1alpha3/zz_generated.deepcopy.go @@ -421,6 +421,194 @@ func (in *GCPMachineTemplateSpec) DeepCopy() *GCPMachineTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedCluster) DeepCopyInto(out *GCPManagedCluster) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedCluster. +func (in *GCPManagedCluster) DeepCopy() *GCPManagedCluster { + if in == nil { + return nil + } + out := new(GCPManagedCluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GCPManagedCluster) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedClusterList) DeepCopyInto(out *GCPManagedClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GCPManagedCluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedClusterList. +func (in *GCPManagedClusterList) DeepCopy() *GCPManagedClusterList { + if in == nil { + return nil + } + out := new(GCPManagedClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GCPManagedClusterList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedClusterSpec) DeepCopyInto(out *GCPManagedClusterSpec) { + *out = *in + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedClusterSpec. +func (in *GCPManagedClusterSpec) DeepCopy() *GCPManagedClusterSpec { + if in == nil { + return nil + } + out := new(GCPManagedClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedClusterStatus) DeepCopyInto(out *GCPManagedClusterStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedClusterStatus. +func (in *GCPManagedClusterStatus) DeepCopy() *GCPManagedClusterStatus { + if in == nil { + return nil + } + out := new(GCPManagedClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedControlPlane) DeepCopyInto(out *GCPManagedControlPlane) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedControlPlane. +func (in *GCPManagedControlPlane) DeepCopy() *GCPManagedControlPlane { + if in == nil { + return nil + } + out := new(GCPManagedControlPlane) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GCPManagedControlPlane) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedControlPlaneList) DeepCopyInto(out *GCPManagedControlPlaneList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GCPManagedControlPlane, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedControlPlaneList. +func (in *GCPManagedControlPlaneList) DeepCopy() *GCPManagedControlPlaneList { + if in == nil { + return nil + } + out := new(GCPManagedControlPlaneList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GCPManagedControlPlaneList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedControlPlaneSpec) DeepCopyInto(out *GCPManagedControlPlaneSpec) { + *out = *in + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if in.AdditionalTags != nil { + in, out := &in.AdditionalTags, &out.AdditionalTags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + out.DefaultPoolRef = in.DefaultPoolRef +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedControlPlaneSpec. +func (in *GCPManagedControlPlaneSpec) DeepCopy() *GCPManagedControlPlaneSpec { + if in == nil { + return nil + } + out := new(GCPManagedControlPlaneSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedControlPlaneStatus) DeepCopyInto(out *GCPManagedControlPlaneStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedControlPlaneStatus. +func (in *GCPManagedControlPlaneStatus) DeepCopy() *GCPManagedControlPlaneStatus { + if in == nil { + return nil + } + out := new(GCPManagedControlPlaneStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in Labels) DeepCopyInto(out *Labels) { { diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml new file mode 100644 index 000000000..327c9a86f --- /dev/null +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml @@ -0,0 +1,93 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.2.6 + creationTimestamp: null + name: gcpmanagedclusters.infrastructure.cluster.x-k8s.io +spec: + group: infrastructure.cluster.x-k8s.io + names: + categories: + - cluster-api + kind: GCPManagedCluster + listKind: GCPManagedClusterList + plural: gcpmanagedclusters + singular: gcpmanagedcluster + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Cluster to which this GCPManagedCluster 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: v1alpha3 + schema: + openAPIV3Schema: + description: GCPManagedCluster is the Schema for the gcpmanagedclusters 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: GCPManagedClusterSpec defines the desired state of GCPManagedCluster + properties: + 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 + type: object + status: + description: GCPManagedClusterStatus defines the observed state of GCPManagedCluster + properties: + ready: + type: boolean + required: + - ready + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml new file mode 100644 index 000000000..a2fe2e9cf --- /dev/null +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml @@ -0,0 +1,123 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.2.6 + creationTimestamp: null + name: gcpmanagedcontrolplanes.infrastructure.cluster.x-k8s.io +spec: + group: infrastructure.cluster.x-k8s.io + names: + categories: + - cluster-api + kind: GCPManagedControlPlane + listKind: GCPManagedControlPlaneList + plural: gcpmanagedcontrolplanes + shortNames: + - amcp + singular: gcpmanagedcontrolplane + scope: Namespaced + versions: + - name: v1alpha3 + schema: + openAPIV3Schema: + description: GCPManagedControlPlane is the Schema for the gcpmanagedcontrolplanes + 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: GCPManagedControlPlaneSpec defines the desired state of GCPManagedControlPlane + properties: + additionalTags: + additionalProperties: + type: string + description: AdditionalTags is an optional set of labels 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 + defaultPoolRef: + description: DefaultPoolRef is the specification for the default pool, + without which an GKE cluster cannot be created. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + project: + description: Project is the name of the GCP project to start the GKE + cluster in. + type: string + region: + description: 'Region is a string matching one of the canonical GCP + region names. Examples: "us-central1", "europe-west1".' + type: string + sshPublicKey: + description: SSHPublicKey is a string literal containing an ssh public + key. + type: string + version: + description: Version defines the desired Kubernetes version. + minLength: 2 + pattern: ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([-0-9a-zA-Z_\.+]*)?$ + type: string + required: + - defaultPoolRef + - project + - region + - sshPublicKey + - version + type: object + status: + description: GCPManagedControlPlaneStatus defines the observed state of + GCPManagedControlPlane + properties: + initialized: + description: Initialized is true when the the control plane is available + for initial contact. This may occur before the control plane is + fully ready. In the GCPManagedControlPlane implementation, these + are identical. + type: boolean + ready: + description: Ready is true when the provider resource is ready. + type: boolean + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] From 2bde786154c9ea13c182af34fe15a44e64170d49 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Thu, 21 May 2020 10:52:30 +0100 Subject: [PATCH 2/9] add remaining types and template --- api/v1alpha3/gcpmanagedcluster_types.go | 71 +++++------- api/v1alpha3/gcpmanagedcontrolplane_types.go | 66 +++++++---- api/v1alpha3/gcpmanagedmachinepool_types.go | 94 ++++++++++++++++ api/v1alpha3/zz_generated.deepcopy.go | 104 ++++++++++++++++++ ...ster.x-k8s.io_gcpmanagedcontrolplanes.yaml | 7 +- ...uster.x-k8s.io_gcpmanagedmachinepools.yaml | 95 ++++++++++++++++ templates/gke-cluster-template.yaml | 62 +++++++++++ 7 files changed, 423 insertions(+), 76 deletions(-) create mode 100644 api/v1alpha3/gcpmanagedmachinepool_types.go create mode 100644 config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml create mode 100644 templates/gke-cluster-template.yaml diff --git a/api/v1alpha3/gcpmanagedcluster_types.go b/api/v1alpha3/gcpmanagedcluster_types.go index d6dfd51a7..a0478eb7b 100644 --- a/api/v1alpha3/gcpmanagedcluster_types.go +++ b/api/v1alpha3/gcpmanagedcluster_types.go @@ -17,76 +17,55 @@ limitations under the License. package v1alpha3 import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" +metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" ) -// GCPManagedControlPlaneSpec defines the desired state of GCPManagedControlPlane -type GCPManagedControlPlaneSpec struct { - // Version defines the desired Kubernetes version. - // +kubebuilder:validation:MinLength:=2 - // +kubebuilder:validation:Pattern:=^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([-0-9a-zA-Z_\.+]*)?$ - Version string `json:"version"` - - // Project is the name of the GCP project to start the GKE cluster in. - Project string `json:"project"` - - // Region is a string matching one of the canonical GCP region names. Examples: "us-central1", "europe-west1". - Region string `json:"region"` +const ( + // ManagedClusterFinalizer allows ReconcileGCPManagedCluster to clean up GCP resources associated with GCPManagedCluster before + // removing it from the apiserver. + ManagedClusterFinalizer = "gcpmanagedcluster.infrastructure.cluster.x-k8s.io" +) +// GCPManagedClusterSpec defines the desired state of GCPManagedCluster +type GCPManagedClusterSpec struct { // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. // +optional ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` - - // AdditionalTags is an optional set of labels to add to GCP resources managed by the GCP provider, in addition to the - // ones added by default. - // +optional - AdditionalTags map[string]string `json:"additionalTags,omitempty"` - - // SSHPublicKey is a string literal containing an ssh public key. - SSHPublicKey string `json:"sshPublicKey"` - - // DefaultPoolRef is the specification for the default pool, without which an GKE cluster cannot be created. - DefaultPoolRef corev1.LocalObjectReference `json:"defaultPoolRef"` } -// GCPManagedControlPlaneStatus defines the observed state of GCPManagedControlPlane -type GCPManagedControlPlaneStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready,omitempty"` - - // Initialized is true when the the control plane is available for initial contact. - // This may occur before the control plane is fully ready. - // In the GCPManagedControlPlane implementation, these are identical. - // +optional - Initialized bool `json:"initialized,omitempty"` +// GCPManagedClusterStatus defines the observed state of GCPManagedCluster +type GCPManagedClusterStatus struct { + Ready bool `json:"ready"` } // +kubebuilder:object:root=true -// +kubebuilder:resource:path=gcpmanagedcontrolplanes,scope=Namespaced,categories=cluster-api,shortName=amcp +// +kubebuilder:resource:path=gcpmanagedclusters,scope=Namespaced,categories=cluster-api // +kubebuilder:storageversion // +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this GCPManagedCluster belongs" +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready for GCE instances" +// +kubebuilder:printcolumn:name="Network",type="string",JSONPath=".spec.network.name",description="GCP network the cluster is using" +// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".status.apiEndpoints[0]",description="API Endpoint",priority=1 -// GCPManagedControlPlane is the Schema for the gcpmanagedcontrolplanes API -type GCPManagedControlPlane struct { +// GCPManagedCluster is the Schema for the gcpmanagedclusters API +type GCPManagedCluster struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec GCPManagedControlPlaneSpec `json:"spec,omitempty"` - Status GCPManagedControlPlaneStatus `json:"status,omitempty"` + Spec GCPManagedClusterSpec `json:"spec,omitempty"` + Status GCPManagedClusterStatus `json:"status,omitempty"` } // +kubebuilder:object:root=true -// GCPManagedControlPlaneList contains a list of GCPManagedControlPlane -type GCPManagedControlPlaneList struct { +// GCPManagedClusterList contains a list of GCPManagedCluster +type GCPManagedClusterList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []GCPManagedControlPlane `json:"items"` + Items []GCPManagedCluster `json:"items"` } func init() { - SchemeBuilder.Register(&GCPManagedControlPlane{}, &GCPManagedControlPlaneList{}) + SchemeBuilder.Register(&GCPManagedCluster{}, &GCPManagedClusterList{}) } diff --git a/api/v1alpha3/gcpmanagedcontrolplane_types.go b/api/v1alpha3/gcpmanagedcontrolplane_types.go index 3da382e0c..0e39c77b5 100644 --- a/api/v1alpha3/gcpmanagedcontrolplane_types.go +++ b/api/v1alpha3/gcpmanagedcontrolplane_types.go @@ -17,55 +17,73 @@ limitations under the License. package v1alpha3 import ( + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" ) -const ( - // ManagedClusterFinalizer allows ReconcileGCPManagedCluster to clean up GCP resources associated with GCPManagedCluster before - // removing it from the apiserver. - ManagedClusterFinalizer = "gcpmanagedcluster.infrastructure.cluster.x-k8s.io" -) +// GCPManagedControlPlaneSpec defines the desired state of GCPManagedControlPlane +type GCPManagedControlPlaneSpec struct { + // Version defines the desired Kubernetes version. + // +kubebuilder:validation:MinLength:=2 + // +kubebuilder:validation:Pattern:=^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([-0-9a-zA-Z_\.+]*)?$ + Version string `json:"version"` + + // Project is the name of the GCP project to start the GKE cluster in. + Project string `json:"project"` + + // Region is a string matching one of the canonical GCP region names. Examples: "us-central1", "europe-west1". + Region string `json:"region"` -// GCPManagedClusterSpec defines the desired state of GCPManagedCluster -type GCPManagedClusterSpec struct { // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. // +optional ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` + + // AdditionalTags is an optional set of labels to add to GCP resources managed by the GCP provider, in addition to the + // ones added by default. + // +optional + AdditionalTags map[string]string `json:"additionalTags,omitempty"` + + // DefaultPoolRef is the specification for the default pool, without which an GKE cluster cannot be created. + DefaultPoolRef corev1.LocalObjectReference `json:"defaultPoolRef"` } -// GCPManagedClusterStatus defines the observed state of GCPManagedCluster -type GCPManagedClusterStatus struct { - Ready bool `json:"ready"` +// GCPManagedControlPlaneStatus defines the observed state of GCPManagedControlPlane +type GCPManagedControlPlaneStatus struct { + // Ready is true when the provider resource is ready. + // +optional + Ready bool `json:"ready,omitempty"` + + // Initialized is true when the the control plane is available for initial contact. + // This may occur before the control plane is fully ready. + // In the GCPManagedControlPlane implementation, these are identical. + // +optional + Initialized bool `json:"initialized,omitempty"` } // +kubebuilder:object:root=true -// +kubebuilder:resource:path=gcpmanagedclusters,scope=Namespaced,categories=cluster-api +// +kubebuilder:resource:path=gcpmanagedcontrolplanes,scope=Namespaced,categories=cluster-api,shortName=gmcp // +kubebuilder:storageversion // +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this GCPManagedCluster belongs" -// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready for GCE instances" -// +kubebuilder:printcolumn:name="Network",type="string",JSONPath=".spec.network.name",description="GCP network the cluster is using" -// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".status.apiEndpoints[0]",description="API Endpoint",priority=1 -// GCPManagedCluster is the Schema for the gcpmanagedclusters API -type GCPManagedCluster struct { +// GCPManagedControlPlane is the Schema for the gcpmanagedcontrolplanes API +type GCPManagedControlPlane struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec GCPManagedClusterSpec `json:"spec,omitempty"` - Status GCPManagedClusterStatus `json:"status,omitempty"` + Spec GCPManagedControlPlaneSpec `json:"spec,omitempty"` + Status GCPManagedControlPlaneStatus `json:"status,omitempty"` } // +kubebuilder:object:root=true -// GCPManagedClusterList contains a list of GCPManagedCluster -type GCPManagedClusterList struct { +// GCPManagedControlPlaneList contains a list of GCPManagedControlPlane +type GCPManagedControlPlaneList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []GCPManagedCluster `json:"items"` + Items []GCPManagedControlPlane `json:"items"` } func init() { - SchemeBuilder.Register(&GCPManagedCluster{}, &GCPManagedClusterList{}) -} + SchemeBuilder.Register(&GCPManagedControlPlane{}, &GCPManagedControlPlaneList{}) +} \ No newline at end of file diff --git a/api/v1alpha3/gcpmanagedmachinepool_types.go b/api/v1alpha3/gcpmanagedmachinepool_types.go new file mode 100644 index 000000000..c01b0beff --- /dev/null +++ b/api/v1alpha3/gcpmanagedmachinepool_types.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + capierrors "sigs.k8s.io/cluster-api/errors" +) + +const ( + // ManagedMachinePoolFinalizer allows ReconcileGCPManagedMachinePool to clean up GCP resources associated with + // GCPManagedMachinePool before removing it from the apiserver. + ManagedMachinePoolFinalizer = "gcpmanagedmachinepool.infrastructure.cluster.x-k8s.io" +) + +// GCPManagedMachinePoolSpec defines the desired state of GCPManagedMachinePool +type GCPManagedMachinePoolSpec struct { + // MachineType is the type of the VMs in the node pool. + MachineType string `json:"machineType"` + + // BootDiskSizeGB is the disk size for every machine in this pool. + // If you specify 0, it will apply the default size. + // +optional + BootDiskSizeGB *int32 `json:"bootDiskSizeGB,omitempty"` + + // DiskType is the type of boot disk for machines in this pool. + // Possible values include: 'pd-standard', 'pd-ssd'. Defaults to 'pd-standard'. + // +kubebuilder:validation:Enum=pd-standard;pd-ssd + DiskType string `json:"diskType,omitempty"` +} + +// GCPManagedMachinePoolStatus defines the observed state of GCPManagedMachinePool +type GCPManagedMachinePoolStatus struct { + // Ready is true when the provider resource is ready. + // +optional + Ready bool `json:"ready"` + + // Replicas is the most recently observed number of replicas. + // +optional + Replicas int32 `json:"replicas"` + + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorReason *capierrors.MachineStatusError `json:"errorReason,omitempty"` + + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=gcpmanagedmachinepools,scope=Namespaced,categories=cluster-api,shortName=gmmp +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +// GCPManagedMachinePool is the Schema for the gcpmanagedmachinepools API +type GCPManagedMachinePool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec GCPManagedMachinePoolSpec `json:"spec,omitempty"` + Status GCPManagedMachinePoolStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// GCPManagedMachinePoolList contains a list of GCPManagedMachinePool +type GCPManagedMachinePoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []GCPManagedMachinePool `json:"items"` +} + +func init() { + SchemeBuilder.Register(&GCPManagedMachinePool{}, &GCPManagedMachinePoolList{}) +} diff --git a/api/v1alpha3/zz_generated.deepcopy.go b/api/v1alpha3/zz_generated.deepcopy.go index 29ab86a0a..4f9eef0b8 100644 --- a/api/v1alpha3/zz_generated.deepcopy.go +++ b/api/v1alpha3/zz_generated.deepcopy.go @@ -609,6 +609,110 @@ func (in *GCPManagedControlPlaneStatus) DeepCopy() *GCPManagedControlPlaneStatus return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedMachinePool) DeepCopyInto(out *GCPManagedMachinePool) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedMachinePool. +func (in *GCPManagedMachinePool) DeepCopy() *GCPManagedMachinePool { + if in == nil { + return nil + } + out := new(GCPManagedMachinePool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GCPManagedMachinePool) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedMachinePoolList) DeepCopyInto(out *GCPManagedMachinePoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GCPManagedMachinePool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedMachinePoolList. +func (in *GCPManagedMachinePoolList) DeepCopy() *GCPManagedMachinePoolList { + if in == nil { + return nil + } + out := new(GCPManagedMachinePoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GCPManagedMachinePoolList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedMachinePoolSpec) DeepCopyInto(out *GCPManagedMachinePoolSpec) { + *out = *in + if in.BootDiskSizeGB != nil { + in, out := &in.BootDiskSizeGB, &out.BootDiskSizeGB + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedMachinePoolSpec. +func (in *GCPManagedMachinePoolSpec) DeepCopy() *GCPManagedMachinePoolSpec { + if in == nil { + return nil + } + out := new(GCPManagedMachinePoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPManagedMachinePoolStatus) DeepCopyInto(out *GCPManagedMachinePoolStatus) { + *out = *in + if in.ErrorReason != nil { + in, out := &in.ErrorReason, &out.ErrorReason + *out = new(errors.MachineStatusError) + **out = **in + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPManagedMachinePoolStatus. +func (in *GCPManagedMachinePoolStatus) DeepCopy() *GCPManagedMachinePoolStatus { + if in == nil { + return nil + } + out := new(GCPManagedMachinePoolStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in Labels) DeepCopyInto(out *Labels) { { diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml index a2fe2e9cf..f01fcb7b6 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml @@ -16,7 +16,7 @@ spec: listKind: GCPManagedControlPlaneList plural: gcpmanagedcontrolplanes shortNames: - - amcp + - gmcp singular: gcpmanagedcontrolplane scope: Namespaced versions: @@ -80,10 +80,6 @@ spec: description: 'Region is a string matching one of the canonical GCP region names. Examples: "us-central1", "europe-west1".' type: string - sshPublicKey: - description: SSHPublicKey is a string literal containing an ssh public - key. - type: string version: description: Version defines the desired Kubernetes version. minLength: 2 @@ -93,7 +89,6 @@ spec: - defaultPoolRef - project - region - - sshPublicKey - version type: object status: diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml new file mode 100644 index 000000000..f46e4eca0 --- /dev/null +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml @@ -0,0 +1,95 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.2.6 + creationTimestamp: null + name: gcpmanagedmachinepools.infrastructure.cluster.x-k8s.io +spec: + group: infrastructure.cluster.x-k8s.io + names: + categories: + - cluster-api + kind: GCPManagedMachinePool + listKind: GCPManagedMachinePoolList + plural: gcpmanagedmachinepools + shortNames: + - gmmp + singular: gcpmanagedmachinepool + scope: Namespaced + versions: + - name: v1alpha3 + schema: + openAPIV3Schema: + description: GCPManagedMachinePool is the Schema for the gcpmanagedmachinepools + 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: GCPManagedMachinePoolSpec defines the desired state of GCPManagedMachinePool + properties: + bootDiskSizeGB: + description: BootDiskSizeGB is the disk size for every machine in + this pool. If you specify 0, it will apply the default size. + format: int32 + type: integer + diskType: + description: 'DiskType is the type of boot disk for machines in this + pool. Possible values include: ''pd-standard'', ''pd-ssd''. Defaults + to ''pd-standard''.' + enum: + - pd-standard + - pd-ssd + type: string + machineType: + description: MachineType is the type of the VMs in the node pool. + type: string + required: + - machineType + type: object + status: + description: GCPManagedMachinePoolStatus defines the observed state of + GCPManagedMachinePool + properties: + errorMessage: + description: Any transient errors that occur during the reconciliation + of Machines can be added as events to the Machine object and/or + logged in the controller's output. + type: string + errorReason: + description: Any transient errors that occur during the reconciliation + of Machines can be added as events to the Machine object and/or + logged in the controller's output. + type: string + ready: + description: Ready is true when the provider resource is ready. + type: boolean + replicas: + description: Replicas is the most recently observed number of replicas. + format: int32 + type: integer + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/templates/gke-cluster-template.yaml b/templates/gke-cluster-template.yaml new file mode 100644 index 000000000..7ade2327e --- /dev/null +++ b/templates/gke-cluster-template.yaml @@ -0,0 +1,62 @@ +--- +apiVersion: cluster.x-k8s.io/v1alpha3 +kind: Cluster +metadata: + name: "${CLUSTER_NAME}" +spec: + clusterNetwork: + pods: + cidrBlocks: ["192.168.0.0/16"] + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + kind: GCPManagedCluster + name: "${CLUSTER_NAME}" + controlPlaneRef: + kind: GCPManagedControlPlane + apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 + name: "${CLUSTER_NAME}-control-plane" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +kind: GCPManagedCluster +metadata: + name: "${CLUSTER_NAME}" +--- +apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 +kind: GCPManagedControlPlane +metadata: + name: "${CLUSTER_NAME}-control-plane" +spec: + version: "${KUBERNETES_VERSION}" + project: "${GCP_PROJECT}" + region: "${GCP_REGION}" + defaultPoolRef: + name: nodepool0 +--- +apiVersion: exp.cluster.x-k8s.io/v1alpha3 +kind: MachinePool +metadata: + name: nodepool0 +spec: + clusterName: ${CLUSTER_NAME} + replicas: ${WORKER_MACHINE_COUNT} + template: + metadata: {} + spec: + bootstrap: + dataSecretName: "" + clusterName: ${CLUSTER_NAME} + infrastructureRef: + apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha3 + kind: GCPManagedMachinePool + name: nodepool0 + namespace: default + version: ${KUBERNETES_VERSION} +--- +apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha3 +kind: GCPManagedMachinePool +metadata: + name: nodepool0 +spec: + machineType: "n1-standard-8" + bootDiskSizeGB: 100 + From 56459d5c413a5abe4c1d9ecf6a9110cb46925c2c Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Thu, 21 May 2020 10:56:04 +0100 Subject: [PATCH 3/9] gofmt --- api/v1alpha3/gcpmanagedcluster_types.go | 4 ++-- api/v1alpha3/gcpmanagedcontrolplane_types.go | 2 +- api/v1alpha3/gcpmanagedmachinepool_types.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/v1alpha3/gcpmanagedcluster_types.go b/api/v1alpha3/gcpmanagedcluster_types.go index a0478eb7b..3da382e0c 100644 --- a/api/v1alpha3/gcpmanagedcluster_types.go +++ b/api/v1alpha3/gcpmanagedcluster_types.go @@ -17,8 +17,8 @@ limitations under the License. package v1alpha3 import ( -metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" ) const ( diff --git a/api/v1alpha3/gcpmanagedcontrolplane_types.go b/api/v1alpha3/gcpmanagedcontrolplane_types.go index 0e39c77b5..faa4b2d6c 100644 --- a/api/v1alpha3/gcpmanagedcontrolplane_types.go +++ b/api/v1alpha3/gcpmanagedcontrolplane_types.go @@ -86,4 +86,4 @@ type GCPManagedControlPlaneList struct { func init() { SchemeBuilder.Register(&GCPManagedControlPlane{}, &GCPManagedControlPlaneList{}) -} \ No newline at end of file +} diff --git a/api/v1alpha3/gcpmanagedmachinepool_types.go b/api/v1alpha3/gcpmanagedmachinepool_types.go index c01b0beff..0080683e7 100644 --- a/api/v1alpha3/gcpmanagedmachinepool_types.go +++ b/api/v1alpha3/gcpmanagedmachinepool_types.go @@ -22,7 +22,7 @@ import ( ) const ( - // ManagedMachinePoolFinalizer allows ReconcileGCPManagedMachinePool to clean up GCP resources associated with + // ManagedMachinePoolFinalizer allows ReconcileGCPManagedMachinePool to clean up GCP resources associated with # // GCPManagedMachinePool before removing it from the apiserver. ManagedMachinePoolFinalizer = "gcpmanagedmachinepool.infrastructure.cluster.x-k8s.io" ) From 3676e0ff5155d2565b559f0d6c18ee1fedf84a58 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Thu, 21 May 2020 11:01:03 +0100 Subject: [PATCH 4/9] bad columns --- api/v1alpha3/gcpmanagedcluster_types.go | 4 +--- ...structure.cluster.x-k8s.io_gcpmanagedclusters.yaml | 11 +---------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/api/v1alpha3/gcpmanagedcluster_types.go b/api/v1alpha3/gcpmanagedcluster_types.go index 3da382e0c..32f09cce9 100644 --- a/api/v1alpha3/gcpmanagedcluster_types.go +++ b/api/v1alpha3/gcpmanagedcluster_types.go @@ -44,9 +44,7 @@ type GCPManagedClusterStatus struct { // +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this GCPManagedCluster belongs" -// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready for GCE instances" -// +kubebuilder:printcolumn:name="Network",type="string",JSONPath=".spec.network.name",description="GCP network the cluster is using" -// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".status.apiEndpoints[0]",description="API Endpoint",priority=1 +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready" // GCPManagedCluster is the Schema for the gcpmanagedclusters API type GCPManagedCluster struct { diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml index 327c9a86f..ea270a4b1 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml @@ -23,19 +23,10 @@ spec: jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name name: Cluster type: string - - description: Cluster infrastructure is ready for GCE instances + - description: Cluster infrastructure is ready 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: v1alpha3 schema: openAPIV3Schema: From bc2cbc534a308266a7fe907008dbcadf8ea0e57c Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Thu, 21 May 2020 12:36:11 +0100 Subject: [PATCH 5/9] fix bad api versions --- templates/gke-cluster-template.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/gke-cluster-template.yaml b/templates/gke-cluster-template.yaml index 7ade2327e..46e2bcb85 100644 --- a/templates/gke-cluster-template.yaml +++ b/templates/gke-cluster-template.yaml @@ -21,7 +21,7 @@ kind: GCPManagedCluster metadata: name: "${CLUSTER_NAME}" --- -apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: GCPManagedControlPlane metadata: name: "${CLUSTER_NAME}-control-plane" @@ -52,7 +52,7 @@ spec: namespace: default version: ${KUBERNETES_VERSION} --- -apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha3 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: GCPManagedMachinePool metadata: name: nodepool0 From c760fa697534ce7fd1be3c746ca02a6bd6655fc5 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Thu, 21 May 2020 12:44:38 +0100 Subject: [PATCH 6/9] Add comments and fix up refs in template --- templates/gke-cluster-template.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/templates/gke-cluster-template.yaml b/templates/gke-cluster-template.yaml index 46e2bcb85..7497ab8a3 100644 --- a/templates/gke-cluster-template.yaml +++ b/templates/gke-cluster-template.yaml @@ -1,4 +1,6 @@ --- +# The Cluster object is the top level owner of all resources. +# It coordinates between the control plane and the infrastructure/machines. apiVersion: cluster.x-k8s.io/v1alpha3 kind: Cluster metadata: @@ -13,14 +15,20 @@ spec: name: "${CLUSTER_NAME}" controlPlaneRef: kind: GCPManagedControlPlane - apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 name: "${CLUSTER_NAME}-control-plane" --- +# Due to the nature of managed Kubernetes and the control plane implementation, +# the infrastructure provider for a GKE cluster is basically a no-op. +# It sets itself to ready as soon as it sees the control plane ready. apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: GCPManagedCluster metadata: name: "${CLUSTER_NAME}" --- +# The control plane abstracts readiness and provisioning of an GKE cluster. +# Because GKE requires a default pool, this also requires a reference to the +# default machine pool. apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: GCPManagedControlPlane metadata: @@ -32,6 +40,9 @@ spec: defaultPoolRef: name: nodepool0 --- +# We provision a default machine pool with no bootstrap data (GKE will provide it). +# We specify a GCPManagedMachinePool as the infrastructure machine, which +# will be reflected in GCP as node pools attached to a GKE cluster. apiVersion: exp.cluster.x-k8s.io/v1alpha3 kind: MachinePool metadata: @@ -46,12 +57,14 @@ spec: dataSecretName: "" clusterName: ${CLUSTER_NAME} infrastructureRef: - apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: GCPManagedMachinePool name: nodepool0 namespace: default version: ${KUBERNETES_VERSION} --- +# The GCP-specific machine pool implementation drives the configuration of the +# GKE node. apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: GCPManagedMachinePool metadata: @@ -59,4 +72,3 @@ metadata: spec: machineType: "n1-standard-8" bootDiskSizeGB: 100 - From 87979762d3d101e4026de7d38893cc8bd1b1343a Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Fri, 22 May 2020 10:29:28 +0100 Subject: [PATCH 7/9] Add network config to control plane --- api/v1alpha3/gcpmanagedcontrolplane_types.go | 8 +++++-- api/v1alpha3/gcpmanagedmachinepool_types.go | 4 ++-- api/v1alpha3/types.go | 8 +++++++ api/v1alpha3/zz_generated.deepcopy.go | 20 ++++++++++++++++-- ...ster.x-k8s.io_gcpmanagedcontrolplanes.yaml | 21 +++++++++++++++---- ...uster.x-k8s.io_gcpmanagedmachinepools.yaml | 6 +++--- config/rbac/role.yaml | 20 ++++++++++++++++++ templates/gke-cluster-template.yaml | 5 ++++- 8 files changed, 78 insertions(+), 14 deletions(-) diff --git a/api/v1alpha3/gcpmanagedcontrolplane_types.go b/api/v1alpha3/gcpmanagedcontrolplane_types.go index faa4b2d6c..a867cbdcd 100644 --- a/api/v1alpha3/gcpmanagedcontrolplane_types.go +++ b/api/v1alpha3/gcpmanagedcontrolplane_types.go @@ -35,14 +35,18 @@ type GCPManagedControlPlaneSpec struct { // Region is a string matching one of the canonical GCP region names. Examples: "us-central1", "europe-west1". Region string `json:"region"` + // Network encapsulates all things related to GCP network. + // +optional + Network ManagedNetworkSpec `json:"network"` + // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. // +optional ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` - // AdditionalTags is an optional set of labels to add to GCP resources managed by the GCP provider, in addition to the + // AdditionalLabels is an optional set of labels to add to GCP resources managed by the GCP provider, in addition to the // ones added by default. // +optional - AdditionalTags map[string]string `json:"additionalTags,omitempty"` + AdditionalLabels map[string]string `json:"additionalLabels,omitempty"` // DefaultPoolRef is the specification for the default pool, without which an GKE cluster cannot be created. DefaultPoolRef corev1.LocalObjectReference `json:"defaultPoolRef"` diff --git a/api/v1alpha3/gcpmanagedmachinepool_types.go b/api/v1alpha3/gcpmanagedmachinepool_types.go index 0080683e7..b76c26cb4 100644 --- a/api/v1alpha3/gcpmanagedmachinepool_types.go +++ b/api/v1alpha3/gcpmanagedmachinepool_types.go @@ -29,8 +29,8 @@ const ( // GCPManagedMachinePoolSpec defines the desired state of GCPManagedMachinePool type GCPManagedMachinePoolSpec struct { - // MachineType is the type of the VMs in the node pool. - MachineType string `json:"machineType"` + // InstanceType is the type of the VMs in the node pool. + InstanceType string `json:"instanceType"` // BootDiskSizeGB is the disk size for every machine in this pool. // If you specify 0, it will apply the default size. diff --git a/api/v1alpha3/types.go b/api/v1alpha3/types.go index b927ce956..9e6a1cd0a 100644 --- a/api/v1alpha3/types.go +++ b/api/v1alpha3/types.go @@ -102,6 +102,14 @@ type NetworkSpec struct { LoadBalancerBackendPort *int32 `json:"loadBalancerBackendPort,omitempty"` } +type ManagedNetworkSpec struct { + // Name is the name of the network to be used. + Name string `json:"name"` + + // Subnetwork is the name of the subnetwork to be used. + Subnetwork string `json:"subnetwork"` +} + // SubnetSpec configures an GCP Subnet. type SubnetSpec struct { // Name defines a unique identifier to reference this resource. diff --git a/api/v1alpha3/zz_generated.deepcopy.go b/api/v1alpha3/zz_generated.deepcopy.go index 4f9eef0b8..9ada0cc33 100644 --- a/api/v1alpha3/zz_generated.deepcopy.go +++ b/api/v1alpha3/zz_generated.deepcopy.go @@ -573,9 +573,10 @@ func (in *GCPManagedControlPlaneList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GCPManagedControlPlaneSpec) DeepCopyInto(out *GCPManagedControlPlaneSpec) { *out = *in + out.Network = in.Network out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if in.AdditionalTags != nil { - in, out := &in.AdditionalTags, &out.AdditionalTags + if in.AdditionalLabels != nil { + in, out := &in.AdditionalLabels, &out.AdditionalLabels *out = make(map[string]string, len(*in)) for key, val := range *in { (*out)[key] = val @@ -734,6 +735,21 @@ func (in Labels) DeepCopy() Labels { return *out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ManagedNetworkSpec) DeepCopyInto(out *ManagedNetworkSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedNetworkSpec. +func (in *ManagedNetworkSpec) DeepCopy() *ManagedNetworkSpec { + if in == nil { + return nil + } + out := new(ManagedNetworkSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Network) DeepCopyInto(out *Network) { *out = *in diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml index f01fcb7b6..8110c1ad9 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml @@ -41,12 +41,12 @@ spec: spec: description: GCPManagedControlPlaneSpec defines the desired state of GCPManagedControlPlane properties: - additionalTags: + additionalLabels: additionalProperties: type: string - description: AdditionalTags is an optional set of labels to add to - GCP resources managed by the GCP provider, in addition to the ones - added by default. + description: AdditionalLabels is an optional set of labels 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 @@ -72,6 +72,19 @@ spec: TODO: Add other useful fields. apiVersion, kind, uid?' type: string type: object + network: + description: Network encapsulates all things related to GCP network. + properties: + name: + description: Name is the name of the network to be used. + type: string + subnetwork: + description: Subnetwork is the name of the subnetwork to be used. + type: string + required: + - name + - subnetwork + type: object project: description: Project is the name of the GCP project to start the GKE cluster in. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml index f46e4eca0..d3093840e 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml @@ -54,11 +54,11 @@ spec: - pd-standard - pd-ssd type: string - machineType: - description: MachineType is the type of the VMs in the node pool. + instanceType: + description: InstanceType is the type of the VMs in the node pool. type: string required: - - machineType + - instanceType type: object status: description: GCPManagedMachinePoolStatus defines the observed state of diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 5683b1d2e..86aa04e58 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -83,3 +83,23 @@ rules: - get - patch - update +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - gcpmanagedclusters + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - infrastructure.cluster.x-k8s.io + resources: + - gcpmanagedclusters/status + verbs: + - get + - patch + - update diff --git a/templates/gke-cluster-template.yaml b/templates/gke-cluster-template.yaml index 7497ab8a3..f56e34e59 100644 --- a/templates/gke-cluster-template.yaml +++ b/templates/gke-cluster-template.yaml @@ -37,6 +37,9 @@ spec: version: "${KUBERNETES_VERSION}" project: "${GCP_PROJECT}" region: "${GCP_REGION}" + network: + name: "${CLUSTER_NAME}-network" + subnetwork: "${CLUSTER_NAME}-subnet" defaultPoolRef: name: nodepool0 --- @@ -70,5 +73,5 @@ kind: GCPManagedMachinePool metadata: name: nodepool0 spec: - machineType: "n1-standard-8" + instanceType: "n1-standard-8" bootDiskSizeGB: 100 From b80ac86d368ac0f385dd2b29fbfc76c344385bee Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Fri, 22 May 2020 11:09:41 +0100 Subject: [PATCH 8/9] Add more comments --- api/v1alpha3/gcpmanagedcontrolplane_types.go | 2 +- api/v1alpha3/gcpmanagedmachinepool_types.go | 5 +++++ api/v1alpha3/types.go | 8 ++++++-- api/v1alpha3/zz_generated.deepcopy.go | 16 +++++++++++++++- ...cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml | 7 +++---- ....cluster.x-k8s.io_gcpmanagedmachinepools.yaml | 4 ++++ 6 files changed, 34 insertions(+), 8 deletions(-) diff --git a/api/v1alpha3/gcpmanagedcontrolplane_types.go b/api/v1alpha3/gcpmanagedcontrolplane_types.go index a867cbdcd..48a8cb234 100644 --- a/api/v1alpha3/gcpmanagedcontrolplane_types.go +++ b/api/v1alpha3/gcpmanagedcontrolplane_types.go @@ -37,7 +37,7 @@ type GCPManagedControlPlaneSpec struct { // Network encapsulates all things related to GCP network. // +optional - Network ManagedNetworkSpec `json:"network"` + Network *ManagedNetworkSpec `json:"network,omitempty"` // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. // +optional diff --git a/api/v1alpha3/gcpmanagedmachinepool_types.go b/api/v1alpha3/gcpmanagedmachinepool_types.go index b76c26cb4..53d36403c 100644 --- a/api/v1alpha3/gcpmanagedmachinepool_types.go +++ b/api/v1alpha3/gcpmanagedmachinepool_types.go @@ -40,7 +40,12 @@ type GCPManagedMachinePoolSpec struct { // DiskType is the type of boot disk for machines in this pool. // Possible values include: 'pd-standard', 'pd-ssd'. Defaults to 'pd-standard'. // +kubebuilder:validation:Enum=pd-standard;pd-ssd + // +optional DiskType string `json:"diskType,omitempty"` + + // Preemptible determines if the nodes are preemptible. Defaults to false. + // +optional + Preemptible bool `json:"preemptible,omitempty"` } // GCPManagedMachinePoolStatus defines the observed state of GCPManagedMachinePool diff --git a/api/v1alpha3/types.go b/api/v1alpha3/types.go index 9e6a1cd0a..adf80a4f7 100644 --- a/api/v1alpha3/types.go +++ b/api/v1alpha3/types.go @@ -104,10 +104,14 @@ type NetworkSpec struct { type ManagedNetworkSpec struct { // Name is the name of the network to be used. - Name string `json:"name"` + // If empty, defaults to the default network. + // +optional + Name *string `json:"name,omitempty"` // Subnetwork is the name of the subnetwork to be used. - Subnetwork string `json:"subnetwork"` + // If empty, an automatic name will be used. + // +optional + Subnetwork *string `json:"subnetwork,omitempty"` } // SubnetSpec configures an GCP Subnet. diff --git a/api/v1alpha3/zz_generated.deepcopy.go b/api/v1alpha3/zz_generated.deepcopy.go index 9ada0cc33..b13d8a029 100644 --- a/api/v1alpha3/zz_generated.deepcopy.go +++ b/api/v1alpha3/zz_generated.deepcopy.go @@ -573,7 +573,11 @@ func (in *GCPManagedControlPlaneList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GCPManagedControlPlaneSpec) DeepCopyInto(out *GCPManagedControlPlaneSpec) { *out = *in - out.Network = in.Network + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(ManagedNetworkSpec) + (*in).DeepCopyInto(*out) + } out.ControlPlaneEndpoint = in.ControlPlaneEndpoint if in.AdditionalLabels != nil { in, out := &in.AdditionalLabels, &out.AdditionalLabels @@ -738,6 +742,16 @@ func (in Labels) DeepCopy() Labels { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ManagedNetworkSpec) DeepCopyInto(out *ManagedNetworkSpec) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Subnetwork != nil { + in, out := &in.Subnetwork, &out.Subnetwork + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedNetworkSpec. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml index 8110c1ad9..6f24c75a0 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedcontrolplanes.yaml @@ -76,14 +76,13 @@ spec: description: Network encapsulates all things related to GCP network. properties: name: - description: Name is the name of the network to be used. + description: Name is the name of the network to be used. If empty, + defaults to the default network. type: string subnetwork: description: Subnetwork is the name of the subnetwork to be used. + If empty, an automatic name will be used. type: string - required: - - name - - subnetwork type: object project: description: Project is the name of the GCP project to start the GKE diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml index d3093840e..5589b3c4a 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedmachinepools.yaml @@ -57,6 +57,10 @@ spec: instanceType: description: InstanceType is the type of the VMs in the node pool. type: string + preemptible: + description: Preemptible determines if the nodes are preemptible. + Defaults to false. + type: boolean required: - instanceType type: object From 56188456963e46c968d0641f12e45626ba949039 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Fri, 22 May 2020 11:15:14 +0100 Subject: [PATCH 9/9] remove cluster network from template --- templates/gke-cluster-template.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/templates/gke-cluster-template.yaml b/templates/gke-cluster-template.yaml index f56e34e59..880fd59d7 100644 --- a/templates/gke-cluster-template.yaml +++ b/templates/gke-cluster-template.yaml @@ -6,9 +6,6 @@ kind: Cluster metadata: name: "${CLUSTER_NAME}" spec: - clusterNetwork: - pods: - cidrBlocks: ["192.168.0.0/16"] infrastructureRef: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 kind: GCPManagedCluster