Skip to content

Commit c7c5fba

Browse files
committed
fix: support all Ignition spec versions during provisioning
Signed-off-by: apedriza <adripedriza@gmail.com>
1 parent 7c6e3d5 commit c7c5fba

18 files changed

+365
-313
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ __debug_bin*
4343
_artifacts
4444

4545
# E2E test templates
46-
e2e/data/infrastructure-docker/**/cluster-template*.yaml
46+
e2e/data/infrastructure-docker/**/cluster-template*.yaml
47+
e2e/data/infrastructure-aws/**/cluster-template*.yaml

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,14 @@ generate-e2e-templates-main: $(KUSTOMIZE)
161161
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-remote-hcp --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-remote-hcp.yaml
162162
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-ingress --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-ingress.yaml
163163

164+
AWS_TEMPLATES := e2e/data/infrastructure-aws
164165

165-
e2e: generate-e2e-templates-main
166+
.PHONY: generate-aws-e2e-templates
167+
generate-aws-e2e-templates: $(KUSTOMIZE)
168+
$(KUSTOMIZE) build $(AWS_TEMPLATES)/cluster-template-ignition-fedora --load-restrictor LoadRestrictionsNone > $(AWS_TEMPLATES)/cluster-template-ignition-fedora.yaml
169+
$(KUSTOMIZE) build $(AWS_TEMPLATES)/cluster-template-ignition-flatcar --load-restrictor LoadRestrictionsNone > $(AWS_TEMPLATES)/cluster-template-ignition-flatcar.yaml
170+
171+
e2e: generate-e2e-templates-main generate-aws-e2e-templates
166172
set +x;
167173
PATH="${LOCALBIN}:${PATH}" go test -v -tags e2e -run '$(TEST_NAME)' ./e2e \
168174
-artifacts-folder="$(ARTIFACTS)" \

e2e/config/aws.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ providers:
3434
- old: "imagePullPolicy: Always"
3535
new: "imagePullPolicy: IfNotPresent"
3636
files:
37-
- sourcePath: "../data/infrastructure-aws/cluster-template-ignition.yaml"
37+
- sourcePath: "../data/infrastructure-aws/cluster-template-ignition-flatcar.yaml"
38+
- sourcePath: "../data/infrastructure-aws/cluster-template-ignition-fedora.yaml"
3839
- name: k0sproject-k0smotron
3940
type: ControlPlaneProvider
4041
versions:
@@ -126,7 +127,6 @@ variables:
126127
# Enabling the feature flags by setting the env variables.
127128
CLUSTER_TOPOLOGY: "true"
128129
EXP_MACHINE_POOL: "true"
129-
AWS_INSTANCE_TYPE: "t3.large"
130130
# Following feature flags are required to use Ignition as bootstrap data format in CAPA.
131131
EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION: "true"
132132
EXP_BOOTSTRAP_FORMAT_IGNITION: "true"

