DandyDeveloper / charts

Various helm charts migrated from [helm/stable] due to deprecation
https://dandydeveloper.github.io/charts
Apache License 2.0
157 stars 145 forks source link

[chart/<chart_name>][BUG] Helm Install Syntax Error #270

Closed bshouse6 closed 8 months ago

bshouse6 commented 8 months ago

Describe the bug When deploying this chart along with ArgoCD 2.9.3, when setting the redis-ha value to true, helm is throwing an error:

[error converting YAML to JSON: yaml: line 53: mapping values are not allowed in this context](rror: UPGRADE FAILED: YAML parse error on argo-cd/charts/redis-ha/templates/redis-haproxy-deployment.yaml: error converting YAML to JSON: yaml: line 53: mapping values are not allowed in this context)

To Reproduce Steps to reproduce the behavior:

  1. helm upgrade --install argocd . -n argocd --values value-sbx.yaml --dry-run

Expected behavior The redis subchart deploys correctly.

Additional context The latest community argocd chart deploys correctly without redis-ha and the subchart.

version.BuildInfo{Version:"v3.14.3", GitCommit:"f03cc04caaa8f6d7c3e67cf918929150cf6f3f12", GitTreeState:"clean", GoVersion:"go1.22.1"}

Running on MAC M1

DandyDeveloper commented 8 months ago

@bshouse6 Whats the contents of value-sbx.yaml?

bshouse6 commented 8 months ago
## Redis-HA subchart replaces custom redis deployment when `redis-ha.enabled=true`
# Ref: https://github.com/DandyDeveloper/charts/blob/master/charts/redis-ha/values.yaml
<rest of chart>
redis-ha:
  # -- Enables the Redis HA subchart and disables the custom Redis single node deployment
  enabled: true
  ## Redis image
  image:
    # -- Redis repository
    repository: <private repo>bitnami/redis
    # -- Redis tag
    tag: 7.2.3
  ## Prometheus redis-exporter sidecar
  exporter:
    # -- Enable Prometheus redis-exporter sidecar
    enabled: false
    # -- Repository to use for the redis-exporter
    image: public.ecr.aws/bitnami/redis-exporter
    # -- Tag to use for the redis-exporter
    tag: 1.53.0
  persistentVolume:
    # -- Configures persistence on Redis nodes
    enabled: false
  ## Redis specific configuration options
  redis:
    # -- Redis convention for naming the cluster group: must match `^[\\w-\\.]+$` and can be templated
    masterGroupName: argocd
    # -- Any valid redis config options in this section will be applied to each server (see `redis-ha` chart)
    # @default -- See [values.yaml]
    config:
      # -- Will save the DB if both the given number of seconds and the given number of write operations against the DB 
      occurred. `""`  is disabled
      # @default -- `'""'`
      save: '""'
  ## Enables a HA Proxy for better LoadBalancing / Sentinel Master support. Automatically proxies to Redis master.
  haproxy:
    # -- Enabled HAProxy LoadBalancing/Proxy
    enabled: true
    metrics:
      # -- HAProxy enable prometheus metric scraping
      enabled: true
    # -- Whether the haproxy pods should be forced to run on separate nodes.
    hardAntiAffinity: true
    # -- Additional affinities to add to the haproxy pods.
    additionalAffinities: {}
    # -- Assign custom [affinity] rules to the haproxy pods.
    affinity: |

    # -- [Tolerations] for use with node taints for haproxy pods.
    tolerations: []
    # -- HAProxy container-level security context
    # @default -- See [values.yaml]
    containerSecurityContext:
      readOnlyRootFilesystem: true

    # -- Whether the Redis server pods should be forced to run on separate nodes.
    hardAntiAffinity: true

    # -- Additional affinities to add to the Redis server pods.
    additionalAffinities: {}

    # -- Assign custom [affinity] rules to the Redis pods.
    affinity: |

    # -- [Tolerations] for use with node taints for Redis pods.
    tolerations: []

    # -- Assign custom [TopologySpreadConstraints] rules to the Redis pods.
    ## https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
    topologySpreadConstraints:
      # -- Enable Redis HA topology spread constraints
      enabled: false
      # -- Max skew of pods tolerated
      # @default -- `""` (defaults to `1`)
      maxSkew: ""
      # -- Topology key for spread
      # @default -- `""` (defaults to `topology.kubernetes.io/zone`)
      topologyKey: ""
      # -- Enforcement policy, hard or soft
      # @default -- `""` (defaults to `ScheduleAnyway`)
      whenUnsatisfiable: ""
    # -- Redis HA statefulset container-level security context
    # @default -- See [values.yaml]
    containerSecurityContext:
      readOnlyRootFilesystem: true

  # External Redis parameters
  externalRedis:
    # -- External Redis server host
    host: ""
    # -- External Redis username
    username: ""
    # -- External Redis password
    password: ""
    # -- External Redis server port
    port: 6379
    # -- The name of an existing secret with Redis credentials (must contain key `redis-password`).
    # When it's set, the `externalRedis.password` parameter is ignored
    existingSecret: ""
    # -- External Redis Secret annotations
    secretAnnotations: {}

< rest of chart >

This is the section on the values file relating to redis-ha. The dependency is referenced in the main ArgoCD chart.

DandyDeveloper commented 8 months ago

@bshouse6 There's a bunch of errors in that values file.

affinity: has a pipe that causes interpretation of everything else as a string image

New line string is causing bad YAML interpretation: image

There's also a lot of dupes.

Is this directly from the ArgoCD Repo? They need to fix this file! Got a link to the repo?

DandyDeveloper commented 8 months ago

Also I'm a bit confused, they are using the redis-ha as a direct dependency, there's no value overrides in the default ArgoCD Helm chart: https://github.com/argoproj/argo-helm/blob/main/charts/argo-cd/Chart.yaml

You sure you didn't prepare the values yourself? Got a link for me? @bshouse6

bshouse6 commented 8 months ago

https://github.com/argoproj/argo-helm/blob/main/charts/argo-cd/values.yaml#L1458

That section I pulled is from that values file, the only things we modified were the image/repo, tag, and enabled. So this might be an issue in the argocd chart vs. the redis/dependency, given I used the default values.

So this is an issue with their values file redis-ha overrides! The error was misleading and I assumed (you know what they say about assuming :)) that it should work out of the box.

DandyDeveloper commented 8 months ago

@bshouse6

I think you did a bad copy-paste, it looks OK in their original.

image

bshouse6 commented 8 months ago

I am going to close this out. Looks like there is something up with the values files/templating not working, not ness. something with this chart. For me, out of the box, the redis-ha flags do not work but that might be values needed or not needed that are hosing things up.

I changed that pipe for the affinity values, and that resolved the error. We ended up going with another image/path.