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 4 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
18 changes: 9 additions & 9 deletions pkg/reconciler/nscert/nscert_test.go
Expand Up @@ -67,10 +67,10 @@ const (
type key int

var (
wildcardDNSNames = []string{"*.foo.example.com"}
wildcardDNSNames = []string{"*.foo.svc.cluster.local"}
defaultCertName = names.WildcardCertificate(wildcardDNSNames[0])
defaultDomainTemplate = "{{.Name}}.{{.Namespace}}.{{.Domain}}"
defaultDomain = "example.com"
defaultDomain = "svc.cluster.local"
// Used to pass configuration to tests in TestReconcile
netConfigContextKey key
)
Expand Down 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 @@ -279,7 +279,7 @@ func TestReconcile(t *testing.T) {
Verb: "delete",
Resource: netv1alpha1.SchemeGroupVersion.WithResource("certificates"),
},
Name: "foo.example.com",
Name: "foo.svc.cluster.local",
}},
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "Deleted", "Deleted Knative Certificate %s/%s", "foo", defaultCertName),
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 Expand Up @@ -623,7 +623,7 @@ func networkConfig() *netcfg.Config {
func domainConfig() *routecfg.Domain {
domainConfig := &routecfg.Domain{
Domains: map[string]*routecfg.LabelSelector{
"example.com": {},
"svc.cluster.local": {},
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should keep example.com for this nscert test.
net-certmanager does not create certificates for cluster local (svc.cluster.local) so we should assume that users set the domain as example.com as it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good... in that vein, I added an overlay to set the domain for some of the e2e tests, let me know if you think we should remove that

},
}
return domainConfig
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: |