Skip to content
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

fix(controller): Get the right resourceName for traefik.io.Fixes #3615 #3759

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading