From 13beb2e4c2cb0391251754b41dc68745c2be1f8d Mon Sep 17 00:00:00 2001 From: ComradeProgrammer Date: Sun, 16 Nov 2025 21:38:28 +0100 Subject: [PATCH] [ci]: migrate kubernetes bootcamp image to prow --- deploy/image/kubernetes-bootcamp/Dockerfile | 5 +++++ deploy/image/kubernetes-bootcamp/server.js | 19 +++++++++++++++++++ .../image/kubernetes-bootcamp/cloudbuild.yaml | 19 +++++++++++++++++++ hack/prow/prow.mk | 10 +++++++++- 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 deploy/image/kubernetes-bootcamp/Dockerfile create mode 100644 deploy/image/kubernetes-bootcamp/server.js create mode 100644 hack/prow/image/kubernetes-bootcamp/cloudbuild.yaml diff --git a/deploy/image/kubernetes-bootcamp/Dockerfile b/deploy/image/kubernetes-bootcamp/Dockerfile new file mode 100644 index 000000000000..22aae33362b6 --- /dev/null +++ b/deploy/image/kubernetes-bootcamp/Dockerfile @@ -0,0 +1,5 @@ +FROM node:slim +RUN apt-get update && apt-get install curl -y +EXPOSE 8080 +COPY server.js . +CMD [ "node", "server.js" ] diff --git a/deploy/image/kubernetes-bootcamp/server.js b/deploy/image/kubernetes-bootcamp/server.js new file mode 100644 index 000000000000..f62a963174ee --- /dev/null +++ b/deploy/image/kubernetes-bootcamp/server.js @@ -0,0 +1,19 @@ +var http = require('http'); +var requests = 0; +var podname = process.env.HOSTNAME; +var startTime; +var host; +var handleRequest = function(request, response) { + response.setHeader('Content-Type', 'text/plain'); + response.writeHead(200); + response.write('Hello Kubernetes bootcamp! | Hostname: '); + response.write(host); + response.end(' | v=2\n'); + console.log('Hostname:', host, '| Total Requests:', ++requests, '| App Uptime:', (new Date() - startTime)/1000 , 'seconds', '| Log Time:', new Date()); +} +var www = http.createServer(handleRequest); +www.listen(8080, function () { + startTime = new Date(); + host = process.env.HOSTNAME; + console.log('Kubernetes Bootcamp App Started At:', startTime, '| Running On:', host, '\n'); +}); diff --git a/hack/prow/image/kubernetes-bootcamp/cloudbuild.yaml b/hack/prow/image/kubernetes-bootcamp/cloudbuild.yaml new file mode 100644 index 000000000000..a915288bffe7 --- /dev/null +++ b/hack/prow/image/kubernetes-bootcamp/cloudbuild.yaml @@ -0,0 +1,19 @@ +# See https://cloud.google.com/cloud-build/docs/build-config +options: + substitution_option: ALLOW_LOOSE +steps: +- name: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20250513-9264efb079 + entrypoint: make + env: + - DOCKER_CLI_EXPERIMENTAL=enabled + - _GIT_TAG=$_GIT_TAG + - _PULL_BASE_REF=$_PULL_BASE_REF + args: + - push-kubernetes-bootcamp + substitutions: + # _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and + # can be used as a substitution + _GIT_TAG: '12345' + # _PULL_BASE_REF will contain the ref that was pushed to to trigger this build - + # a branch like 'master' or 'release-0.2', or a tag like 'v0.2'. + _PULL_BASE_REF: 'master' \ No newline at end of file diff --git a/hack/prow/prow.mk b/hack/prow/prow.mk index 751320cad41a..e32d6f4c2e0c 100644 --- a/hack/prow/prow.mk +++ b/hack/prow/prow.mk @@ -21,4 +21,12 @@ build-mini-test: # build minitest binary setup-prow-gcp-ssh-keys: # set up ssh keys for gcloud cli. These env vars are set by test/infra mkdir -p -m 0700 ~/.ssh cp -f "${GCE_SSH_PRIVATE_KEY_FILE}" ~/.ssh/google_compute_engine - cp -f "${GCE_SSH_PUBLIC_KEY_FILE}" ~/.ssh/google_compute_engine.pub \ No newline at end of file + cp -f "${GCE_SSH_PUBLIC_KEY_FILE}" ~/.ssh/google_compute_engine.pub + +.PHONY: push-kubernetes-bootcamp +push-kubernetes-bootcamp: + docker run --rm --privileged tonistiigi/binfmt:latest --install all + docker buildx create --name multiarch --bootstrap + docker buildx build --builder multiarch --push --platform linux/amd64,linux/arm64 \ + -t us-central1-docker.pkg.dev/k8s-staging-images/minikube/kubernetes-bootcamp:$(_GIT_TAG) -t us-central1-docker.pkg.dev/k8s-staging-images/minikube/kubernetes-bootcamp:latest deploy/image/kubernetes-bootcamp + docker buildx rm multiarch \ No newline at end of file