diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index ab3deeda..b9650864 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -89,7 +89,7 @@ jobs: - name: Create release assets id: create-assets env: - IMG: "europe-docker.pkg.dev/kyma-project/prod/serverless-operator:${{ github.event.inputs.name }}" + IMG: "europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:${{ github.event.inputs.name }}" PULL_BASE_REF: ${{ github.event.inputs.name }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: ./.github/scripts/release.sh diff --git a/.github/workflows/operator-verify.yaml b/.github/workflows/operator-verify.yaml index e0702fbd..a23b6d99 100644 --- a/.github/workflows/operator-verify.yaml +++ b/.github/workflows/operator-verify.yaml @@ -55,7 +55,7 @@ jobs: - name: upgrade test run: make -C hack upgrade-test env: - IMG: europe-docker.pkg.dev/kyma-project/prod/serverless-operator:${{ github.sha }} + IMG: europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:${{ github.sha }} gardener-integration-test: if: github.event_name == 'push' @@ -76,7 +76,7 @@ jobs: - name: run test run: make -C hack integration-test-on-cluster env: - IMG: europe-docker.pkg.dev/kyma-project/prod/serverless-operator:${{ github.sha }} + IMG: europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:${{ github.sha }} - name: deprovision gardener # https://docs.github.com/en/actions/learn-github-actions/expressions#always if: ${{ always() }} diff --git a/.github/workflows/serverless-verify.yaml b/.github/workflows/serverless-verify.yaml deleted file mode 100644 index 24527755..00000000 --- a/.github/workflows/serverless-verify.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: Docker registry verify - -on: - push: - branches: [ "main", "release-*" ] - pull_request: - paths-ignore: - - 'docs/**' - - 'examples/**' - types: - - opened - - reopened - - synchronize - - ready_for_review - - converted_to_draft - -jobs: - integration-test: - runs-on: ubuntu-latest - if: github.event.pull_request.draft == false - steps: - - uses: actions/checkout@v4 - - name: create single cluster - uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79 #v2.4.0 - with: - cluster-name: "k3dCluster" - args: >- - --agents 1 - --image rancher/k3s:v1.28.6-k3s1 - --port 80:80@loadbalancer - --port 443:443@loadbalancer - --wait - - name: run integration test (pre) - if: github.event_name == 'pull_request' - run: make -C hack integration-test-on-cluster - env: - IMG: europe-docker.pkg.dev/kyma-project/dev/dockerregistry-operator:PR-${{ github.event.number }} - - name: run integration test (post) - if: github.event_name == 'push' - run: make -C hack integration-test-on-cluster - env: - IMG: europe-docker.pkg.dev/kyma-project/prod/serverless-operator:${{ github.sha }} - - #post-serverless-git-auth-integration-k3s - git-auth-integration-test: - if: github.event_name == 'push' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: create single cluster - uses: AbsaOSS/k3d-action@4e8b3239042be1dc0aed6c5eb80c13b18200fc79 #v2.4.0 - with: - cluster-name: "k3dCluster" - args: >- - --agents 1 - --image rancher/k3s:v1.28.6-k3s1 - --port 80:80@loadbalancer - --port 443:443@loadbalancer - --wait - - name: run git auth tests - run: make -C hack git-auth-test-on-cluster - env: - APP_TEST_GITHUB_SSH_AUTH_KEY: ${{ secrets.GIT_AUTH_TEST_GITHUB_SSH_KEY }} - APP_TEST_AZURE_BASIC_AUTH_USERNAME: ${{ secrets.GIT_AUTH_TEST_AZURE_USERNAME }} - APP_TEST_AZURE_BASIC_AUTH_PASSWORD: ${{ secrets.GIT_AUTH_TEST_AZURE_PASSWORD }} - IMG: europe-docker.pkg.dev/kyma-project/prod/serverless-operator:${{ github.sha }} diff --git a/components/operator/Dockerfile b/components/operator/Dockerfile index e1ee7c5a..012d7d1b 100644 --- a/components/operator/Dockerfile +++ b/components/operator/Dockerfile @@ -22,35 +22,13 @@ COPY components/operator components/operator RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o operator ./components/operator/main.go -# Replace main images in values.yaml -# Bumping dockerregistry images in the values.yaml - used for building "local" and "dev" images -FROM alpine:3.19.1 as replacer - -WORKDIR /workspace - -# TODO: remove variable PURPOSE -ARG PURPOSE -ARG IMG_DIRECTORY -ARG IMG_VERSION - -ENV IMG_DIRECTORY=$IMG_DIRECTORY -ENV IMG_VERSION=$IMG_VERSION -ENV PROJECT_ROOT="." - -RUN apk update && apk add bash yq - -COPY components/operator/hack components/operator/hack -COPY config/docker-registry config/docker-registry -COPY hack/ hack/ - - # Use distroless as minimal base image to package the operator binary # Refer to https://github.com/GoogleContainerTools/distroless for more details FROM gcr.io/distroless/static:nonroot WORKDIR / COPY --chown=65532:65532 --from=builder /workspace/operator . -COPY --chown=65532:65532 --from=replacer /workspace/config/docker-registry /module-chart +COPY --chown=65532:65532 config/docker-registry /module-chart USER 65532:65532 ENTRYPOINT ["/operator"] diff --git a/components/operator/Makefile b/components/operator/Makefile index 10c134f7..49b5c799 100644 --- a/components/operator/Makefile +++ b/components/operator/Makefile @@ -7,7 +7,7 @@ include ${PROJECT_ROOT}/hack/help.mk # incoming variables # Image URL to use all building/pushing image targets -IMG ?= europe-docker.pkg.dev/kyma-project/prod/serverless-operator:main +IMG ?= europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:main # Setting SHELL to bash allows bash commands to be executed by recipes. # Options are set to exit when a recipe line exits non-zero or a piped command fails. @@ -48,13 +48,9 @@ build: generate fmt vet ## Build operator binary. run: manifests generate fmt vet ## Run a controller from your host. go run ./main.go -.PHONY: docker-build-dev -docker-build-dev: manifests generate ## Build docker dev image with the operator. - docker build -t ${IMG} -f Dockerfile $(PROJECT_ROOT) --build-arg=PURPOSE="dev" --build-arg=IMG_DIRECTORY="$(IMG_DIRECTORY)" --build-arg=IMG_VERSION="$(IMG_VERSION)" - -.PHONY: docker-build-local -docker-build-local: manifests generate ## Build docker local image with the operator. - docker build -t ${IMG} -f Dockerfile $(PROJECT_ROOT) --build-arg=PURPOSE="local" --build-arg=IMG_DIRECTORY="$(IMG_DIRECTORY)" --build-arg=IMG_VERSION="$(IMG_VERSION)" +.PHONY: docker-build +docker-build: manifests generate ## Build docker image with the operator. + docker build -t ${IMG} -f Dockerfile $(PROJECT_ROOT) .PHONY: docker-push docker-push: ## Push docker image with the operator. @@ -98,7 +94,7 @@ generate-kustomization-dev: .PHONY: deploy deploy: manifests kustomize generate-kustomization-dev ## Deploy controller to the K8s cluster specified in ~/.kube/config with image from IMG env. kubectl create namespace kyma-system || true - cd $(CONFIG_OPERATOR_DEV) && $(KUSTOMIZE) edit set image europe-docker.pkg.dev/kyma-project/prod/serverless-operator=${IMG} + cd $(CONFIG_OPERATOR_DEV) && $(KUSTOMIZE) edit set image europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator=${IMG} $(KUSTOMIZE) build $(CONFIG_OPERATOR_DEV) | kubectl apply -f - @@ -141,11 +137,6 @@ print-dockerregistry-details: ## Print all pods, deploys and dockerregistry CRs ##@ Module - -.PHONY: module-image-dev -module-image-dev: docker-build-dev docker-push ## Build the dev Module Image and push it to a registry defined in IMG. - echo "built and pushed module image $(IMG)" - -.PHONY: module-image-local -module-image-local: docker-build-local docker-push ## Build the local Module Image and push it to a registry defined in IMG. +.PHONY: module-image +module-image: docker-build docker-push ## Build the Module Image and push it to a registry defined in IMG. echo "built and pushed module image $(IMG)" diff --git a/config/operator/dev/kustomization.yaml.tpl b/config/operator/dev/kustomization.yaml.tpl index f84a747f..412e9c94 100644 --- a/config/operator/dev/kustomization.yaml.tpl +++ b/config/operator/dev/kustomization.yaml.tpl @@ -4,6 +4,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization # To overwrite image in base it has to point to the image in base kustomization.yaml images: -- name: europe-docker.pkg.dev/kyma-project/prod/serverless-operator +- name: europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator newName: local-registry newTag: local