Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.
This repository was archived by the owner on Jan 25, 2019. It is now read-only.

Charts with randomly generated fields that are part of pod annotations fail to be installed (e.g. stable/redis) #76

@anurag-prakash-singh

Description

@anurag-prakash-singh

While attempting to install the default version (i.e. without specifying any overrides or changing the values*.yaml files) of the stable/redis chart, I'm noticing that the Redis master pod goes into a Started -> Terminating -> Started loop. This happens because the master statefulset keeps getting revised. The reason why this is happening for the Redis chart is that it contains the following pod annotation in a StatefulSet spec (this is part of the redis-master-statefulset.yaml file in the chart):

checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}

The secret itself is randomly generated thanks to this:

data:
  {{- if .Values.password }}
  redis-password: {{ .Values.password | b64enc | quote }}
  {{- else }}
  redis-password: {{ randAlphaNum 10 | b64enc | quote }}
  {{- end }}
{{- end -}}

In other words, if the values.yaml file doesn't specify a value for the password, the pod annotation will be randomly generated.

This results in a continuous release update loop when the helm-app-operator tries to install the release. As far as I can tell from the code, this is the sequence of events:

  1. the chart is installed for the first time. reconcile.go::Reconcile is invoked and after the installation finishes, the reconciler creates a work request to do a resync because of return reconcile.Result{RequeueAfter: r.ResyncPeriod}, err
  2. the resync is triggered. This time, we fall through to if manager.IsUpdateRequired() {, which returns true. The reason is that the way the operator checks if an update to a chart has happened is by doing a dry run installation of the chart. Naturally, each dry run will produce a manifest with a different value for the password field.
  3. the update process begins, leading to a new revision of the statefulset (leading to the old pod being terminated and replaced) being created.
  4. Repeat 2 and 3. (edited)

I understand that this problem is avoided by providing an override for generated values. However, for my project, it would be great if charts could work as-is, without having to provide overridden values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions