Improve uniqueness of ClusterControlPlane Id and name#1386
Improve uniqueness of ClusterControlPlane Id and name#1386Atish-iaf wants to merge 1 commit intovmware-tanzu:mainfrom
Conversation
|
Can one of the admins verify this patch? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1386 +/- ##
==========================================
+ Coverage 76.75% 76.80% +0.04%
==========================================
Files 151 151
Lines 21319 21335 +16
==========================================
+ Hits 16364 16386 +22
+ Misses 3785 3780 -5
+ Partials 1170 1169 -1
🚀 New features to boost your workflow:
|
0fe343c to
cc434c2
Compare
|
Hi @edwardbadboy @liu4480 |
627c567 to
5a56192
Compare
5a56192 to
905a145
Compare
edwardbadboy
left a comment
There was a problem hiding this comment.
There is a typo in PR title and commit message title: ClusterClontrolPlane -> ClusterControlPlane
905a145 to
33063fe
Compare
|
|
||
| func (s *NSXServiceAccountService) getClusterName(namespace, name string) string { | ||
| return fmt.Sprintf("%s-%s-%s", s.NSXConfig.CoeConfig.Cluster, namespace, name) | ||
| func (s *NSXServiceAccountService) getClusterName(clusterName, namespace, name string) string { |
There was a problem hiding this comment.
When DeleteNSXServiceAccount is called by the garbageCollector, the namespace and name can be parsed from a cluster-control-plane/SV-NS-ClusterName resource (from its tags), and there is no corresponding K8s NSXSA resource. When getClusterName is called with getClusterName("", "NS", "ClusterName"), it will return SV_NS_ClusterName which doesn't match the existing CCPN ID SV-NS-ClusterName.
Need to think of how to solve this corner case.
There was a problem hiding this comment.
Thanks, updated to delete CCP and PI by getting CCP and PI from store using NSXSA uid.
d0bd271 to
fe71ef7
Compare
- "-" as delimiter when generating cluster-control-plane names results in following two different namespaces and clusters to have the same name. namespace: xx, cluster: yy-zz, result: xx-yy-zz namespace: xx-yy, cluster: zz, result: xx-yy-zz - Use '_' instead of '-' as delimiter when generating cluster-control-plane names because K8s doesn't allow namespace and name to include underscore "_". - Do not change existing NSXServiceAccount cluster-control-plane node IDs and names. - Delete PrincipalIdentity and ClusterControlPlane node by NSXServiceAccount UID. Signed-off-by: Kumar Atish <kumar.atish@broadcom.com>
fe71ef7 to
43c5956
Compare
nsx-operator uses the following name pattern when generating cluster-control-plane names.
fmt.Sprintf("%s-%s-%s", s.NSXConfig.CoeConfig.Cluster, namespace, name)"-" as delimiter when generating cluster-control-plane names results in following two different namespaces and clusters to have the same name
Use
_instead of-as delimiter when generating cluster-control-plane names becauseK8s doesn't allow namespace and name to include underscore
_.Do not change existing NSXServiceAccount cluster-control-plane Id and name.
This new name pattern should only apply to new NSXServiceAccount CRs created after this new name pattern is enabled in nsx-operator.
Delete PrincipalIdentity and ClusterControlPlane node by NSXServiceAccount UID.
Test summary
Doesn't change
status.clusterNamein existing NSXServiceAccount CRFor new NSXServiceAccount CR, it uses the new pattern
_to join namespace and name instead of-when generating clusterName so that it is unique.