@@ -23,17 +23,20 @@ func (c *authOperator) handleRoute(ingress *configv1.Ingress) (*routev1.Route, *
23
23
return nil , nil , err
24
24
}
25
25
26
+ host := getCanonicalHost (route , ingress )
27
+ if len (host ) == 0 {
28
+ // be careful not to print route.spec as it many contain secrets
29
+ return nil , nil , fmt .Errorf ("route is not available at canonical host %s: %+v" , ingressToHost (ingress ), route .Status .Ingress )
30
+ }
31
+
26
32
// assume it is unsafe to mutate route in case we go to a shared informer in the future
27
33
// this way everything else can just assume route.Spec.Host is correct
28
34
// note that we are not updating route.Spec.Host in the API - that value is nonsense to us
29
35
route = route .DeepCopy ()
30
- route .Spec .Host = getCanonicalHost (route , ingress )
31
-
32
- if len (route .Spec .Host ) == 0 {
33
- return nil , nil , fmt .Errorf ("route has no host: %#v" , route )
34
- }
36
+ route .Spec .Host = host
35
37
36
38
if err := isValidRoute (route , ingress ); err != nil {
39
+ // TODO remove this delete so that we do not lose the early creation timestamp of our route
37
40
// delete the route so that it is replaced with the proper one in next reconcile loop
38
41
klog .Infof ("deleting invalid route: %#v" , route )
39
42
opts := & metav1.DeleteOptions {Preconditions : & metav1.Preconditions {UID : & route .UID }}
@@ -48,7 +51,8 @@ func (c *authOperator) handleRoute(ingress *configv1.Ingress) (*routev1.Route, *
48
51
return nil , nil , err
49
52
}
50
53
if len (routerSecret .Data ) == 0 {
51
- return nil , nil , fmt .Errorf ("router secret is empty: %#v" , routerSecret )
54
+ // be careful not to print the routerSecret even when it is empty
55
+ return nil , nil , fmt .Errorf ("router secret %s/%s is empty" , routerSecret .Namespace , routerSecret .Name )
52
56
}
53
57
54
58
return route , routerSecret , nil
0 commit comments