Skip to content
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

Deployment fails with monitor-secret.yaml in tidb-cluster chart #2867

Closed
8398a7 opened this issue Jul 5, 2020 · 2 comments
Closed

Deployment fails with monitor-secret.yaml in tidb-cluster chart #2867

8398a7 opened this issue Jul 5, 2020 · 2 comments

Comments

@8398a7
Copy link
Contributor

8398a7 commented Jul 5, 2020

Bug Report

What version of Kubernetes are you using?
client: v1.18.5 (macOS)
server: 1.16.6-beta.0 (docker-desktop)

What version of TiDB Operator are you using?

$ > helm search repo tidb-cluster
NAME                    CHART VERSION   APP VERSION     DESCRIPTION
pingcap/tidb-cluster    v1.1.2                          A Helm chart for TiDB Cluster
$ > kubectl exec tidb-controller-manager-5749f98d8-crhw5 -- tidb-controller-manager -V
TiDB Operator Version: version.Info{GitVersion:"v1.1.2", GitCommit:"04c96f3b1b35f0196f4298c15b6c12559976b57b", GitTreeState:"clean", BuildDate:"2020-07-01T11:43:16Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}

What storage classes exist in the Kubernetes cluster and what are used for PD/TiKV pods?

This is after the provisional action described in What did you see instead?.
Before that, there is nothing because the deployment has failed.

$ > kubectl get sc,pvc
NAME                                             PROVISIONER          AGE
storageclass.storage.k8s.io/hostpath (default)   docker.io/hostpath   66m

NAME                                             STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/pd-tidb-cluster-pd-0       Bound    pvc-f9c558f7-ba0b-451f-8f7d-287f60eb3efd   1Gi        RWO            hostpath       18m
persistentvolumeclaim/tikv-tidb-cluster-tikv-0   Bound    pvc-178327c5-b522-4baa-8224-5addc7ff6c4c   10Gi       RWO            hostpath       17m

What's the status of the TiDB cluster pods?

This is after the provisional action described in What did you see instead?.
Before that, there is nothing because the deployment has failed.

$ > kubectl get po -o wide
NAME                                      READY   STATUS    RESTARTS   AGE   IP          NODE             NOMINATED NODE   READINESS GATES
tidb-cluster-discovery-77dc784b5f-7qcc6   1/1     Running   0          18m   10.1.0.35   docker-desktop   <none>           <none>
tidb-cluster-monitor-58f47cc95f-jjp8c     3/3     Running   0          18m   10.1.0.33   docker-desktop   <none>           <none>
tidb-cluster-pd-0                         1/1     Running   0          18m   10.1.0.34   docker-desktop   <none>           <none>
tidb-cluster-tidb-0                       2/2     Running   0          17m   10.1.0.37   docker-desktop   <none>           <none>
tidb-cluster-tikv-0                       1/1     Running   0          18m   10.1.0.36   docker-desktop   <none>           <none>
tidb-controller-manager-5749f98d8-crhw5   1/1     Running   0          60m   10.1.0.12   docker-desktop   <none>           <none>
tidb-scheduler-6f6786b685-xq8kb           2/2     Running   0          60m   10.1.0.11   docker-desktop   <none>           <none>

What did you do?

$ > helm upgrade tidb-cluster pingcap/tidb-cluster -i --wait -n tidb-admin --set pd.storageClassName=hostpath,tikv.storageClassName=hostpath,pd.replicas=1,tikv.replicas=1,tidb.replicas=1,monitor.create=true,monitor.grafana.create=false
Error: UPGRADE FAILED: template: tidb-cluster/templates/monitor-secret.yaml:1:7: executing "tidb-cluster/templates/monitor-secret.yaml" at <(.Values.monitor.create) and (.Values.monitor.grafana.create)>: can't give argument to non-function .Values.monitor.create

What did you expect to see?

Successful deployment.

What did you see instead?

I'm using helm v3.2.4.

$ > helm version
version.BuildInfo{Version:"v3.2.4", GitCommit:"0ad800ef43d3b826f31a5ad8dfbb4fe05d143688", GitTreeState:"dirty", GoVersion:"go1.14.3"}

I don't know if it's a problem with the version of helm, but I fixed it as follows.

diff --git a/charts/tidb-cluster/templates/monitor-secret.yaml b/charts/tidb-cluster/templates/monitor-secret.yaml
index f1df734..903feb5 100644
--- a/charts/tidb-cluster/templates/monitor-secret.yaml
+++ b/charts/tidb-cluster/templates/monitor-secret.yaml
@@ -1,4 +1,4 @@
-{{- if (.Values.monitor.create) and (.Values.monitor.grafana.create) }}
+{{- if and .Values.monitor.create .Values.monitor.grafana.create }}
 apiVersion: v1
 kind: Secret
 metadata:

The deployment is now a success.
May I issue a PR?

@DanielZhangQD
Copy link
Contributor

@8398a7 Thanks for reporting this issue!
We do not update our docs/procedures to adapt to helm 3 yet except for kind and across our docs, we require helm 2.
Would you please help test if your change works for both helm 2 and helm 3?
If yes, please help submit a PR.
Thanks!

@8398a7
Copy link
Contributor Author

8398a7 commented Jul 6, 2020

@DanielZhangQD When I tried it, I saw the same problem with helm2.

helm 2 docs: https://v2.helm.sh/docs/chart_template_guide/#operators-are-functions
helm 3 docs: https://helm.sh/docs/chart_template_guide/function_list/#and

So I would like to change it and submit a PR as I don't think it will affect compatibility.
Thanks for the confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants