Skip to content

Commit

Permalink
Use config flag instead of constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ReToCode committed Oct 11, 2023
1 parent 13fcbd5 commit 28dd4c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 2 additions & 6 deletions pkg/reconciler/ingress/resources/destinationrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,11 @@ import (
"knative.dev/networking/pkg/apis/networking"
"knative.dev/networking/pkg/apis/networking/v1alpha1"
"knative.dev/networking/pkg/certificates"
"knative.dev/networking/pkg/config"
"knative.dev/pkg/kmap"
"knative.dev/pkg/kmeta"
)

const (
// has to match config/700-istio-secret.yaml
knativeServingCertsSecret = "routing-serving-certs"
)

// MakeInternalEncryptionDestinationRule creates a DestinationRule that enables upstream TLS
// on for the specified host
func MakeInternalEncryptionDestinationRule(host string, ing *v1alpha1.Ingress, http2 bool) *v1beta1.DestinationRule {
Expand All @@ -47,7 +43,7 @@ func MakeInternalEncryptionDestinationRule(host string, ing *v1alpha1.Ingress, h
TrafficPolicy: &istiov1beta1.TrafficPolicy{
Tls: &istiov1beta1.ClientTLSSettings{
Mode: istiov1beta1.ClientTLSSettings_SIMPLE,
CredentialName: knativeServingCertsSecret,
CredentialName: config.ServingRoutingCertName,
SubjectAltNames: []string{
// SAN used by Activator
certificates.DataPlaneRoutingSAN,
Expand Down
5 changes: 3 additions & 2 deletions pkg/reconciler/ingress/resources/destinationrule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"knative.dev/networking/pkg/apis/networking"
"knative.dev/networking/pkg/apis/networking/v1alpha1"
"knative.dev/networking/pkg/certificates"
"knative.dev/networking/pkg/config"
"knative.dev/pkg/kmeta"
)

Expand Down Expand Up @@ -69,7 +70,7 @@ func TestMakeInternalEncryptionDestinationRuleHttp1(t *testing.T) {
TrafficPolicy: &istiov1beta1.TrafficPolicy{
Tls: &istiov1beta1.ClientTLSSettings{
Mode: istiov1beta1.ClientTLSSettings_SIMPLE,
CredentialName: knativeServingCertsSecret,
CredentialName: config.ServingRoutingCertName,
SubjectAltNames: []string{certificates.DataPlaneRoutingSAN, certificates.DataPlaneUserSAN(ing.Namespace)},
},
},
Expand Down Expand Up @@ -102,7 +103,7 @@ func TestMakeInternalEncryptionDestinationRuleHttp2(t *testing.T) {
TrafficPolicy: &istiov1beta1.TrafficPolicy{
Tls: &istiov1beta1.ClientTLSSettings{
Mode: istiov1beta1.ClientTLSSettings_SIMPLE,
CredentialName: knativeServingCertsSecret,
CredentialName: config.ServingRoutingCertName,
SubjectAltNames: []string{certificates.DataPlaneRoutingSAN, certificates.DataPlaneUserSAN(ing.Namespace)},
},
ConnectionPool: &istiov1beta1.ConnectionPoolSettings{
Expand Down

0 comments on commit 28dd4c5

Please sign in to comment.