Skip to content

Commit

Permalink
ci: support loading all components image in E2E (#1705)
Browse files Browse the repository at this point in the history
Signed-off-by: saintube <[email protected]>
  • Loading branch information
saintube authored Oct 12, 2023
1 parent beefb7c commit 57cab21
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 29 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/e2e-k8s-1.22.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ jobs:
version: ${{ env.KIND_VERSION }}
- name: Build image
run: |
export IMAGE="koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID}"
docker build --pull --no-cache . -t $IMAGE -f docker/koord-manager.dockerfile
kind load docker-image --name=${KIND_CLUSTER_NAME} $IMAGE || { echo >&2 "kind not installed or error loading image: $IMAGE"; exit 1; }
export MANAGER_IMAGE="koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID}"
docker build --pull . -t ${MANAGER_IMAGE} -f docker/koord-manager.dockerfile
export KOORDLET_IMAGE="koordinator-sh/koordlet:e2e-${GITHUB_RUN_ID}"
docker build --pull . -t ${KOORDLET_IMAGE} -f docker/koordlet.dockerfile
kind load docker-image --name=${KIND_CLUSTER_NAME} ${MANAGER_IMAGE} || { echo >&2 "kind not installed or error loading image: ${MANAGER_IMAGE}"; exit 1; }
kind load docker-image --name=${KIND_CLUSTER_NAME} ${KOORDLET_IMAGE} || { echo >&2 "kind not installed or error loading image: ${KOORDLET_IMAGE}"; exit 1; }
- name: Check host environment
run: |
set -ex
Expand All @@ -55,7 +58,7 @@ jobs:
run: |
set -ex
kubectl cluster-info
IMG=koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID} KUBERNETES_VERSION="1.22" ./hack/deploy_kind.sh
KUBERNETES_VERSION="1.22" MANAGER_IMG=koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID} KOORDLET_IMG=koordinator-sh/koordlet:e2e-${GITHUB_RUN_ID} ./hack/deploy_kind.sh
NODES=$(kubectl get node | wc -l)
for ((i=1;i<10;i++));
do
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/e2e-k8s-1.24.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ jobs:
version: ${{ env.KIND_VERSION }}
- name: Build image
run: |
export IMAGE="koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID}"
docker build --pull --no-cache . -t $IMAGE -f docker/koord-manager.dockerfile
kind load docker-image --name=${KIND_CLUSTER_NAME} $IMAGE || { echo >&2 "kind not installed or error loading image: $IMAGE"; exit 1; }
export MANAGER_IMAGE="koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID}"
docker build --pull . -t ${MANAGER_IMAGE} -f docker/koord-manager.dockerfile
export KOORDLET_IMAGE="koordinator-sh/koordlet:e2e-${GITHUB_RUN_ID}"
docker build --pull . -t ${KOORDLET_IMAGE} -f docker/koordlet.dockerfile
kind load docker-image --name=${KIND_CLUSTER_NAME} ${MANAGER_IMAGE} || { echo >&2 "kind not installed or error loading image: ${MANAGER_IMAGE}"; exit 1; }
kind load docker-image --name=${KIND_CLUSTER_NAME} ${KOORDLET_IMAGE} || { echo >&2 "kind not installed or error loading image: ${KOORDLET_IMAGE}"; exit 1; }
- name: Check host environment
run: |
set -ex
Expand All @@ -55,7 +58,7 @@ jobs:
run: |
set -ex
kubectl cluster-info
IMG=koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID} ./hack/deploy_kind.sh
MANAGER_IMG=koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID} KOORDLET_IMG=koordinator-sh/koordlet:e2e-${GITHUB_RUN_ID} ./hack/deploy_kind.sh
NODES=$(kubectl get node | wc -l)
for ((i=1;i<10;i++));
do
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/e2e-k8s-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ jobs:
version: ${{ env.KIND_VERSION }}
- name: Build image
run: |
export IMAGE="koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID}"
docker build --pull --no-cache . -t $IMAGE -f docker/koord-manager.dockerfile
kind load docker-image --name=${KIND_CLUSTER_NAME} $IMAGE || { echo >&2 "kind not installed or error loading image: $IMAGE"; exit 1; }
export MANAGER_IMAGE="koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID}"
docker build --pull . -t ${MANAGER_IMAGE} -f docker/koord-manager.dockerfile
export KOORDLET_IMAGE="koordinator-sh/koordlet:e2e-${GITHUB_RUN_ID}"
docker build --pull . -t ${KOORDLET_IMAGE} -f docker/koordlet.dockerfile
kind load docker-image --name=${KIND_CLUSTER_NAME} ${MANAGER_IMAGE} || { echo >&2 "kind not installed or error loading image: ${MANAGER_IMAGE}"; exit 1; }
kind load docker-image --name=${KIND_CLUSTER_NAME} ${KOORDLET_IMAGE} || { echo >&2 "kind not installed or error loading image: ${KOORDLET_IMAGE}"; exit 1; }
- name: Check host environment
run: |
set -ex
Expand All @@ -53,7 +56,7 @@ jobs:
run: |
set -ex
kubectl cluster-info
IMG=koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID} ./hack/deploy_kind.sh
MANAGER_IMG=koordinator-sh/koord-manager:e2e-${GITHUB_RUN_ID} KOORDLET_IMG=koordinator-sh/koordlet:e2e-${GITHUB_RUN_ID} ./hack/deploy_kind.sh
NODES=$(kubectl get node | wc -l)
for ((i=1;i<10;i++));
do
Expand Down
33 changes: 16 additions & 17 deletions hack/deploy_kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,28 @@
# limitations under the License.
#

