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

⚠️ container friendly commands #4288

Conversation

mateusoliveira43
Copy link
Contributor

Why the changes were made

Replace docker with container from command names that do not necessarily need Docker to be used, but should work with any container tool (Podman, Buildah, etc).

Note: I use these commands with Podman, so I validated them with this tool, but not with any other container tool.

How the changes were made

Checked places that mentions docker with the command

grep -Inr "docker" ./pkg/plugins/golang/v4/scaffolds/internal/templates/

and changed them to a container friendly wording.

Note: Still have to run make generate and change docker appearances/references in documentation. Waiting to see if community wants this change before doing more changes.

How to test the changes made

Run new container-build and container-push commands, and confirm they work as docker-build and docker-push used to work.

Signed-off-by: Mateus Oliveira <[email protected]>
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 4, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mateusoliveira43
Once this PR has been reviewed and has the lgtm label, please assign camilamacedo86 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

Hi @mateusoliveira43. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 4, 2024
@@ -194,7 +194,7 @@ docker-push: ## Push docker image with the manager.
# To adequately provide solutions that are compatible with multiple platforms, you should consider using this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
docker-buildx: ## Build and push docker image for the manager for cross-platform support
docker-buildx: ## Build and push container image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- $(CONTAINER_TOOL) buildx create --name {{ .ProjectName }}-builder
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO change $(CONTAINER_TOOL) here in this command to docker

@@ -178,12 +178,12 @@ run: manifests generate fmt vet ## Run a controller from your host.
# If you wish to build 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: docker-build
docker-build: ## Build docker image with the manager.
Copy link
Member

@camilamacedo86 camilamacedo86 Nov 4, 2024

Choose a reason for hiding this comment

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

This change could significantly impact our users, as these targets are likely used in CI pipelines and other automated processes. While I’m open to switching from docker to container term, we need to carefully weigh the pros and cons.

Additionally, we would need to update all relevant documentation, so it’s not as straightforward as it seems. I’m uncertain if the benefits here outweigh the potential downsides.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, waiting to see if community wants the change before changing the other places

- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
- a container tool (Docker, Podman, Buildah, etc)
Copy link
Member

Choose a reason for hiding this comment

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

The issue is that we can't claim full support for all container tools since our testing is limited to Docker. To support additional tools, we would need to test across each of them as well, which would be a considerable burden for us as maintainers. Don't you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, my though here was where the requirement appears, which is the Getting Started section of the scaffolded README. In this section, we just need to build and push a container image to run the steps described. So should be ok for not test all options here (I tested with Podman, but not with Buildah, for example)

we also have a comment about not testing all options today

# CONTAINER_TOOL defines the container tool to be used for building images.
# Be aware that the target commands are only tested with Docker which is
# scaffolded by default. However, you might want to replace it to use other
# tools. (i.e. podman)
CONTAINER_TOOL ?= docker

But for other parts of the project, we can still say docker is still required, and no need for changing how is tested (for example, if a section about multi-arch release is added to scaffolded README, docker-buildx command would be necessary and then, docker would be necessary requirement for that section)

what you think?

Copy link
Member

@camilamacedo86 camilamacedo86 Nov 5, 2024

Choose a reason for hiding this comment

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

Yes, we added a comment to clarify that it MAYBE compatible with other tools. However, it’s not tested or officially supported. We avoided renaming the targets to prevent unnecessary disruptions for developers and extensive changes.

This isn't just a matter of updating a few files—it would impact our documentation, CI, and other templates like the README**. I don’t think we should proceed with this right now.**

Perhaps in the future, but not at this point when we need to push changes that require developer effort to ensure compatible with controller-runtime, to fix old bugs and etc. Changing a name or wording just to imply broader tool support which btw is not, isn’t worth the hassle. This might be better suited for a major update, like when we introduce go/v5, for example.

Copy link
Member

Choose a reason for hiding this comment

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

For example, if we allow the tests run here it will broke all our CI as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree with waiting for a major update to merge this one

Copy link
Member

Choose a reason for hiding this comment

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

So, could you please track an issue with the request, and we can create a go/v5 milestone to add this one there?
When we have enough request changes, we can create a new version and do this one.

Also, could you please link this PR there as a reference and close it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created #4293

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants