Skip to content

Commit 8ef3e34

Browse files
committed
wip: adding clusterclass support for aws managed control plane
Signed-off-by: Richard Case <[email protected]>
1 parent b4506f8 commit 8ef3e34

20 files changed

+1803
-345
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
package v1beta2
15+
16+
import (
17+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
18+
)
19+
20+
// AWSManagedClusterTemplateSpec defines the desired state of AWSManagedClusterTemplate
21+
type AWSManagedClusterTemplateSpec struct {
22+
Template AWSManagedClusterTemplateResource `json:"template"`
23+
}
24+
25+
// +kubebuilder:object:root=true
26+
// +kubebuilder:resource:path=awsmanagedclustertemplates,scope=Namespaced,categories=cluster-api,shortName=awsmct
27+
// +kubebuilder:storageversion
28+
29+
// AWSManagedClusterTemplate is the Schema for the AWSManagedClusterTemplate.
30+
type AWSManagedClusterTemplate struct {
31+
metav1.TypeMeta `json:",inline"`
32+
metav1.ObjectMeta `json:"metadata,omitempty"`
33+
34+
Spec AWSManagedClusterTemplateSpec `json:"spec,omitempty"`
35+
}
36+
37+
// +kubebuilder:object:root=true
38+
39+
// AWSManagedClusterTemplateList contains a list of AWSManagedClusterTemplates.
40+
type AWSManagedClusterTemplateList struct {
41+
metav1.TypeMeta `json:",inline"`
42+
metav1.ListMeta `json:"metadata,omitempty"`
43+
Items []AWSManagedClusterTemplate `json:"items"`
44+
}
45+
46+
// AWSManagedClusterTemplateResource describes the data needed to create an AWSManagedCluster from a template.
47+
type AWSManagedClusterTemplateResource struct {
48+
Spec AWSManagedClusterTemplateResourceSpec `json:"spec"`
49+
}
50+
51+
func init() {
52+
SchemeBuilder.Register(&AWSManagedClusterTemplate{}, &AWSManagedClusterTemplateList{})
53+
}

api/v1beta2/types_template.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
package v1beta2
15+
16+
// AWSManagedClusterTemplateResourceSpec specifies the AWS managed cluster template resource.
17+
type AWSManagedClusterTemplateResourceSpec struct{}

api/v1beta2/zz_generated.deepcopy.go

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

bootstrap/eks/controllers/eksconfig_controller_reconciler_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,9 @@ func newAMCP(name string) *ekscontrolplanev1.AWSManagedControlPlane {
423423
Namespace: "default",
424424
},
425425
Spec: ekscontrolplanev1.AWSManagedControlPlaneSpec{
426-
EKSClusterName: generatedName,
426+
AWSManagedControlPlaneClassSpec: ekscontrolplanev1.AWSManagedControlPlaneClassSpec{
427+
EKSClusterName: generatedName,
428+
},
427429
},
428430
}
429431
}

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,11 +1707,14 @@ spec:
17071707
description: Bastion contains options to configure the bastion host.
17081708
properties:
17091709
allowedCIDRBlocks:
1710+
allOf:
1711+
- items:
1712+
type: string
1713+
- items:
1714+
type: string
17101715
description: AllowedCIDRBlocks is a list of CIDR blocks allowed
17111716
to access the bastion host. They are set as ingress rules for
17121717
the Bastion host's Security Group (defaults to 0.0.0.0/0).
1713-
items:
1714-
type: string
17151718
type: array
17161719
ami:
17171720
description: AMI will use the specified AMI to boot the bastion.
@@ -1782,10 +1785,13 @@ spec:
17821785
publicly accessible
17831786
type: boolean
17841787
publicCIDRs:
1788+
allOf:
1789+
- items:
1790+
type: string
1791+
- items:
1792+
type: string
17851793
description: PublicCIDRs specifies which blocks can access the
17861794
public endpoint
1787-
items:
1788-
type: string
17891795
type: array
17901796
type: object
17911797
iamAuthenticatorConfig:
@@ -2302,18 +2308,23 @@ spec:
23022308
description: The AWS Region the cluster lives in.
23032309
type: string
23042310
roleAdditionalPolicies:
2311+
allOf:
2312+
- items:
2313+
type: string
2314+
- items:
2315+
type: string
23052316
description: RoleAdditionalPolicies allows you to attach additional
23062317
polices to the control plane role. You must enable the EKSAllowAddRoles
23072318
feature flag to incorporate these into the created role.
2308-
items:
2309-
type: string
23102319
type: array
23112320
roleName:
2321+
allOf:
2322+
- minLength: 2
2323+
- minLength: 2
23122324
description: RoleName specifies the name of IAM role that gives EKS
23132325
permission to make API calls. If the role is pre-existing we will
23142326
treat it as unmanaged and not delete it on deletion. If the EKSEnableIAM
23152327
feature flag is true and no name is supplied then a role is created.
2316-
minLength: 2
23172328
type: string
23182329
secondaryCidrBlock:
23192330
description: SecondaryCidrBlock is the additional CIDR range to use

0 commit comments

Comments
 (0)