Skip to content

Commit 86de23b

Browse files
committed
tmp: replace the route-specific CA with trust bundle?
1 parent bc16162 commit 86de23b

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

pkg/operator2/operator.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,7 @@ func (c *authOperator) checkDeploymentReady(deployment *appsv1.Deployment, opera
532532
}
533533

534534
func (c *authOperator) checkRouteHealthy(route *routev1.Route, routerSecret *corev1.Secret, ingress *configv1.Ingress) (ready bool, msg, reason string, err error) {
535-
caData := routerSecretToCA(route, routerSecret, ingress)
536-
537-
rt, err := transportFor("", caData, nil, nil)
535+
rt, err := transportForTrustedCA("", nil, nil)
538536
if err != nil {
539537
return false, "", "FailedTransport", fmt.Errorf("failed to build transport for route: %v", err)
540538
}

pkg/operator2/route.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package operator2
22

33
import (
4-
"crypto/x509"
54
"fmt"
65

76
corev1 "k8s.io/api/core/v1"
@@ -127,31 +126,6 @@ func routerSecretToSNI(routerSecret *corev1.Secret) []configv1.NamedCertificate
127126
return out
128127
}
129128

130-
func routerSecretToCA(route *routev1.Route, routerSecret *corev1.Secret, ingress *configv1.Ingress) []byte {
131-
var caData []byte
132-
133-
// find the domain that matches our route
134-
if certs, ok := routerSecret.Data[ingress.Spec.Domain]; ok {
135-
caData = certs
136-
}
137-
138-
// if we have no CA, use system roots (or more correctly, if we have no CERTIFICATE block)
139-
// TODO so this branch is effectively never taken, because the value of caData
140-
// is the concatenation of tls.crt and tls.key - the .crt data gets parsed
141-
// as a valid cert by AppendCertsFromPEM meaning ok is always true.
142-
// because Go is weird with how it validates TLS connections, having the actual
143-
// peer cert loaded in the transport is totally fine with the connection even
144-
// without having the CA loaded. this is weird but it lets us tolerate scenarios
145-
// where we do not have the CA (i.e. admin is using a cert from an internal company CA).
146-
// thus the only way we take this branch is if len(caData) == 0
147-
if ok := x509.NewCertPool().AppendCertsFromPEM(caData); !ok {
148-
klog.Infof("using global CAs for %s, ingress domain=%s, cert data len=%d", route.Spec.Host, ingress.Spec.Domain, len(caData))
149-
return nil
150-
}
151-
152-
return caData
153-
}
154-
155129
func getCanonicalHost(route *routev1.Route, ingressConfig *configv1.Ingress) string {
156130
host := ingressToHost(ingressConfig)
157131
for _, ingress := range route.Status.Ingress {

0 commit comments

Comments
 (0)