Skip to content

Commit

Permalink
Double-check and populate ns for MS and MD template
Browse files Browse the repository at this point in the history
Signed-off-by: Danil-Grigorev <[email protected]>
  • Loading branch information
Danil-Grigorev committed Nov 18, 2024
1 parent a3e3e9a commit de51a24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,12 @@ func reconcileExternalTemplateReference(ctx context.Context, c client.Client, cl
return errors.New(err.Error())
}

// Ensure the ref namespace is populated for objects not yet defaulted by webhook
if ref.Namespace == "" {
ref = ref.DeepCopy()
ref.Namespace = cluster.Namespace
}

obj, err := external.Get(ctx, c, ref)
if err != nil {
return err
Expand Down
6 changes: 6 additions & 0 deletions internal/controllers/machineset/machineset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,12 @@ func (r *Reconciler) reconcileExternalTemplateReference(ctx context.Context, clu
return false, err
}

// Ensure the ref namespace is populated for objects not yet defaulted by webhook
if ref.Namespace == "" {
ref = ref.DeepCopy()
ref.Namespace = cluster.Namespace
}

obj, err := external.Get(ctx, r.Client, ref)
if err != nil {
if apierrors.IsNotFound(err) {
Expand Down

0 comments on commit de51a24

Please sign in to comment.