Skip to content

Commit 0493d80

Browse files
committed
feat: EKS ClusterClass and Cluster example
The bases are included in the hack directory rather than pulling in from external projects as we do for other providers because the EKS CC support has not been released in CAPA yet. Once that has happened, we can switch to the same strategy and use the upstream CC and Cluster as the base for patching to create the CAREN CC/Cluster examples.
1 parent cdbbed1 commit 0493d80

File tree

16 files changed

+631
-2
lines changed

16 files changed

+631
-2
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
apiVersion: cluster.x-k8s.io/v1beta1
2+
kind: ClusterClass
3+
metadata:
4+
labels:
5+
cluster.x-k8s.io/provider: eks
6+
name: eks-quick-start
7+
spec:
8+
controlPlane:
9+
ref:
10+
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
11+
kind: AWSManagedControlPlaneTemplate
12+
name: eks-quick-start-control-plane
13+
infrastructure:
14+
ref:
15+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
16+
kind: AWSManagedClusterTemplate
17+
name: eks-quick-start
18+
patches:
19+
- external:
20+
discoverVariablesExtension: eksclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix
21+
generateExtension: eksclusterv1configpatch-gp.cluster-api-runtime-extensions-nutanix
22+
name: cluster-config
23+
- external:
24+
discoverVariablesExtension: eksworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix
25+
generateExtension: eksworkerv1configpatch-gp.cluster-api-runtime-extensions-nutanix
26+
name: worker-config
27+
- definitions:
28+
- jsonPatches:
29+
- op: add
30+
path: /spec/template/spec/identityRef
31+
value:
32+
kind: AWSClusterControllerIdentity
33+
name: default
34+
selector:
35+
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
36+
kind: AWSManagedControlPlaneTemplate
37+
matchResources:
38+
controlPlane: true
39+
description: AWSClusterStaticIdentity identityRef to use when creating the cluster
40+
name: identityRef
41+
workers:
42+
machineDeployments:
43+
- class: default-worker
44+
template:
45+
bootstrap:
46+
ref:
47+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
48+
kind: EKSConfigTemplate
49+
name: eks-quick-start-worker-configtemplate
50+
infrastructure:
51+
ref:
52+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
53+
kind: AWSMachineTemplate
54+
name: eks-quick-start-worker-machinetemplate
55+
- class: system-worker
56+
template:
57+
bootstrap:
58+
ref:
59+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
60+
kind: EKSConfigTemplate
61+
name: eks-quick-start-worker-configtemplate
62+
infrastructure:
63+
ref:
64+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
65+
kind: AWSMachineTemplate
66+
name: eks-quick-start-worker-machinetemplate
67+
---
68+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
69+
kind: AWSManagedClusterTemplate
70+
metadata:
71+
labels:
72+
cluster.x-k8s.io/provider: eks
73+
name: eks-quick-start
74+
spec:
75+
template:
76+
spec: {}
77+
---
78+
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
79+
kind: AWSManagedControlPlaneTemplate
80+
metadata:
81+
labels:
82+
cluster.x-k8s.io/provider: eks
83+
name: eks-quick-start-control-plane
84+
spec:
85+
template:
86+
spec:
87+
bootstrapSelfManagedAddons: false
88+
kubeProxy:
89+
disable: true
90+
vpcCni:
91+
disable: true
92+
---
93+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
94+
kind: AWSMachineTemplate
95+
metadata:
96+
labels:
97+
cluster.x-k8s.io/provider: eks
98+
name: eks-quick-start-worker-machinetemplate
99+
spec:
100+
template:
101+
spec:
102+
instanceType: PLACEHOLDER
103+
sshKeyName: ""
104+
---
105+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
106+
kind: EKSConfigTemplate
107+
metadata:
108+
labels:
109+
cluster.x-k8s.io/provider: eks
110+
name: eks-quick-start-worker-configtemplate
111+
spec:
112+
template:
113+
spec: {}
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
apiVersion: v1
2+
data:
3+
values.yaml: |-
4+
cni:
5+
exclusive: false
6+
hubble:
7+
enabled: true
8+
tls:
9+
auto:
10+
enabled: true # enable automatic TLS certificate generation
11+
method: cronJob # auto generate certificates using cronJob method
12+
certValidityDuration: 60 # certificates validity duration in days (default 2 months)
13+
schedule: "0 0 1 * *" # schedule on the 1st day regeneration of each month
14+
relay:
15+
enabled: true
16+
tls:
17+
server:
18+
enabled: true
19+
mtls: true
20+
image:
21+
useDigest: false
22+
priorityClassName: system-cluster-critical
23+
image:
24+
useDigest: false
25+
operator:
26+
image:
27+
useDigest: false
28+
certgen:
29+
image:
30+
useDigest: false
31+
socketLB:
32+
hostNamespaceOnly: true
33+
envoy:
34+
image:
35+
useDigest: false
36+
kubeProxyReplacement: true
37+
k8sServiceHost: "{{ trimPrefix "https://" .Cluster.spec.controlPlaneEndpoint.host }}"
38+
k8sServicePort: "{{ .Cluster.spec.controlPlaneEndpoint.port }}"
39+
ipam:
40+
mode: eni
41+
enableIPv4Masquerade: false
42+
eni:
43+
enabled: true
44+
awsReleaseExcessIPs: true
45+
routingMode: native
46+
endpointRoutes:
47+
enabled: true
48+
kind: ConfigMap
49+
metadata:
50+
labels:
51+
cluster.x-k8s.io/provider: eks
52+
name: ${CLUSTER_NAME}-cilium-cni-helm-values-template
53+
---
54+
apiVersion: cluster.x-k8s.io/v1beta1
55+
kind: Cluster
56+
metadata:
57+
annotations:
58+
preflight.cluster.caren.nutanix.com/skip: all
59+
labels:
60+
cluster.x-k8s.io/provider: eks
61+
name: ${CLUSTER_NAME}
62+
spec:
63+
topology:
64+
class: eks-quick-start
65+
controlPlane:
66+
metadata:
67+
annotations:
68+
controlplane.cluster.x-k8s.io/skip-kube-proxy: ""
69+
variables:
70+
- name: clusterConfig
71+
value:
72+
addons:
73+
clusterAutoscaler: {}
74+
cni:
75+
provider: Cilium
76+
values:
77+
sourceRef:
78+
kind: ConfigMap
79+
name: ${CLUSTER_NAME}-cilium-cni-helm-values-template
80+
csi:
81+
defaultStorage:
82+
provider: aws-ebs
83+
storageClassConfig: default
84+
providers:
85+
aws-ebs:
86+
storageClassConfigs:
87+
default: {}
88+
snapshotController: {}
89+
nfd: {}
90+
eks:
91+
region: us-west-2
92+
- name: workerConfig
93+
value:
94+
eks:
95+
instanceType: m5.2xlarge
96+
version: ${KUBERNETES_VERSION}
97+
workers:
98+
machineDeployments:
99+
- class: default-worker
100+
metadata:
101+
annotations:
102+
cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: "${WORKER_MACHINE_COUNT}"
103+
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}"
104+
name: md-0
105+
- class: system-worker
106+
metadata:
107+
labels:
108+
node-restriction.kubernetes.io/capi-controllers: ""
109+
name: system
110+
replicas: 1
111+
variables:
112+
overrides:
113+
- name: workerConfig
114+
value:
115+
eks:
116+
iamInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io
117+
taints:
118+
- effect: NoSchedule
119+
key: node-restriction.kubernetes.io/capi-controllers
120+
value: "true"
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
apiVersion: v1
2+
data:
3+
values.yaml: |-
4+
cni:
5+
exclusive: false
6+
hubble:
7+
enabled: true
8+
tls:
9+
auto:
10+
enabled: true # enable automatic TLS certificate generation
11+
method: cronJob # auto generate certificates using cronJob method
12+
certValidityDuration: 60 # certificates validity duration in days (default 2 months)
13+
schedule: "0 0 1 * *" # schedule on the 1st day regeneration of each month
14+
relay:
15+
enabled: true
16+
tls:
17+
server:
18+
enabled: true
19+
mtls: true
20+
image:
21+
useDigest: false
22+
priorityClassName: system-cluster-critical
23+
image:
24+
useDigest: false
25+
operator:
26+
image:
27+
useDigest: false
28+
certgen:
29+
image:
30+
useDigest: false
31+
socketLB:
32+
hostNamespaceOnly: true
33+
envoy:
34+
image:
35+
useDigest: false
36+
kubeProxyReplacement: true
37+
k8sServiceHost: "{{ trimPrefix "https://" .Cluster.spec.controlPlaneEndpoint.host }}"
38+
k8sServicePort: "{{ .Cluster.spec.controlPlaneEndpoint.port }}"
39+
ipam:
40+
mode: eni
41+
enableIPv4Masquerade: false
42+
eni:
43+
enabled: true
44+
awsReleaseExcessIPs: true
45+
routingMode: native
46+
endpointRoutes:
47+
enabled: true
48+
kind: ConfigMap
49+
metadata:
50+
name: ${CLUSTER_NAME}-cilium-cni-helm-values-template
51+
---
52+
apiVersion: cluster.x-k8s.io/v1beta1
53+
kind: Cluster
54+
metadata:
55+
name: ${CLUSTER_NAME}
56+
annotations:
57+
preflight.cluster.caren.nutanix.com/skip: all
58+
spec:
59+
topology:
60+
class: eks-quick-start
61+
version: ${KUBERNETES_VERSION}
62+
variables:
63+
- name: clusterConfig
64+
value:
65+
addons:
66+
cni:
67+
provider: Cilium
68+
values:
69+
sourceRef:
70+
name: ${CLUSTER_NAME}-cilium-cni-helm-values-template
71+
kind: ConfigMap
72+
- name: workerConfig
73+
value:
74+
eks:
75+
instanceType: m5.2xlarge
76+
controlPlane:
77+
metadata:
78+
annotations:
79+
controlplane.cluster.x-k8s.io/skip-kube-proxy: ""
80+
workers:
81+
machineDeployments:
82+
- class: default-worker
83+
name: md-0
84+
replicas: ${WORKER_MACHINE_COUNT}
85+
- class: system-worker
86+
name: system
87+
metadata:
88+
labels:
89+
node-restriction.kubernetes.io/capi-controllers: ""
90+
replicas: 1
91+
variables:
92+
overrides:
93+
- name: workerConfig
94+
value:
95+
taints:
96+
- effect: NoSchedule
97+
key: node-restriction.kubernetes.io/capi-controllers
98+
value: "true"
99+
eks:
100+
iamInstanceProfile: "control-plane.cluster-api-provider-aws.sigs.k8s.io"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2024 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: kustomize.config.k8s.io/v1beta1
5+
kind: Kustomization
6+
7+
resources:
8+
- cluster.yaml
9+
10+
sortOptions:
11+
order: fifo
12+
13+
labels:
14+
- includeSelectors: false
15+
pairs:
16+
cluster.x-k8s.io/provider: eks
17+
18+
patches:
19+
- target:
20+
kind: Cluster
21+
patch: |-
22+
- op: "add"
23+
path: "/spec/topology/class"
24+
value: "eks-quick-start"
25+
- target:
26+
kind: Cluster
27+
path: ../../../patches/eks/initialize-variables.yaml
28+
- target:
29+
kind: Cluster
30+
path: ../../../patches/cluster-autoscaler.yaml
31+
- target:
32+
kind: Cluster
33+
path: ../../../patches/eks/csi.yaml
34+
- target:
35+
kind: Cluster
36+
path: ../../../patches/eks/config-var.yaml

0 commit comments

Comments
 (0)