You've already forked helm-actions

### Description of the change Use the same namespace template for all `namespace:` fields, this would be no error if the ServiceAccount would had the same different template than the reference. I found this while analyzing existing code statically via `namespace:` search. Updated to also use correct namespace in existing secret lookup ### Benefits Previously if .Values.namespace and .Release.Namespace didn't match this might caused an install error. e.g. in values.yml ```yaml namespace: test # ** enable provisioning job is required ``` However installed using ``` helm install -f values.yml --create-namespace --namespace install-name-space myactions . ``` Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/11 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Co-committed-by: Christopher Homberger <christopher.homberger@web.de>
21 lines
791 B
YAML
21 lines
791 B
YAML
{{- if .Values.enabled }}
|
|
{{- if and (and .Values.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
|
|
{{- $name := include "gitea.actions.workername" (dict "global" . "worker" "actions-token-job") }}
|
|
{{- $secretName := include "gitea.actions.workername" (dict "global" . "worker" "actions-token") }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ $secretName }}
|
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
|
labels:
|
|
{{- include "gitea.actions.labels" . | nindent 4 }}
|
|
app.kubernetes.io/component: token-job
|
|
{{ $secret := (lookup "v1" "Secret" (.Values.namespace | default .Release.Namespace) $secretName) -}}
|
|
{{ if $secret -}}
|
|
data:
|
|
token: {{ (b64dec (index $secret.data "token")) | b64enc }}
|
|
{{ end -}}
|
|
{{- end }}
|
|
{{- end }}
|