Skip to content

Commit

Permalink
use new internal TLS names
Browse files Browse the repository at this point in the history
  • Loading branch information
KauzClay committed Sep 22, 2023
1 parent a544014 commit e97337c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pkg/reconciler/autoscaling/config/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestStoreImmutableConfig(t *testing.T) {
config := store.Load()
config.Autoscaler.MaxScaleUpRate = 100.0
config.Deployment.ProgressDeadline = 3 * time.Minute
config.Network.DataplaneTrust = netcfg.TrustMinimal
config.Network.SystemInternalTLS = netcfg.EncryptionEnabled
newConfig := store.Load()

if newConfig.Autoscaler.MaxScaleUpRate == 100.0 {
Expand All @@ -76,7 +76,7 @@ func TestStoreImmutableConfig(t *testing.T) {
t.Error("Deployment config is not immutable")
}

if newConfig.Network.DataplaneTrust != netcfg.TrustDisabled {
if newConfig.Network.SystemInternalTLS != netcfg.EncryptionDisabled {
t.Error("Network config is not immutable")
}
}
3 changes: 1 addition & 2 deletions pkg/reconciler/autoscaling/kpa/kpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"go.uber.org/zap"

nv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1"
netcfg "knative.dev/networking/pkg/config"
"knative.dev/pkg/logging"
pkgmetrics "knative.dev/pkg/metrics"
"knative.dev/pkg/ptr"
Expand Down Expand Up @@ -129,7 +128,7 @@ func (c *Reconciler) ReconcileKind(ctx context.Context, pa *autoscalingv1alpha1.
// When activator CA is enabled, force activator always in path.
// TODO: This is a temporary state and to be fixed.
// See also issues/11906 and issues/12797.
case config.FromContext(ctx).Network.DataplaneTrust != netcfg.TrustDisabled:
case config.FromContext(ctx).Network.SystemInternalTLSEnabled():
mode = nv1alpha1.SKSOperationModeProxy

// If the want == -1 and PA is inactive that implies the autoscaler
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/autoscaling/kpa/kpa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func initialScaleZeroASConfig() *autoscalerconfig.Config {

func activatorCertsNetConfig() *netcfg.Config {
nc, _ := netcfg.NewConfigFromMap(map[string]string{
netcfg.DataplaneTrustKey: "minimal",
netcfg.SystemInternalTLSKey: "enabled",
})
return nc
}
Expand All @@ -140,7 +140,7 @@ func defaultConfig() *config.Config {
deployment.ProgressDeadlineKey: progressDeadline.String(),
})
networkConfig, _ := netcfg.NewConfigFromMap(map[string]string{
netcfg.DataplaneTrustKey: "disabled",
netcfg.SystemInternalTLSKey: "disabled",
})

return &config.Config{
Expand Down
5 changes: 2 additions & 3 deletions pkg/reconciler/route/resources/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (

"knative.dev/networking/pkg/apis/networking"
netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1"
netcfg "knative.dev/networking/pkg/config"
netheader "knative.dev/networking/pkg/http/header"
ingress "knative.dev/networking/pkg/ingress"
"knative.dev/pkg/kmeta"
Expand Down Expand Up @@ -150,7 +149,7 @@ func makeIngressSpec(
return netv1alpha1.IngressSpec{}, err
}
rule := makeIngressRule(domains, r.Namespace,
visibility, tc.Targets[name], ro.RolloutsByTag(name), networkConfig.DataplaneTrust != netcfg.TrustDisabled)
visibility, tc.Targets[name], ro.RolloutsByTag(name), networkConfig.SystemInternalTLSEnabled())
if featuresConfig.TagHeaderBasedRouting == apicfg.Enabled {
if rule.HTTP.Paths[0].AppendHeaders == nil {
rule.HTTP.Paths[0].AppendHeaders = make(map[string]string, 1)
Expand All @@ -172,7 +171,7 @@ func makeIngressSpec(
// Since names are sorted `DefaultTarget == ""` is the first one,
// so just pass the subslice.
rule.HTTP.Paths = append(
makeTagBasedRoutingIngressPaths(r.Namespace, tc, ro, networkConfig.DataplaneTrust != netcfg.TrustDisabled, names[1:]), rule.HTTP.Paths...)
makeTagBasedRoutingIngressPaths(r.Namespace, tc, ro, networkConfig.SystemInternalTLSEnabled(), names[1:]), rule.HTTP.Paths...)
} else {
// If a request is routed by a tag-attached hostname instead of the tag header,
// the request may not have the tag header "Knative-Serving-Tag",
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/route/resources/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,6 @@ func testContextWithHTTPOption() context.Context {

func testContextWithActivatorCA() context.Context {
cfg := testConfig()
cfg.Network.DataplaneTrust = netcfg.TrustMinimal
cfg.Network.SystemInternalTLS = netcfg.EncryptionEnabled
return config.ToContext(context.Background(), cfg)
}
2 changes: 1 addition & 1 deletion pkg/reconciler/route/resources/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func testConfig() *config.Config {
DefaultIngressClass: "test-ingress-class",
DomainTemplate: netcfg.DefaultDomainTemplate,
TagTemplate: netcfg.DefaultTagTemplate,
DataplaneTrust: netcfg.TrustDisabled,
SystemInternalTLS: netcfg.EncryptionDisabled,
},
Features: &apiConfig.Features{
MultiContainer: apiConfig.Disabled,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ function install() {

if (( ENABLE_TLS )); then
echo "Patch to config-network to enable internal encryption"
toggle_feature dataplane-trust minimal config-network
toggle_feature system-internal-tls Enabled config-network
if [[ "$INGRESS_CLASS" == "kourier.ingress.networking.knative.dev" ]]; then
echo "Point Kourier local gateway to custom server certificates"
toggle_feature cluster-cert-secret server-certs config-kourier
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/autoscale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ func TestTargetBurstCapacity(t *testing.T) {
}

// TODO: Remove this when "activator always stay in path" is eliminated.
dataplaneTrustMode := cm.Data[netcfg.DataplaneTrustKey]
if (dataplaneTrustMode != "" && !strings.EqualFold(dataplaneTrustMode, string(netcfg.TrustDisabled))) || strings.EqualFold(cm.Data[netcfg.InternalEncryptionKey], "true") {
dataplaneTrustMode := cm.Data[netcfg.SystemInternalTLSKey]
if (dataplaneTrustMode != "" && !strings.EqualFold(dataplaneTrustMode, string(netcfg.EncryptionDisabled))) || strings.EqualFold(cm.Data[netcfg.InternalEncryptionKey], "true") {
t.Skip("Skipping TestTargetBurstCapacity as activator always stay in path.")
}

Expand Down

0 comments on commit e97337c

Please sign in to comment.