@@ -110,15 +110,17 @@ type LBHost struct {
110
110
}
111
111
112
112
type cluster struct {
113
- Name string
114
- VirtualHost string
115
- HealthCheckPath string
116
- HealthCheckHost string // with Wildcard, the HealthCheck host can be different than the VirtualHost
117
- HttpVersion string
118
- Timeout time.Duration
119
- Hosts []LBHost
120
- authTLSSecret string // the secret name of the CA : could be "ca-secret"
121
- authTLSVerifyClient string // Verify or not the client cert (can be either true or false)
113
+ Name string
114
+ VirtualHost string
115
+ HealthCheckPath string
116
+ HealthCheckHost string // with Wildcard, the HealthCheck host can be different than the VirtualHost
117
+ HttpVersion string
118
+ Timeout time.Duration
119
+ Hosts []LBHost
120
+ authTLSSecret string // the secret name of the CA : could be "ca-secret"
121
+ authTLSVerifyClient string // Verify or not the client cert (can be either true or false)
122
+ authTLSEnvoyClientCert string // the envoy cert, if authTLSSecret is set, this will be used for mTLS between envoy and the backend
123
+ authTLSEnvoyClientKey string // the envoy key, if authTLSSecret is set, this will be used for mTLS between envoy and the backend
122
124
}
123
125
124
126
func (c * cluster ) identity () string {
@@ -312,6 +314,13 @@ func (ing *envoyIngress) setAuthTlsSecret(version string) {
312
314
func (ing * envoyIngress ) setAuthTlsVerifyClient (verify string ) {
313
315
ing .cluster .authTLSVerifyClient = verify
314
316
}
317
+ func (ing * envoyIngress ) setAuthTlsEnvoyClientCert (cert string ) {
318
+ ing .cluster .authTLSEnvoyClientCert = cert
319
+ }
320
+
321
+ func (ing * envoyIngress ) setAuthTlsEnvoyClientKey (key string ) {
322
+ ing .cluster .authTLSEnvoyClientKey = key
323
+ }
315
324
316
325
// hostMatch returns true if tlsHost and ruleHost match, with wildcard support
317
326
//
@@ -553,16 +562,19 @@ func translateIngresses(ingresses []*k8s.Ingress, syncSecrets bool, secrets []*v
553
562
// envoyIngress.setUpstreamHttpVersion(val)
554
563
// }
555
564
}
556
-
557
565
if ingress .Annotations ["yggdrasil.uswitch.com/auth-tls-secret" ] != "" {
558
566
val := ingress .Annotations ["yggdrasil.uswitch.com/auth-tls-secret" ]
559
567
caSecret , err := getCaTlsSecret (ingress , secrets ) // auth-tls-secret is only the name of the secret, it does not contain the namespace
560
568
if err != nil {
561
569
logrus .Warnf ("Failed to retrive auth-tls-secret %s/%s: %s" , ingress .Namespace , val , err .Error ())
562
570
} else {
563
- caCert := string (caSecret .Data ["tls.crt" ])
571
+ caCert := string (caSecret .Data ["ca.crt" ])
572
+ envoyClientCert := string (caSecret .Data ["tls.crt" ])
573
+ envoyClientKey := string (caSecret .Data ["tls.key" ])
564
574
envoyIngress .setAuthTlsSecret (fmt .Sprintf ("%s/%s" , ingress .Namespace , val ))
565
575
envoyIngress .vhost .TrustedCa = caCert
576
+ envoyIngress .setAuthTlsEnvoyClientCert (envoyClientCert )
577
+ envoyIngress .setAuthTlsEnvoyClientKey (envoyClientKey )
566
578
}
567
579
}
568
580
0 commit comments