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

Add controller-gen and kustomize to the SDK base image #4000

Closed
SteveMattar opened this issue Oct 8, 2020 · 12 comments
Closed

Add controller-gen and kustomize to the SDK base image #4000

SteveMattar opened this issue Oct 8, 2020 · 12 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. language/go Issue is related to a Go operator project lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs discussion
Milestone

Comments

@SteveMattar
Copy link

SteveMattar commented Oct 8, 2020

Feature Request

Describe the problem you need a feature to resolve.

My project is using the new Kubebuilder-style layout
I need a base image containing the following tools in order to build my operator bundle

  • controller-gen
  • kustomize
  • operator-sdk v1+
  • envtest

Describe the solution you'd like.

Include controller-gen and kustomize to your SDK base image
The original PR is #3902

/language go

@openshift-ci-robot openshift-ci-robot added the language/go Issue is related to a Go operator project label Oct 8, 2020
@joelanford
Copy link
Member

We should probably include the envtest binaries in the base image as well.

@jberkhahn jberkhahn added this to the v1.3.0 milestone Oct 12, 2020
@aemperador
Copy link
Contributor

it looks like the PR for this was merged. should this issue be closed?

PR ref: #3902

@SteveMattar
Copy link
Author

SteveMattar commented Oct 15, 2020

it looks like the PR for this was merged. should this issue be closed?

PR ref: #3902

@aemperador this PR does not include all the tools
this docker base image contains operator-sdk only but we also need
controller-gen, kustomize and envtest

@aemperador
Copy link
Contributor

ok @SteveMattar thanks for the update. I can take this on

@aemperador
Copy link
Contributor

I've created a PR for adding kustomize first as a base image that includes the operator-sdk and kustomize: #4130

controller-gen is not included in this one

@SteveMattar
Copy link
Author

@aemperador Thanks for your work! Is there any reason why controller-gen is not part of this PR?

@estroz estroz added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 14, 2020
@estroz estroz modified the milestones: v1.3.0, v1.5.0 Dec 18, 2020
@estroz
Copy link
Member

estroz commented Feb 2, 2021

Packaging all binaries into one image is complicated by multiple plugins and versions. From #4428:

[There are t]hree ways to tackle this:

  1. Make an image for each plugin version with the appropriate tool version.
    • quay.io/operator-framework/operator-sdk-go-v2:v1.3.0 containing all go/v2 tools
  2. Download multiple versions of tool binaries into the same image, with each binary name containing its version, ex. kustomize-3-5-4.
    • quay.io/operator-framework/operator-sdk-go:v1.3.0 containing all tools for go/v2 and go/v3 with versioned binary names
  3. Make an image for dependency tool and version supported.
    • quay.io/operator-framework/kustomize:v3.5.4, quay.io/operator-framework/kustomize:v3.8.7

I personally prefer (3) because it scales the best, produces the smallest images, and is plugin-agnostic. The major problem with the first two is that the kustomize version (and controller-gen's for Go operators) is dependent on plugin version (and type, even though a divergence hasn't happened yet), while a given operator-sdk version supports multiple plugins. We'd have to maintain a build matrix of operator-sdk version x plugin type x plugin version, for which tagging would not scale as well (see examples) and we'd have to rebuid these images each time a new operator-sdk version was released. Additionally we'd only ever have to publish a new tool image once, if the default version of some plugin changed.

Example Dockerfile for kustomize:

# images/kustomize/Dockerfile

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3-227

ARG VERSION
ARG ARCH
RUN curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${VERSION}/kustomize_${VERSION}_linux_${ARCH}.tar.gz | \
tar xzf - -C /

ENTRYPOINT ["/kustomize"]

Build with:

export KUSTOMIZE_VERSION=v3.5.4
docker build \
	-f images/kustomize/Dockerfile \
	-t quay.io/operator-framework/kustomize:$KUSTOMIZE_VERSION \
	--build-arg VERSION=$KUSTOMIZE_VERSION \
	--build-arg ARCH=$(go env GOARCH) \
	images/kustomize

@estroz estroz modified the milestones: v1.4.0, v1.5.0 Feb 2, 2021
@jmrodri jmrodri modified the milestones: v1.5.0, v1.6.0 Feb 22, 2021
@estroz
Copy link
Member

estroz commented Mar 19, 2021

Moving this to the backlog to await further discussion, as no one has responded to ^.

@estroz estroz modified the milestones: v1.6.0, Backlog Mar 19, 2021
@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 18, 2021
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 18, 2021
@SteveMattar
Copy link
Author

/close

@openshift-ci openshift-ci bot closed this as completed Aug 5, 2021
@openshift-ci
Copy link

openshift-ci bot commented Aug 5, 2021

@SteveMattar: Closing this issue.

In response to this:

/close

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. language/go Issue is related to a Go operator project lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants