chore(ci): modularize integration test (#722)
Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
This commit is contained in:
parent
8a5acff119
commit
95b107d884
@ -230,11 +230,6 @@ COPY --from=talos-build /rootfs /
|
||||
COPY --from=init-build /init /init
|
||||
ENTRYPOINT ["/init"]
|
||||
|
||||
# The kernel target is the linux kernel.
|
||||
|
||||
ARG KERNEL_IMAGE
|
||||
FROM ${KERNEL_IMAGE} as kernel
|
||||
|
||||
# The installer target generates an image that can be used to install Talos to
|
||||
# various environments.
|
||||
|
||||
|
@ -2,41 +2,18 @@
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
TMP="$(mktemp -d)"
|
||||
OSCTL="${PWD}/build/osctl-linux-amd64"
|
||||
|
||||
export TMP="$(mktemp -d)"
|
||||
export OSCTL="${PWD}/build/osctl-linux-amd64"
|
||||
export TALOSCONFIG="${TMP}/talosconfig"
|
||||
export KUBECONFIG="${TMP}/kubeconfig"
|
||||
|
||||
|
||||
cleanup() {
|
||||
${OSCTL} cluster destroy --name integration
|
||||
rm -rf ${TMP}
|
||||
}
|
||||
|
||||
run() {
|
||||
docker run \
|
||||
--rm \
|
||||
--interactive \
|
||||
--net=integration \
|
||||
--entrypoint=bash \
|
||||
--mount type=bind,source=${TMP},target=${TMP} \
|
||||
--mount type=bind,source=${PWD}/hack/dev/manifests,target=/manifests \
|
||||
-v ${OSCTL}:/bin/osctl:ro \
|
||||
-e KUBECONFIG=${KUBECONFIG} \
|
||||
-e TALOSCONFIG=${TALOSCONFIG} \
|
||||
k8s.gcr.io/hyperkube:${KUBERNETES_VERSION} -c "${1}"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
${OSCTL} cluster create --name integration
|
||||
${OSCTL} config target 10.5.0.2
|
||||
|
||||
run "until osctl kubeconfig > ${KUBECONFIG}; do cat ${KUBECONFIG}; sleep 5; done"
|
||||
run "until kubectl get nodes -o json | jq '.items | length' | grep 4 >/dev/null; do kubectl get nodes -o wide; sleep 5; done"
|
||||
run "kubectl apply -f /manifests/psp.yaml -f /manifests/flannel.yaml"
|
||||
run "kubectl wait --for=condition=ready=true --all nodes"
|
||||
# Verify that we have an HA controlplane
|
||||
run "kubectl get nodes -l node-role.kubernetes.io/master='' -o json | jq '.items | length' | grep 3 >/dev/null"
|
||||
./hack/test/osctl-docker-create.sh
|
||||
|
||||
exit 0
|
||||
|
27
hack/test/osctl-docker-create.sh
Executable file
27
hack/test/osctl-docker-create.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
run() {
|
||||
docker run \
|
||||
--rm \
|
||||
--interactive \
|
||||
--net=integration \
|
||||
--entrypoint=bash \
|
||||
--mount type=bind,source=${TMP},target=${TMP} \
|
||||
--mount type=bind,source=${PWD}/hack/dev/manifests,target=/manifests \
|
||||
-v ${OSCTL}:/bin/osctl:ro \
|
||||
-e KUBECONFIG=${KUBECONFIG} \
|
||||
-e TALOSCONFIG=${TALOSCONFIG} \
|
||||
k8s.gcr.io/hyperkube:${KUBERNETES_VERSION} -c "${1}"
|
||||
}
|
||||
|
||||
${OSCTL} cluster create --name integration
|
||||
${OSCTL} config target 10.5.0.2
|
||||
|
||||
run "until osctl kubeconfig > ${KUBECONFIG}; do cat ${KUBECONFIG}; sleep 5; done"
|
||||
run "until kubectl get nodes -o json | jq '.items | length' | grep 4 >/dev/null; do kubectl get nodes -o wide; sleep 5; done"
|
||||
run "kubectl apply -f /manifests/psp.yaml -f /manifests/flannel.yaml"
|
||||
run "kubectl wait --for=condition=ready=true --all nodes"
|
||||
# Verify that we have an HA controlplane
|
||||
run "kubectl get nodes -l node-role.kubernetes.io/master='' -o json | jq '.items | length' | grep 3 >/dev/null"
|
Loading…
x
Reference in New Issue
Block a user