mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
Adding multi arch support in all kyverno components (AMD6 and ARM64) (#1542)
* Adding multi arch support Signed-off-by: Raj Das <mail.rajdas@gmail.com> * Adding multi arch support Signed-off-by: Raj Das <mail.rajdas@gmail.com> * minor refactors Signed-off-by: Raj Das <mail.rajdas@gmail.com> * adding buildx action in e2e.yaml Signed-off-by: Raj Das <mail.rajdas@gmail.com> * Adding kyvernopre Signed-off-by: Raj Das <mail.rajdas@gmail.com> * Adding kyvernopre Signed-off-by: Raj Das <mail.rajdas@gmail.com> * Adding amd build Signed-off-by: Raj Das <mail.rajdas@gmail.com> * Adding go env Signed-off-by: Raj Das <mail.rajdas@gmail.com> * minor fix Signed-off-by: Raj Das <mail.rajdas@gmail.com> * removing docker tag Signed-off-by: Raj Das <mail.rajdas@gmail.com> * Adding local dockerfile build command Signed-off-by: rajdas98 <mail.rajdas@gmail.com>
This commit is contained in:
parent
48f0d90dd1
commit
0b832a038d
8 changed files with 63 additions and 29 deletions
6
.github/workflows/build.yaml
vendored
6
.github/workflows/build.yaml
vendored
|
@ -43,6 +43,12 @@ jobs:
|
|||
- name: golangci-lint
|
||||
uses: reviewdog/action-golangci-lint@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: docker images build
|
||||
run: |
|
||||
make docker-build-all
|
||||
|
|
4
.github/workflows/e2e.yaml
vendored
4
.github/workflows/e2e.yaml
vendored
|
@ -53,9 +53,9 @@ jobs:
|
|||
- name: golangci-lint
|
||||
uses: reviewdog/action-golangci-lint@v1
|
||||
|
||||
- name: docker images build
|
||||
- name: docker images build (AMD64)
|
||||
run: |
|
||||
make docker-build-all
|
||||
make docker-build-all-amd64
|
||||
|
||||
- name : Create Kind Cluster and setup kustomize
|
||||
run: |
|
||||
|
|
6
.github/workflows/image.yaml
vendored
6
.github/workflows/image.yaml
vendored
|
@ -21,6 +21,12 @@ jobs:
|
|||
- name: login to GitHub Container Registry
|
||||
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: docker images publish
|
||||
run: |
|
||||
make docker-publish-all
|
6
.github/workflows/release.yaml
vendored
6
.github/workflows/release.yaml
vendored
|
@ -35,6 +35,12 @@ jobs:
|
|||
- name: login to GitHub Container Registry
|
||||
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name : docker images publish
|
||||
run: |
|
||||
make docker-publish-all
|
||||
|
|
46
Makefile
46
Makefile
|
@ -31,24 +31,24 @@ INITC_IMAGE := kyvernopre
|
|||
initContainer: fmt vet
|
||||
GOOS=$(GOOS) go build -o $(PWD)/$(INITC_PATH)/kyvernopre -ldflags=$(LD_FLAGS) $(PWD)/$(INITC_PATH)/main.go
|
||||
|
||||
.PHONY: docker-build-initContainer docker-tag-repo-initContainer docker-push-initContainer
|
||||
.PHONY: docker-build-initContainer docker-push-initContainer
|
||||
|
||||
docker-publish-initContainer: docker-build-initContainer docker-tag-repo-initContainer docker-push-initContainer
|
||||
docker-publish-initContainer: docker-build-initContainer docker-push-initContainer
|
||||
|
||||
docker-build-initContainer:
|
||||
@docker build -f $(PWD)/$(INITC_PATH)/Dockerfile -t $(REPO)/$(INITC_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
||||
@docker buildx build --file $(PWD)/$(INITC_PATH)/Dockerfile --progress plane --platform linux/arm64,linux/amd64 --tag $(REPO)/$(INITC_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
||||
|
||||
docker-tag-repo-initContainer:
|
||||
@docker tag $(REPO)/$(INITC_IMAGE):$(IMAGE_TAG) $(REPO)/$(INITC_IMAGE):latest
|
||||
docker-build-initContainer-amd64:
|
||||
@docker build -f $(PWD)/$(INITC_PATH)/Dockerfile -t $(REPO)/$(INITC_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --build-arg TARGETPLATFORM="linux/amd64"
|
||||
|
||||
docker-push-initContainer:
|
||||
@docker push $(REPO)/$(INITC_IMAGE):$(IMAGE_TAG)
|
||||
@docker push $(REPO)/$(INITC_IMAGE):latest
|
||||
@docker buildx build --file $(PWD)/$(INITC_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(INITC_IMAGE):$(IMAGE_TAG) .
|
||||
@docker buildx build --file $(PWD)/$(INITC_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(INITC_IMAGE):latest .
|
||||
|
||||
##################################
|
||||
# KYVERNO CONTAINER
|
||||
##################################
|
||||
.PHONY: docker-build-kyverno docker-tag-repo-kyverno docker-push-kyverno
|
||||
.PHONY: docker-build-kyverno docker-push-kyverno
|
||||
KYVERNO_PATH := cmd/kyverno
|
||||
KYVERNO_IMAGE := kyverno
|
||||
|
||||
|
@ -59,22 +59,21 @@ local:
|
|||
kyverno: fmt vet
|
||||
GOOS=$(GOOS) go build -o $(PWD)/$(KYVERNO_PATH)/kyverno -ldflags=$(LD_FLAGS) $(PWD)/$(KYVERNO_PATH)/main.go
|
||||
|
||||
docker-publish-kyverno: docker-build-kyverno docker-tag-repo-kyverno docker-push-kyverno
|
||||
docker-publish-kyverno: docker-build-kyverno docker-push-kyverno
|
||||
|
||||
docker-build-kyverno:
|
||||
@docker build -f $(PWD)/$(KYVERNO_PATH)/Dockerfile -t $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
||||
@docker buildx build --file $(PWD)/$(KYVERNO_PATH)/Dockerfile --progress plane --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
||||
|
||||
docker-build-local-kyverno:
|
||||
CGO_ENABLED=0 GOOS=linux go build -o $(PWD)/$(KYVERNO_PATH)/kyverno -ldflags=$(LD_FLAGS) $(PWD)/$(KYVERNO_PATH)/main.go
|
||||
@docker build -f $(PWD)/$(KYVERNO_PATH)/localDockerfile -t $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) $(PWD)/$(KYVERNO_PATH)
|
||||
|
||||
docker-tag-repo-kyverno:
|
||||
@echo "docker tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) $(REPO)/$(KYVERNO_IMAGE):latest"
|
||||
@docker tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) $(REPO)/$(KYVERNO_IMAGE):latest
|
||||
docker-build-kyverno-amd64:
|
||||
@docker build -f $(PWD)/$(KYVERNO_PATH)/Dockerfile -t $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --build-arg TARGETPLATFORM="linux/amd64"
|
||||
|
||||
docker-push-kyverno:
|
||||
@docker push $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG)
|
||||
@docker push $(REPO)/$(KYVERNO_IMAGE):latest
|
||||
@docker buildx build --file $(PWD)/$(KYVERNO_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) .
|
||||
@docker buildx build --file $(PWD)/$(KYVERNO_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_IMAGE):latest .
|
||||
|
||||
##################################
|
||||
|
||||
|
@ -88,32 +87,31 @@ generate-api-docs:
|
|||
##################################
|
||||
# CLI
|
||||
##################################
|
||||
.PHONY: docker-build-cli docker-tag-repo-cli docker-push-cli
|
||||
.PHONY: docker-build-cli docker-push-cli
|
||||
CLI_PATH := cmd/cli/kubectl-kyverno
|
||||
KYVERNO_CLI_IMAGE := kyverno-cli
|
||||
|
||||
cli:
|
||||
GOOS=$(GOOS) go build -o $(PWD)/$(CLI_PATH)/kyverno -ldflags=$(LD_FLAGS) $(PWD)/$(CLI_PATH)/main.go
|
||||
|
||||
docker-publish-cli: docker-build-cli docker-tag-repo-cli docker-push-cli
|
||||
docker-publish-cli: docker-build-cli docker-push-cli
|
||||
|
||||
docker-build-cli:
|
||||
@docker build -f $(PWD)/$(CLI_PATH)/Dockerfile -t $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
||||
@docker buildx build --file $(PWD)/$(CLI_PATH)/Dockerfile --progress plane --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
||||
|
||||
docker-tag-repo-cli:
|
||||
@echo "docker tag $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG) $(REPO)/$(KYVERNO_CLI_IMAGE):latest"
|
||||
@docker tag $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG) $(REPO)/$(KYVERNO_CLI_IMAGE):latest
|
||||
docker-build-cli-amd64:
|
||||
@docker build -f $(PWD)/$(CLI_PATH)/Dockerfile -t $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --build-arg TARGETPLATFORM="linux/amd64"
|
||||
|
||||
docker-push-cli:
|
||||
@docker push $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG)
|
||||
@docker push $(REPO)/$(KYVERNO_CLI_IMAGE):latest
|
||||
@docker buildx build --file $(PWD)/$(CLI_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG) .
|
||||
@docker buildx build --file $(PWD)/$(CLI_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_CLI_IMAGE):latest .
|
||||
|
||||
##################################
|
||||
docker-publish-all: docker-publish-initContainer docker-publish-kyverno docker-publish-cli
|
||||
|
||||
docker-build-all: docker-build-initContainer docker-build-kyverno docker-build-cli
|
||||
|
||||
docker-tag-all: docker-tag-repo-initContainer docker-tag-repo-kyverno docker-tag-repo-cli
|
||||
docker-build-all-amd64: docker-build-initContainer-amd64 docker-build-kyverno-amd64 docker-build-cli-amd64
|
||||
|
||||
##################################
|
||||
# Create e2e Infrastruture
|
||||
|
|
|
@ -6,11 +6,17 @@ LABEL maintainer="Kyverno"
|
|||
|
||||
# LD_FLAGS is passed as argument from Makefile. It will be empty, if no argument passed
|
||||
ARG LD_FLAGS
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
ADD . /kyverno
|
||||
WORKDIR /kyverno
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /output/kyverno -ldflags="${LD_FLAGS}" -v ./cmd/cli/kubectl-kyverno/
|
||||
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
|
||||
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
|
||||
|
||||
RUN go env
|
||||
|
||||
RUN CGO_ENABLED=0 go build -o /output/kyverno -ldflags="${LD_FLAGS}" -v ./cmd/cli/kubectl-kyverno/
|
||||
|
||||
RUN useradd -u 10001 kyverno
|
||||
|
||||
|
|
|
@ -6,11 +6,17 @@ LABEL maintainer="Kyverno"
|
|||
|
||||
# LD_FLAGS is passed as argument from Makefile. It will be empty, if no argument passed
|
||||
ARG LD_FLAGS
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
ADD . /kyverno
|
||||
WORKDIR /kyverno
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /output/kyvernopre -ldflags="${LD_FLAGS}" -v ./cmd/initContainer/
|
||||
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
|
||||
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
|
||||
|
||||
RUN go env
|
||||
|
||||
RUN CGO_ENABLED=0 go build -o /output/kyvernopre -ldflags="${LD_FLAGS}" -v ./cmd/initContainer/
|
||||
|
||||
RUN useradd -u 10001 kyverno
|
||||
|
||||
|
|
|
@ -6,11 +6,17 @@ LABEL maintainer="Kyverno"
|
|||
|
||||
# LD_FLAGS is passed as argument from Makefile. It will be empty, if no argument passed
|
||||
ARG LD_FLAGS
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
ADD . /kyverno
|
||||
WORKDIR /kyverno
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /output/kyverno -ldflags="${LD_FLAGS}" -v ./cmd/kyverno/
|
||||
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
|
||||
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
|
||||
|
||||
RUN go env
|
||||
|
||||
RUN CGO_ENABLED=0 go build -o /output/kyverno -ldflags="${LD_FLAGS}" -v ./cmd/kyverno/
|
||||
|
||||
RUN useradd -u 10001 kyverno
|
||||
|
||||
|
|
Loading…
Reference in a new issue