Skip to content

Commit

Permalink
check tenantid is set and correct (when upgrading kcp)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelvillard committed Feb 8, 2023
1 parent 6016ada commit 5d0246d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/syncer/spec/spec_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ func (c *Controller) ensureDownstreamNamespaceExists(ctx context.Context, downst
return fmt.Errorf("(namespace collision) namespace %s already exists, but has a different namespace locator annotation: %+v vs %+v", newNamespace.GetName(), nsLocator, desiredNSLocator)
}

// Handle kcp upgrades by checking the tenant ID is set and correct
if tenantID, ok := unstrNamespace.GetLabels()[shared.TenantIDLabel]; !ok || tenantID != desiredTenantID {
unstrNamespace.GetLabels()[shared.TenantIDLabel] = desiredTenantID
_, err := namespaces.Update(ctx, unstrNamespace, metav1.UpdateOptions{})
return err
}

return nil
}

Expand Down

0 comments on commit 5d0246d

Please sign in to comment.