apecloud / kubeblocks

KubeBlocks is an open-source control plane software that runs and manages databases, message queues and other stateful applications on K8s.
https://kubeblocks.io
GNU Affero General Public License v3.0
2.09k stars 170 forks source link

[BUG] `ConfigConstraint` Conversion Generates Incorrect Content After Upgrading KubeBlocks #8260

Open dingshun-cmss opened 1 week ago

dingshun-cmss commented 1 week ago

Describe the Bug

After upgrading KubeBlocks in a test environment:

  1. The ConfigConstraint objects are upgraded by the upgrade hook from v1alpha1 to v1beta1, but the converted content is incorrect.
  2. This results in the config-manager container disappearing after the DB cluster Pod is regenerated.

To Reproduce

  1. Record the ConfigConstraint before the upgrade.
  2. Create a test cluster before the upgrade.
  3. Upgrade KubeBlocks following the steps outlined in the official documentation.
  4. Record the ConfigConstraint after the upgrade. I found that all the properties in spec are missing, except for spec.immutableParameters and spec.staticParameters, which are retained.
  5. Check the containers for the DB Pods.
  6. Fix the ConfigConstraints and restart the test cluster; the config-manager container reappears.

Expected Behavior

The ConfigConstraint conversion from the upgrade hook should generate the correct content.

Additional Context

Upgrade from v0.8.4 to v0.9.1

shanshanying commented 1 week ago

aome additional info:

  1. pre-install hook executed
  2. this engine is installed through helm (without an Addon cr)
sophon-zt commented 1 week ago

Can you show the logs for the kbcli upgrade kb?

sophon-zt commented 1 week ago

Verify whether webhook is enabled:

kubectl get crd configconstraints.apps.kubeblocks.io -o jsonpath='{.spec.conversion}'
dingshun-cmss commented 1 week ago

Verify whether webhook is enabled:

kubectl get crd configconstraints.apps.kubeblocks.io -o jsonpath='{.spec.conversion}'

Here's the output for this command on my test environment:

{"strategy":"None"}
sophon-zt commented 1 week ago

Verify whether webhook is enabled:

kubectl get crd configconstraints.apps.kubeblocks.io -o jsonpath='{.spec.conversion}'

Here's the output for this command on my test environment:

{"strategy":"None"}

The conversion webhook is disable. Please show the kbcli/helm upgrade logs:

kbcli logs path:
$ ls -lrt ~/.kbcli/logs  |tail -n 3
-rw-r--r--  1 zhangtao  staff   93550  7 Aug 14:52 kbcli-2024-08-07.log
-rw-r--r--  1 zhangtao  staff   10141 13 Aug 15:57 kbcli-2024-08-13.log
-rw-r--r--  1 zhangtao  staff   24684  3 Sep 18:21 kbcli-2024-09-03.log
shanshanying commented 5 days ago

@dingshun-cmss we will update the upgrade doc. Since KB 0.9.1 we will enable WebHook to support multi-version APIs.