Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use svc.cluster.local as default domain #13259

Merged
merged 5 commits into from Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions config/core/configmaps/domain.yaml
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: |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we change this in the example for clarity?


# 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
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
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
@@ -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: |