Skip to content

Commit 40ec19a

Browse files
authored
use X509CertRef to get the namespace of the cert (#731)
X509CertRef is a ResourceRefNamespaced, which means it contains a name and a namespace. The name is only used to get the object while the namespace is discarded, This PR uses the namespace defined here to get the object while falling back to the project namespace to maintain backward compatibility. This can break projects for people configuring the namespace differently that what's intended. It will only break if the configuration is initially wrong.
1 parent 50b887f commit 40ec19a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/api/v1/atlasproject_types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,11 @@ func (p *AtlasProject) UpdateStatus(conditions []status.Condition, options ...st
157157

158158
func (p *AtlasProject) X509SecretObjectKey() *client.ObjectKey {
159159
if p.Spec.X509CertRef != nil {
160-
key := kube.ObjectKey(p.Namespace, p.Spec.X509CertRef.Name)
160+
namespace := p.Spec.X509CertRef.Namespace
161+
if namespace == "" {
162+
namespace = p.Namespace
163+
}
164+
key := kube.ObjectKey(namespace, p.Spec.X509CertRef.Name)
161165
return &key
162166
}
163167
return nil

0 commit comments

Comments
 (0)