-
Notifications
You must be signed in to change notification settings - Fork 890
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
fix: resourceregistry is incompatible in the upgrade scenario #4171
fix: resourceregistry is incompatible in the upgrade scenario #4171
Conversation
Signed-off-by: zhzhuang-zju <[email protected]>
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #4171 +/- ##
=======================================
Coverage 52.93% 52.93%
=======================================
Files 239 239
Lines 23522 23522
=======================================
Hits 12452 12452
Misses 10395 10395
Partials 675 675
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
the root cause is: karmada/vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go Lines 1408 to 1420 in fc006ce
Field DefaultQualifiedResource is used to construct storage paths to resource directories. So, changing it will cause the storage path to change, and eventually cause upgrate problem. I did some experiments, and the results were consistent with the code analysis.
sh-5.1# sh-5.1# etcdctl --cert="/etc/karmada/pki/etcd-client.crt" --key="/etc/karmada/pki/etcd-client.key" --cacert="/etc/karmada/pki/etcd-ca.crt" get /registry --prefix --keys-only
/registry/search.karmada.io/resourceRegistries/deployment-search
sh-5.1# sh-5.1# etcdctl --cert="/etc/karmada/pki/etcd-client.crt" --key="/etc/karmada/pki/etcd-client.key" --cacert="/etc/karmada/pki/etcd-ca.crt" get /registry --prefix --keys-only
/registry/search.karmada.io/resourceRegistries/deployment-search
/registry/search.karmada.io/resourceregistries/deployment-search so, field ➜ karmada git:(1.7) ✗ ka api-resources|grep resourceregistries
resourceregistries search.karmada.io/v1alpha1 false ResourceRegistry The plural name of the resource has always been karmada/vendor/k8s.io/client-go/restmapper/discovery.go Lines 107 to 112 in 4e7084c
Tracing the code, I found the source of the value of pluralName. The key of the map is its pluralName. That's why the plural name of the resource has always been resourceregistries .karmada/pkg/search/apiserver.go Lines 78 to 79 in 4e7084c
As you can see from the following code, pluralNames are forced to be lowercase only. karmada/vendor/k8s.io/apiserver/pkg/server/genericapiserver.go Lines 904 to 911 in 4e7084c
|
Here is my test report.
3.Executing ➜ karmada git:(1.5) ✗ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get ResourceRegistry
NAME CREATED AT
deployment-search 2023-10-25T07:04:14Z
➜ karmada git:(1.5) ✗ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get resourceregistries
NAME CREATED AT
deployment-search 2023-10-25T07:04:14Z 4.Upgrade the component karmada-search with the latest image. ➜ karmada git:(1.7) ✗ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get ResourceRegistry
NAME CREATED AT
deployment-search 2023-10-25T07:04:14Z
➜ karmada git:(1.7) ✗ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get resourceregistries
NAME CREATED AT
deployment-search 2023-10-25T07:04:14Z |
Ask @RainbowMango to help rerun the CI. |
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.
/approve
[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:
Approvers can indicate their approval by writing |
/lgtm |
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.
/lgtm
/hold |
/hold cancel |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Referring to #4144, there is a problem in the upgrade scenario of resource
resourceregistry
. We need to solve it, otherwise the relevant data will be lost after the upgrade.Which issue(s) this PR fixes:
Refer to #4141
Special notes for your reviewer:
none
Does this PR introduce a user-facing change?: