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 d0f5ac2 commit e284288
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 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

Check failure on line 69 in pkg/reconciler/autoscaling/config/store_test.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

config.Network.SystemInternalTLS undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLS)

Check failure on line 69 in pkg/reconciler/autoscaling/config/store_test.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

undefined: netcfg.EncryptionEnabled

Check failure on line 69 in pkg/reconciler/autoscaling/config/store_test.go

View workflow job for this annotation

GitHub Actions / build / Build

config.Network.SystemInternalTLS undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLS)

Check failure on line 69 in pkg/reconciler/autoscaling/config/store_test.go

View workflow job for this annotation

GitHub Actions / build / Build

undefined: 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 {

Check failure on line 79 in pkg/reconciler/autoscaling/config/store_test.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

newConfig.Network.SystemInternalTLS undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLS)

Check failure on line 79 in pkg/reconciler/autoscaling/config/store_test.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

undefined: netcfg.EncryptionDisabled

Check failure on line 79 in pkg/reconciler/autoscaling/config/store_test.go

View workflow job for this annotation

GitHub Actions / build / Build

newConfig.Network.SystemInternalTLS undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLS)

Check failure on line 79 in pkg/reconciler/autoscaling/config/store_test.go

View workflow job for this annotation

GitHub Actions / build / Build

undefined: 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():

Check failure on line 131 in pkg/reconciler/autoscaling/kpa/kpa.go

View workflow job for this annotation

GitHub Actions / build

config.FromContext(ctx).Network.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)

Check failure on line 131 in pkg/reconciler/autoscaling/kpa/kpa.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

config.FromContext(ctx).Network.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)

Check failure on line 131 in pkg/reconciler/autoscaling/kpa/kpa.go

View workflow job for this annotation

GitHub Actions / build / Build

config.FromContext(ctx).Network.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)

Check failure on line 131 in pkg/reconciler/autoscaling/kpa/kpa.go

View workflow job for this annotation

GitHub Actions / analyze / Go vulnerability Detection

config.FromContext(ctx).Network.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method 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())

Check failure on line 152 in pkg/reconciler/route/resources/ingress.go

View workflow job for this annotation

GitHub Actions / build

networkConfig.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)

Check failure on line 152 in pkg/reconciler/route/resources/ingress.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

networkConfig.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)

Check failure on line 152 in pkg/reconciler/route/resources/ingress.go

View workflow job for this annotation

GitHub Actions / build / Build

networkConfig.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)

Check failure on line 152 in pkg/reconciler/route/resources/ingress.go

View workflow job for this annotation

GitHub Actions / analyze / Go vulnerability Detection

networkConfig.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method 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...)

Check failure on line 174 in pkg/reconciler/route/resources/ingress.go

View workflow job for this annotation

GitHub Actions / build

networkConfig.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)

Check failure on line 174 in pkg/reconciler/route/resources/ingress.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

networkConfig.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)

Check failure on line 174 in pkg/reconciler/route/resources/ingress.go

View workflow job for this annotation

GitHub Actions / build / Build

networkConfig.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)

Check failure on line 174 in pkg/reconciler/route/resources/ingress.go

View workflow job for this annotation

GitHub Actions / analyze / Go vulnerability Detection

networkConfig.SystemInternalTLSEnabled undefined (type *"knative.dev/networking/pkg/config".Config has no field or method SystemInternalTLSEnabled)
} 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
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]

Check failure on line 178 in test/e2e/autoscale_test.go

View workflow job for this annotation

GitHub Actions / build / Build

undefined: netcfg.SystemInternalTLSKey
if (dataplaneTrustMode != "" && !strings.EqualFold(dataplaneTrustMode, string(netcfg.EncryptionDisabled))) || strings.EqualFold(cm.Data[netcfg.InternalEncryptionKey], "true") {

Check failure on line 179 in test/e2e/autoscale_test.go

View workflow job for this annotation

GitHub Actions / build / Build

undefined: netcfg.EncryptionDisabled
t.Skip("Skipping TestTargetBurstCapacity as activator always stay in path.")
}

Expand Down

0 comments on commit e284288

Please sign in to comment.