-
Notifications
You must be signed in to change notification settings - Fork 28
Avoid name conflict by using deployment+delimiter+container as the key #159
Avoid name conflict by using deployment+delimiter+container as the key #159
Conversation
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.
@houshengbo: 0 warnings.
In response to this:
Issue to be fixed
Fixes #
Proposed Changes
Release Note
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.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: houshengbo 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 |
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.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
6081264
to
0b78105
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.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
@@ -33,6 +33,7 @@ import ( | |||
var ( | |||
// The string to be replaced by the container name | |||
containerNameVariable = "${NAME}" | |||
delimiter = "-" |
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.
Format Go code:
delimiter = "-" | |
delimiter = "-" |
e912d23
to
4f88185
Compare
@@ -33,6 +33,7 @@ import ( | |||
var ( | |||
// The string to be replaced by the container name | |||
containerNameVariable = "${NAME}" | |||
delimiter = "-" |
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 thought the decision from chat was to use / as a delimiter, am I misremembering?
In particular, because - is allowed in deployment's container names, the override for
deployment-container
is ambiguous, it could mean container in deployment, or it could mean a container called deployment-container.
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 got the issue. It looks like I need to switch to /
.
func getNewImage(registry *eventingv1alpha1.Registry, containerName string) string { | ||
overrideImage := registry.Override[containerName] | ||
func getNewImage(registry *eventingv1alpha1.Registry, containerName, deploymentName string) string { | ||
overrideImage := registry.Override[deploymentName+delimiter+containerName] |
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.
Re-using the same override map for deployment and deployment-container style overrides could cause issues if the deployment name contains -, which seems to be possible.
Thoughts on creating two maps, one for container-only overrides and one for deployment+container?
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 have changed the delimiter to /
.
@@ -172,6 +172,96 @@ var updateDeploymentImageTests = []updateDeploymentImageTest{ | |||
Env: []corev1.EnvVar{{Name: "SOME_IMAGE", Value: "docker.io/my/overridden-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.
It would be nice to test a few more corner cases:
- container X in multiple deployments
- Specify just X-Y, doesn't apply to container called X-Y
4f88185
to
4464b88
Compare
4464b88
to
1183db3
Compare
The following is the coverage report on the affected files.
|
/lgtm |
I wanted to give this a try today. Here are the cases I tried:
|
Issue to be fixed
Fixes #148
Proposed Changes
Release Note