-
Notifications
You must be signed in to change notification settings - Fork 751
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
Canary labels copied to primary on promotion when include-label-prefix not defined #1403
Comments
Can u please take me of this smarter then me trace me shit Sent from my iPhoneOn Apr 4, 2023, at 1:46 PM, ta924 ***@***.***> wrote:
I have noticed that when a canary is promoted I'm seeing all the canary annotations copied over to the primary when include-label-prefix is not defined. It seems that * and when a value is not defined resulting in the same results. I tested the method in the util_test file with the below method and it fails since the strings.HasPrefix returns true when comparing any string against an empty string. Is this expected behavior or should there be an additional check to rule out empty strings?
For reference I'm utilizing 1.24.1, but I didn't see any changes to the methods that would eliminate this issues.
`
func TestIncludeLabelsNoIncludes(t *testing.T) {
labels := map[string]string{
"foo": "foo-value",
"bar": "bar-value",
"lorem": "ipsum",
}
includeLabelPrefix := []string{""}
filteredLabels := includeLabelsByPrefix(labels, includeLabelPrefix)
/*assert.Equal(t, filteredLabels, map[string]string{
//"foo": "foo-value",
//"lorem": "ipsum",
// bar excluded
})*/
assert.Equal(t, map[string]string{}, filteredLabels)
}
`
`
--- FAIL: TestIncludeLabelsNoIncludes (0.00s)
Expected :map[string]string{}
Actual :map[string]string{"bar":"bar-value", "foo":"foo-value", "lorem":"ipsum"}
`
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@stefanprodan This might be as simple as removing the logic https://github.com/fluxcd/flagger/blob/main/pkg/canary/deployment_controller.go#L134-L136 and calling the
I still need to do some testing on |
@stefanprodan I will submit a PR for review today, thanks for evaluating |
I have noticed that when a canary is promoted I'm seeing all the canary annotations copied over to the primary when
include-label-prefix
is not defined. It seems that*
and when a value is not defined resulting in the same results. I tested the method in the util_test file with the below method and it fails since thestrings.HasPrefix
returns true when comparing any string against an empty string. Is this expected behavior or should there be an additional check to rule out empty strings?For reference I'm utilizing 1.24.1, but I didn't see any changes to the methods that would eliminate this issues.
Primary after creation and before first analysis
Primary after promotion
From main I would expect the below would default to an empty string
Then the split would create an array with one entry consisting of one entry
Followed by an always true from the HasPrefix method when comparing the string
I also noticed if I set
include-label-prefix
to a value that doesn't match any prefix of the labels on the canary, all labels will be dropped on the primary after promotion.The text was updated successfully, but these errors were encountered: