Skip to content

Commit 63b7795

Browse files
committed
WIP: add CI image to target cluster
1 parent af24762 commit 63b7795

File tree

7 files changed

+81
-3
lines changed

7 files changed

+81
-3
lines changed

scripts/ci-e2e.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ fi
8484

8585
"hack/ci/create_devstack.sh"
8686

87+
# TODO: Upload image to swift for e2e clusterctl upgrade tests
88+
# This is just a quick hack to test the process
89+
make e2e-image
90+
make hack/tools/bin/gojq
91+
ARTIFACTS="$(pwd)/_artifacts"
92+
docker save -o ${ARTIFACTS}/capo-e2e-image.tar gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:dev
93+
export OS_CLOUD=capo-e2e
94+
openstack container create --public capo-e2e
95+
openstack object create capo-e2e ${ARTIFACTS}/capo-e2e-image.tar --name capo-e2e-image.tar
96+
ACCOUNT=$(openstack object show capo-e2e capo-e2e-image.tar -f json | hack/tools/bin/gojq -r .account)
97+
URL=http://10.0.3.15:8080/v1/${ACCOUNT}/capo-e2e/capo-e2e-image.tar
98+
sed -i "s@CAPO_CONTAINER_IMAGE_URL@${URL}@" test/e2e/data/kustomize/upgrade-patches/ci-hack-kcp.yaml
99+
sed -i "s@CAPO_CONTAINER_IMAGE_URL@${URL}@" test/e2e/data/kustomize/upgrade-patches/ci-hack-kct.yaml
100+
unset OS_CLOUD
101+
# TODO: This is just to test the clusterctl upgrade tests
102+
export E2E_GINKGO_PARALLEL="1"
103+
export E2E_GINKGO_ARGS="-focus='\[clusterctl-upgrade\]'"
104+
87105
export OPENSTACK_CLOUD_YAML_FILE
88106
OPENSTACK_CLOUD_YAML_FILE="$(pwd)/clouds.yaml"
89107
make test-e2e

test/e2e/data/e2e_conf.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,8 @@ providers:
160160
- sourcePath: "./infrastructure-openstack/cluster-template-external-cloud-provider.yaml"
161161
- sourcePath: "./infrastructure-openstack/cluster-template-without-lb.yaml"
162162
replacements:
163-
# TODO: We should use e2e here instead of main, but we need a way to get it into the workload cluster
164-
# for upgrade tests for that to work.
165163
- old: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:dev
166-
new: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:main
164+
new: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:e2e
167165
- old: "imagePullPolicy: Always"
168166
new: "imagePullPolicy: IfNotPresent"
169167
- old: "--v=2"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# Workaround for https://github.com/kubernetes-sigs/cluster-api/issues/7457
3+
# There is a small but important difference between these two:
4+
# path: /a/b/c
5+
# *creates* the c array, overwriting anything that was there before
6+
# path: /a/b/c/-
7+
# *adds* to the c array and does not work if the array is missing
8+
- op: add
9+
path: /spec/kubeadmConfigSpec/preKubeadmCommands
10+
value:
11+
- /usr/local/bin/ci-artifacts-openstack.sh
12+
- op: add
13+
path: /spec/kubeadmConfigSpec/files/-
14+
value:
15+
content: |
16+
#!/bin/bash
17+
# Download the locally built CAPO controller image
18+
echo "Downloading CAPO_CONTAINER_IMAGE_URL"
19+
wget "CAPO_CONTAINER_IMAGE_URL" -O "/tmp/capo-controller-manager.tar"
20+
sudo ctr -n k8s.io images import "/tmp/capo-controller-manager.tar" || echo "* ignoring expected 'ctr images import' result"
21+
owner: root:root
22+
path: /usr/local/bin/ci-artifacts-openstack.sh
23+
permissions: "0750"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# Workaround for https://github.com/kubernetes-sigs/cluster-api/issues/7457
3+
# There is a small but important difference between these two:
4+
# path: /a/b/c
5+
# *creates* the c array, overwriting anything that was there before
6+
# path: /a/b/c/-
7+
# *adds* to the c array and does not work if the array is missing
8+
- op: add
9+
path: /spec/template/spec/preKubeadmCommands
10+
value:
11+
- /usr/local/bin/ci-artifacts-openstack.sh
12+
- op: add
13+
path: /spec/template/spec/files/-
14+
value:
15+
content: |
16+
#!/bin/bash
17+
# Download the locally built CAPO controller image
18+
echo "Downloading CAPO_CONTAINER_IMAGE_URL"
19+
wget "CAPO_CONTAINER_IMAGE_URL" -O "/tmp/capo-controller-manager.tar"
20+
sudo ctr -n k8s.io images import "/tmp/capo-controller-manager.tar" || echo "* ignoring expected 'ctr images import' result"
21+
owner: root:root
22+
path: /usr/local/bin/ci-artifacts-openstack.sh
23+
permissions: "0750"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Modifications to release templates for clusterctl upgrade scenarios
2+
---
3+
apiVersion: kustomize.config.k8s.io/v1alpha1
4+
kind: Component
5+
6+
patches:
7+
- target:
8+
kind: KubeadmControlPlane
9+
name: \${CLUSTER_NAME}-control-plane
10+
path: ci-hack-kcp.yaml
11+
- target:
12+
kind: KubeadmConfigTemplate
13+
name: \${CLUSTER_NAME}-md-0
14+
path: ci-hack-kct.yaml

test/e2e/data/kustomize/v1alpha4/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ resources:
44

55
components:
66
- ../common-patches
7+
- ../upgrade-patches

test/e2e/data/kustomize/v1alpha5/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ resources:
44

55
components:
66
- ../common-patches
7+
- ../upgrade-patches

0 commit comments

Comments
 (0)