Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding multi arch support in all kyverno components (AMD6 and ARM64) #1542

Merged
merged 13 commits into from
Feb 19, 2021

Conversation

imrajdas
Copy link
Contributor

@imrajdas imrajdas commented Feb 4, 2021

Related issue

Issue:
#1535

  • Adding multi arch support with docker buildx
  • ARCHs- AMD64, ARM64
  • file changes
    • github actions build
    • Makefile
    • Dockerfiles(kyverno, initcontainer, cli)

Docker hub screenshot
Selection_140

Running on ARM k8s cluster
Selection_139

Running on AMD k8s cluster
Selection_141

For demo purpose use these image

  1. kyverno- imrajdas/kyverno:latest
  2. kyverno-initcontainer- imrajdas/kyvernopre:latest
  3. cli - imrajdas/kyverno-cli:latest

What type of PR is this?

Proposed changes

Checklist

Further comments

Signed-off-by: Raj Das <mail.rajdas@gmail.com>
Signed-off-by: Raj Das <mail.rajdas@gmail.com>
Signed-off-by: Raj Das <mail.rajdas@gmail.com>
@imrajdas
Copy link
Contributor Author

imrajdas commented Feb 4, 2021

cc: @JimBugwadia / @realshuting / @chipzoller

Makefile Show resolved Hide resolved
Signed-off-by: Raj Das <mail.rajdas@gmail.com>
Signed-off-by: Raj Das <mail.rajdas@gmail.com>
Signed-off-by: Raj Das <mail.rajdas@gmail.com>
@imrajdas
Copy link
Contributor Author

imrajdas commented Feb 4, 2021

build is failed due to this

kubectl cluster-info --context kind-kind
35

36
Not sure what to do next? 😅  Check out https://kind.sigs.k8s.io/docs/user/quick-start/
37
ERROR: image: "ghcr.io/kyverno/kyverno:v1.3.2-rc2-8-gcbe586d2" not present locally
38

This is because docker buildx builds in image builder cache and it is not able to find it in docker engine. Either we have to user docker or docker buildx?

Signed-off-by: Raj Das <mail.rajdas@gmail.com>
Signed-off-by: Raj Das <mail.rajdas@gmail.com>
Signed-off-by: Raj Das <mail.rajdas@gmail.com>
@imrajdas
Copy link
Contributor Author

imrajdas commented Feb 8, 2021

@realshuting Build and e2e has been passed :)

Recent changes

  • docker images will build and push for both arm64 and amd64 ---- (using docker buildx)
  • For e2e, we are building all docker image in amd64 arch and testing that image. --- (using docker build)

Please let me know, if you have any question for this PR. Thanks

Copy link
Member

@realshuting realshuting left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments.

Makefile Outdated
@@ -36,14 +36,17 @@ initContainer: fmt vet
docker-publish-initContainer: docker-build-initContainer docker-tag-repo-initContainer docker-push-initContainer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since docker-push-initContainer does everything build tag push, can we remove docker-publish-initContainer?

Makefile Outdated
@@ -62,15 +65,18 @@ kyverno: fmt vet
docker-publish-kyverno: docker-build-kyverno docker-tag-repo-kyverno docker-push-kyverno
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment on lines +36 to +41
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
id: buildx
with:
install: true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@realshuting
Copy link
Member

@rajdas98 Can you please merge the main branch to check all builds? Thanks.

Signed-off-by: Raj Das <mail.rajdas@gmail.com>
Signed-off-by: Raj Das <mail.rajdas@gmail.com>
@imrajdas
Copy link
Contributor Author

imrajdas commented Feb 13, 2021

@realshuting Made the changes

  1. Adding docker buildx action to release.yaml and image.yaml
  2. Remove all docker tag commands
  3. Now, make docker-publish-initContainer will build and push. we need this command because buildx push required build command


docker-build-kyverno:
@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-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-build-local-kyverno:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not remove this local build? Some are using this to test locally.

@realshuting
Copy link
Member

@rajdas98 Can we keep this? #1542 (comment)

@imrajdas
Copy link
Contributor Author

imrajdas commented Feb 18, 2021

@rajdas98 Can we keep this? #1542 (comment)

**Oh I forgot that. Let me add docker-build-local-kyverno

@imrajdas
Copy link
Contributor Author

@realshuting I reverted the docker-build-local-kyverno step in Makefile.

@realshuting realshuting merged commit 0b832a0 into kyverno:main Feb 19, 2021
vyankyGH pushed a commit to vyankyGH/kyverno that referenced this pull request Feb 23, 2021
…yverno#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>
Signed-off-by: vyankatesh <vyankatesh@neualto.com>
@imrajdas imrajdas deleted the multi-arch branch June 26, 2021 16:30
@imrajdas imrajdas restored the multi-arch branch June 26, 2021 16:30
@imrajdas imrajdas deleted the multi-arch branch August 19, 2021 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants