Skip to content

Commit

Permalink
fix(controller): Get the right resourceName for traefik.io.Fixes #3615 (
Browse files Browse the repository at this point in the history
#3759)

Signed-off-by: BrunoTarijon <[email protected]>
  • Loading branch information
BrunoTarijon authored and zachaller committed Aug 13, 2024
1 parent e621fb2 commit a0b7332
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions rollout/trafficrouting/traefik/traefik.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ const Type = "Traefik"
const traefikServices = "traefikservices"
const TraefikServiceUpdateError = "TraefikServiceUpdateError"

var (
apiGroupToResource = map[string]string{
defaults.GetTraefikAPIGroup(): traefikServices,
}
)

type ReconcilerConfig struct {
Rollout *v1alpha1.Rollout
Client ClientInterface
Expand All @@ -41,6 +35,13 @@ type Reconciler struct {
Recorder record.EventRecorder
}

func apiGroupToResource(group string) string {
apiGroupToResource := map[string]string{
defaults.GetTraefikAPIGroup(): traefikServices,
}
return apiGroupToResource[group]
}

func (r *Reconciler) sendWarningEvent(id, msg string) {
r.sendEvent(corev1.EventTypeWarning, id, msg)
}
Expand Down Expand Up @@ -71,7 +72,8 @@ func GetMappingGVR() schema.GroupVersionResource {
group := defaults.GetTraefikAPIGroup()
parts := strings.Split(defaults.GetTraefikVersion(), "/")
version := parts[len(parts)-1]
resourceName := apiGroupToResource[group]
resourceName := apiGroupToResource(group)

return schema.GroupVersionResource{
Group: group,
Version: version,
Expand Down

0 comments on commit a0b7332

Please sign in to comment.