|
| 1 | +# Copyright 2023 D2iQ, Inc. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +apiVersion: cluster.x-k8s.io/v1beta1 |
| 5 | +kind: ClusterClass |
| 6 | +metadata: |
| 7 | + name: quick-start |
| 8 | + namespace: default |
| 9 | +spec: |
| 10 | + controlPlane: |
| 11 | + machineInfrastructure: |
| 12 | + ref: |
| 13 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 14 | + kind: DockerMachineTemplate |
| 15 | + name: quick-start-control-plane |
| 16 | + ref: |
| 17 | + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 |
| 18 | + kind: KubeadmControlPlaneTemplate |
| 19 | + name: quick-start-control-plane |
| 20 | + infrastructure: |
| 21 | + ref: |
| 22 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 23 | + kind: DockerClusterTemplate |
| 24 | + name: quick-start-cluster |
| 25 | + patches: |
| 26 | + - definitions: |
| 27 | + - jsonPatches: |
| 28 | + - op: add |
| 29 | + path: /spec/template/spec/kubeadmConfigSpec/clusterConfiguration/imageRepository |
| 30 | + valueFrom: |
| 31 | + variable: imageRepository |
| 32 | + selector: |
| 33 | + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 |
| 34 | + kind: KubeadmControlPlaneTemplate |
| 35 | + matchResources: |
| 36 | + controlPlane: true |
| 37 | + description: Sets the imageRepository used for the KubeadmControlPlane. |
| 38 | + enabledIf: '{{ ne .imageRepository "" }}' |
| 39 | + name: imageRepository |
| 40 | + - definitions: |
| 41 | + - jsonPatches: |
| 42 | + - op: add |
| 43 | + path: /spec/template/spec/kubeadmConfigSpec/clusterConfiguration/etcd |
| 44 | + valueFrom: |
| 45 | + template: | |
| 46 | + local: |
| 47 | + imageTag: {{ .etcdImageTag }} |
| 48 | + selector: |
| 49 | + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 |
| 50 | + kind: KubeadmControlPlaneTemplate |
| 51 | + matchResources: |
| 52 | + controlPlane: true |
| 53 | + description: Sets tag to use for the etcd image in the KubeadmControlPlane. |
| 54 | + name: etcdImageTag |
| 55 | + - definitions: |
| 56 | + - jsonPatches: |
| 57 | + - op: add |
| 58 | + path: /spec/template/spec/kubeadmConfigSpec/clusterConfiguration/dns |
| 59 | + valueFrom: |
| 60 | + template: | |
| 61 | + imageTag: {{ .coreDNSImageTag }} |
| 62 | + selector: |
| 63 | + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 |
| 64 | + kind: KubeadmControlPlaneTemplate |
| 65 | + matchResources: |
| 66 | + controlPlane: true |
| 67 | + description: Sets tag to use for the etcd image in the KubeadmControlPlane. |
| 68 | + name: coreDNSImageTag |
| 69 | + - definitions: |
| 70 | + - jsonPatches: |
| 71 | + - op: add |
| 72 | + path: /spec/template/spec/customImage |
| 73 | + valueFrom: |
| 74 | + template: | |
| 75 | + kindest/node:{{ .builtin.machineDeployment.version | replace "+" "_" }} |
| 76 | + selector: |
| 77 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 78 | + kind: DockerMachineTemplate |
| 79 | + matchResources: |
| 80 | + machineDeploymentClass: |
| 81 | + names: |
| 82 | + - default-worker |
| 83 | + - jsonPatches: |
| 84 | + - op: add |
| 85 | + path: /spec/template/spec/customImage |
| 86 | + valueFrom: |
| 87 | + template: | |
| 88 | + kindest/node:{{ .builtin.controlPlane.version | replace "+" "_" }} |
| 89 | + selector: |
| 90 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 91 | + kind: DockerMachineTemplate |
| 92 | + matchResources: |
| 93 | + controlPlane: true |
| 94 | + description: Sets the container image that is used for running dockerMachines for the controlPlane and default-worker machineDeployments. |
| 95 | + name: customImage |
| 96 | + - definitions: |
| 97 | + - jsonPatches: |
| 98 | + - op: add |
| 99 | + path: /spec/template/spec/kubeadmConfigSpec/clusterConfiguration/apiServer/extraArgs |
| 100 | + value: |
| 101 | + admission-control-config-file: /etc/kubernetes/kube-apiserver-admission-pss.yaml |
| 102 | + - op: add |
| 103 | + path: /spec/template/spec/kubeadmConfigSpec/clusterConfiguration/apiServer/extraVolumes |
| 104 | + value: |
| 105 | + - hostPath: /etc/kubernetes/kube-apiserver-admission-pss.yaml |
| 106 | + mountPath: /etc/kubernetes/kube-apiserver-admission-pss.yaml |
| 107 | + name: admission-pss |
| 108 | + pathType: File |
| 109 | + readOnly: true |
| 110 | + - op: add |
| 111 | + path: /spec/template/spec/kubeadmConfigSpec/files |
| 112 | + valueFrom: |
| 113 | + template: | |
| 114 | + - content: | |
| 115 | + apiVersion: apiserver.config.k8s.io/v1 |
| 116 | + kind: AdmissionConfiguration |
| 117 | + plugins: |
| 118 | + - name: PodSecurity |
| 119 | + configuration: |
| 120 | + apiVersion: pod-security.admission.config.k8s.io/v1{{ if semverCompare "< v1.25" .builtin.controlPlane.version }}beta1{{ end }} |
| 121 | + kind: PodSecurityConfiguration |
| 122 | + defaults: |
| 123 | + enforce: "{{ .podSecurityStandard.enforce }}" |
| 124 | + enforce-version: "latest" |
| 125 | + audit: "{{ .podSecurityStandard.audit }}" |
| 126 | + audit-version: "latest" |
| 127 | + warn: "{{ .podSecurityStandard.warn }}" |
| 128 | + warn-version: "latest" |
| 129 | + exemptions: |
| 130 | + usernames: [] |
| 131 | + runtimeClasses: [] |
| 132 | + namespaces: [kube-system] |
| 133 | + path: /etc/kubernetes/kube-apiserver-admission-pss.yaml |
| 134 | + selector: |
| 135 | + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 |
| 136 | + kind: KubeadmControlPlaneTemplate |
| 137 | + matchResources: |
| 138 | + controlPlane: true |
| 139 | + description: Adds an admission configuration for PodSecurity to the kube-apiserver. |
| 140 | + enabledIf: '{{ .podSecurityStandard.enabled }}' |
| 141 | + name: podSecurityStandard |
| 142 | + - external: |
| 143 | + discoverVariablesExtension: clusterconfigvars.capi-runtime-extensions |
| 144 | + generateExtension: clusterconfigpatch.capi-runtime-extensions |
| 145 | + name: cluster-config |
| 146 | + variables: |
| 147 | + - name: imageRepository |
| 148 | + required: true |
| 149 | + schema: |
| 150 | + openAPIV3Schema: |
| 151 | + default: "" |
| 152 | + description: imageRepository sets the container registry to pull images from. If empty, nothing will be set and the from of kubeadm will be used. |
| 153 | + example: registry.k8s.io |
| 154 | + type: string |
| 155 | + - name: etcdImageTag |
| 156 | + required: true |
| 157 | + schema: |
| 158 | + openAPIV3Schema: |
| 159 | + default: "" |
| 160 | + description: etcdImageTag sets the tag for the etcd image. |
| 161 | + example: 3.5.3-0 |
| 162 | + type: string |
| 163 | + - name: coreDNSImageTag |
| 164 | + required: true |
| 165 | + schema: |
| 166 | + openAPIV3Schema: |
| 167 | + default: "" |
| 168 | + description: coreDNSImageTag sets the tag for the coreDNS image. |
| 169 | + example: v1.8.5 |
| 170 | + type: string |
| 171 | + - name: podSecurityStandard |
| 172 | + required: false |
| 173 | + schema: |
| 174 | + openAPIV3Schema: |
| 175 | + properties: |
| 176 | + audit: |
| 177 | + default: restricted |
| 178 | + description: audit sets the level for the audit PodSecurityConfiguration mode. One of privileged, baseline, restricted. |
| 179 | + type: string |
| 180 | + enabled: |
| 181 | + default: true |
| 182 | + description: enabled enables the patches to enable Pod Security Standard via AdmissionConfiguration. |
| 183 | + type: boolean |
| 184 | + enforce: |
| 185 | + default: baseline |
| 186 | + description: enforce sets the level for the enforce PodSecurityConfiguration mode. One of privileged, baseline, restricted. |
| 187 | + type: string |
| 188 | + warn: |
| 189 | + default: restricted |
| 190 | + description: warn sets the level for the warn PodSecurityConfiguration mode. One of privileged, baseline, restricted. |
| 191 | + type: string |
| 192 | + type: object |
| 193 | + workers: |
| 194 | + machineDeployments: |
| 195 | + - class: default-worker |
| 196 | + template: |
| 197 | + bootstrap: |
| 198 | + ref: |
| 199 | + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 |
| 200 | + kind: KubeadmConfigTemplate |
| 201 | + name: quick-start-default-worker-bootstraptemplate |
| 202 | + infrastructure: |
| 203 | + ref: |
| 204 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 205 | + kind: DockerMachineTemplate |
| 206 | + name: quick-start-default-worker-machinetemplate |
| 207 | +--- |
| 208 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 209 | +kind: DockerClusterTemplate |
| 210 | +metadata: |
| 211 | + name: quick-start-cluster |
| 212 | + namespace: default |
| 213 | +spec: |
| 214 | + template: |
| 215 | + spec: {} |
| 216 | +--- |
| 217 | +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 |
| 218 | +kind: KubeadmControlPlaneTemplate |
| 219 | +metadata: |
| 220 | + name: quick-start-control-plane |
| 221 | + namespace: default |
| 222 | +spec: |
| 223 | + template: |
| 224 | + spec: |
| 225 | + kubeadmConfigSpec: |
| 226 | + clusterConfiguration: |
| 227 | + apiServer: |
| 228 | + certSANs: |
| 229 | + - localhost |
| 230 | + - 127.0.0.1 |
| 231 | + - 0.0.0.0 |
| 232 | + - host.docker.internal |
| 233 | + controllerManager: |
| 234 | + extraArgs: |
| 235 | + enable-hostpath-provisioner: "true" |
| 236 | + initConfiguration: |
| 237 | + nodeRegistration: {} |
| 238 | + joinConfiguration: |
| 239 | + nodeRegistration: {} |
| 240 | +--- |
| 241 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 242 | +kind: DockerMachineTemplate |
| 243 | +metadata: |
| 244 | + name: quick-start-control-plane |
| 245 | + namespace: default |
| 246 | +spec: |
| 247 | + template: |
| 248 | + spec: |
| 249 | + extraMounts: |
| 250 | + - containerPath: /var/run/docker.sock |
| 251 | + hostPath: /var/run/docker.sock |
| 252 | +--- |
| 253 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 254 | +kind: DockerMachineTemplate |
| 255 | +metadata: |
| 256 | + name: quick-start-default-worker-machinetemplate |
| 257 | + namespace: default |
| 258 | +spec: |
| 259 | + template: |
| 260 | + spec: |
| 261 | + extraMounts: |
| 262 | + - containerPath: /var/run/docker.sock |
| 263 | + hostPath: /var/run/docker.sock |
| 264 | +--- |
| 265 | +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 |
| 266 | +kind: KubeadmConfigTemplate |
| 267 | +metadata: |
| 268 | + name: quick-start-default-worker-bootstraptemplate |
| 269 | + namespace: default |
| 270 | +spec: |
| 271 | + template: |
| 272 | + spec: |
| 273 | + joinConfiguration: |
| 274 | + nodeRegistration: {} |
0 commit comments