-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Normalize naming of Kubernetes clusters #10778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.19
Are you sure you want to change the base?
Normalize naming of Kubernetes clusters #10778
Conversation
@blueorangutan package |
@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 4.19 #10778 +/- ##
============================================
+ Coverage 15.16% 15.18% +0.01%
- Complexity 11332 11368 +36
============================================
Files 5412 5416 +4
Lines 475033 475887 +854
Branches 57963 58091 +128
============================================
+ Hits 72048 72260 +212
- Misses 394930 395540 +610
- Partials 8055 8087 +32
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
good idea. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13185 |
@weizhouapache yes, this approach would be much better from a UX perspective. I'll mark this PR as draft while I refactor it. |
@blueorangutan package |
@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13499 |
@blueorangutan test |
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-13404)
|
...om/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall lgtm
not tested
@blueorangutan package |
@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13528 |
@weizhouapache @Pearl1594, can we run the CI again for this one? |
@julien-vaz, could you test this one, please? |
Description
Kubernetes has naming conventions for some type of resources. It requires, for instance, that some of them must:
-
;More information regarding Kubernetes naming constraints can be found on its Object Names and IDs documentation section.
Apache CloudStack names the control and worker cluster nodes using the following format:
<cluster-name> + <"control" | "node"> + <hash>
. When generating the names of the nodes, firstly, the cluster name is normalized, in order to meet the Kubernetes naming requirements:cloudstack/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java
Lines 775 to 788 in 55c8138
However, not all required normalization operations are performed. When a Kubernetes cluster contains uppercase letters in its name, for instance, the static method
NetUtils.verifyDomainLabel
returnstrue
(it verifies the domain name label in a case-insensitive manner). Thus, the uppercase letters are not removed from the string (prefix.replaceAll("[^a-zA-Z0-9-]", "")
is not executed) and the Kubernetes nodes end up with names containing uppercase letters. As a consequence of that, some inconsistencies when consuming the Kubernetes services are faced, because Kubernetes is not able to properly identify its nodes.Therefore, this PR applies all the required normalization steps to Kubernetes cluster names to always meet the above-mentioned naming requirements. When required, unsupported characters are removed, names are truncated and converted to lower case. Unit tests have been implemented to cover all possible normalization scenarios.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?