Skip to content

Adding distroless image to Envoy CI pipeline - #16268

Merged
phlax merged 2 commits into
envoyproxy:mainfrom
oleksiyp:distroless
May 3, 2021
Merged

phlax merged 2 commits into
envoyproxy:mainfrom
oleksiyp:distroless

Conversation

@oleksiyp

@oleksiyp oleksiyp commented May 2, 2021

Copy link
Copy Markdown
Contributor

Commit Message: ci: adding distroless image to Envoy CI pipeline
Additional Description:

In #16170 we came up to the conclusion that the best option is to add distroless based images.
I analyzed #15312 and came to the conclusion that it will take a lot of changes to add distroless images by using bazel's rules_docker. Instead of it using current CI pipeline to add distroless image is low hanging fruit. Conversion to rules_docker might be performed later.

Risk Level: Medium
Testing: Please guide what testing best to perform
Docs Changes: Please guide if there are any best location to document it
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Oleksiy Pylypenko <[email protected]>
@repokitteh-read-only

Copy link
Copy Markdown

Hi @oleksiyp, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #16268 was opened by oleksiyp.

see: more, trace.

@phlax phlax self-assigned this May 2, 2021
@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

cc @lizan

@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

once this lands i will to through the examples and start shifting over anything that currently uses the alpine images

we also need to update docs to include some refs to this image

@oleksiyp

oleksiyp commented May 2, 2021

Copy link
Copy Markdown
Contributor Author

Hold on a little bit. I am still trying to run it locally. Wanted to trigger CI build to check it and open PR for discussion. Will return back with a commit or acknowledgment that everything is okay.

@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

cool, yep

it seems to be failing with a missing /bin/sh on the RUN line - not sure how this is done with distroless

@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

i think you need

RUN ["/busybox/sh", "-c", "mkdir /opt/myfolder"]

from GoogleContainerTools/distroless#419 (comment)

@oleksiyp

oleksiyp commented May 2, 2021 •

Copy link
Copy Markdown
Contributor Author

Don't think sh is included. Only is added to ":debug" images

@phlax

phlax commented May 2, 2021 •

Copy link
Copy Markdown
Member

this might work alternatively

FROM gcr.io/distroless/java:debug
SHELL ["/busybox/sh", "-c"]
RUN mkdir /opt/myfolder

i think sh is there in busybox - i guess the key is to prevent it invoking the normal path in RUN

(edit: or something like that - ie not java image, not debug and correct path)

@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

hmm - maybe not - testing this locally and busybox isnt there either

@oleksiyp

oleksiyp commented May 2, 2021

Copy link
Copy Markdown
Contributor Author

Shell is added only to ":debug" images + 'python' distroless has "dash" because there is no other way to run it.

@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

i think then maybe copying in the directory using a multistage build

@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

something vaguely like this GoogleContainerTools/distroless#427 (comment)

Signed-off-by: Oleksiy Pylypenko <[email protected]>
@oleksiyp

oleksiyp commented May 2, 2021

Copy link
Copy Markdown
Contributor Author

I think RUN is not needed here at all.

The ADD destination is automatically created if it doesn't exist.
https://www.reddit.com/r/docker/comments/7t5953/dockerfile_add_to_a_nonexisting_directory/

@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

relatedly - this is the getenvoy Dockerfile - https://github.com/tetratelabs/getenvoy/blob/master/Dockerfile

not sure exactly why they use the :cc image but it looks like it has shell support

Comment thread ci/Dockerfile-envoy-distroless Resolved
@oleksiyp

oleksiyp commented May 2, 2021

Copy link
Copy Markdown
Contributor Author

relatedly - this is the getenvoy Dockerfile - https://github.com/tetratelabs/getenvoy/blob/master/Dockerfile

not sure exactly why they use the :cc image but it looks like it has shell support

RUN ["/getenvoy", "fetch", "@"]

and

RUN mkdir  bla-bla-bla

differs that second type of command runs shell I believe, while first just uses exec syscall.

@phlax

phlax commented May 2, 2021 •

Copy link
Copy Markdown
Member

i see

so iiuc this should work now

i had a poke around the debian and cc images - not sure what is extra in the cc image but its slightly larger - so lets use the debian image if we can

(and afaict the c libs are the same)

@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

as its a pita to test the ci images locally i created a testing branch here #16269

Comment thread ci/verify_examples.sh Resolved
@oleksiyp

oleksiyp commented May 2, 2021

Copy link
Copy Markdown
Contributor Author

Should I try other examples? all of them?

@phlax

phlax commented May 2, 2021

Copy link
Copy Markdown
Member

Should I try other examples? all of them?

no that is good i think

if you revert all of the example stuff im happy for this to merge

if you wish we could try the static distroless base image first

@oleksiyp

oleksiyp commented May 2, 2021

Copy link
Copy Markdown
Contributor Author

Reverted

@oleksiyp

oleksiyp commented May 2, 2021

Copy link
Copy Markdown
Contributor Author

Forgot about static. Indeed let's check. Running in parallel #16272

@oleksiyp

oleksiyp commented May 2, 2021

Copy link
Copy Markdown
Contributor Author

From my side, all set for merge.

@phlax phlax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@oleksiyp thanks for taking the time to work through and test this

lgtm

@oleksiyp

oleksiyp commented May 3, 2021

Copy link
Copy Markdown
Contributor Author

@phlax thank you for your assistance! Envoyproxy is a really cool thing. I hope will have more opportunities to contribute.

Not able to merge:

The base branch restricts merging to authorized users

@phlax
phlax merged commit c86cfb5 into envoyproxy:main May 3, 2021
@oleksiyp
oleksiyp deleted the distroless branch May 3, 2021 08:21
@oleksiyp

oleksiyp commented May 3, 2021

Copy link
Copy Markdown
Contributor Author

@phlax seems build failed.
Some authorization is required:

#8 ERROR: server message: insufficient_scope: authorization failed
------
 > exporting to image:
------
error: failed to solve: rpc error: code = Unknown desc = server message: insufficient_scope: authorization failed
The push refers to repository [docker.io/envoyproxy/envoy-distroless-dev]
21c123484da7: Preparing
f3e1a44f8191: Preparing
5d09c2db1d76: Preparing
417cb9b79ade: Preparing
denied: requested access to the resource is denied

@phlax

phlax commented May 3, 2021

Copy link
Copy Markdown
Member

eek!

ive pinged @lizan in the envoy-ci channel on slack - i reckon he will know how to resolve

@phlax

phlax commented May 4, 2021 •

Copy link
Copy Markdown
Member

@oleksiyp dockerhub should be fixed now - the first image has been uploaded - you can see it here https://hub.docker.com/r/envoyproxy/envoy-distroless-dev/tags?page=1&ordering=last_updated

i opened a couple of follow up bugs - for documentation (#16282 ), and deprecation of the alpine image here (#16275 ) which is basically fixing the examples that (mistakenly) use the alpine image as a base for backend service

lmk if you want to take either of them

gokulnair pushed a commit to gokulnair/envoy that referenced this pull request May 5, 2021
* ci: Adding distroless image

Signed-off-by: Oleksiy Pylypenko <[email protected]>
Signed-off-by: Gokul Nair <[email protected]>
gokulnair pushed a commit to gokulnair/envoy that referenced this pull request May 6, 2021
* ci: Adding distroless image

Signed-off-by: Oleksiy Pylypenko <[email protected]>
Signed-off-by: Gokul Nair <[email protected]>
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.

2 participants