Skip to content

Commit 604709e

Browse files
committed
fix empty secret name behavior
1 parent 3fa68d8 commit 604709e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

internal/initializer/tls.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,24 @@ func TLSCertificateGeneratorWithOwner(owner []metav1.OwnerReference) TLSCertific
8989
}
9090

9191
// TLSCertificateGeneratorWithServerSecretName returns an TLSCertificateGeneratorOption that sets server secret name.
92+
// If the secret name is empty, the option is a no-op.
9293
func TLSCertificateGeneratorWithServerSecretName(s string, dnsNames []string) TLSCertificateGeneratorOption {
9394
return func(g *TLSCertificateGenerator) {
95+
if s == "" {
96+
return
97+
}
9498
g.tlsServerSecretName = &s
9599
g.tlsServerDNSNames = dnsNames
96100
}
97101
}
98102

99103
// TLSCertificateGeneratorWithClientSecretName returns an TLSCertificateGeneratorOption that sets client secret name.
104+
// If the secret name is empty, the option is a no-op.
100105
func TLSCertificateGeneratorWithClientSecretName(s string, subjects []string) TLSCertificateGeneratorOption {
101106
return func(g *TLSCertificateGenerator) {
107+
if s == "" {
108+
return
109+
}
102110
g.tlsClientSecretName = &s
103111
g.tlsClientDNSNames = subjects
104112
}

0 commit comments

Comments
 (0)