Skip to content

Commit

Permalink
Use svc.cluster.local as default domain (#13259)
Browse files Browse the repository at this point in the history
* testing cluster local as default domain

Signed-off-by: Paul S. Schweigert <[email protected]>

* update default domain on tests

Signed-off-by: Paul S. Schweigert <[email protected]>

* missed a few

Signed-off-by: Paul S. Schweigert <[email protected]>

* add domain for e2e tests

Signed-off-by: Paul S. Schweigert <[email protected]>

* review fixes

Signed-off-by: Paul S. Schweigert <[email protected]>

Signed-off-by: Paul S. Schweigert <[email protected]>
  • Loading branch information
psschwei authored Oct 14, 2022
1 parent 535572e commit f9a75d7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
22 changes: 11 additions & 11 deletions config/core/configmaps/domain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
app.kubernetes.io/component: controller
app.kubernetes.io/version: devel
annotations:
knative.dev/example-checksum: "81552d0b"
knative.dev/example-checksum: "26c09de5"
data:
_example: |
################################
Expand All @@ -41,16 +41,6 @@ data:
# to actually change the configuration.
# Default value for domain.
# Although it will match all routes, it is the least-specific rule so it
# will only be used if no other domain matches.
example.com: |
# These are example settings of domain.
# example.org will be used for routes having app=nonprofit.
example.org: |
selector:
app: nonprofit
# Routes having the cluster domain suffix (by default 'svc.cluster.local')
# will not be exposed through Ingress. You can define your own label
# selector to assign that domain suffix to your Route here, or you can set
Expand All @@ -61,3 +51,13 @@ data:
svc.cluster.local: |
selector:
app: secret
# These are example settings of domain.
# example.com will be used for all routes, but it is the least-specific rule so it
# will only be used if no other domain matches.
example.com: |
# example.org will be used for routes having app=nonprofit.
example.org: |
selector:
app: nonprofit
10 changes: 5 additions & 5 deletions pkg/reconciler/nscert/nscert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func newTestSetup(t *testing.T, configs ...*corev1.ConfigMap) (
Namespace: system.Namespace(),
},
Data: map[string]string{
"example.com": "",
"svc.cluster.local": "",
},
}}
cms = append(cms, configs...)
Expand Down Expand Up @@ -161,7 +161,7 @@ func TestNewController(t *testing.T) {
Namespace: system.Namespace(),
},
Data: map[string]string{
"example.com": "",
"svc.cluster.local": "",
}},
)

Expand Down Expand Up @@ -430,7 +430,7 @@ func TestChangeDefaultDomain(t *testing.T) {

// The certificate should be created with the default domain.
cert := <-certEvents
if got, want := cert.Spec.DNSNames[0], "*.testns.example.com"; got != want {
if got, want := cert.Spec.DNSNames[0], "*.testns.svc.cluster.local"; got != want {
t.Errorf("DNSName[0] = %s, want %s", got, want)
}

Expand Down Expand Up @@ -483,8 +483,8 @@ func TestDomainConfigDomain(t *testing.T) {
"autoTLS": "Enabled",
"namespace-wildcard-cert-selector": "{}",
},
wantCertName: "testns.example.com",
wantDNSName: "*.testns.example.com",
wantCertName: "testns.svc.cluster.local",
wantDNSName: "*.testns.svc.cluster.local",
}, {
name: "default domain",
domainCfg: map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/route/config/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
DomainConfigName = "config-domain"
// DefaultDomain holds the domain that Route's live under by default
// when no label selector-based options apply.
DefaultDomain = "example.com"
DefaultDomain = "svc.cluster.local"
)

// LabelSelector represents map of {key,value} pairs. A single {key,value} in the
Expand Down
8 changes: 8 additions & 0 deletions test/config/ytt/core/overlay-config-domain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#@ load("@ytt:overlay", "overlay")
#@ load("helpers.lib.yaml", "system_configmap")

#@overlay/match by=system_configmap("config-domain"), expects=1
---
#@overlay/match-child-defaults missing_ok=True
data:
example.com: |

0 comments on commit f9a75d7

Please sign in to comment.