Skip to content

Commit 8da9555

Browse files
authored
Merge pull request #3797 from richardcase/awsmanaged_cluster_is_back
feat: re-introduce awsmanagedcluster
2 parents f5332d7 + 6e9e8e3 commit 8da9555

29 files changed

+750
-113
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
Copyright 2022 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta2
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
22+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
23+
)
24+
25+
// AWSManagedClusterSpec defines the desired state of AWSManagedCluster
26+
type AWSManagedClusterSpec struct {
27+
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
28+
// +optional
29+
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
30+
}
31+
32+
// AWSManagedClusterStatus defines the observed state of AWSManagedCluster
33+
type AWSManagedClusterStatus struct {
34+
// Ready is when the AWSManagedControlPlane has a API server URL.
35+
// +optional
36+
Ready bool `json:"ready,omitempty"`
37+
38+
// FailureDomains specifies a list fo available availability zones that can be used
39+
// +optional
40+
FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"`
41+
}
42+
43+
// +kubebuilder:object:root=true
44+
// +kubebuilder:resource:path=awsmanagedclusters,scope=Namespaced,categories=cluster-api,shortName=awsmc
45+
// +kubebuilder:storageversion
46+
// +kubebuilder:subresource:status
47+
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AWSManagedControl belongs"
48+
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Control plane infrastructure is ready for worker nodes"
49+
// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".spec.controlPlaneEndpoint.host",description="API Endpoint",priority=1
50+
51+
// AWSManagedCluster is the Schema for the awsmanagedclusters API
52+
type AWSManagedCluster struct {
53+
metav1.TypeMeta `json:",inline"`
54+
metav1.ObjectMeta `json:"metadata,omitempty"`
55+
56+
Spec AWSManagedClusterSpec `json:"spec,omitempty"`
57+
Status AWSManagedClusterStatus `json:"status,omitempty"`
58+
}
59+
60+
// +kubebuilder:object:root=true
61+
62+
// AWSManagedClusterList contains a list of AWSManagedCluster.
63+
type AWSManagedClusterList struct {
64+
metav1.TypeMeta `json:",inline"`
65+
metav1.ListMeta `json:"metadata,omitempty"`
66+
Items []AWSManagedCluster `json:"items"`
67+
}
68+
69+
func init() {
70+
SchemeBuilder.Register(&AWSManagedCluster{}, &AWSManagedClusterList{})
71+
}

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 97 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedclusters.yaml

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.2
6+
controller-gen.kubebuilder.io/version: v0.10.0
77
creationTimestamp: null
88
name: awsmanagedclusters.infrastructure.cluster.x-k8s.io
99
spec:
@@ -28,80 +28,11 @@ spec:
2828
jsonPath: .status.ready
2929
name: Ready
3030
type: string
31-
- description: AWS VPC the control plane is using
32-
jsonPath: .spec.networkSpec.vpc.id
33-
name: VPC
34-
type: string
3531
- description: API Endpoint
3632
jsonPath: .spec.controlPlaneEndpoint.host
3733
name: Endpoint
3834
priority: 1
3935
type: string
40-
name: v1beta1
41-
schema:
42-
openAPIV3Schema:
43-
description: AWSManagedCluster is the Schema for the awsmanagedclusters API
44-
properties:
45-
apiVersion:
46-
description: 'APIVersion defines the versioned schema of this representation
47-
of an object. Servers should convert recognized schemas to the latest
48-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
49-
type: string
50-
kind:
51-
description: 'Kind is a string value representing the REST resource this
52-
object represents. Servers may infer this from the endpoint the client
53-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
54-
type: string
55-
metadata:
56-
type: object
57-
spec:
58-
description: AWSManagedClusterSpec defines the desired state of AWSManagedCluster
59-
properties:
60-
controlPlaneEndpoint:
61-
description: ControlPlaneEndpoint represents the endpoint used to
62-
communicate with the control plane.
63-
properties:
64-
host:
65-
description: The hostname on which the API server is serving.
66-
type: string
67-
port:
68-
description: The port on which the API server is serving.
69-
format: int32
70-
type: integer
71-
required:
72-
- host
73-
- port
74-
type: object
75-
type: object
76-
status:
77-
description: AWSManagedClusterStatus defines the observed state of AWSManagedCluster
78-
properties:
79-
failureDomains:
80-
additionalProperties:
81-
description: FailureDomainSpec is the Schema for Cluster API failure
82-
domains. It allows controllers to understand how many failure
83-
domains a cluster can optionally span across.
84-
properties:
85-
attributes:
86-
additionalProperties:
87-
type: string
88-
description: Attributes is a free form map of attributes an
89-
infrastructure provider might use or require.
90-
type: object
91-
controlPlane:
92-
description: ControlPlane determines if this failure domain
93-
is suitable for use by control plane machines.
94-
type: boolean
95-
type: object
96-
description: FailureDomains specifies a list fo available availability
97-
zones that can be used
98-
type: object
99-
ready:
100-
description: Ready is when the AWSManagedControlPlane has a API server
101-
URL.
102-
type: boolean
103-
type: object
104-
type: object
10536
name: v1beta2
10637
schema:
10738
openAPIV3Schema:

config/crd/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ resources:
1818
- bases/infrastructure.cluster.x-k8s.io_awsclustercontrolleridentities.yaml
1919
- bases/infrastructure.cluster.x-k8s.io_awsclustertemplates.yaml
2020
- bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml
21+
- bases/infrastructure.cluster.x-k8s.io_awsmanagedclusters.yaml
2122
- bases/bootstrap.cluster.x-k8s.io_eksconfigs.yaml
2223
- bases/bootstrap.cluster.x-k8s.io_eksconfigtemplates.yaml
2324
# +kubebuilder:scaffold:crdkustomizeresource
@@ -45,6 +46,7 @@ patchesStrategicMerge:
4546
- patches/cainjection_in_awsclusterroleidentities.yaml
4647
- patches/cainjection_in_awsclustertemplates.yaml
4748
- patches/cainjection_in_awsmanagedcontrolplanes.yaml
49+
- patches/cainjection_in_awsmanagedclusters.yaml
4850
- patches/cainjection_in_eksconfigs.yaml
4951
- patches/cainjection_in_eksconfigtemplates.yaml
5052
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# The following patch adds a directive for certmanager to inject CA into the CRD
2+
# CRD conversion requires k8s 1.13 or later.
3+
apiVersion: apiextensions.k8s.io/v1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
annotations:
7+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
8+
name: awsmanagedclusters.infrastructure.cluster.x-k8s.io

config/rbac/role.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,35 @@ rules:
267267
- get
268268
- patch
269269
- update
270+
- apiGroups:
271+
- infrastructure.cluster.x-k8s.io
272+
resources:
273+
- awsmanagedclusters
274+
verbs:
275+
- create
276+
- delete
277+
- get
278+
- list
279+
- patch
280+
- update
281+
- watch
282+
- apiGroups:
283+
- infrastructure.cluster.x-k8s.io
284+
resources:
285+
- awsmanagedclusters
286+
- awsmanagedclusters/status
287+
verbs:
288+
- get
289+
- list
290+
- watch
291+
- apiGroups:
292+
- infrastructure.cluster.x-k8s.io
293+
resources:
294+
- awsmanagedclusters/status
295+
verbs:
296+
- get
297+
- patch
298+
- update
270299
- apiGroups:
271300
- infrastructure.cluster.x-k8s.io
272301
resources:

0 commit comments

Comments
 (0)