-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Create debug docker images for jaeger backends #2545
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2545 +/- ##
==========================================
- Coverage 95.33% 95.32% -0.02%
==========================================
Files 208 208
Lines 9281 9281
==========================================
- Hits 8848 8847 -1
Misses 355 355
- Partials 78 79 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I would strongly prefer having a single Dockerfile for each binary, not copy-pasting content across two files. For example, you are already missing ARG USER_UID=10001
directive that's in master.
For example, would the following work?
# default build
FROM alpine:latest as certs
RUN apk add --update --no-cache ca-certificates
COPY ./scripts/fake-dlv /go/bin/dlv
# debug build
FROM golang:1.15.2-alpine as debug
...
# for debug builds, these vars should be replaced with BASEIMAGE=BUILDIMAGE=debug
ARG BASEIMAGE=scratch
ARG BUILDIMAGE=certs
FROM $BASEIMAGE
COPY --from=$BUILDIMAGE /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=$BUILDIMAGE /go/bin/dlv /go/bin/dlv
...
Hi @yurishkuro Thank you for the review. It definitely makes sense to generate two images out of a single Dockerfile. Let me work on it and update the PR. |
Makefile
Outdated
@@ -328,13 +328,19 @@ docker-images-jaeger-backend: | |||
docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-agent:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/agent/Dockerfile cmd/opentelemetry/cmd/agent --build-arg TARGETARCH=$(GOARCH) | |||
docker build -t $(DOCKER_NAMESPACE)/jaeger-opentelemetry-ingester:${DOCKER_TAG} -f ${OTEL_COLLECTOR_DIR}/cmd/ingester/Dockerfile cmd/opentelemetry/cmd/ingester --build-arg TARGETARCH=$(GOARCH) | |||
|
|||
.PHONY: docker-images-jaeger-backend-debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this target should just delegate to docker-images-jaeger-backend
with some extra variables
I have another question related to this debug image:
|
Makefile
Outdated
.PHONY: docker-images-tracegen | ||
docker-images-tracegen: | ||
docker build -t $(DOCKER_NAMESPACE)/jaeger-tracegen:${DOCKER_TAG} cmd/tracegen/ --build-arg TARGETARCH=$(GOARCH) | ||
@echo "Finished building jaeger-tracegen ==============" | ||
|
||
.PHONY: docker-images-only | ||
docker-images-only: docker-images-cassandra docker-images-elastic docker-images-jaeger-backend docker-images-tracegen | ||
docker-images-only: docker-images-cassandra docker-images-elastic docker-images-jaeger-backend docker-images-jaeger-backend-debug docker-images-tracegen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The long line is getting difficult to grok. Is there a way to break the dependency targets into multiple lines, something like:
a: \
b \
c \
d
?
I think the biggest ask was not so much the debug tools, but just any tools, because when we build from |
True. For the debug images, I would even base it on something else. Note that the CMD instruction should also be custom for the debug image. |
Few more questions I have related to this:
|
We talked before about changing the base image (#2116), and to be honest, I forgot to add it to my queue. I guess it's on yours now :-) That said, for this specific issue here, users would need to deploy a different image anyway, as the process has to be started with Still about your first point: while I agree that people should be able to enter the container when they face an issue, I don't think it's unreasonable to ask them to deploy a debug image if problems can't be easily detected (#2452 comes to my mind). They can create a second deployment with this special image, and change the fronting service to direct part of the traffic to it: if there are 10 matching pods, one of them being from the debug deployment, then only 10% of the traffic will reach the debug image. |
Thank you for answering my questions earlier. This PR is ready for review again. I have updated the PR with:
I have one followup question: While trying out delve I found that delve suggest to compile with optimisations disabled for golang binaries (https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_exec.md) Would you suggest for jaeger components binaries used in debug images ? |
I noticed @jpkrohling comment in the github issue about disabling optimizations, hence updated the PR accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking good! I need to try it out myself, but I have a couple of comments:
- looks like it's missing the all-in-one image?
- can we somehow have a base image for our components? Or a script that generates the Dockerfile? Most of it seems to be the same plumbing code, and maintaining is probably becoming harder.
- perhaps as a follow-up PR, but we need to publish the images as well. Take a look at the Travis configuration and look for
DOCKER=true
: that's how/where we are building the images and pushing to the Docker Hub. - documentation, which would belong to jaegertracing/documentation
Hi @jpkrohling Thank you for giving detailed feedback earlier. I have updated the branch with the changes for second point in the review.
Can I ask for a review again please. I will work on rest three feedbacks once we're convinced with the dockerfiles layout changes since those three will depend on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really excited about this change, and I think we are almost at a working state.
To recap, this PR is still missing:
|
I am still working on the documentation part. |
Hello @jpkrohling I have raised a PR in documentation repo. I wasn't sure about what to document so most likely I am missing something. Thank you. |
I'll do a final check next Monday, but looks good to me! If anyone else wants to try this out before that, it would be awesome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I tested the collector image before and just tested the all-in-one and it looks good!
- Use alpine as the base image for jaeger backends Signed-off-by: Ashmita Bohara <[email protected]>
Signed-off-by: Ashmita Bohara <[email protected]>
Signed-off-by: Ashmita Bohara <[email protected]>
Signed-off-by: Ashmita Bohara <[email protected]>
Signed-off-by: Ashmita Bohara <[email protected]>
Signed-off-by: Ashmita Bohara <[email protected]>
Signed-off-by: Ashmita Bohara <[email protected]>
Signed-off-by: Ashmita Bohara <[email protected]>
Pull request has been modified.
Resolved the merge conflict due to another PR merge in Makefile. |
Thanks for your contribution! |
@@ -67,7 +67,7 @@ script: | |||
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) | |||
- if [ "$TESTS" == true ]; then make test-ci ; else echo 'skipping tests'; fi | |||
- if [ "$PROTO_GEN_TEST" == true ]; then make proto && git diff --name-status --exit-code ; else echo 'skipping protoc validation'; fi | |||
- if [ "$ALL_IN_ONE" == true ]; then bash ./scripts/travis/build-all-in-one-image.sh ; else echo 'skipping all_in_one'; fi | |||
- if [ "$ALL_IN_ONE" == true ]; then make create-baseimg-debugimg && bash ./scripts/travis/build-all-in-one-image.sh ; else echo 'skipping all_in_one'; fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the extra step make create-baseimg-debugimg
needed here but not in DOCKER step in L73?
Also, why not call it from ./scripts/travis/build-all-in-one-image.sh
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the extra step make create-baseimg-debugimg needed here but not in DOCKER step in L73?
My understanding is that script calls: make docker -> make docker-images-only -> make docker-images-jaeger-backend-debug which has dependencies on create-baseimg and create-debugimg.
Also, why not call it from ./scripts/travis/build-all-in-one-image.sh?
We can do it if you think that is the better place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be done after #2325, as it touches this code as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if need to support multi arch for other components.
base images need to published with multi arch too.
or just upgrade Dockerfile like https://github.com/morlay/jaeger/blob/master/cmd/all-in-one/Dockerfile
|
||
FROM scratch | ||
FROM $base_image AS release | ||
ARG TARGETARCH=amd64 | ||
ARG USER_UID=10001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ashmita152 was there a reason for TARGETARCH and USER_UID args to be repeated in each target, instead of being defined at the top of the file?
If not, probably another opportunity to clean up / DRY the docker files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will clean that today.
Signed-off-by: Ashmita Bohara [email protected]
Which problem is this PR solving?
Tackles #2493
Short description of the changes
As part of this PR, we are creating separate images for jaeger backend components.