e2e/data/infrastructure-aws/cluster-template-ignition.yaml renamed to e2e/data/infrastructure-aws/bases/cluster-with-ignition-provisioner.yaml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ spec:
3434
version: "3.4"
3535
ami:
3636
id: ami-00d12617b68dbc62f # Flatcar Container Linux stable 3975.2.1 (HVM) in eu-west-1
37-
instanceType: ${AWS_INSTANCE_TYPE}
3837
publicIP: true
3938
iamInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io
4039
uncompressedUserData: false
@@ -50,19 +49,6 @@ spec:
5049
version: v1.30.2+k0s.0
5150
updateStrategy: Recreate
5251
k0sConfigSpec:
53-
# Flatcar, as inmutable OS, needs k0s in /opt/bin. It cannot write k0s binary in the default /usr/local/bin.
54-
k0sInstallDir: /opt/bin
55-
ignition:
56-
variant: flatcar
57-
version: 1.1.0
58-
additionalConfig: |
59-
variant: flatcar
60-
version: 1.1.0
61-
passwd:
62-
users:
63-
- name: core
64-
ssh_authorized_keys:
65-
- ssh-rsa ${SSH_PUBLIC_KEY}
6652
args:
6753
- --enable-worker
6854
- --debug
@@ -141,18 +127,4 @@ metadata:
141127
namespace: ${NAMESPACE}
142128
spec:
143129
template:
144-
spec:
145-
version: v1.30.2+k0s.0
146-
# Flatcar, as inmutable OS, needs k0s in /opt/bin. It cannot write k0s binary in the default /usr/local/bin.
147-
k0sInstallDir: /opt/bin
148-
ignition:
149-
variant: flatcar
150-
version: 1.1.0
151-
additionalConfig: |
152-
variant: flatcar
153-
version: 1.1.0
154-
passwd:
155-
users:
156-
- name: core
157-
ssh_authorized_keys:
158-
- ssh-rsa ${SSH_PUBLIC_KEY}
130+
spec: {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
2+
kind: AWSMachineTemplate
3+
metadata:
4+
name: ${CLUSTER_NAME}-aws-test-mt
5+
namespace: ${NAMESPACE}
6+
spec:
7+
template:
8+
spec:
9+
ami:
10+
id: ami-00288eb1655108c26 # Fedora CoreOS
11+
instanceType: x2gd.8xlarge
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
2+
kind: K0sControlPlane
3+
metadata:
4+
name: ${CLUSTER_NAME}-aws-test
5+
namespace: ${NAMESPACE}
6+
spec:
7+
k0sConfigSpec:
8+
ignition:
9+
variant: fcos
10+
version: 1.4.0
11+
additionalConfig: |
12+
variant: fcos
13+
version: 1.4.0
14+
passwd:
15+
users:
16+
- name: core
17+
ssh_authorized_keys:
18+
- ssh-rsa ${SSH_PUBLIC_KEY}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
2+
kind: K0sWorkerConfigTemplate
3+
metadata:
4+
name: ${CLUSTER_NAME}-machine-config
5+
namespace: ${NAMESPACE}
6+
spec:
7+
template:
8+
spec:
9+
version: v1.30.2+k0s.0
10+
ignition:
11+
variant: fcos
12+
version: 1.4.0
13+
additionalConfig: |
14+
variant: fcos
15+
version: 1.4.0
16+
passwd:
17+
users:
18+
- name: core
19+
ssh_authorized_keys:
20+
- ssh-rsa ${SSH_PUBLIC_KEY}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resources:
2+
- ../bases/cluster-with-ignition-provisioner.yaml
3+
4+
patches:
5+
- path: k0scontrolplane-patch.yaml
6+
- path: k0sworkerconfigtemplate-patch.yaml
7+
- path: aws-machine-template-patch.yaml
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
2+
kind: AWSMachineTemplate
3+
metadata:
4+
name: ${CLUSTER_NAME}-aws-test-mt
5+
namespace: ${NAMESPACE}
6+
spec:
7+
template:
8+
spec:
9+
ami:
10+
id: ami-00d12617b68dbc62f
11+
instanceType: t3.large
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
2+
kind: K0sControlPlane
3+
metadata:
4+
name: ${CLUSTER_NAME}-aws-test
5+
namespace: ${NAMESPACE}
6+
spec:
7+
k0sConfigSpec:
8+
k0sInstallDir: /opt/bin # Flatcar, as inmutable OS, needs k0s in /opt/bin. It cannot write k0s binary in the default /usr/local/bin.
9+
ignition:
10+
variant: flatcar
11+
version: 1.1.0
12+
additionalConfig: |
13+
variant: flatcar
14+
version: 1.1.0
15+
passwd:
16+
users:
17+
- name: core
18+
ssh_authorized_keys:
19+
- ssh-rsa ${SSH_PUBLIC_KEY}

0 commit comments

Comments
 (0)