Skip to content

Commit

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

Signed-off-by: BrunoTarijon <btarijon@gmail.com>
  • Loading branch information
BrunoTarijon committed Jul 31, 2024
1 parent 643d684 commit a253778
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 a253778

Please sign in to comment.