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.05k stars 167 forks source link

[BUG] Patch an addon upgraded from 0.8 does not work #7982

Open shanshanying opened 4 weeks ago

shanshanying commented 4 weeks ago

Describe the bug Patching an addon, upgraded from KB0.8, will fail.

To Reproduce Steps to reproduce the behavior:

  1. install KB 0.8
  2. kbcli addon enable milvus
  3. upgrade to KB 0.9
  4. KB is working as expected
  5. patch milvus addon by kbcli addon enable milvus --set images.milvus.repository=test.io the intention of this issue is to update milvus' images defined in ClusterDefinition milvus-2.3.2
  6. an addon upgrade job is created, the job will perform helm upgrad -i command
  7. and we foud the upgrade configconstratint is nil

Screenshots

image

Quick fix to patch the ConfigConstraint's fileFormatConfig api:

k patch cc milvus-config-template-2.3.2 -p '{"spec":{"fileFormatConfig":{"format":"yaml"}}}' --type merge

When upgrading from KB 08 to KB09, KubeBlocks will perform an upgrading job and converting existing CR's into KB09 compatible formats. But the addon is not aware of this. When there is an update applied to the Addon cr, Addon Controller will do a helm upgrade, using KB 08's Addon Version.

shanshanying commented 4 weeks ago

we'd better validat if the Addon can be updated (e.g. in kbcli

sophon-zt commented 4 weeks ago

To update parameters in this way, you need to upgrade the addon version first.

Discussing with @shanshanying , we can add an interception for kbcli to prevent users from updating parameters.

shanshanying commented 2 weeks ago

@ahjing99 we used Webhook conversion to support multi-version APIs. shoud enable webhook to make sure multi-version ConfigConstraints works (both v1alpha1 and v1beta1 works).

sophon-zt commented 2 weeks ago

It is best to consider the multi-version of 1.0 and use the same upgrade strategy. In version 1.0, more crds have multiple versions, which is more likely to cause problems.