Skip to content

Commit

Permalink
Update API and proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
richardchen331 committed Jan 4, 2023
1 parent 35fc9f7 commit a124a98
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
name: v1beta1
schema:
openAPIV3Schema:
description: GCPManagedCluster is the Schema for the gcpmanagedclusters API
description: GCPManagedCluster is the Schema for the gcpmanagedclusters API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -55,7 +55,7 @@ spec:
metadata:
type: object
spec:
description: GCPManagedClusterSpec defines the desired state of GCPManagedCluster
description: GCPManagedClusterSpec defines the desired state of GCPManagedCluster.
properties:
additionalLabels:
additionalProperties:
Expand All @@ -64,7 +64,7 @@ spec:
GCP resources managed by the GCP provider, in addition to the ones
added by default.
type: object
controlplaneEndpoint:
controlPlaneEndpoint:
description: ControlPlaneEndpoint represents the endpoint used to
communicate with the control plane.
properties:
Expand Down Expand Up @@ -173,12 +173,11 @@ spec:
description: The GCP Region the cluster lives in.
type: string
required:
- controlplaneEndpoint
- project
- region
type: object
status:
description: GCPManagedClusterStatus defines the observed state of GCPManagedCluster
description: GCPManagedClusterStatus defines the observed state of GCPManagedCluster.
properties:
conditions:
description: Conditions specifies the conditions for the managed control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
schema:
openAPIV3Schema:
description: GCPManagedControlPlane is the Schema for the gcpmanagedcontrolplanes
API
API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -38,16 +38,16 @@ spec:
metadata:
type: object
spec:
description: GCPManagedControlPlaneSpec defines the desired state of GCPManagedControlPlane
description: GCPManagedControlPlaneSpec defines the desired state of GCPManagedControlPlane.
properties:
controlPlaneVersion:
description: ControlPlaneVersion represents the control plane version
of the GKE cluster If not specified, the default version currently
supported by GKE will be used
of the GKE cluster. If not specified, the default version currently
supported by GKE will be used.
type: string
enableAutopilot:
description: EnableAutopilot indicates whether to enable autopilot
for this GKE cluster
for this GKE cluster.
type: boolean
endpoint:
description: Endpoint represents the endpoint used to communicate
Expand All @@ -66,11 +66,11 @@ spec:
type: object
location:
description: Location represents the location (region or zone) in
which the GKE cluster will be created
which the GKE cluster will be created.
type: string
releaseChannel:
description: ReleaseChannel represents the release channel of the
GKE cluster
GKE cluster.
type: string
required:
- enableAutopilot
Expand All @@ -79,8 +79,54 @@ spec:
type: object
status:
description: GCPManagedControlPlaneStatus defines the observed state of
GCPManagedControlPlane
GCPManagedControlPlane.
properties:
conditions:
description: Conditions specifies the cpnditions for the managed control
plane
items:
description: Condition defines an observation of a Cluster API resource
operational state.
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status
to another. This should be when the underlying condition changed.
If that is not known, then using the time when the API field
changed is acceptable.
format: date-time
type: string
message:
description: A human readable message indicating details about
the transition. This field may be empty.
type: string
reason:
description: The reason for the condition's last transition
in CamelCase. The specific API may choose whether or not this
field is considered a guaranteed API. This field may not be
empty.
type: string
severity:
description: Severity provides an explicit classification of
Reason code, so the users or machines can immediately understand
the current situation and act accordingly. The Severity field
MUST be set only when Status=False.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important.
type: string
required:
- lastTransitionTime
- status
- type
type: object
type: array
ready:
type: boolean
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
schema:
openAPIV3Schema:
description: GCPManagedMachinePool is the Schema for the gcpmanagedmachinepools
API
API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -42,7 +42,7 @@ spec:
metadata:
type: object
spec:
description: GCPManagedMachinePoolSpec defines the desired state of GCPManagedMachinePool
description: GCPManagedMachinePoolSpec defines the desired state of GCPManagedMachinePool.
properties:
additionalLabels:
additionalProperties:
Expand All @@ -61,16 +61,16 @@ spec:
additionalProperties:
type: string
description: KubernetesLabels specifies the labels to apply to the
nodes of the node pool
nodes of the node pool.
type: object
kubernetesTaints:
description: KubernetesTaints specifies the taints to apply to the
nodes of the node pool
nodes of the node pool.
items:
description: Taint represents a Kubernetes taint.
properties:
effect:
description: Effect specifies the effect for the taint
description: Effect specifies the effect for the taint.
enum:
- NoSchedule
- NoExecute
Expand All @@ -88,26 +88,71 @@ spec:
- value
type: object
type: array
mode:
description: Mode represents mode of an machine pool. A cluster always
requires 1 system pool
enum:
- system
- user
type: string
nodeVersion:
description: NodeVersion represents the node version of the node pool
description: NodeVersion represents the node version of the node pool.
If not specified, the GKE cluster control plane version will be
used
used.
type: string
providerIDList:
description: ProviderIDList are the provider IDs of instances in the
managed instance group corresponding to the nodegroup represented
by this machine pool
items:
type: string
type: array
required:
- initialNodeCount
- mode
type: object
status:
description: GCPManagedMachinePoolStatus defines the observed state of
GCPManagedMachinePool
GCPManagedMachinePool.
properties:
conditions:
description: Conditions specifies the cpnditions for the managed machine
pool
items:
description: Condition defines an observation of a Cluster API resource
operational state.
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status
to another. This should be when the underlying condition changed.
If that is not known, then using the time when the API field
changed is acceptable.
format: date-time
type: string
message:
description: A human readable message indicating details about
the transition. This field may be empty.
type: string
reason:
description: The reason for the condition's last transition
in CamelCase. The specific API may choose whether or not this
field is considered a guaranteed API. This field may not be
empty.
type: string
severity:
description: Severity provides an explicit classification of
Reason code, so the users or machines can immediately understand
the current situation and act accordingly. The Severity field
MUST be set only when Status=False.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important.
type: string
required:
- lastTransitionTime
- status
- type
type: object
type: array
ready:
type: boolean
replicas:
Expand Down
15 changes: 14 additions & 1 deletion docs/proposals/20221123-managed-kubernetes-in-capg.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ type GCPManagedClusterSpec struct {
Region string `json:"region"`

// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
ControlPlaneEndpoint clusterv1.APIEndpoint `json:”controlplaneEndpoint”`
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`

// NetworkSpec encapsulates all things related to the GCP network.
// +optional
Expand Down Expand Up @@ -178,6 +179,9 @@ type GCPManagedControlPlaneSpec struct {

type GCPManagedControlPlaneStatus struct {
Ready bool `json:"ready"`

// Conditions specifies the cpnditions for the managed control plane
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}

type GCPManagedMachinePoolSpec struct {
Expand All @@ -202,6 +206,12 @@ type GCPManagedMachinePoolSpec struct {
// ones added by default.
// +optional
AdditionalLabels Labels `json:"additionalLabels,omitempty"`

// ProviderIDList are the provider IDs of instances in the
// managed instance group corresponding to the nodegroup represented by this
// machine pool
// +optional
ProviderIDList []string `json:"providerIDList,omitempty"`
}

type GCPManagedMachinePoolStatus struct {
Expand All @@ -210,6 +220,9 @@ type GCPManagedMachinePoolStatus struct {
// Replicas is the most recently observed number of replicas.
// +optional
Replicas int32 `json:"replicas"`

// Conditions specifies the cpnditions for the managed machine pool
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}
```

Expand Down
3 changes: 2 additions & 1 deletion exp/api/v1beta1/gcpmanagedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ type GCPManagedClusterSpec struct {
// The GCP Region the cluster lives in.
Region string `json:"region"`
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlplaneEndpoint"`
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
// NetworkSpec encapsulates all things related to the GCP network.
// +optional
Network infrav1.NetworkSpec `json:"network"`
Expand Down
3 changes: 3 additions & 0 deletions exp/api/v1beta1/gcpmanagedcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ type GCPManagedControlPlaneSpec struct {
// GCPManagedControlPlaneStatus defines the observed state of GCPManagedControlPlane.
type GCPManagedControlPlaneStatus struct {
Ready bool `json:"ready"`

// Conditions specifies the cpnditions for the managed control plane
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
11 changes: 8 additions & 3 deletions exp/api/v1beta1/gcpmanagedmachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
infrav1 "sigs.k8s.io/cluster-api-provider-gcp/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)

const (
Expand Down Expand Up @@ -46,9 +47,11 @@ type GCPManagedMachinePoolSpec struct {
// ones added by default.
// +optional
AdditionalLabels infrav1.Labels `json:"additionalLabels,omitempty"`
// Mode represents mode of an machine pool. A cluster always requires 1 system pool.
// +kubebuilder:validation:Enum=system;user
Mode string `json:"mode"`
// ProviderIDList are the provider IDs of instances in the
// managed instance group corresponding to the nodegroup represented by this
// machine pool
// +optional
ProviderIDList []string `json:"providerIDList,omitempty"`
}

// GCPManagedMachinePoolStatus defines the observed state of GCPManagedMachinePool.
Expand All @@ -57,6 +60,8 @@ type GCPManagedMachinePoolStatus struct {
// Replicas is the most recently observed number of replicas.
// +optional
Replicas int32 `json:"replicas"`
// Conditions specifies the cpnditions for the managed machine pool
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
10 changes: 0 additions & 10 deletions exp/api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,3 @@ type Taint struct {

// Taints is an array of Taints.
type Taints []Taint

// MachinePoolMode represents the mode of operation for the machine pool.
type MachinePoolMode string

const (
// MachinePoolModeSystem represents a system machine pool.
MachinePoolModeSystem MachinePoolMode = "system"
// MachinePoolModeUser represenyts a user machine pool.
MachinePoolModeUser MachinePoolMode = "user"
)
Loading

0 comments on commit a124a98

Please sign in to comment.