Skip to content

Commit 3d73636

Browse files
authored
Use combination of namespace, GitHub URL, and runner group when hashing the listener name (#4299)
1 parent 722c6e9 commit 3d73636

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

controllers/actions.github.com/resourcebuilder.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -690,20 +690,28 @@ func scaleSetListenerConfigName(autoscalingListener *v1alpha1.AutoscalingListene
690690
return fmt.Sprintf("%s-config", autoscalingListener.Name)
691691
}
692692

693-
func scaleSetListenerName(autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet) string {
694-
namespaceHash := hash.FNVHashString(autoscalingRunnerSet.Namespace)
693+
func hashSuffix(namespace, runnerGroup, configURL string) string {
694+
namespaceHash := hash.FNVHashString(namespace + "@" + runnerGroup + "@" + configURL)
695695
if len(namespaceHash) > 8 {
696696
namespaceHash = namespaceHash[:8]
697697
}
698-
return fmt.Sprintf("%v-%v-listener", autoscalingRunnerSet.Name, namespaceHash)
698+
return namespaceHash
699+
}
700+
701+
func scaleSetListenerName(autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet) string {
702+
return fmt.Sprintf(
703+
"%v-%v-listener",
704+
autoscalingRunnerSet.Name,
705+
hashSuffix(
706+
autoscalingRunnerSet.Namespace,
707+
autoscalingRunnerSet.Spec.RunnerGroup,
708+
autoscalingRunnerSet.Spec.GitHubConfigUrl,
709+
),
710+
)
699711
}
700712

701713
func proxyListenerSecretName(autoscalingListener *v1alpha1.AutoscalingListener) string {
702-
namespaceHash := hash.FNVHashString(autoscalingListener.Spec.AutoscalingRunnerSetNamespace)
703-
if len(namespaceHash) > 8 {
704-
namespaceHash = namespaceHash[:8]
705-
}
706-
return fmt.Sprintf("%v-%v-listener-proxy", autoscalingListener.Spec.AutoscalingRunnerSetName, namespaceHash)
714+
return autoscalingListener.Name + "-proxy"
707715
}
708716

709717
func proxyEphemeralRunnerSetSecretName(ephemeralRunnerSet *v1alpha1.EphemeralRunnerSet) string {

0 commit comments

Comments
 (0)