Skip to content

Commit

Permalink
feat: add support for pod Labels and PV Selectors (#52)
Browse files Browse the repository at this point in the history
* Add support for podLabels and PVC Selector

* Update README

* Update chart version

* Fix linting

* Fix ending newline
  • Loading branch information
Steven Arnott authored Mar 10, 2021
1 parent 1615ed6 commit 71b994e
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 34 deletions.
68 changes: 35 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,41 @@ deletes the release.
The following table lists the configurable parameters of the Verdaccio chart
and their default values.

| Parameter | Description | Default |
| ---------------------------------- | --------------------------------------------------------------- | --------------------- |
| `affinity` | Affinity for pod assignment | `{}` |
| `existingConfigMap` | Name of custom ConfigMap to use | `false` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Image pull secrets | `[]` |
| `image.repository` | Verdaccio container image repository | `verdaccio/verdaccio` |
| `image.tag` | Verdaccio container image tag | `4.6.2` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | List of node taints to tolerate | `[]` |
| `persistence.accessMode` | PVC Access Mode for Verdaccio volume | `ReadWriteOnce` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.existingClaim` | Use existing PVC | `nil` |
| `persistence.mounts` | Additional mounts | `nil` |
| `persistence.size` | PVC Storage Request for Verdaccio volume | `8Gi` |
| `persistence.storageClass` | PVC Storage Class for Verdaccio volume | `nil` |
| `persistence.volumes` | Additional volumes | `nil` |
| `podAnnotations` | Annotations to add to each pod | `{}` |
| `priorityClass.enabled` | Enable specifying pod priorityClassName | `false` |
| `priorityClass.name` | PriorityClassName to be specified in pod spec | `""` |
| `replicaCount` | Desired number of pods | `1` |
| `resources` | CPU/Memory resource requests/limits | `{}` |
| `service.annotations` | Annotations to add to service | none |
| `service.clusterIP` | IP address to assign to service | `""` |
| `service.externalIPs` | Service external IP addresses | `[]` |
| `service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` |
| `service.loadBalancerSourceRanges` | List of IP CIDRs allowed access to load balancer (if supported) | `[]` |
| `service.port` | Service port to expose | `4873` |
| `service.nodePort` | Service port to expose | none |
| `service.type` | Type of service to create | `ClusterIP` |
| `serviceAccount.enabled` | Enable service account | `false` |
| `serviceAccount.name` | Service account Name | none |
| `extraEnvVars` | Define environment variables to be passed to the container | `{}` |
| Parameter | Description | Default |
| ---------------------------------- | --------------------------------------------------------------- | ------------------------------ |
| `affinity` | Affinity for pod assignment | `{}` |
| `existingConfigMap` | Name of custom ConfigMap to use | `false` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Image pull secrets | `[]` |
| `image.repository` | Verdaccio container image repository | `verdaccio/verdaccio` |
| `image.tag` | Verdaccio container image tag | `4.6.2` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | List of node taints to tolerate | `[]` |
| `persistence.accessMode` | PVC Access Mode for Verdaccio volume | `ReadWriteOnce` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.existingClaim` | Use existing PVC | `nil` |
| `persistence.mounts` | Additional mounts | `nil` |
| `persistence.size` | PVC Storage Request for Verdaccio volume | `8Gi` |
| `persistence.storageClass` | PVC Storage Class for Verdaccio volume | `nil` |
| `persistence.selector` | Selector to match an existing Persistent Volume | `{}` (evaluated as a template) |
| `persistence.volumes` | Additional volumes | `nil` |
| `podLabels` | Additional pod labels | `{}` (evaluated as a template) |
| `podAnnotations` | Annotations to add to each pod | `{}` |
| `priorityClass.enabled` | Enable specifying pod priorityClassName | `false` |
| `priorityClass.name` | PriorityClassName to be specified in pod spec | `""` |
| `replicaCount` | Desired number of pods | `1` |
| `resources` | CPU/Memory resource requests/limits | `{}` |
| `service.annotations` | Annotations to add to service | none |
| `service.clusterIP` | IP address to assign to service | `""` |
| `service.externalIPs` | Service external IP addresses | `[]` |
| `service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` |
| `service.loadBalancerSourceRanges` | List of IP CIDRs allowed access to load balancer (if supported) | `[]` |
| `service.port` | Service port to expose | `4873` |
| `service.nodePort` | Service port to expose | none |
| `service.type` | Type of service to create | `ClusterIP` |
| `serviceAccount.enabled` | Enable service account | `false` |
| `serviceAccount.name` | Service account Name | none |
| `extraEnvVars` | Define environment variables to be passed to the container | `{}` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

Expand Down
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: v2
description: A lightweight private npm proxy registry (sinopia fork)
name: verdaccio
version: 1.1.0
version: 1.2.0
appVersion: 4.10.0
home: https://verdaccio.org
icon: https://cdn.verdaccio.dev/logos/default.png
Expand Down
13 changes: 13 additions & 0 deletions charts/verdaccio/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,16 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Renders a value that contains template.
Usage:
{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
3 changes: 3 additions & 0 deletions charts/verdaccio/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ spec:
labels:
app: {{ template "verdaccio.name" . }}
release: {{ .Release.Name }}
{{- if .Values.podLabels }}
{{- include "tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ include "verdaccio.serviceAccountName" . }}
Expand Down
4 changes: 4 additions & 0 deletions charts/verdaccio/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ spec:
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- if .Values.persistence.selector }}
selector: {{- include "tplvalues.render" (dict "value" .Values.persistence.selector "context" $) | nindent 4 }}
{{- end -}}

{{- end }}
11 changes: 11 additions & 0 deletions charts/verdaccio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ affinity: {}
## Tolerations for nodes
tolerations: []

## Additional pod labels
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
##
podLabels: {}

podAnnotations: {}
replicaCount: 1

Expand Down Expand Up @@ -169,6 +174,12 @@ persistence:

accessMode: ReadWriteOnce
size: 8Gi
## selector can be used to match an existing PersistentVolume
## selector:
## matchLabels:
## app: my-app
selector: {}

volumes:
# - name: nothing
# emptyDir: {}
Expand Down

0 comments on commit 71b994e

Please sign in to comment.