karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.12k stars 807 forks source link

replace work namespace/name labels with annotations #4865

Closed XiShanYongYe-Chang closed 1 week ago

XiShanYongYe-Chang commented 1 week ago

What type of PR is this?

/kind bug

What this PR does / why we need it:

When we create a namespace with a length of 63, the namespace will not be synchronized to the member cluster. The error reported in karmada-controller-manager is as follows:

objectwatcher.go:102] Failed to create resource(kind=Namespace, /test12345678901234567890123456789012345678901234567890123456789) in cluster member1, err is Namespace "test12345678901234567890123456789012345678901234567890123456789" is invalid: metadata.labels: Invalid value: "test12345678901234567890123456789012345678901234567890123456789-56889cc77": must be no more than 63 characters
E0424 07:43:38.082314       1 execution_controller.go:261] Failed to create resource(/test12345678901234567890123456789012345678901234567890123456789) in the given member cluster member1, err is Namespace "test12345678901234567890123456789012345678901234567890123456789" is invalid: metadata.labels: Invalid value: "test12345678901234567890123456789012345678901234567890123456789-56889cc77": must be no more than 63 characters

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

We miss update it in the #4765

Does this PR introduce a user-facing change?:

karmada-controller-manager: fix the error that can not propagate the namespace with a length of 63.
XiShanYongYe-Chang commented 1 week ago

/cc @RainbowMango

codecov-commenter commented 1 week ago

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 52.97%. Comparing base (6e5a602) to head (a16b4e2). Report is 2 commits behind head on master.

Files Patch % Lines
...controllers/unifiedauth/unified_auth_controller.go 0.00% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #4865 +/- ## ========================================== - Coverage 52.98% 52.97% -0.01% ========================================== Files 250 250 Lines 20421 20421 ========================================== - Hits 10820 10819 -1 - Misses 8881 8882 +1 Partials 720 720 ``` | [Flag](https://app.codecov.io/gh/karmada-io/karmada/pull/4865/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=karmada-io) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/karmada-io/karmada/pull/4865/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=karmada-io) | `52.97% <0.00%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=karmada-io#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

XiShanYongYe-Chang commented 1 week ago

Test result:

# kubectl create ns test12345678901234567890123456789012345678901234567890123456789
namespace/test12345678901234567890123456789012345678901234567890123456789 created

# km1 get ns
NAME                                                              STATUS   AGE
default                                                           Active   13m
karmada-cluster                                                   Active   7m43s
kube-node-lease                                                   Active   13m
kube-public                                                       Active   13m
kube-system                                                       Active   13m
local-path-storage                                                Active   13m
test12345678901234567890123456789012345678901234567890123456789   Active   7s
XiShanYongYe-Chang commented 1 week ago

@whitewindmills Thanks a lot! I update it.

whitewindmills commented 1 week ago

lgtm

karmada-bot commented 1 week ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[pkg/controllers/OWNERS](https://github.com/karmada-io/karmada/blob/master/pkg/controllers/OWNERS)~~ [RainbowMango] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
RainbowMango commented 1 week ago

/lgtm