Skip to content

Commit

Permalink
fix: service account and allow setting annotations (#29)
Browse files Browse the repository at this point in the history
* Fix service account

* Update charts/verdaccio/values.yaml

Co-authored-by: Tod Hansmann <[email protected]>

Co-authored-by: Tod Hansmann <[email protected]>
  • Loading branch information
duboisph and todpunk authored Jun 26, 2020
1 parent ce394df commit e98a432
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/verdaccio/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: A lightweight private npm proxy registry (sinopia fork)
name: verdaccio
version: 0.15.0
version: 0.15.1
appVersion: 4.6.2
home: https://verdaccio.org
icon: https://cdn.verdaccio.dev/logos/default.png
Expand Down
11 changes: 11 additions & 0 deletions charts/verdaccio/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "verdaccio.serviceAccountName" -}}
{{- if .Values.serviceAccount.enabled }}
{{- default (include "verdaccio.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/verdaccio/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ metadata:
release: {{ .Release.Name }}
name: {{ template "verdaccio.fullname" . }}
spec:
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ template ".Values.serviceAccount.name" . }}
{{- end}}
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
Expand All @@ -34,6 +31,9 @@ spec:
app: {{ template "verdaccio.name" . }}
release: {{ .Release.Name }}
spec:
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ include "verdaccio.serviceAccountName" . }}
{{- end}}
containers:
- name: {{ template "verdaccio.name" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Expand Down
8 changes: 6 additions & 2 deletions charts/verdaccio/templates/service-account.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{{- if .Values.serviceAccount.enabled }}
{{- if .Values.serviceAccount.enabled -}}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template ".Values.serviceAccount.name" . }}
name: {{ include "verdaccio.serviceAccountName" . }}
labels:
app: {{ template "verdaccio.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
7 changes: 6 additions & 1 deletion charts/verdaccio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ ingress:

## Service account
serviceAccount:
# Specifies whether a service account should be created
enabled: false
# name:
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and enabled is true, a name is generated using the Chart's fullname template
name: ""

# Extra Environment Values - allows yaml definitions
extraEnvVars:
Expand Down

0 comments on commit e98a432

Please sign in to comment.