Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions charts/portainer/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- end }}
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.edgeNodePort))) }}
args: [ '--tunnel-port','{{ .Values.service.edgeNodePort }}' ]
{{- end }}
args:
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.edgeNodePort))) }}
- "--tunnel-port"
- "{{ .Values.service.edgeNodePort }}"
{{- end }}
{{- if (not (empty .Values.admin.password)) }}
- "--admin-password"
- "'${ADMIN_PASSWORD_HASH}'"
{{- end }}
volumeMounts:
- name: data
mountPath: /data
Expand All @@ -60,3 +66,11 @@ spec:
port: 9000
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
{{- if (not (empty .Values.admin.password)) }}
- name: ADMIN_PASSWORD_HASH
valueFrom:
secretKeyRef:
name: portainer-initial-credentials
key: password
{{- end }}
13 changes: 13 additions & 0 deletions charts/portainer/templates/secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{ $htpasswdString := htpasswd .Values.admin.username .Values.admin.password -}}
{{ $htpasswdHash := split ":" $htpasswdString -}}

apiVersion: v1
kind: Secret
metadata:
name: portainer-initial-credentials
namespace: {{ .Release.Namespace }}
labels:
{{- include "portainer.selectorLabels" . | nindent 8 }}
data:
username: {{ default "" .Values.admin.username | b64enc | quote }}
password: {{ $htpasswdHash._1 | b64enc | quote }}
4 changes: 4 additions & 0 deletions charts/portainer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

replicaCount: 1

admin:
username: admin
password:

# If enterpriseEdition is enabled, then use the values below _instead_ of those in .image
enterpriseEdition:
enabled: false
Expand Down