From 79f970d5e27e7fe2adee54c8b139a8bdd122b354 Mon Sep 17 00:00:00 2001 From: Nishant Gupta <90177384+nishant-yt@users.noreply.github.com> Date: Wed, 8 Jun 2022 19:10:09 +0530 Subject: [PATCH 01/15] Issue 482: Reevaluating number of client connections dynamically in the teardown script (#483) Signed-off-by: Nishant Gupta Signed-off-by: Marco Moscher --- docker/bin/zookeeperTeardown.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/bin/zookeeperTeardown.sh b/docker/bin/zookeeperTeardown.sh index 309d6b782..85af30fbb 100755 --- a/docker/bin/zookeeperTeardown.sh +++ b/docker/bin/zookeeperTeardown.sh @@ -20,8 +20,8 @@ LOG4J_CONF=/conf/log4j-quiet.properties # Wait for client connections to drain. Kubernetes will wait until the confiugred # "terminationGracePeriodSeconds" before focibly killing the container -CONN_COUNT=`echo cons | nc localhost 2181 | grep -v "^$" |grep -v "/127.0.0.1:" | wc -l` for (( i = 0; i < 6; i++ )); do + CONN_COUNT=`echo cons | nc localhost 2181 | grep -v "^$" |grep -v "/127.0.0.1:" | wc -l` if [[ "$CONN_COUNT" -gt 0 ]]; then echo "$CONN_COUNT non-local connections still connected." sleep 5 From d2f588ee8ebb24e6ba1fa09d7f6de913f9a580fb Mon Sep 17 00:00:00 2001 From: Amit-Singh40 <104156566+Amit-Singh40@users.noreply.github.com> Date: Tue, 14 Jun 2022 11:05:57 +0530 Subject: [PATCH 02/15] upgrading zookeeper to 3.7.1 (#485) * upgrading zookeeper to 3.7.1 Signed-off-by: Amit-Singh40 * updating zookeeper version in build.gradle.kts and readme file Signed-off-by: Amit-Singh40 Signed-off-by: Marco Moscher --- README.md | 2 +- docker/Dockerfile | 2 +- docker/zu/build.gradle.kts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2e4741e2b..d4d44a4da 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ The project is currently alpha. While no breaking API changes are currently plan ### Overview -This operator runs a Zookeeper 3.7.0 cluster, and uses Zookeeper dynamic reconfiguration to handle node membership. +This operator runs a Zookeeper 3.7.1 cluster, and uses Zookeeper dynamic reconfiguration to handle node membership. The operator itself is built with the [Operator framework](https://github.com/operator-framework/operator-sdk). diff --git a/docker/Dockerfile b/docker/Dockerfile index a6c520b4b..baaf42b3c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,7 +15,7 @@ COPY zu /zu WORKDIR /zu RUN ./gradlew --console=verbose --info shadowJar -FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}zookeeper:3.7.0 +FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}zookeeper:3.7.1 COPY bin /usr/local/bin RUN chmod +x /usr/local/bin/* COPY --from=0 /zu/build/libs/zu.jar /opt/libs/ diff --git a/docker/zu/build.gradle.kts b/docker/zu/build.gradle.kts index 2aa875c81..95e1d874c 100644 --- a/docker/zu/build.gradle.kts +++ b/docker/zu/build.gradle.kts @@ -12,7 +12,7 @@ repositories { dependencies { implementation(kotlin("stdlib")) - implementation("org.apache.zookeeper:zookeeper:3.7.0") + implementation("org.apache.zookeeper:zookeeper:3.7.1") } tasks.withType() { From 27e3a93b99a0441cf2c9066d3cafa4598f8ad5ca Mon Sep 17 00:00:00 2001 From: Sava Date: Fri, 24 Jun 2022 20:51:41 +0500 Subject: [PATCH 03/15] fix manager.yaml path (#488) Signed-off-by: Sava Lifanov Signed-off-by: Marco Moscher --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4d44a4da..49479125e 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ $ kubectl create -f config/rbac/all_ns_rbac.yaml Deploy the Zookeeper operator. ``` -$ kubectl create -f deploy/manager/manager.yaml +$ kubectl create -f config/manager/manager.yaml ``` Verify that the Zookeeper operator is running. From a10dcfac3dab19a6184d6c3b38522e1b73fbe1b3 Mon Sep 17 00:00:00 2001 From: Acto Team <97862925+hoyhbx@users.noreply.github.com> Date: Thu, 11 Aug 2022 23:37:36 -0500 Subject: [PATCH 04/15] fix: create and also update svc annotations (#474) (#492) Signed-off-by: hoyhbx Signed-off-by: hoyhbx Signed-off-by: Marco Moscher --- pkg/zk/synchronizers.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/zk/synchronizers.go b/pkg/zk/synchronizers.go index 405c51117..77a37f89f 100644 --- a/pkg/zk/synchronizers.go +++ b/pkg/zk/synchronizers.go @@ -26,6 +26,7 @@ func SyncStatefulSet(curr *appsv1.StatefulSet, next *appsv1.StatefulSet) { func SyncService(curr *v1.Service, next *v1.Service) { curr.Spec.Ports = next.Spec.Ports curr.Spec.Type = next.Spec.Type + curr.SetAnnotations(next.GetAnnotations()) } // SyncConfigMap synchronizes a configmap with an updated spec and validates it From f94494f467c332aabd2701d0cdeb0ec9c53c3ab2 Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Tue, 4 Oct 2022 23:14:49 +0200 Subject: [PATCH 05/15] use arm64 for go Signed-off-by: Marco Moscher --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 539573ee5..cd438313c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ COPY api/ api/ COPY controllers/ controllers/ # Build -RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \ +RUN GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \ -ldflags "-X ${REPO_PATH}/pkg/version.Version=${VERSION} -X ${REPO_PATH}/pkg/version.GitSHA=${GIT_SHA}" main.go FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}alpine:${ALPINE_VERSION} AS final From d3a9902fb8f9f415c7a31dfbdf878839916aa89e Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 21:59:32 +0200 Subject: [PATCH 06/15] adds docker multiarch builds and use it in push Signed-off-by: Marco Moscher --- .github/workflows/ci.yaml | 106 ++++++++++++++++++++------------------ Dockerfile | 8 +-- Makefile | 21 +++++++- 3 files changed, 80 insertions(+), 55 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c9d351141..35313b294 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,62 +15,66 @@ on: # jobs to run jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Set up Go 1.17 - uses: actions/setup-go@v2 - with: - go-version: 1.17 - id: go - - name: Set up Go for root - run: | - sudo ln -sf `which go` `sudo which go` || true - sudo go version - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: get go version - run: go version - - name: Gofmt and License checks - run: make check - - name: unit tests - run: make test - - name: Codecov - uses: codecov/codecov-action@v1.0.12 - - name: Set env - run: | - echo "KUBERNETES_VERSION=v1.23.1" >> $GITHUB_ENV - echo "MINIKUBE_VERSION=v1.25.2" >> $GITHUB_ENV - echo "KUBERNETES_CONFIG_FILE=$HOME/.kube/config" >> $GITHUB_ENV - echo "CHANGE_MINIKUBE_NONE_USER=true" >> $GITHUB_ENV - - name: minikube setup - run: | - curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$KUBERNETES_VERSION/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ - curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ - sudo mount --make-rshared / - sudo apt-get install -y conntrack - CHANGE_MINIKUBE_NONE_USER=true - export KUBERNETES_CONFIG_FILE=$HOME/.kube/config - export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true;sudo minikube start --vm-driver=none --bootstrapper=kubeadm --kubernetes-version=$KUBERNETES_VERSION - echo "minikube started, updating context" - export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true; sudo minikube update-context - echo "context is updated" - #JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done - sleep 60 - sudo kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default - echo "created cluster role" - sudo kubectl cluster-info - echo "cluster info" - sudo kubectl -n kube-system get pod -o wide - sudo kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username="testanisha" --docker-password="123456789" --docker-email=testimage456@gmail.com - - name: E2E - run: sudo make test-e2e + # build: + # runs-on: ubuntu-latest + # steps: + # - name: Set up Go 1.17 + # uses: actions/setup-go@v2 + # with: + # go-version: 1.17 + # id: go + # - name: Set up Go for root + # run: | + # sudo ln -sf `which go` `sudo which go` || true + # sudo go version + # - name: Check out code into the Go module directory + # uses: actions/checkout@v2 + # - name: get go version + # run: go version + # - name: Gofmt and License checks + # run: make check + # - name: unit tests + # run: make test + # - name: Codecov + # uses: codecov/codecov-action@v1.0.12 + # - name: Set env + # run: | + # echo "KUBERNETES_VERSION=v1.23.1" >> $GITHUB_ENV + # echo "MINIKUBE_VERSION=v1.25.2" >> $GITHUB_ENV + # echo "KUBERNETES_CONFIG_FILE=$HOME/.kube/config" >> $GITHUB_ENV + # echo "CHANGE_MINIKUBE_NONE_USER=true" >> $GITHUB_ENV + # - name: minikube setup + # run: | + # curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$KUBERNETES_VERSION/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ + # curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ + # sudo mount --make-rshared / + # sudo apt-get install -y conntrack + # CHANGE_MINIKUBE_NONE_USER=true + # export KUBERNETES_CONFIG_FILE=$HOME/.kube/config + # export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true;sudo minikube start --vm-driver=none --bootstrapper=kubeadm --kubernetes-version=$KUBERNETES_VERSION + # echo "minikube started, updating context" + # export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true; sudo minikube update-context + # echo "context is updated" + # #JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done + # sleep 60 + # sudo kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default + # echo "created cluster role" + # sudo kubectl cluster-info + # echo "cluster info" + # sudo kubectl -n kube-system get pod -o wide + # sudo kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username="testanisha" --docker-password="123456789" --docker-email=testimage456@gmail.com + # - name: E2E + # run: sudo make test-e2e publish: name: Publish docker image runs-on: ubuntu-latest - needs: build + #needs: build if: github.event_name == 'release' && github.event.action == 'created' steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Pushing docker images run: sudo make push - name: Uploading binary files diff --git a/Dockerfile b/Dockerfile index cd438313c..b578ed971 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG DOCKER_REGISTRY ARG ALPINE_VERSION=3.15 -FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:1.17-alpine${ALPINE_VERSION} as go-builder +FROM --platform=$BUILDPLATFORM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:1.17-alpine${ALPINE_VERSION} as go-builder ARG PROJECT_NAME=zookeeper-operator ARG REPO_PATH=github.com/pravega/$PROJECT_NAME @@ -9,6 +9,9 @@ ARG REPO_PATH=github.com/pravega/$PROJECT_NAME ARG VERSION=0.0.0-localdev ARG GIT_SHA=0000000 +ARG TARGETOS=linux +ARG TARGETARCH=amd64 + WORKDIR /src COPY pkg ./pkg COPY cmd ./cmd @@ -25,12 +28,11 @@ COPY api/ api/ COPY controllers/ controllers/ # Build -RUN GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \ +RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \ -ldflags "-X ${REPO_PATH}/pkg/version.Version=${VERSION} -X ${REPO_PATH}/pkg/version.GitSHA=${GIT_SHA}" main.go FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}alpine:${ALPINE_VERSION} AS final - ARG PROJECT_NAME=zookeeper-operator COPY --from=go-builder /src/${PROJECT_NAME} /usr/local/bin/${PROJECT_NAME} diff --git a/Makefile b/Makefile index 9017f7577..f754ce0e0 100644 --- a/Makefile +++ b/Makefile @@ -149,6 +149,25 @@ build-zk-image: docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(APP_REPO):$(VERSION) ./docker docker tag $(APP_REPO):$(VERSION) $(APP_REPO):latest +build-multiarch-image: + docker buildx build \ + --build-arg VERSION=$(VERSION) \ + --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) \ + --build-arg GIT_SHA=$(GIT_SHA) \ + --platform=linux/amd64,linux/arm64 \ + -t $(REPO):$(VERSION) . + docker tag $(REPO):$(VERSION) $(REPO):latest + +build-multiarch-zk-image: + docker buildx build \ + --build-arg VERSION=$(VERSION) \ + --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) \ + --build-arg GIT_SHA=$(GIT_SHA) \ + --platform=linux/amd64,linux/arm64 \ + -t $(APP_REPO):$(VERSION) \ + ./docker + docker tag $(APP_REPO):$(VERSION) $(APP_REPO):latest + build-zk-image-swarm: docker build --build-arg VERSION=$(VERSION)-swarm --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) \ -f ./docker/Dockerfile-swarm -t $(APP_REPO):$(VERSION)-swarm ./docker @@ -180,7 +199,7 @@ login: test-login: echo "$(DOCKER_TEST_PASS)" | docker login -u "$(DOCKER_TEST_USER)" --password-stdin -push: build-image build-zk-image login +push: build-multiarch-image build-multiarch-zk-image login docker push $(REPO):$(VERSION) docker push $(REPO):latest docker push $(APP_REPO):$(VERSION) From f5c9d8b638b040e258d6f593835d122e4c506f15 Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 22:05:17 +0200 Subject: [PATCH 07/15] change repo for testing Signed-off-by: Marco Moscher --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index f754ce0e0..7cd699bd4 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,9 @@ CRD_OPTIONS ?= "crd" PROJECT_NAME=zookeeper-operator EXPORTER_NAME=zookeeper-exporter APP_NAME=zookeeper -REPO=pravega/$(PROJECT_NAME) +REPO=mmoscher/$(PROJECT_NAME) TEST_REPO=testzkop/$(PROJECT_NAME) -APP_REPO=pravega/$(APP_NAME) +APP_REPO=mmoscher/$(APP_NAME) ALTREPO=emccorp/$(PROJECT_NAME) APP_ALTREPO=emccorp/$(APP_NAME) VERSION=$(shell git describe --always --tags --dirty | tr -d "v" | sed "s/\(.*\)-g`git rev-parse --short HEAD`/\1/") @@ -204,14 +204,14 @@ push: build-multiarch-image build-multiarch-zk-image login docker push $(REPO):latest docker push $(APP_REPO):$(VERSION) docker push $(APP_REPO):latest - docker tag $(REPO):$(VERSION) $(ALTREPO):$(VERSION) - docker tag $(REPO):$(VERSION) $(ALTREPO):latest - docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):$(VERSION) - docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):latest - docker push $(ALTREPO):$(VERSION) - docker push $(ALTREPO):latest - docker push $(APP_ALTREPO):$(VERSION) - docker push $(APP_ALTREPO):latest + # docker tag $(REPO):$(VERSION) $(ALTREPO):$(VERSION) + # docker tag $(REPO):$(VERSION) $(ALTREPO):latest + # docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):$(VERSION) + # docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):latest + # docker push $(ALTREPO):$(VERSION) + # docker push $(ALTREPO):latest + # docker push $(APP_ALTREPO):$(VERSION) + # docker push $(APP_ALTREPO):latest clean: rm -f bin/$(PROJECT_NAME) From e0c8c56ded1d5a20349d2484568c09811891f26a Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 22:29:36 +0200 Subject: [PATCH 08/15] minor rework, push mutliarch directly Signed-off-by: Marco Moscher --- .github/workflows/ci.yaml | 8 ++------ Makefile | 31 ++++++++++++++++++------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 35313b294..36b2caa42 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -76,9 +76,5 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Pushing docker images - run: sudo make push - - name: Uploading binary files - uses: actions/upload-artifact@v2 - with: - name: zookeeper-exporter - path: bin/zookeeper-exporter* + run: | + make push-multiarch diff --git a/Makefile b/Makefile index 7cd699bd4..df487e0c9 100644 --- a/Makefile +++ b/Makefile @@ -151,22 +151,25 @@ build-zk-image: build-multiarch-image: docker buildx build \ + --push \ --build-arg VERSION=$(VERSION) \ --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) \ --build-arg GIT_SHA=$(GIT_SHA) \ --platform=linux/amd64,linux/arm64 \ - -t $(REPO):$(VERSION) . - docker tag $(REPO):$(VERSION) $(REPO):latest + -t $(REPO):$(VERSION) + -t $(REPO):latest \ + . build-multiarch-zk-image: docker buildx build \ + --push \ --build-arg VERSION=$(VERSION) \ --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) \ --build-arg GIT_SHA=$(GIT_SHA) \ --platform=linux/amd64,linux/arm64 \ -t $(APP_REPO):$(VERSION) \ + -t $(APP_REPO):latest \ ./docker - docker tag $(APP_REPO):$(VERSION) $(APP_REPO):latest build-zk-image-swarm: docker build --build-arg VERSION=$(VERSION)-swarm --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) \ @@ -194,24 +197,26 @@ run-local: go run ./main.go login: - @docker login -u "$(DOCKER_USER)" -p "$(DOCKER_PASS)" + echo "$(DOCKER_PASS)" | docker login -u "$(DOCKER_USER)" --password-stdin test-login: echo "$(DOCKER_TEST_PASS)" | docker login -u "$(DOCKER_TEST_USER)" --password-stdin -push: build-multiarch-image build-multiarch-zk-image login +push-multiarch: login build-multiarch-image build-multiarch-zk-image + +push: build-image build-zk-image login docker push $(REPO):$(VERSION) docker push $(REPO):latest docker push $(APP_REPO):$(VERSION) docker push $(APP_REPO):latest - # docker tag $(REPO):$(VERSION) $(ALTREPO):$(VERSION) - # docker tag $(REPO):$(VERSION) $(ALTREPO):latest - # docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):$(VERSION) - # docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):latest - # docker push $(ALTREPO):$(VERSION) - # docker push $(ALTREPO):latest - # docker push $(APP_ALTREPO):$(VERSION) - # docker push $(APP_ALTREPO):latest + docker tag $(REPO):$(VERSION) $(ALTREPO):$(VERSION) + docker tag $(REPO):$(VERSION) $(ALTREPO):latest + docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):$(VERSION) + docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):latest + docker push $(ALTREPO):$(VERSION) + docker push $(ALTREPO):latest + docker push $(APP_ALTREPO):$(VERSION) + docker push $(APP_ALTREPO):latest clean: rm -f bin/$(PROJECT_NAME) From a57ecac6fcf7ca8d70c594d64983f05175b3717d Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 22:35:01 +0200 Subject: [PATCH 09/15] adds checkout to ci.yaml Signed-off-by: Marco Moscher --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 36b2caa42..24dda4746 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -71,6 +71,8 @@ jobs: #needs: build if: github.event_name == 'release' && github.event.action == 'created' steps: + - name: Check out code + uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx From 3ce4de06e5cca51a7421fe8133ef7f833977bfff Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 22:35:18 +0200 Subject: [PATCH 10/15] fixes job naming Signed-off-by: Marco Moscher --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 24dda4746..3acc2bb52 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -77,6 +77,6 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Pushing docker images + - name: Build and publish docker images run: | make push-multiarch From 348a50117254fccad89c85cb0172f39f2b0b7f4e Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 22:42:30 +0200 Subject: [PATCH 11/15] reworks ci Signed-off-by: Marco Moscher --- .github/workflows/ci.yaml | 6 +++++- Makefile | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3acc2bb52..368010735 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -77,6 +77,10 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Run docker login + run: | + echo "${{ secrets.DOCKER_PASS }}" | docker login -u "${{ secrets.DOCKER_PASS }}" --password-stdin - name: Build and publish docker images run: | - make push-multiarch + make build-and-push-multiarch-image + make build-and-push-multiarch-zk-image diff --git a/Makefile b/Makefile index df487e0c9..6259a6845 100644 --- a/Makefile +++ b/Makefile @@ -149,7 +149,7 @@ build-zk-image: docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(APP_REPO):$(VERSION) ./docker docker tag $(APP_REPO):$(VERSION) $(APP_REPO):latest -build-multiarch-image: +build-and-push-multiarch: docker buildx build \ --push \ --build-arg VERSION=$(VERSION) \ @@ -160,7 +160,7 @@ build-multiarch-image: -t $(REPO):latest \ . -build-multiarch-zk-image: + build-and-push-multiarch-zk-image: docker buildx build \ --push \ --build-arg VERSION=$(VERSION) \ @@ -202,8 +202,6 @@ login: test-login: echo "$(DOCKER_TEST_PASS)" | docker login -u "$(DOCKER_TEST_USER)" --password-stdin -push-multiarch: login build-multiarch-image build-multiarch-zk-image - push: build-image build-zk-image login docker push $(REPO):$(VERSION) docker push $(REPO):latest From 6e1a85d708fe7944e4c47e9d2a08a2e15e463add Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 22:45:19 +0200 Subject: [PATCH 12/15] fixes variable name Signed-off-by: Marco Moscher --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 368010735..84e36aa80 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -79,7 +79,7 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Run docker login run: | - echo "${{ secrets.DOCKER_PASS }}" | docker login -u "${{ secrets.DOCKER_PASS }}" --password-stdin + echo "${{ secrets.DOCKER_PASS }}" | docker login -u "${{ secrets.DOCKER_USER }}" --password-stdin - name: Build and publish docker images run: | make build-and-push-multiarch-image From 336db272acac8100024220a10b31b28e95ddce35 Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 22:46:45 +0200 Subject: [PATCH 13/15] finally... Signed-off-by: Marco Moscher --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6259a6845..43ad8fd06 100644 --- a/Makefile +++ b/Makefile @@ -149,7 +149,7 @@ build-zk-image: docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(APP_REPO):$(VERSION) ./docker docker tag $(APP_REPO):$(VERSION) $(APP_REPO):latest -build-and-push-multiarch: +build-and-push-multiarch-image: docker buildx build \ --push \ --build-arg VERSION=$(VERSION) \ From 11b5181a6aa2cb6650174fe3d533fc669bde9b9e Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 22:48:37 +0200 Subject: [PATCH 14/15] fixed missing slash Signed-off-by: Marco Moscher --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 43ad8fd06..0348bbbe6 100644 --- a/Makefile +++ b/Makefile @@ -156,7 +156,7 @@ build-and-push-multiarch-image: --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) \ --build-arg GIT_SHA=$(GIT_SHA) \ --platform=linux/amd64,linux/arm64 \ - -t $(REPO):$(VERSION) + -t $(REPO):$(VERSION) \ -t $(REPO):latest \ . From d6edd99ad1af06b4c45e1834cc09c785bb2a6322 Mon Sep 17 00:00:00 2001 From: Marco Moscher Date: Wed, 12 Oct 2022 23:01:20 +0200 Subject: [PATCH 15/15] undo changes for testing Signed-off-by: Marco Moscher --- .github/workflows/ci.yaml | 102 +++++++++++++++++++------------------- Dockerfile | 1 + Makefile | 4 +- 3 files changed, 54 insertions(+), 53 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 84e36aa80..809e76b00 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,60 +15,60 @@ on: # jobs to run jobs: - # build: - # runs-on: ubuntu-latest - # steps: - # - name: Set up Go 1.17 - # uses: actions/setup-go@v2 - # with: - # go-version: 1.17 - # id: go - # - name: Set up Go for root - # run: | - # sudo ln -sf `which go` `sudo which go` || true - # sudo go version - # - name: Check out code into the Go module directory - # uses: actions/checkout@v2 - # - name: get go version - # run: go version - # - name: Gofmt and License checks - # run: make check - # - name: unit tests - # run: make test - # - name: Codecov - # uses: codecov/codecov-action@v1.0.12 - # - name: Set env - # run: | - # echo "KUBERNETES_VERSION=v1.23.1" >> $GITHUB_ENV - # echo "MINIKUBE_VERSION=v1.25.2" >> $GITHUB_ENV - # echo "KUBERNETES_CONFIG_FILE=$HOME/.kube/config" >> $GITHUB_ENV - # echo "CHANGE_MINIKUBE_NONE_USER=true" >> $GITHUB_ENV - # - name: minikube setup - # run: | - # curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$KUBERNETES_VERSION/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ - # curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ - # sudo mount --make-rshared / - # sudo apt-get install -y conntrack - # CHANGE_MINIKUBE_NONE_USER=true - # export KUBERNETES_CONFIG_FILE=$HOME/.kube/config - # export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true;sudo minikube start --vm-driver=none --bootstrapper=kubeadm --kubernetes-version=$KUBERNETES_VERSION - # echo "minikube started, updating context" - # export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true; sudo minikube update-context - # echo "context is updated" - # #JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done - # sleep 60 - # sudo kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default - # echo "created cluster role" - # sudo kubectl cluster-info - # echo "cluster info" - # sudo kubectl -n kube-system get pod -o wide - # sudo kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username="testanisha" --docker-password="123456789" --docker-email=testimage456@gmail.com - # - name: E2E - # run: sudo make test-e2e + build: + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.17 + uses: actions/setup-go@v2 + with: + go-version: 1.17 + id: go + - name: Set up Go for root + run: | + sudo ln -sf `which go` `sudo which go` || true + sudo go version + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + - name: get go version + run: go version + - name: Gofmt and License checks + run: make check + - name: unit tests + run: make test + - name: Codecov + uses: codecov/codecov-action@v1.0.12 + - name: Set env + run: | + echo "KUBERNETES_VERSION=v1.23.1" >> $GITHUB_ENV + echo "MINIKUBE_VERSION=v1.25.2" >> $GITHUB_ENV + echo "KUBERNETES_CONFIG_FILE=$HOME/.kube/config" >> $GITHUB_ENV + echo "CHANGE_MINIKUBE_NONE_USER=true" >> $GITHUB_ENV + - name: minikube setup + run: | + curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$KUBERNETES_VERSION/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ + curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ + sudo mount --make-rshared / + sudo apt-get install -y conntrack + CHANGE_MINIKUBE_NONE_USER=true + export KUBERNETES_CONFIG_FILE=$HOME/.kube/config + export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true;sudo minikube start --vm-driver=none --bootstrapper=kubeadm --kubernetes-version=$KUBERNETES_VERSION + echo "minikube started, updating context" + export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true; sudo minikube update-context + echo "context is updated" + #JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done + sleep 60 + sudo kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default + echo "created cluster role" + sudo kubectl cluster-info + echo "cluster info" + sudo kubectl -n kube-system get pod -o wide + sudo kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username="testanisha" --docker-password="123456789" --docker-email=testimage456@gmail.com + - name: E2E + run: sudo make test-e2e publish: name: Publish docker image runs-on: ubuntu-latest - #needs: build + needs: build if: github.event_name == 'release' && github.event.action == 'created' steps: - name: Check out code diff --git a/Dockerfile b/Dockerfile index b578ed971..7139b330b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ ARG DOCKER_REGISTRY ARG ALPINE_VERSION=3.15 +ARG BUILDPLATFORM=linux/amd64 FROM --platform=$BUILDPLATFORM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:1.17-alpine${ALPINE_VERSION} as go-builder ARG PROJECT_NAME=zookeeper-operator diff --git a/Makefile b/Makefile index 0348bbbe6..1d05824be 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,9 @@ CRD_OPTIONS ?= "crd" PROJECT_NAME=zookeeper-operator EXPORTER_NAME=zookeeper-exporter APP_NAME=zookeeper -REPO=mmoscher/$(PROJECT_NAME) +REPO=pravega/$(PROJECT_NAME) TEST_REPO=testzkop/$(PROJECT_NAME) -APP_REPO=mmoscher/$(APP_NAME) +APP_REPO=pravega/$(APP_NAME) ALTREPO=emccorp/$(PROJECT_NAME) APP_ALTREPO=emccorp/$(APP_NAME) VERSION=$(shell git describe --always --tags --dirty | tr -d "v" | sed "s/\(.*\)-g`git rev-parse --short HEAD`/\1/")