-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[processor/k8sattributes] Support name:tag@digest image name format #36145
base: main
Are you sure you want to change the base?
Conversation
|
8a9c1bd
to
90d3a08
Compare
e699514
to
09323ed
Compare
09323ed
to
828a728
Compare
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.
Thank's for working on this @spiffyy99!
I think the fix is in the right direction but I left some concerns.
@@ -816,7 +818,7 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) { | |||
"k8s.container.name": newExpectedValue(equal, "telemetrygen"), | |||
"container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), | |||
"container.image.repo_digests": newExpectedValue(shouldnotexist, ""), | |||
"container.image.tag": newExpectedValue(equal, "latest"), | |||
"container.image.tag": newExpectedValue(shouldnotexist, ""), |
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.
Shouldn't we honor that implicitly latest version
here? Otherwise this might break users that rely on this assumption right now. @TylerHelmuth wdyt?
@@ -504,7 +505,7 @@ func TestE2E_NamespacedRBAC(t *testing.T) { | |||
"k8s.container.name": newExpectedValue(equal, "telemetrygen"), | |||
"container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), | |||
"container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), | |||
"container.image.tag": newExpectedValue(equal, "latest"), | |||
"container.image.tag": newExpectedValue(shouldnotexist, ""), |
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 we preserve this? Unless it is a wrong assumption that we want to fix.
FWIWI a container with image: busybox
in the spec will produce a running container with
image: docker.io/library/busybox:latest
so technically I think that putting latest
when the tag is absent in the spec, is correct.
if c.Rules.ContainerImageName { | ||
container.ImageName = name | ||
} | ||
if c.Rules.ContainerImageTag { |
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.
👍🏽
Since we are on it, I also wonder if we should override the ImageTag
from the container's status in case it is available.
See https://github.com/kubernetes/api/blob/v0.32.0-alpha.3/core/v1/types.go#L3047-L3055.
container.ImageName = spec.Image[:nameTagSep] | ||
} else { | ||
container.ImageName = spec.Image | ||
name, tag, err := parseNameAndTagFromImage(spec.Image) |
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.
Could we reflect this logic in the documentation as well? Something like what was described at #36131 (comment)
Description
Fixed issue with
k8sattributesprocessor
where digest is not properly separated from tag if both are present. used official docker library to perform parsing.Link to tracking issue
Fixes #36131
Testing
unit tests
integration/e2e tests
Documentation
N/A. Fields are already described correctly, this is simply fixing parsing logic