if [ -z "$IMG" ]; then
echo "no found IMG env"
exit 1
fi

K8S_VERSION=""
if [ -z "$KUBERNETES_VERSION" ]; then
K8S_VERSION="latest"
else
K8S_VERSION=$KUBERNETES_VERSION
fi

set -e

make kustomize
KUSTOMIZE=$(pwd)/bin/kustomize
(cd config/manager && "${KUSTOMIZE}" edit set image manager="${IMG}")

if [[ "$K8S_VERSION" == "1.22" ]]; then
if [[ -n "$MANAGER_IMG" ]]; then
(cd config/manager && "${KUSTOMIZE}" edit set image manager="${MANAGER_IMG}")
fi
if [[ -n "$SCHEDULER_IMG" ]]; then
(cd config/manager && "${KUSTOMIZE}" edit set image scheduler="${SCHEDULER_IMG}")
fi
if [[ -n "$DESCHEDULER_IMG" ]]; then
(cd config/manager && "${KUSTOMIZE}" edit set image descheduler="${DESCHEDULER_IMG}")
fi
if [[ -n "$KOORDLET_IMG" ]]; then
(cd config/manager && "${KUSTOMIZE}" edit set image koordlet="${KOORDLET_IMG}")
fi

if [[ "$KUBERNETES_VERSION" == "1.22" ]]; then
sed "s/feature-gates=/feature-gates=CompatibleCSIStorageCapacity=true/g" $(pwd)/config/manager/scheduler.yaml > /tmp/scheduler.yaml && mv /tmp/scheduler.yaml $(pwd)/config/manager/scheduler.yaml
$(pwd)/hack/kustomize.sh "${KUSTOMIZE}" | sed -e 's/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g' > /tmp/koordinator-kustomization.yaml
else
$(pwd)/hack/kustomize.sh "${KUSTOMIZE}" | sed -e 's/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g' > /tmp/koordinator-kustomization.yaml
fi

$(pwd)/hack/kustomize.sh "${KUSTOMIZE}" | sed -e 's/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g' > /tmp/koordinator-kustomization.yaml

kubectl apply -f /tmp/koordinator-kustomization.yaml

0 comments on commit 57cab21

Please sign in to comment.