From 9fcfae7107009562af687c576cb133e728e0e298 Mon Sep 17 00:00:00 2001 From: Drew Walters Date: Fri, 12 Feb 2021 16:40:47 +0000 Subject: [PATCH] Add custom Jump Host image This change introduces a custom Jump Host image to include jq and the DMTF Redfish tool. This will enable SIP to provide sub-cluster virtual machine reboot capabilities. Signed-off-by: Drew Walters Change-Id: Ic38a13707a28ef7a7ea868d35b58df9b619c7b15 --- Makefile | 49 +++++++++++++++++++++------------- README.md | 2 +- images/jump-host/Dockerfile | 9 +++++++ playbooks/test-sip.yaml | 8 ++++-- tools/deployment/deploy-sip.sh | 4 +-- 5 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 images/jump-host/Dockerfile diff --git a/Makefile b/Makefile index d5544dc..7623bb7 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,17 @@ # Docker Image Options -DOCKER_REGISTRY ?= quay.io -DOCKER_FORCE_CLEAN ?= true -DOCKER_IMAGE_NAME ?= sip -DOCKER_IMAGE_PREFIX ?= airshipit -DOCKER_IMAGE_TAG ?= latest -DOCKER_TARGET_STAGE ?= release -PUBLISH ?= false +DOCKER_REGISTRY ?= quay.io +DOCKER_FORCE_CLEAN ?= true +DOCKER_IMAGE_PREFIX ?= airshipit +DOCKER_IMAGE_TAG ?= latest +DOCKER_TARGET_STAGE ?= release +PUBLISH ?= false -# Image URL to use all building/pushing image targets -#IMG ?= controller:latest -IMG ?= $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) +JUMP_HOST_IMAGE_NAME ?= jump-host +SIP_IMAGE_NAME ?= sip + +# Image URLs to build/publish images +JUMP_HOST_IMG ?= $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(JUMP_HOST_IMAGE_NAME):$(DOCKER_IMAGE_TAG) +SIP_IMG ?= $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(SIP_IMAGE_NAME):$(DOCKER_IMAGE_TAG) # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd:trivialVersions=true" @@ -59,7 +61,7 @@ uninstall: manifests # Deploy controller in the configured Kubernetes cluster in ~/.kube/config deploy: manifests - cd config/manager && kustomize edit set image controller=${IMG} + cd config/manager && kustomize edit set image controller=${SIP_IMG} kustomize build config/default | kubectl apply -f - # Generate manifests e.g. CRD, RBAC etc. @@ -78,14 +80,23 @@ vet: generate: controller-gen $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -# Build the docker image -# If DOCKER_PROXY_FLAGS values are empty, we are fine with that -docker-build: - docker build ${DOCKER_PROXY_FLAGS} . -t ${IMG} +images: docker-build-controller docker-build-jump-host -# Push the docker image -docker-push: - docker push ${IMG} +# Build the SIP Docker image +# NOTE: DOCKER_PROXY_FLAGS can be empty. +docker-build-controller: + docker build ${DOCKER_PROXY_FLAGS} . -t ${SIP_IMG} + +# Build the Jump Host Docker image +# NOTE: DOCKER_PROXY_FLAGS can be empty. +docker-build-jump-host: + docker build ${DOCKER_PROXY_FLAGS} -f images/jump-host/Dockerfile . -t ${JUMP_HOST_IMG} + +docker-push-controller: + docker push ${SIP_IMG} + +docker-push-jump-host: + docker push ${JUMP_HOST_IMG} # Generate API reference documentation api-docs: gen-crd-api-reference-docs @@ -139,4 +150,4 @@ $(TOOLBINDIR): .PHONY: check-git-diff check-git-diff: - @./tools/git_diff_check \ No newline at end of file + @./tools/git_diff_check diff --git a/README.md b/README.md index f14702b..224c300 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ USE_PROXY=true ### Deploy SIP ``` -# make docker-build +# make docker-build-controller # kubectl get nodes # make deploy ``` diff --git a/images/jump-host/Dockerfile b/images/jump-host/Dockerfile new file mode 100644 index 0000000..bd55285 --- /dev/null +++ b/images/jump-host/Dockerfile @@ -0,0 +1,9 @@ +ARG BASE_IMAGE=gcr.io/google-appengine/python +FROM ${BASE_IMAGE} + +RUN apt-get update +RUN apt-get install -y --no-install-recommends jq + +RUN pip3 install requests python-dateutil redfishtool + +CMD ["/bin/bash"] diff --git a/playbooks/test-sip.yaml b/playbooks/test-sip.yaml index 09f4c47..3c18ff2 100644 --- a/playbooks/test-sip.yaml +++ b/playbooks/test-sip.yaml @@ -63,7 +63,11 @@ make: chdir: "{{ zuul.project.src_dir }}" target: check-git-diff - - name: Build Docker image + - name: Build SIP Docker image make: chdir: "{{ zuul.project.src_dir }}" - target: docker-build + target: docker-build-controller + - name: Build Jump Host Docker image + make: + chdir: "{{ zuul.project.src_dir }}" + target: docker-build-jump-host diff --git a/tools/deployment/deploy-sip.sh b/tools/deployment/deploy-sip.sh index 20abe5b..d2b1513 100755 --- a/tools/deployment/deploy-sip.sh +++ b/tools/deployment/deploy-sip.sh @@ -1,7 +1,7 @@ #!/bin/bash set -xe sudo snap install kustomize && sudo snap install go --classic -make docker-build +make images kubectl wait --for=condition=Ready pods --all -A --timeout=180s make deploy #Wait for sip controller manager Pod @@ -15,4 +15,4 @@ until [[ $(kubectl -n sipcluster-system get pod -l control-plane=controller-mana sleep 2 done kubectl wait -n sipcluster-system pod -l control-plane=controller-manager --for=condition=ready --timeout=240s -kubectl get po -A \ No newline at end of file +kubectl get po -A