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

images: base the default image on distroless/base #1027

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

marquiz
Copy link
Contributor

@marquiz marquiz commented Jan 10, 2023

Make distroless/base as the base image for the default image, effectively making the minimal image as the default. Add a new "full" image variant that corresponds the previous default image. The "*-minimal" container image tag is provided for backwards compatibility.

The practical user impact of this change is that hook support is limited to statically linked ELF binaries. Bash or Perl scripts are not supported by the default image, anymore, but the new "full" image variant can be used for backwards compatibility.

Refs #855
Fixes #963

@netlify
Copy link

netlify bot commented Jan 10, 2023

Deploy Preview for kubernetes-sigs-nfd ready!

Name Link
🔨 Latest commit cd62f65
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-nfd/deploys/63d8dfd5c3714000099be02f
😎 Deploy Preview https://deploy-preview-1027--kubernetes-sigs-nfd.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 10, 2023
@marquiz
Copy link
Contributor Author

marquiz commented Jan 10, 2023

Let's get some feedback
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 10, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 18, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 18, 2023
@fmuyassarov
Copy link
Member

/assign

Copy link
Member

@fmuyassarov fmuyassarov left a comment

Choose a reason for hiding this comment

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

This looks good to me @marquiz and sorry for such a late review.
I had some nits below, but +1 for the change.

Makefile Outdated Show resolved Hide resolved
Comment on lines +81 to +84
-t $(IMAGE_TAG) \
-t $(IMAGE_TAG)-minimal \
$(foreach tag,$(IMAGE_EXTRA_TAGS),-t $(tag) -t $(tag)-minimal) \
$(IMAGE_BUILD_EXTRA_OPTS) ./
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
-t $(IMAGE_TAG) \
-t $(IMAGE_TAG)-minimal \
$(foreach tag,$(IMAGE_EXTRA_TAGS),-t $(tag) -t $(tag)-minimal) \
$(IMAGE_BUILD_EXTRA_OPTS) ./
-t $(IMAGE_TAG)-minimal \
$(foreach tag,$(IMAGE_EXTRA_TAGS),-t $(tag)-minimal) \
$(IMAGE_BUILD_EXTRA_OPTS) ./

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We still definitely want to keep the "default" image tag (i.e. just v0.13.0 without any -minimal or -full suffix). As explained in the commit message this PR keeps the -minimal tag for backwards compatibility. Makes sense?

Copy link
Member

Choose a reason for hiding this comment

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

ah right.

@fmuyassarov
Copy link
Member

One comment I forgot to mention is, I think we should add a note in the sources.local.hooksEnabled section of the document that the user need to use full image if they are using hooks, like we have notes about hooks deprecation, etc.

Make distroless/base as the base image for the default image,
effectively making the minimal image as the default. Add a new "full"
image variant that corresponds the previous default image. The
"*-minimal" container image tag is provided for backwards compatibility.

The practical user impact of this change is that hook support is limited
to statically linked ELF binaries. Bash or Perl scripts are not
supported by the default image, anymore, but the new "full" image
variant can be used for backwards compatibility.
@marquiz
Copy link
Contributor Author

marquiz commented Jan 31, 2023

One comment I forgot to mention is, I think we should add a note in the sources.local.hooksEnabled section of the document that the user need to use full image if they are using hooks, like we have notes about hooks deprecation, etc.

That's not entirely true as the "non-full" image (i.e. default or minimal) is able to run hooks but they must be statically linked binaries. Anyway, I added a not about that here, too

@fmuyassarov
Copy link
Member

One comment I forgot to mention is, I think we should add a note in the sources.local.hooksEnabled section of the document that the user need to use full image if they are using hooks, like we have notes about hooks deprecation, etc.

That's not entirely true as the "non-full" image (i.e. default or minimal) is able to run hooks but they must be statically linked binaries. Anyway, I added a not about that here, too

