Skip to content

Commit 567c7f1

Browse files
authored
fix: use the cluster namespace if the secret-ref namespace of the TLS issuer is not set (#9791)
1 parent a5e930e commit 567c7f1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

controllers/apps/component/transformer_component_tls.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ func (i *tlsIssuerUserProvided) referenced(ctx context.Context, cli client.Reade
292292
Namespace: secretRef.Namespace,
293293
Name: secretRef.Name,
294294
}
295+
if len(secretKey.Namespace) == 0 {
296+
secretKey.Namespace = i.synthesizedComp.Namespace
297+
}
295298
secret := &corev1.Secret{}
296299
if err := cli.Get(ctx, secretKey, secret); err != nil {
297300
return nil, err

controllers/apps/component/transformer_component_tls_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ var _ = Describe("TLS transformer test", func() {
6868

6969
tlsSecret4User = &corev1.Secret{
7070
ObjectMeta: metav1.ObjectMeta{
71-
Namespace: testCtx.DefaultNamespace,
71+
Namespace: "default", // testCtx hasn't been initialized yet
7272
Name: "tls-secret-4-user",
7373
},
7474
Data: map[string][]byte{

0 commit comments

Comments
 (0)