diff --git a/.github/workflows/image-build.yaml b/.github/workflows/image-build.yaml index a780249ba..8d8a48502 100644 --- a/.github/workflows/image-build.yaml +++ b/.github/workflows/image-build.yaml @@ -17,10 +17,6 @@ jobs: id-token: write # needed for signing the images with GitHub OIDC Token runs-on: ubuntu-latest - env: - WF_BPFMAN_AGENT_IMG: quay.io/bpfman/bpfman-agent - WF_BPFMAN_OPERATOR_IMG: quay.io/bpfman/bpfman-operator - WF_MULTIARCH_TARGETS: amd64 arm64 ppc64le s390x strategy: fail-fast: false matrix: @@ -51,6 +47,75 @@ jobs: # set latest tag for default branch type=raw,value=latest,enable={{is_default_branch}} + name: Build Image (${{ matrix.image.image }}) + steps: + - name: Checkout bpfman + uses: actions/checkout@v4 + + - name: Install cosign + uses: sigstore/cosign-installer@v3.5.0 + + - name: Login to quay.io/bpfman + uses: redhat-actions/podman-login@v1 + if: ${{ github.event_name == 'push' && matrix.image.repository == 'bpfman'}} + with: + registry: ${{ matrix.image.registry }} + username: ${{ secrets.BPFMAN_USERNAME }} + password: ${{ secrets.BPFMAN_ROBOT_TOKEN }} + + - name: Extract metadata (tags, labels) for image + id: meta + uses: docker/metadata-action@v5.5.1 + with: + images: ${{ matrix.image.registry }}/${{ matrix.image.repository }}/${{ matrix.image.image }} + tags: ${{ matrix.image.tags }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Set push flag + id: set-push + run: | + if [ ${{ github.event_name }} == 'push' ]; then + echo "push_flag=true" >> "$GITHUB_OUTPUT" + else + echo "push_flag=false" >> "$GITHUB_OUTPUT" + fi + + - name: Build and push + id: build-push-image + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x + push: ${{ fromJSON(steps.set-push.outputs.push_flag) }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: ${{ matrix.image.dockerfile }} + build-args: ${{ matrix.image.build_args }} + context: ${{ matrix.image.context }} + + - name: Sign the images with GitHub OIDC Token + if: ${{ github.event_name == 'push' }} + run: | + readarray -t tags <<<"${{ steps.meta.outputs.tags }}" + for tag in ${tags[@]}; do + cosign sign -y "${tag}@${{ steps.push-image.outputs.digest }}" + done + + generate-and-push-bundle-images: + permissions: + contents: read + packages: write + id-token: write # needed for signing the images with GitHub OIDC Token + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + image: - registry: quay.io repository: bpfman image: bpfman-operator-bundle @@ -64,21 +129,17 @@ jobs: # set latest tag for default branch type=raw,value=latest,enable={{is_default_branch}} - name: Build Image (${{ matrix.image.image }}) + name: Build Bundle Image (${{ matrix.image.image }}) steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - # prettier-ignore - go-version: '1.22' # yamllint disable-line rule:quoted-strings + - name: Checkout bpfman + uses: actions/checkout@v4 - - uses: sigstore/cosign-installer@v3.5.0 + - name: Install cosign + uses: sigstore/cosign-installer@v3.5.0 - name: Generate olm bundle on disk - if: ${{ matrix.image.image == 'bpfman-operator-bundle' }} run: | - make bundle + make bundle-build - name: Login to quay.io/bpfman uses: redhat-actions/podman-login@v1 @@ -95,21 +156,10 @@ jobs: images: ${{ matrix.image.registry }}/${{ matrix.image.repository }}/${{ matrix.image.image }} tags: ${{ matrix.image.tags }} - - name: Build image - id: build-image - uses: redhat-actions/buildah-build@v2 - with: - image: ${{ matrix.image.image }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - containerfiles: ${{ matrix.image.dockerfile }} - build-args: ${{ matrix.image.build_args }} - context: ${{ matrix.image.context }} - - name: Push to registry id: push-image uses: redhat-actions/push-to-registry@v2 - if: ${{ github.event_name == 'push' && matrix.image.image != 'mutli-arch-images' }} + if: ${{ github.event_name == 'push' }} with: tags: ${{ steps.meta.outputs.tags }} @@ -120,26 +170,3 @@ jobs: for tag in ${tags[@]}; do cosign sign -y "${tag}@${{ steps.push-image.outputs.digest }}" done - - name: get short sha - run: | - echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - - name: Build operator multi arch images - if: ${{ matrix.image.image == 'bpfman-operator' }} - run: | - BPFMAN_AGENT_IMG="${{ env.WF_BPFMAN_AGENT_IMG }}:${{ env.short_sha }}" BPFMAN_OPERATOR_IMG="${{ env.WF_BPFMAN_OPERATOR_IMG}}:${{ env.short_sha }}" MULTIARCH_TARGETS="${{ env.WF_MULTIARCH_TARGETS }}" make build-operator-images - - - name: Push operator multi arch images and manifest - if: ${{ github.event_name == 'push' && matrix.image.image == 'bpfman-operator' }} - run: | - BPFMAN_AGENT_IMG="${{ env.WF_BPFMAN_AGENT_IMG }}:${{ env.short_sha }}" BPFMAN_OPERATOR_IMG="${{ env.WF_BPFMAN_OPERATOR_IMG}}:${{ env.short_sha }}" MULTIARCH_TARGETS="${{ env.WF_MULTIARCH_TARGETS }}" make operator-images - - - name: Build agent multi arch images - if: ${{ matrix.image.image == 'bpfman-agent' }} - run: | - BPFMAN_AGENT_IMG="${{ env.WF_BPFMAN_AGENT_IMG }}:${{ env.short_sha }}" BPFMAN_OPERATOR_IMG="${{ env.WF_BPFMAN_OPERATOR_IMG}}:${{ env.short_sha }}" MULTIARCH_TARGETS="${{ env.WF_MULTIARCH_TARGETS }}" make build-agent-images - - - name: Push agent multi arch images and manifest - if: ${{ github.event_name == 'push' && matrix.image.image == 'bpfman-agent' }} - run: | - BPFMAN_AGENT_IMG="${{ env.WF_BPFMAN_AGENT_IMG }}:${{ env.short_sha }}" BPFMAN_OPERATOR_IMG="${{ env.WF_BPFMAN_OPERATOR_IMG}}:${{ env.short_sha }}" MULTIARCH_TARGETS="${{ env.WF_MULTIARCH_TARGETS }}" make agent-images diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ce41b40ee..3b14bef85 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -16,58 +16,76 @@ jobs: uses: apache/skywalking-eyes@cd7b195c51fd3d6ad52afceb760719ddc6b3ee91 build-lint-test: - name: Build, lint, test + name: Build (Go ${{ matrix.go }} - ${{ matrix.arch.arch }}) runs-on: ubuntu-latest strategy: + fail-fast: false matrix: go: ['1.22'] + arch: + - arch: amd64 + filename: linux-x86_64 + - arch: arm64 + filename: linux-arm64 + - arch: ppc64le + filename: linux-ppc64le + - arch: s390x + filename: linux-s390x steps: - - name: install make - run: sudo apt-get install make - - name: set up go 1.x - uses: actions/setup-go@v3 + - name: Install go + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - - name: checkout - uses: actions/checkout@v3 - - name: check format + + - name: Checkout bpfman-operator + uses: actions/checkout@v4 + + - name: Check format + if: ${{ matrix.arch.arch == 'amd64' }} run: make fmt && git add -A && git diff --exit-code - - name: build, lint, test - run: make build lint test - - name: check clean vendors - run: go mod vendor - - name: Report coverage - if: ${{ matrix.go == '1.22' }} - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + - name: Build Operator and Agent + run: GOARCH=${{ matrix.arch.arch }} make build + + - name: Run lint + if: ${{ matrix.arch.arch == 'amd64' }} + run: make lint + + - name: Verify Autogenerated Code + if: ${{ matrix.arch.arch == 'amd64' }} + run: make verify + + - name: Run test + if: ${{ matrix.arch.arch == 'amd64' }} + run: make test + + - name: Archive Go code coverage results + if: ${{ matrix.arch.arch == 'amd64' && matrix.go == '1.22' }} + uses: actions/upload-artifact@v4 with: - files: ./cover.out - flags: unittests - fail_ci_if_error: false - verbose: true + name: coverage-go + path: cover.out + if-no-files-found: error + + - name: Check clean vendors + if: ${{ matrix.arch.arch == 'amd64' }} + run: go mod vendor - bundle-check: - runs-on: ubuntu-latest - name: Checking bundle up-to-date - steps: - - name: install make - run: sudo apt-get install make - - name: checkout - uses: actions/checkout@v3 - name: Verify generated bundle manifest + if: ${{ matrix.arch.arch == 'amd64' }} run: | make bundle git diff --exit-code -I'^ createdAt: ' bundle kubernetes-integration-tests: + name: Kubernetes Integration Tests (Go ${{ matrix.go }} - amd64) runs-on: ubuntu-latest strategy: matrix: go: ['1.22'] env: - WF_BPFMAN_AGENT_IMG: quay.io/bpfman/bpfman-agent:int-test - WF_BPFMAN_OPERATOR_IMG: quay.io/bpfman/bpfman-operator:int-test + BPFMAN_AGENT_IMG: quay.io/bpfman/bpfman-agent:int-test + BPFMAN_OPERATOR_IMG: quay.io/bpfman/bpfman-operator:int-test XDP_PASS_PRIVATE_IMAGE_CREDS: ${{ secrets.XDP_PASS_PRIVATE_IMAGE_CREDS }} steps: - name: Check disk space @@ -84,8 +102,8 @@ jobs: - name: Check disk space again run: df -h - - name: set up go 1.x - uses: actions/setup-go@v3 + - name: Install go + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} @@ -96,24 +114,25 @@ jobs: key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-build-codegen- - - name: checkout repository + + - name: Checkout bpfman-operator uses: actions/checkout@v4 with: fetch-depth: 0 - - name: build images + - name: Build Operator and Agent images run: | - MULTIARCH_TARGETS="amd64" BPFMAN_AGENT_IMG="${{ env.WF_BPFMAN_AGENT_IMG }}" BPFMAN_OPERATOR_IMG="${{ env.WF_BPFMAN_OPERATOR_IMG}}" make build-images + make build-images - - name: run integration tests + - name: Run integration tests run: | - BPFMAN_AGENT_IMG="${{ env.WF_BPFMAN_AGENT_IMG }}-amd64" BPFMAN_OPERATOR_IMG="${{ env.WF_BPFMAN_OPERATOR_IMG}}-amd64" make test-integration + make test-integration - name: Check disk space run: df -h ## Upload diagnostics if integration test step failed. - - name: upload diagnostics + - name: Upload diagnostics if: ${{ failure() }} uses: actions/upload-artifact@v4 with: @@ -121,12 +140,31 @@ jobs: path: /tmp/ktf-diag* if-no-files-found: ignore + coverage: + needs: [build-lint-test] + runs-on: ubuntu-latest + steps: + - name: Download golang coverage artifacts + uses: actions/download-artifact@v4 + with: + name: coverage-go + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: ./cover.out + flags: unittests + fail_ci_if_error: false + verbose: true + build-workflow-complete: needs: [ check-license, build-lint-test, - bundle-check, + coverage, kubernetes-integration-tests, ] runs-on: ubuntu-latest diff --git a/Containerfile.bpfman-agent b/Containerfile.bpfman-agent index f3d4c4706..b30f14b5d 100644 --- a/Containerfile.bpfman-agent +++ b/Containerfile.bpfman-agent @@ -1,10 +1,14 @@ # Build the manager binary -ARG TARGETPLATFORM -ARG BUILDPLATFORM -FROM docker.io/library/golang:1.22 as bpfman-agent-build +ARG BUILDPLATFORM=linux/amd64 + +FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 as bpfman-agent-build + +# The following ARGs are set internally by docker/build-push-action in github actions ARG TARGETOS -ARG TARGETPLATFORM ARG TARGETARCH +ARG TARGETPLATFORM + +RUN echo "TARGETOS=${TARGETOS} TARGETARCH=${TARGETARCH} BUILDPLATFORM=${BUILDPLATFORM} TARGETPLATFORM=${TARGETPLATFORM}" WORKDIR /usr/src/bpfman-operator @@ -31,7 +35,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -mod ven # Use the fedora minimal image to reduce the size of the final image but still # be able to easily install extra packages. -FROM quay.io/fedora/fedora-minimal +FROM --platform=$TARGETPLATFORM quay.io/fedora/fedora-minimal ARG DNF_CMD="microdnf" # The full fedora image can be used for debugging purposes. To use it, comment @@ -40,13 +44,15 @@ ARG DNF_CMD="microdnf" # ARG DNF_CMD="dnf" ARG TARGETARCH +ARG TARGETPLATFORM + WORKDIR / COPY --from=bpfman-agent-build /usr/src/bpfman-operator/bpfman-agent . # Install crictl RUN ${DNF_CMD} -y install wget tar gzip ARG VERSION="v1.28.0" -RUN wget https://github.com/kubernetes-sigs/cri-tools/releases/download/${VERSION}/crictl-${VERSION}-linux-${TARGETARCH}.tar.gz +RUN wget --no-check-certificate https://github.com/kubernetes-sigs/cri-tools/releases/download/${VERSION}/crictl-${VERSION}-linux-${TARGETARCH}.tar.gz RUN tar zxvf crictl-${VERSION}-linux-${TARGETARCH}.tar.gz -C /usr/local/bin RUN rm -f crictl-${VERSION}-linux-${TARGETARCH}.tar.gz RUN ${DNF_CMD} -y clean all diff --git a/Containerfile.bpfman-operator b/Containerfile.bpfman-operator index ff2fb463c..97901f90b 100644 --- a/Containerfile.bpfman-operator +++ b/Containerfile.bpfman-operator @@ -1,10 +1,16 @@ # Build the manager binary -ARG TARGETPLATFORM +ARG BUILDPLATFORM=linux/amd64 + +FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 as bpfman-operator-build + ARG BUILDPLATFORM -FROM docker.io/library/golang:1.22 as bpfman-operator-build + +# The following ARGs are set internally by docker/build-push-action in github actions ARG TARGETOS -ARG TARGETPLATFORM ARG TARGETARCH +ARG TARGETPLATFORM + +RUN echo "TARGETOS=${TARGETOS} TARGETARCH=${TARGETARCH} BUILDPLATFORM=${BUILDPLATFORM} TARGETPLATFORM=${TARGETPLATFORM}" WORKDIR /usr/src/bpfman-operator @@ -35,8 +41,11 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -mod ven # The full fedora image can be used for debugging purposes, but you may need to # change "microdnf" to "dnf" below to install extra packages. # FROM fedora:38 -FROM quay.io/fedora/fedora-minimal -ARG TARGETARCH +FROM --platform=$TARGETPLATFORM quay.io/fedora/fedora-minimal + +# The following ARGs are set internally by docker or podman on multiarch builds +ARG TARGETPLATFORM + WORKDIR / COPY --from=bpfman-operator-build /usr/src/bpfman-operator/config/bpfman-deployment/daemonset.yaml ./config/bpfman-deployment/daemonset.yaml COPY --from=bpfman-operator-build /usr/src/bpfman-operator/config/bpfman-deployment/csidriverinfo.yaml ./config/bpfman-deployment/csidriverinfo.yaml diff --git a/Makefile b/Makefile index 422e68a8a..ab5985357 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,6 @@ # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) VERSION ?= 0.4.1 -MULTIARCH_TARGETS ?= amd64 # CHANNELS define the bundle channels used in the bundle. # Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") @@ -76,18 +75,8 @@ SHELL = /usr/bin/env bash -o pipefail OCI_BIN_PATH := $(shell which docker 2>/dev/null || which podman) OCI_BIN ?= $(shell basename ${OCI_BIN_PATH}) -# build a single arch target provided as argument -define build_target - echo 'building $(1) for arch $(2)'; \ - $(OCI_BIN) buildx build --load --build-arg TARGETPLATFORM=linux/$(2)\ - --build-arg TARGETARCH=$(2) --build-arg BUILDPLATFORM=linux/amd64 -t $(1)-$(2) -f $(3) .; -endef - -# push a single arch target image -define push_target - echo 'pushing image $(1)-$(2)'; \ - $(OCI_BIN) push $(1)-$(2); -endef +GOARCH ?= $(shell go env GOHOSTARCH) +PLATFORM ?= $(shell go env GOHOSTOS)/$(shell go env GOHOSTARCH) .PHONY: all all: build @@ -313,7 +302,7 @@ bundle: operator-sdk generate kustomize manifests ## Generate bundle manifests a cd config/bpfman-operator-deployment && $(KUSTOMIZE) edit set image quay.io/bpfman/bpfman-operator=${BPFMAN_OPERATOR_IMG} cd config/bpfman-deployment && \ $(SED) -e 's@bpfman\.image=.*@bpfman.image=$(BPFMAN_IMG)@' \ - -e 's@bpfman\.agent\.image=.*@bpfman.agent.image=$(BPFMAN_AGENT_IMG)-$(MULTIARCH_TARGETS)@' \ + -e 's@bpfman\.agent\.image=.*@bpfman.agent.image=$(BPFMAN_AGENT_IMG)@' \ kustomization.yaml.env > kustomization.yaml $(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS) cp config/manifests/dependencies.yaml bundle/metadata/ @@ -327,89 +316,31 @@ build-release-yamls: generate kustomize ## Generate the crd install bundle for a .PHONY: build build: fmt ## Build bpfman-operator and bpfman-agent binaries. - go build -mod vendor -o bin/bpfman-operator cmd/bpfman-operator/main.go - go build -mod vendor -o bin/bpfman-agent cmd/bpfman-agent/main.go - -# If you wish built the manager image targeting other platforms you can use the --platform flag. -# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it. -# More info: https://docs.docker.com/develop/develop-images/build_enhancements/ -.PHONY: build-operator-images -build-operator-images: ## Build bpfman-operator images. - trap 'exit' INT; \ - $(foreach target,$(MULTIARCH_TARGETS),$(call build_target,${BPFMAN_OPERATOR_IMG},$(target),Containerfile.bpfman-operator)) - -.PHONY: build-agent-images -build-agent-images: ## Build bpfman-agent images. - trap 'exit' INT; \ - $(foreach target,$(MULTIARCH_TARGETS),$(call build_target,${BPFMAN_AGENT_IMG},$(target),Containerfile.bpfman-agent)) + CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build -mod vendor -o bin/bpfman-operator cmd/bpfman-operator/main.go + CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build -mod vendor -o bin/bpfman-agent cmd/bpfman-agent/main.go .PHONY: build-images -build-images: build-operator-images build-agent-images ## Build bpfman-agent, and bpfman-operator images. - -.PHONY: push-operator-images -push-operator-images: ## Push bpfman-operator images. - trap 'exit' INT; \ - $(foreach target,$(MULTIARCH_TARGETS),$(call push_target,${BPFMAN_OPERATOR_IMG},$(target))) - -.PHONY: push-agent-images -push-agent-images: ## Push bpfman-agent images. - trap 'exit' INT; \ - $(foreach target,$(MULTIARCH_TARGETS),$(call push_target,${BPFMAN_AGENT_IMG},$(target))) - +build-images: ## Build bpfman-agent and bpfman-operator images. + $(OCI_BIN) buildx build --load -t ${BPFMAN_OPERATOR_IMG} \ + --build-arg TARGETPLATFORM=linux/$(GOARCH) \ + --build-arg TARGETARCH=$(GOARCH) \ + --build-arg BUILDPLATFORM=linux/amd64 \ + -f Containerfile.bpfman-operator . + $(OCI_BIN) buildx build --load -t ${BPFMAN_AGENT_IMG} \ + --build-arg TARGETPLATFORM=linux/$(GOARCH) \ + --build-arg TARGETARCH=$(GOARCH) \ + --build-arg BUILDPLATFORM=linux/amd64 \ + -f Containerfile.bpfman-agent . .PHONY: push-images -push-images: push-operator-images push-agent-images ## Push bpfman-agent, bpfman-operator images. - -.PHONY: manifest-operator-build -manifest-operator-build: ## Build MULTIARCH_TARGETS manifest for bpfman-operator. - echo 'building manifest for $(BPFMAN_OPERATOR_IMG)' - $(OCI_BIN) rmi ${BPFMAN_OPERATOR_IMG} -f - $(OCI_BIN) manifest create ${BPFMAN_OPERATOR_IMG} \ - $(foreach target,$(MULTIARCH_TARGETS), --amend ${BPFMAN_OPERATOR_IMG}-$(target)); - -.PHONY: manifest-agent-build -manifest-agent-build: ## Build MULTIARCH_TARGETS manifest for bpfman-agent. - echo 'building manifest for $(BPFMAN_AGENT_IMG)' - $(OCI_BIN) rmi ${BPFMAN_AGENT_IMG} -f - $(OCI_BIN) manifest create ${BPFMAN_AGENT_IMG} \ - $(foreach target,$(MULTIARCH_TARGETS), --amend ${BPFMAN_AGENT_IMG}-$(target)); - -.PHONY: manifest-build -manifest-build: manifest-operator-build manifest-agent-build ## Build MULTIARCH_TARGETS manifest for bpfman-operator and bpfman-agent. - -.PHONY: manifest-operator-push -manifest-operator-push: ## Push MULTIARCH_TARGETS manifest for bpfman-operator. - @echo 'publish manifest for $(BPFMAN_OPERATOR_IMG)' -ifeq (${OCI_BIN}, docker) - $(OCI_BIN) manifest push ${BPFMAN_OPERATOR_IMG}; -else - $(OCI_BIN) manifest push ${BPFMAN_OPERATOR_IMG} docker://${BPFMAN_OPERATOR_IMG}; -endif - -.PHONY: manifest-agent-push -manifest-agent-push: ## Push MULTIARCH_TARGETS manifest for bpfman-agent. - @echo 'publish manifest for $(BPFMAN_AGENT_IMG)' -ifeq (${OCI_BIN}, docker) - $(OCI_BIN) manifest push ${BPFMAN_AGENT_IMG}; -else - $(OCI_BIN) manifest push ${BPFMAN_AGENT_IMG} docker://${BPFMAN_AGENT_IMG}; -endif - -.PHONY: manifest-push -manifest-push: manifest-operator-push manifest-agent-push ## Push MULTIARCH_TARGETS manifest for bpfman-operator and bpfman-agent. - -.PHONY: operator-images -operator-images: build-operator-images push-operator-images manifest-operator-build manifest-operator-push ## Build and push bpfman-operator images and manifest - -.PHONY: agent-images -agent-images: build-agent-images push-agent-images manifest-agent-build manifest-agent-push ## Build and push bpfman-agent images and manifest - -.PHONY: images -images: operator-images agent-images ## Build and push bpfman-agent, and bpfman-operator images and manifest +push-images: ## Push bpfman-agent and bpfman-operator images. + $(OCI_BIN) push ${BPFMAN_OPERATOR_IMG} + $(OCI_BIN) push ${BPFMAN_AGENT_IMG} + $(OCI_BIN) push ${BPFMAN_IMG} .PHONY: load-images-kind load-images-kind: ## Load bpfman-agent, and bpfman-operator images into the running local kind devel cluster. - kind load docker-image ${BPFMAN_OPERATOR_IMG}-${MULTIARCH_TARGETS} ${BPFMAN_AGENT_IMG}-${MULTIARCH_TARGETS} --name ${KIND_CLUSTER_NAME} + kind load docker-image ${BPFMAN_OPERATOR_IMG} ${BPFMAN_AGENT_IMG} --name ${KIND_CLUSTER_NAME} .PHONY: bundle-build bundle-build: ## Build the bundle image. @@ -468,10 +399,10 @@ destroy-kind: ## Destroy Kind cluster ## Default deploy target is KIND based with its CSI driver initialized. .PHONY: deploy deploy: manifests kustomize ## Deploy bpfman-operator to the K8s cluster specified in ~/.kube/config with the csi driver initialized. - cd config/bpfman-operator-deployment && $(KUSTOMIZE) edit set image quay.io/bpfman/bpfman-operator=${BPFMAN_OPERATOR_IMG}-${MULTIARCH_TARGETS} + cd config/bpfman-operator-deployment && $(KUSTOMIZE) edit set image quay.io/bpfman/bpfman-operator=${BPFMAN_OPERATOR_IMG} cd config/bpfman-deployment && \ $(SED) -e 's@bpfman\.image=.*@bpfman.image=$(BPFMAN_IMG)@' \ - -e 's@bpfman\.agent\.image=.*@bpfman.agent.image=$(BPFMAN_AGENT_IMG)-$(MULTIARCH_TARGETS)@' \ + -e 's@bpfman\.agent\.image=.*@bpfman.agent.image=$(BPFMAN_AGENT_IMG)@' \ kustomization.yaml.env > kustomization.yaml $(KUSTOMIZE) build config/default | kubectl apply -f - @@ -493,10 +424,10 @@ run-on-kind: kustomize setup-kind build-images load-images-kind deploy ## Kind D .PHONY: deploy-openshift deploy-openshift: manifests kustomize ## Deploy bpfman-operator to the Openshift cluster specified in ~/.kube/config. - cd config/bpfman-operator-deployment && $(KUSTOMIZE) edit set image quay.io/bpfman/bpfman-operator=${BPFMAN_OPERATOR_IMG}-${MULTIARCH_TARGETS} + cd config/bpfman-operator-deployment && $(KUSTOMIZE) edit set image quay.io/bpfman/bpfman-operator=${BPFMAN_OPERATOR_IMG} cd config/bpfman-deployment && \ $(SED) -e 's@bpfman\.image=.*@bpfman.image=$(BPFMAN_IMG)@' \ - -e 's@bpfman\.agent\.image=.*@bpfman.agent.image=$(BPFMAN_AGENT_IMG)-$(MULTIARCH_TARGETS)@' \ + -e 's@bpfman\.agent\.image=.*@bpfman.agent.image=$(BPFMAN_AGENT_IMG)@' \ kustomization.yaml.env > kustomization.yaml $(KUSTOMIZE) build config/openshift | kubectl apply -f - diff --git a/bundle/manifests/bpfman-config_v1_configmap.yaml b/bundle/manifests/bpfman-config_v1_configmap.yaml index d004b017b..545bfc394 100644 --- a/bundle/manifests/bpfman-config_v1_configmap.yaml +++ b/bundle/manifests/bpfman-config_v1_configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 data: bpfman.agent.healthprobe.addr: :8175 - bpfman.agent.image: quay.io/bpfman/bpfman-agent:latest-amd64 + bpfman.agent.image: quay.io/bpfman/bpfman-agent:latest bpfman.agent.log.level: info bpfman.agent.metric.addr: 127.0.0.1:8174 bpfman.image: quay.io/bpfman/bpfman:latest diff --git a/config/test/kustomization.yaml b/config/test/kustomization.yaml index a34862e5b..5f52dab86 100644 --- a/config/test/kustomization.yaml +++ b/config/test/kustomization.yaml @@ -46,4 +46,4 @@ resources: images: - name: quay.io/bpfman/bpfman-operator newName: quay.io/bpfman/bpfman-operator - newTag: int-test-amd64 + newTag: int-test diff --git a/config/test/patch.yaml b/config/test/patch.yaml index 4278ed4a1..709b3cdfd 100644 --- a/config/test/patch.yaml +++ b/config/test/patch.yaml @@ -4,7 +4,7 @@ metadata: name: config namespace: kube-system data: - bpfman.agent.image: quay.io/bpfman/bpfman-agent:int-test-amd64 + bpfman.agent.image: quay.io/bpfman/bpfman-agent:int-test bpfman.image: quay.io/bpfman/bpfman:latest bpfman.log.level: bpfman=debug bpfman.agent.log.level: debug diff --git a/test/integration/suite_test.go b/test/integration/suite_test.go index 14e5007b9..49bbfbaff 100644 --- a/test/integration/suite_test.go +++ b/test/integration/suite_test.go @@ -55,6 +55,8 @@ func TestMain(m *testing.M) { // changes prior to the tests and fed them to the test suite. if bpfmanAgentImage == "" || bpfmanOperatorImage == "" { exitOnErr(fmt.Errorf("BPFMAN_AGENT_IMG, and BPFMAN_OPERATOR_IMG must be provided")) + } else { + fmt.Printf("INFO: using bpfmanAgentImage=%s and bpfmanOperatorImage=%s\n", bpfmanAgentImage, bpfmanOperatorImage) } ctx, cancel = context.WithCancel(context.Background())