if I hook in a shell script, will I be able to run it on distroless image based container?

@fmuyassarov
Copy link
Member

fmuyassarov commented Jan 31, 2023

my understanding was such that if I inject a shell script then NFD tries to run it (runHook) on a container where there is no runtime available but I guess NFD doesn't require any shell to be available to do it is job but it is rather users who might want to hack in or debug.
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 31, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 8e3d88655f420d684be5a649091abc4a04c9102d

@marquiz
Copy link
Contributor Author

marquiz commented Jan 31, 2023

my understanding was such that if I inject a shell script then NFD tries to run it (runHook) on a container where there is no runtime available

This is correct. If you have a shell script hook and try to run that in the minimal container it will just fail because there is no shell executable inside the container. But you can use a statically linked ELF binary, it doesn't require a shell or virtually any libraries

but I guess NFD doesn't require any shell to be available to do it is job but it is rather users who might want to hack in or debug.

Yes, NFD itself does not require any shell

@marquiz
Copy link
Contributor Author

marquiz commented Jan 31, 2023

@zvonkok @mythi @ArangoGutierrez @PiotrProkop et. al any thoughts on the change of swapping to the minimal image?

@PiotrProkop
Copy link
Contributor

PiotrProkop commented Jan 31, 2023

@zvonkok @mythi @ArangoGutierrez @PiotrProkop et. al any thoughts on the change of swapping to the minimal image?

+1 for me. We are using distroless/scratch containers where we can for security reasons.

@mythi
Copy link
Contributor

mythi commented Jan 31, 2023

@zvonkok @mythi @ArangoGutierrez @PiotrProkop et. al any thoughts on the change of swapping to the minimal image?

no objections. our source hooks are currently static Go binaries but we're also planning on moving away from them to feature hooks at some point.

@ArangoGutierrez
Copy link
Contributor

that's a good point, maybe we can hold a bit on this, until we fully deprecate Hooks?

@ArangoGutierrez
Copy link
Contributor

On issue : #856 (comment) @marquiz presents a road map to move to minimal as default, maybe we can add this to that?

@marquiz
Copy link
Contributor Author

marquiz commented Jan 31, 2023

that's a good point, maybe we can hold a bit on this, until we fully deprecate Hooks?

What point do you mean? What do you mean by "full deprecation"? My thinking with this PR was to limit the usage of hooks before disabling them (by default). I.e. default to minimal image one step earlier than I outlined in #856. That would give the benefits of minimal image with still supporting existing users that have statically linked hooks. Others would still be backed up by the full image.

But I'm open to discussion. The question basically being are there many bash or perl hook users.

@ArangoGutierrez
Copy link
Contributor

that's a good point, maybe we can hold a bit on this, until we fully deprecate Hooks?

What point do you mean? What do you mean by "full deprecation"? My thinking with this PR was to limit the usage of hooks before disabling them (by default). I.e. default to minimal image one step earlier than I outlined in #856. That would give the benefits of minimal image with still supporting existing users that have statically linked hooks. Others would still be backed up by the full image.

But I'm open to discussion. The question basically being are there many bash or perl hook users.

Bash probably, perl............... ...... .... ..

@marquiz
Copy link
Contributor Author

marquiz commented Feb 10, 2023

So what do you think @ArangoGutierrez about merging this? Comments from others were favorable

Copy link
Contributor

@ArangoGutierrez ArangoGutierrez left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ArangoGutierrez, marquiz

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

The pull request process is described 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

@marquiz
Copy link
Contributor Author

marquiz commented Feb 10, 2023

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 10, 2023
@k8s-ci-robot k8s-ci-robot merged commit e3b9184 into kubernetes-sigs:master Feb 10, 2023
@marquiz marquiz deleted the devel/image-full branch February 10, 2023 17:42
@marquiz marquiz mentioned this pull request Apr 12, 2023
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider moving to a more minimal container base image.
6 participants