Skip to content

Commit

Permalink
check for route ownership via annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
bparees committed Feb 26, 2019
1 parent 5899596 commit 76c641b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 1 addition & 3 deletions pkg/resource/imageconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ func (gic *generatorImageConfig) getRouteHostnames() ([]string, error) {
}
defaultHost := ""
for _, route := range routes {
routeOwner := metav1.GetControllerOf(route)

// ignore routes that weren't created by the registry operator
if routeOwner == nil || routeOwner.UID != gic.owner.UID {
if _, ok := route.Annotations[RouteOwnerAnnotation]; !ok {
continue
}
for _, ingress := range route.Status.Ingress {
Expand Down
7 changes: 5 additions & 2 deletions pkg/resource/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/openshift/cluster-image-registry-operator/pkg/parameters"
)

const RouteOwnerAnnotation = "imageregistry.openshift.io"

var _ Mutator = &generatorRoute{}

type generatorRoute struct {
Expand Down Expand Up @@ -50,8 +52,9 @@ func (gr *generatorRoute) GetName() string {
func (gr *generatorRoute) expected() (runtime.Object, error) {
r := &routeapi.Route{
ObjectMeta: metav1.ObjectMeta{
Name: gr.GetName(),
Namespace: gr.GetNamespace(),
Name: gr.GetName(),
Namespace: gr.GetNamespace(),
Annotations: map[string]string{RouteOwnerAnnotation: "true"},
},
Spec: routeapi.RouteSpec{
Host: gr.route.Hostname,
Expand Down

0 comments on commit 76c641b

Please sign in to comment.