apiVersion: v1
kind: Secret
metadata:
  name: "bootstrap-secret"
  namespace: {{ .Release.Namespace }}
type: Opaque
data:
  {{- $existingSecret := lookup "v1" "Secret" .Release.Namespace "bootstrap-secret" }}
  {{- if and $existingSecret $existingSecret.data }}
  bootstrapPassword: {{ $existingSecret.data.bootstrapPassword }}
  {{- else }}
  bootstrapPassword: {{ .Values.bootstrapPassword | b64enc | quote }}
  {{- end }}

apiVersion: v1
kind: Secret
metadata:
  name: "bootstrap-secret"
  namespace: {{ .Release.Namespace }}
type: Opaque
data:
  {{- $existingSecret := lookup "v1" "Secret" .Release.Namespace "bootstrap-secret" }}
  {{- if and $existingSecret $existingSecret.data }}
    {{- if $existingSecret.data.bootstrapPassword }}
  bootstrapPassword: {{ $existingSecret.data.bootstrapPassword }}
    {{- else }}
  bootstrapPassword: {{ .Values.bootstrapPassword | default "" | b64enc | quote }}
    {{- end }}
  {{- else }}
  bootstrapPassword: {{ .Values.bootstrapPassword | default "" | b64enc | quote }}
  {{- end }}

Fix helm upgrade for bootstrap password
Fix helm upgrade for bootstrap password

This handles upgrade when bootstrapPassword is no in the values and
also if the bootstrap secret exists and has no data or empty
bootstrapPassword field
