|
| 1 | +apiVersion: cluster.x-k8s.io/v1beta1 |
| 2 | +kind: ClusterClass |
| 3 | +metadata: |
| 4 | + name: aws-eks-example |
| 5 | +spec: |
| 6 | + controlPlane: |
| 7 | + ref: |
| 8 | + apiVersion: controlplane.cluster.x-k8s.io/v1beta2 |
| 9 | + kind: AWSManagedControlPlaneTemplate |
| 10 | + name: "eks-control-plane" |
| 11 | + infrastructure: |
| 12 | + ref: |
| 13 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 |
| 14 | + kind: AWSManagedClusterTemplate |
| 15 | + name: "eks-cluster" |
| 16 | + workers: |
| 17 | + machineDeployments: |
| 18 | + - class: default-worker |
| 19 | + template: |
| 20 | + bootstrap: |
| 21 | + ref: |
| 22 | + name: "eks-md-0" |
| 23 | + apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 |
| 24 | + kind: EKSConfigTemplate |
| 25 | + infrastructure: |
| 26 | + ref: |
| 27 | + name: "eks-md-0" |
| 28 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 |
| 29 | + kind: AWSMachineTemplate |
| 30 | + variables: |
| 31 | + - name: region |
| 32 | + required: true |
| 33 | + schema: |
| 34 | + openAPIV3Schema: |
| 35 | + description: "The AWS region where the Cluster will be created" |
| 36 | + type: string |
| 37 | + - name: sshKeyName |
| 38 | + required: false |
| 39 | + schema: |
| 40 | + openAPIV3Schema: |
| 41 | + description: "AWS SSH key name to use" |
| 42 | + type: string |
| 43 | + default: '' |
| 44 | + - name: instanceType |
| 45 | + required: false |
| 46 | + schema: |
| 47 | + openAPIV3Schema: |
| 48 | + description: "AWS instance type to use" |
| 49 | + type: string |
| 50 | + default: "t3.xlarge" |
| 51 | + - name: eksClusterName |
| 52 | + required: false |
| 53 | + schema: |
| 54 | + openAPIV3Schema: |
| 55 | + description: "EKS cluster name" |
| 56 | + type: string |
| 57 | + default: '' |
| 58 | + - name: awsClusterIdentityName |
| 59 | + required: true |
| 60 | + schema: |
| 61 | + openAPIV3Schema: |
| 62 | + description: The AWSClusterStaticIdentity resource name referencing the credentials to create the Cluster. |
| 63 | + type: string |
| 64 | + default: cluster-identity |
| 65 | + patches: |
| 66 | + - name: awsManagedControlPlaneTemplate |
| 67 | + definitions: |
| 68 | + - selector: |
| 69 | + apiVersion: controlplane.cluster.x-k8s.io/v1beta2 |
| 70 | + kind: AWSManagedControlPlaneTemplate |
| 71 | + matchResources: |
| 72 | + controlPlane: true |
| 73 | + jsonPatches: |
| 74 | + - op: add |
| 75 | + enabledIf: '{{ ne .eksClusterName }}' |
| 76 | + path: /spec/template/spec/eksClusterName |
| 77 | + valueFrom: |
| 78 | + variable: eksClusterName |
| 79 | + - op: add |
| 80 | + path: /spec/template/spec/region |
| 81 | + valueFrom: |
| 82 | + variable: region |
| 83 | + - op: add |
| 84 | + enabledIf: '{{ ne .sshKeyName }}' |
| 85 | + path: /spec/template/spec/sshKeyName |
| 86 | + valueFrom: |
| 87 | + variable: sshKeyName |
| 88 | + - op: add |
| 89 | + path: /spec/template/spec/identityRef/name |
| 90 | + valueFrom: |
| 91 | + variable: awsClusterIdentityName |
| 92 | + # Builtins |
| 93 | + - op: add |
| 94 | + path: "/spec/template/spec/version" |
| 95 | + valueFrom: |
| 96 | + variable: builtin.cluster.topology.version |
| 97 | + - name: awsMachineTemplate |
| 98 | + definitions: |
| 99 | + - selector: |
| 100 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 |
| 101 | + kind: AWSMachineTemplate |
| 102 | + matchResources: |
| 103 | + machineDeploymentClass: |
| 104 | + names: |
| 105 | + - default-worker |
| 106 | + jsonPatches: |
| 107 | + - op: add |
| 108 | + enabledIf: '{{ ne .sshKeyName }}' |
| 109 | + path: /spec/template/spec/sshKeyName |
| 110 | + valueFrom: |
| 111 | + variable: sshKeyName |
| 112 | + - op: add |
| 113 | + path: /spec/template/spec/instanceType |
| 114 | + valueFrom: |
| 115 | + variable: instanceType |
| 116 | +--- |
| 117 | +kind: AWSManagedClusterTemplate |
| 118 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 |
| 119 | +metadata: |
| 120 | + name: "eks-cluster" |
| 121 | +spec: |
| 122 | + template: |
| 123 | + spec: {} |
| 124 | +--- |
| 125 | +kind: AWSManagedControlPlaneTemplate |
| 126 | +apiVersion: controlplane.cluster.x-k8s.io/v1beta2 |
| 127 | +metadata: |
| 128 | + name: "eks-control-plane" |
| 129 | +spec: |
| 130 | + template: |
| 131 | + spec: |
| 132 | + region: "replaced_by_patch" |
| 133 | + version: "v0.0.0" # To be replaced by patch |
| 134 | + identityRef: |
| 135 | + kind: AWSClusterStaticIdentity |
| 136 | + name: cluster-identity |
| 137 | +--- |
| 138 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 |
| 139 | +kind: AWSMachineTemplate |
| 140 | +metadata: |
| 141 | + name: "eks-md-0" |
| 142 | +spec: |
| 143 | + template: |
| 144 | + spec: |
| 145 | + instanceType: "replaced_by_patch" |
| 146 | + iamInstanceProfile: "nodes.cluster-api-provider-aws.sigs.k8s.io" |
| 147 | +--- |
| 148 | +apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 |
| 149 | +kind: EKSConfigTemplate |
| 150 | +metadata: |
| 151 | + name: "eks-md-0" |
| 152 | +spec: |
| 153 | + template: |
| 154 | + spec: {} |
0 commit comments