@@ -40,11 +40,13 @@ type RouteSyncController struct {
40
40
routeName string
41
41
isHealthCheckEnabled bool
42
42
// clients
43
- operatorClient v1helpers.OperatorClient
44
- routeClient routeclientv1.RoutesGetter
45
- operatorConfigLister operatorv1listers.ConsoleLister
46
- ingressConfigLister configlistersv1.IngressLister
47
- secretLister corev1listers.SecretLister
43
+ operatorClient v1helpers.OperatorClient
44
+ routeClient routeclientv1.RoutesGetter
45
+ operatorConfigLister operatorv1listers.ConsoleLister
46
+ ingressConfigLister configlistersv1.IngressLister
47
+ secretLister corev1listers.SecretLister
48
+ infrastructureConfigLister configlistersv1.InfrastructureLister
49
+ clusterVersionLister configlistersv1.ClusterVersionLister
48
50
}
49
51
50
52
func NewRouteSyncController (
@@ -63,13 +65,15 @@ func NewRouteSyncController(
63
65
recorder events.Recorder ,
64
66
) factory.Controller {
65
67
ctrl := & RouteSyncController {
66
- routeName : routeName ,
67
- isHealthCheckEnabled : isHealthCheckEnabled ,
68
- operatorClient : operatorClient ,
69
- operatorConfigLister : operatorConfigInformer .Lister (),
70
- ingressConfigLister : configInformer .Config ().V1 ().Ingresses ().Lister (),
71
- routeClient : routev1Client ,
72
- secretLister : secretInformer .Lister (),
68
+ routeName : routeName ,
69
+ isHealthCheckEnabled : isHealthCheckEnabled ,
70
+ operatorClient : operatorClient ,
71
+ operatorConfigLister : operatorConfigInformer .Lister (),
72
+ ingressConfigLister : configInformer .Config ().V1 ().Ingresses ().Lister (),
73
+ routeClient : routev1Client ,
74
+ secretLister : secretInformer .Lister (),
75
+ infrastructureConfigLister : configInformer .Config ().V1 ().Infrastructures ().Lister (),
76
+ clusterVersionLister : configInformer .Config ().V1 ().ClusterVersions ().Lister (),
73
77
}
74
78
75
79
configV1Informers := configInformer .Config ().V1 ()
@@ -114,6 +118,35 @@ func (c *RouteSyncController) Sync(ctx context.Context, controllerContext factor
114
118
115
119
statusHandler := status .NewStatusHandler (c .operatorClient )
116
120
121
+ // Do not proceed to the route checks if alternative ingress is requested.
122
+ switch c .routeName {
123
+ case api .OpenShiftConsoleRouteName :
124
+ if len (operatorConfig .Spec .Ingress .ConsoleURL ) != 0 {
125
+ return statusHandler .FlushAndReturn (nil )
126
+ }
127
+ case api .OpenShiftConsoleDownloadsRouteName :
128
+ if len (operatorConfig .Spec .Ingress .ClientDownloadsURL ) != 0 {
129
+ return statusHandler .FlushAndReturn (nil )
130
+ }
131
+ }
132
+
133
+ infrastructureConfig , err := c .infrastructureConfigLister .Get (api .ConfigResourceName )
134
+ if err != nil {
135
+ return statusHandler .FlushAndReturn (err )
136
+ }
137
+
138
+ clusterVersionConfig , err := c .clusterVersionLister .Get ("version" )
139
+ if err != nil {
140
+ return statusHandler .FlushAndReturn (err )
141
+ }
142
+
143
+ // Disable the route check for external control plane topology (hypershift) if the ingress capability is disabled.
144
+ // The components will miss the required RBAC to implement the custom hostname or TLS.
145
+ // Link: https://github.com/openshift/enhancements/blob/f5290a98ea4f23f8e76621806b656a3849c74a17/enhancements/ingress/optional-ingress-hypershift.md#component-routes.
146
+ if util .IsExternalControlPlaneWithIngressDisabled (infrastructureConfig , clusterVersionConfig ) {
147
+ return statusHandler .FlushAndReturn (nil )
148
+ }
149
+
117
150
ingressConfig , err := c .ingressConfigLister .Get (api .ConfigResourceName )
118
151
if err != nil {
119
152
return statusHandler .FlushAndReturn (err )
0 commit comments