-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Use combination of namespace, GitHub URL, and runner group when hashing the listener name #4299
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -690,20 +690,28 @@ func scaleSetListenerConfigName(autoscalingListener *v1alpha1.AutoscalingListene | |
| return fmt.Sprintf("%s-config", autoscalingListener.Name) | ||
| } | ||
|
|
||
| func scaleSetListenerName(autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet) string { | ||
| namespaceHash := hash.FNVHashString(autoscalingRunnerSet.Namespace) | ||
| func hashSuffix(namespace, runnerGroup, configURL string) string { | ||
| namespaceHash := hash.FNVHashString(namespace + "@" + runnerGroup + "@" + configURL) | ||
| if len(namespaceHash) > 8 { | ||
| namespaceHash = namespaceHash[:8] | ||
| } | ||
| return fmt.Sprintf("%v-%v-listener", autoscalingRunnerSet.Name, namespaceHash) | ||
| return namespaceHash | ||
| } | ||
|
|
||
| func scaleSetListenerName(autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet) string { | ||
| return fmt.Sprintf( | ||
| "%v-%v-listener", | ||
| autoscalingRunnerSet.Name, | ||
| hashSuffix( | ||
| autoscalingRunnerSet.Namespace, | ||
| autoscalingRunnerSet.Spec.RunnerGroup, | ||
| autoscalingRunnerSet.Spec.GitHubConfigUrl, | ||
| ), | ||
| ) | ||
| } | ||
|
|
||
| func proxyListenerSecretName(autoscalingListener *v1alpha1.AutoscalingListener) string { | ||
| namespaceHash := hash.FNVHashString(autoscalingListener.Spec.AutoscalingRunnerSetNamespace) | ||
| if len(namespaceHash) > 8 { | ||
| namespaceHash = namespaceHash[:8] | ||
| } | ||
| return fmt.Sprintf("%v-%v-listener-proxy", autoscalingListener.Spec.AutoscalingRunnerSetName, namespaceHash) | ||
| return autoscalingListener.Name + "-proxy" | ||
|
||
| } | ||
|
|
||
| func proxyEphemeralRunnerSetSecretName(ephemeralRunnerSet *v1alpha1.EphemeralRunnerSet) string { | ||
|
|
||
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 hash input format uses '@' as a delimiter between components. If any of these fields (namespace, runnerGroup, or configURL) can contain '@' characters, this could lead to hash collisions. Consider using a more robust delimiter strategy or including field separators that cannot appear in the input values.