Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit 2f1dc3b

Browse files
Merge pull request #1393 from ibuildthecloud/main
If cert-manager annotations are set always use that tls
2 parents 08c7578 + 0d36b3c commit 2f1dc3b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

pkg/publish/ingress.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,8 @@ func Ingress(req router.Request, svc *v1.ServiceInstance) (result []kclient.Obje
243243
}
244244

245245
func setupCertManager(serviceName string, annotations map[string]string, rules []networkingv1.IngressRule, tls []networkingv1.IngressTLS) []networkingv1.IngressTLS {
246-
if (annotations["cert-manager.io/cluster-issuer"] == "" && annotations["cert-manager.io/issuer"] == "") ||
247-
len(tls) != 0 {
248-
// cert-manager is not being used, or we have TLS for this
246+
if annotations["cert-manager.io/cluster-issuer"] == "" && annotations["cert-manager.io/issuer"] == "" {
247+
// cert-manager override is not being used
249248
return tls
250249
}
251250

pkg/publish/ingress_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func Test_setupCertManager(t *testing.T) {
286286
want: []networkingv1.IngressTLS{{Hosts: []string{"host"}}},
287287
},
288288
{
289-
name: "annotation but tls found",
289+
name: "annotation and tls found, prefer annotation",
290290
args: args{
291291
serviceName: "foo",
292292
annotations: map[string]string{
@@ -295,7 +295,7 @@ func Test_setupCertManager(t *testing.T) {
295295
rules: []networkingv1.IngressRule{{Host: "host1"}},
296296
tls: []networkingv1.IngressTLS{{Hosts: []string{"host"}}},
297297
},
298-
want: []networkingv1.IngressTLS{{Hosts: []string{"host"}}},
298+
want: []networkingv1.IngressTLS{{Hosts: []string{"host1"}, SecretName: "foo-cm-cert-1"}},
299299
},
300300
{
301301
name: "cluster-issuer annotation found",

0 commit comments

Comments
 (0)