cetic / helm-nifi

Helm Chart for Apache Nifi
Apache License 2.0
215 stars 228 forks source link

Nifi chart has no stable UUID in flow.xml in the ConfigMap #300

Open lucasfcnunes opened 1 year ago

lucasfcnunes commented 1 year ago

I expected a stable apply/sync of the chart. The down side is that it creates lots of unnecessary revisions.

Diff (helmfile diff): image Template (it's caused by {{ default uuidv4 }} not having a stable result): image

Thanks! https://github.com/cetic/helm-charts/issues/6

banzo commented 1 year ago

Would setting the uuids as chart values fix the issue?

Related discussion bits here: https://stackoverflow.com/questions/66143201/reuse-uuid-in-helm-charts

lucasfcnunes commented 1 year ago

Would setting the uuids as chart values fix the issue?

Related discussion bits here: https://stackoverflow.com/questions/66143201/reuse-uuid-in-helm-charts

Yes. It would. At the first apply the uuid would be generated. At the second time it would be regenerated if you didn't set a uuid on your values.

Is helm capable of doing this process automatically (without setting it at values level)?

lucasfcnunes commented 1 year ago

@banzo

This pattern could work!

{{/* Define the secrets */}}
{{- define "kutt.secrets" -}}
---

apiVersion: v1
kind: Secret
type: Opaque
metadata:
  name: kutt-secrets
{{- $kuttprevious := lookup "v1" "Secret" .Release.Namespace "kutt-secrets" }}
{{- $jwt_secret := "" }}
data:
  {{- if $kuttprevious}}
  JWT_SECRET: {{ index $kuttprevious.data "JWT_SECRET" }}
  {{- else }}
  {{- $jwt_secret := randAlphaNum 32 }}
  JWT_SECRET: {{ $jwt_secret | b64enc }}
  {{- end }}

{{- end -}}

Source: https://github.com/truecharts/charts/blob/2bc5a5656ac62b5078b07360c7ccc4f47c76022e/charts/incubator/kutt/templates/_secrets.tpl#L10