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.07k stars 169 forks source link

[BUG]:executing "kubeblocks.defaultStorageClass" at <.Values.storageClass.name>: can't evaluate field name in type interface {} #7960

Closed mi-zy closed 1 month ago

mi-zy commented 1 month ago

Describe the bug

helm install kubeblocks --namespace kb-system --create-namespace --set storageClass="rook-ceph-block" .

Error: INSTALLATION FAILED: template: kubeblocks/templates/storageprovider/pvc.yaml:10:22: executing "kubeblocks/templates/storageprovider/pvc.yaml" at <include "kubeblocks.defaultStorageClass" .>: error calling include: template: kubeblocks/templates/_helpers.tpl:319:39: executing "kubeblocks.defaultStorageClass" at <.Values.storageClass.name>: can't evaluate field name in type interface {}

[root@k8s-master01 kubeblocks]# kbcli kubeblocks install --set storageClass=rook-ceph-block KubeBlocks will be installed to namespace "kb-system" Kubernetes version 1.28.4 kbcli version 0.9.0 Collecting data from cluster OK Kubernetes cluster preflight OK Warn

Desktop (please complete the following information): k8s v1.28.4

mi-zy commented 1 month ago

helm和 kbcli kubeblocks install时,只要添加torageClass="rook-ceph-block"就报这个错

wangyelei commented 1 month ago

@zjx20 PTAL

zjx20 commented 1 month ago

@mi-zy I guess you added this option based on the kbcli output:

The default storage class was not found. You can use option --set storageClass= when creating cluster

However, this tip suggests using the option when creating a cluster, like kbcli cluster create mysql --set storageClass=xxx. It's not for KubeBlocks installation.

According to values.yaml of the Helm Chart: https://github.com/apecloud/kubeblocks/blob/fd72344dabbe16d6b509eafafdf19ddec4d3fc67/deploy/helm/values.yaml#L1861-L1870

To specify a default StorageClass when installing KubeBlocks, you can use --set storageClass.name=rook-ceph-block. Additionally, if you don't need KubeBlocks to create the StorageClass, add --set storageClass.create=false as well.

The complete command for your case should be:

kbcli kubeblocks install --set storageClass.name=rook-ceph-block --set storageClass.create=false
zjx20 commented 1 month ago

Feel free to reopen if it is still a problem.

mi-zy commented 1 month ago

You’re a star. Thanks! I did a test and it was like this. kbcli cluster create mysql -n kb-system --storage-class-name='rook-ceph-block' Info: --version is not specified, ac-mysql-8.0.30 is applied by default. Cluster orange62 created ----- 原始邮件 ----- 发件人:zjx20 @.> 收件人:apecloud/kubeblocks @.> 抄送人:mi-zy @.>, Mention @.> 主题:Re: [apecloud/kubeblocks] [BUG]:executing "kubeblocks.defaultStorageClass" at <.Values.storageClass.name>: can't evaluate field name in type interface {} (Issue #7960) 日期:2024年08月13日 12点15分

@mi-zy I guess you added this option based on the kbcli output:

The default storage class was not found. You can use option --set storageClass= when creating cluster

However, this tip suggests using the option when creating a cluster, like kbcli cluster create mysql --set storageClass=xxx. It's not for KubeBlocks installation. According to values.yaml of the Helm Chart:

https://github.com/apecloud/kubeblocks/blob/fd72344dabbe16d6b509eafafdf19ddec4d3fc67/deploy/helm/values.yaml#L1861-L1870 To specify a default StorageClass when installing KubeBlocks, you can use --set storageClass.name=rook-ceph-block. Additionally, if you don't need KubeBlocks to create the StorageClass, add --set storageClass.create=false as well. The complete command for your case should be: kbcli kubeblocks install --set storageClass.name=rook-ceph-block --set storageClass.create=false

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>