cetic / helm-zabbix

Helm Chart For Zabbix
https://artifacthub.io/packages/helm/cetic/zabbix
Apache License 2.0
56 stars 57 forks source link

[cetic/zabbix] Unable to use external database due to missing newline in web deployment #55

Closed acritelli closed 2 years ago

acritelli commented 2 years ago

Describe the bug

When attempting to specify external database parameters without using a secret, a missing newline in the web deployment causes the chart rendering to fail.

Version of Helm and Kubernetes:

❯ helm version
version.BuildInfo{Version:"v3.8.0", GitCommit:"d14138609b01886f544b2025f5000351c9eb092e", GitTreeState:"clean", GoVersion:"go1.17.5"}

❯ k version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.1", GitCommit:"86ec240af8cbd1b60bcc4c03c20da9b98005b92e", GitTreeState:"clean", BuildDate:"2021-12-16T11:41:01Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21+", GitVersion:"v1.21.12-eks-a64ea69", GitCommit:"d4336843ba36120e9ed1491fddff5f2fec33eb77", GitTreeState:"clean", BuildDate:"2022-05-12T18:29:27Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.23) and server (1.21) exceeds the supported minor version skew of +/-1

What happened:

Using the following values file fails with an error:

❯ cat /tmp/zabbix-values.yaml -p
db_access:
  secret_name: false
  DB_SERVER_HOST: "zabbix-postgresql"
  DB_SERVER_PORT: "5432"
  POSTGRES_USER: "zabbix"
  POSTGRES_PASSWORD: "zabbix"
  POSTGRES_DB: "zabbix"

postgresql:
  enabled: false

helm-zabbix on  master is 📦 v2.0.0 via ⎈ v3.8.0 on ☁️  (us-west-1) on ☁️  anthony@cloudify.co 
❯ helm template . -f /tmp/zabbix-values.yaml
Error: YAML parse error on zabbix/templates/deployment-zabbix-web.yaml: error converting YAML to JSON: yaml: line 39: block sequence entries are not allowed in this context

Use --debug flag to render out invalid YAML

What you expected to happen:

The chart should render successfully

How to reproduce it (as minimally and precisely as possible):

Use the following values file and attempt to render the chart:

db_access:
  secret_name: false
  DB_SERVER_HOST: "zabbix-postgresql"
  DB_SERVER_PORT: "5432"
  POSTGRES_USER: "zabbix"
  POSTGRES_PASSWORD: "zabbix"
  POSTGRES_DB: "zabbix"

postgresql:
  enabled: false

Using debug mode, you can see that a missing newline causes malformed YAML, specifically in the web deployment template. The newline is missing after the DB_SERVER_HOST environment variable:

❯ helm template . -f /tmp/zabbix-values.yaml --debug -s templates/deployment-zabbix-web.yaml 
install.go:178: [debug] Original chart version: ""
install.go:195: [debug] CHART PATH: /home/acritelli/src/helm-zabbix

---
# Source: zabbix/templates/deployment-zabbix-web.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: release-name-zabbix-zabbix-web
< ... output omitted for brevity ...>
        env:
          - name: ZBX_SERVER_HOST
            value: 
          - name: ZBX_SERVER_PORT
            value: 
          - name: DB_SERVER_HOST
            value: "zabbix-postgresql"- name: DB_SERVER_PORT
            value: "5432"
< ... output omitted for brevity ...>
Error: YAML parse error on zabbix/templates/deployment-zabbix-web.yaml: error converting YAML to JSON: yaml: line 39: block sequence entries are not allowed in this context
helm.go:84: [debug] error converting YAML to JSON: yaml: line 39: block sequence entries are not allowed in this context
YAML parse error on zabbix/templates/deployment-zabbix-web.yaml
helm.sh/helm/v3/pkg/releaseutil.(*manifestFile).sort
    helm.sh/helm/v3/pkg/releaseutil/manifest_sorter.go:146
helm.sh/helm/v3/pkg/releaseutil.SortManifests
    helm.sh/helm/v3/pkg/releaseutil/manifest_sorter.go:106
helm.sh/helm/v3/pkg/action.(*Configuration).renderResources
    helm.sh/helm/v3/pkg/action/action.go:165
helm.sh/helm/v3/pkg/action.(*Install).RunWithContext
    helm.sh/helm/v3/pkg/action/install.go:259
main.runInstall
    helm.sh/helm/v3/cmd/helm/install.go:264
main.newTemplateCmd.func2
    helm.sh/helm/v3/cmd/helm/template.go:82
github.com/spf13/cobra.(*Command).execute
    github.com/spf13/cobra@v1.3.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
    github.com/spf13/cobra@v1.3.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
    github.com/spf13/cobra@v1.3.0/command.go:902
main.main
    helm.sh/helm/v3/cmd/helm/helm.go:83
runtime.main
    runtime/proc.go:255
runtime.goexit
    runtime/asm_amd64.s:1581

Anything else we need to know:

sa-ChristianAnton commented 2 years ago

Absolutely I am fine with this. And yes, this must have been a mistake on my side.

Von meinem iPhone gesendet

Am 11.06.2022 um 21:25 schrieb Aécio Pires @.***>:



Hi @acritellihttps://github.com/acritelli!

Thanks for your contributition and sorry for this problem.

@sa-ChristianAntonhttps://github.com/sa-ChristianAnton you agree with this solution? Can I publish this hotfix before 3.0.0 version?

@acritellihttps://github.com/acritelli for your information, we are working in 3.0.0 version of chart in this PR: #54https://github.com/cetic/helm-zabbix/pull/54

— Reply to this email directly, view it on GitHubhttps://github.com/cetic/helm-zabbix/issues/55#issuecomment-1152985599, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APLOSHSKI22IACWTL7VL7PLVOTR3VANCNFSM5YD4MAHQ. You are receiving this because you were mentioned.Message ID: @.***>