Skip to content

Commit

Permalink
USe cluster namespace if no namespace provided in credentials Ref
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbenjemaa committed Jun 26, 2024
1 parent 03179ef commit 02bfb5b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ func NewClusterScope(params ClusterScopeParams) (*ClusterScope, error) {
func (s *ClusterScope) setupProxmoxClient(ctx context.Context) (capmox.Client, error) {
// get the credentials secret
secret := corev1.Secret{}
namespace := s.ProxmoxCluster.Spec.CredentialsRef.Namespace
if len(namespace) == 0 {
namespace = s.ProxmoxCluster.GetNamespace()
}
err := s.client.Get(ctx, client.ObjectKey{
Namespace: s.ProxmoxCluster.Spec.CredentialsRef.Namespace,
Namespace: namespace,
Name: s.ProxmoxCluster.Spec.CredentialsRef.Name,
}, &secret)
if err != nil {
Expand Down

0 comments on commit 02bfb5b

Please sign in to comment.