Add Verdaccio chart (#2727)

* Add Verdaccio chart

* Add appVersion to charts, update deployment apiVersion to apps/v1beta1
This commit is contained in:
Etienne
2017-11-29 21:14:14 +01:00
committed by Reinhard Nägele
parent 88882d26f4
commit 63c338bb9c
10 changed files with 442 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
+10
View File
@@ -0,0 +1,10 @@
apiVersion: v1
description: A lightweight private npm proxy registry (sinopia fork)
name: verdaccio
version: 0.1.0
appVersion: 2.6.5
sources:
- http://www.verdaccio.org
maintainers:
- name: etiennetremel
email: etienne.tremel@container-solutions.com
+125
View File
@@ -0,0 +1,125 @@
# Verdaccio
[Verdaccio](http://www.verdaccio.org) is a lightweight private
[NPM](https://www.npmjs.com) proxy registry.
## TL;DR;
```
$ helm install stable/verdaccio
```
## Introduction
This chart bootstraps a [Verdaccio](https://github.com/verdaccio/verdaccio)
deployment on a [Kubernetes](http://kubernetes.io) cluster using the
[Helm](https://helm.sh) package manager.
## Prerequisites
- Kubernetes 1.7+ with Beta APIs enabled
- PV provisioner support in the underlying infrastructure
## Installing the Chart
To install the chart with the release name `my-release`:
```
$ helm install --name my-release stable/verdaccio
```
The command deploys Verdaccio on the Kubernetes cluster in the default
configuration. The [configuration](#configuration) section lists the parameters
that can be configured during installation.
> **Tip**: List all releases using `helm list`
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```
$ helm delete my-release
```
The command removes all the Kubernetes components associated with the chart and
deletes the release.
## Configuration
The following tables lists the configurable parameters of the Verdaccio chart
and their default values.
| Parameter | Description | Default |
| ---------------------------------- | --------------------------------------------------------------- | -------------------------------------------------------- |
| `customConfigMap` | Use a custom ConfigMap | `false` |
| `image.pullPolicy` | Image pull policy | `Always` if `image` tag is `latest`, else `IfNotPresent` |
| `image.repository` | Verdaccio image | `verdaccio/verdaccio:{VERSION}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `persistence.accessMode` | PVC Access Mode for Verdaccio volume | `ReadWriteOnce` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `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 | `{}` |
| `replicaCount` | Desired number of pods | `1` |
| `resources` | CPU/Memory resource requests/limits | `{}` |
| `resources` | pod 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.type` | Type of service to create | `ClusterIP` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```
$ helm install --name my-release \
--set service.type=LoadBalancer \
stable/verdaccio
```
The above command sets the a service type LoadBalancer.
Alternatively, a YAML file that specifies the values for the above parameters
can be provided while installing the chart. For example,
```
$ helm install --name my-release -f values.yaml stable/verdaccio
```
> **Tip**: You can use the default [values.yaml](values.yaml)
### Custom ConfigMap
When creating a new chart with this chart as a dependency, CustomConfigMap can
be used to override the default config.yaml provided. It also allows for
providing additional configuration files that will be copied into
`/verdaccio/conf`. In the parent chart's values.yaml, set the value to true and
provide the file `templates/config.yaml` for your use case.
### Persistence
The Verdaccio image stores persistence under `/verdaccio/storage` path of the
container. A dynamically managed Persistent Volume Claim is used to keep the
data across deployments, by default. This is known to work in GCE, AWS, and
minikube.
Alternatively, a previously configured Persistent Volume Claim can be used.
It is possible to mount several volumes using `Persistence.volumes` and
`Persistence.mounts` parameters.
#### Existing PersistentVolumeClaim
1. Create the PersistentVolume
1. Create the PersistentVolumeClaim
1. Install the chart
```bash
$ helm install --name my-release \
--set persistence.existingClaim=PVC_NAME \
stable/verdaccio
```
+15
View File
@@ -0,0 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "verdaccio.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "verdaccio.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "verdaccio.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "verdaccio.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward $POD_NAME 8080:{{ .Values.service.port }}
echo "Visit http://127.0.0.1:8080 to use your application"
{{- end }}
+16
View File
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "verdaccio.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "verdaccio.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
+66
View File
@@ -0,0 +1,66 @@
{{- if not .Values.customConfigMap }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "verdaccio.fullname" . }}
labels:
app: {{ template "verdaccio.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
config.yaml: |
#
# This is the config file used for the docker images.
# It allows all users to do anything, so don't use it on production systems.
#
# Do not configure host and port under `listen` in this file
# as it will be ignored when using docker.
# see https://github.com/verdaccio/verdaccio/blob/master/wiki/docker.md#docker-and-custom-port-configuration
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
#
# path to a directory with all packages
storage: /verdaccio/storage/data
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
# Maximum amount of users allowed to register, defaults to "+infinity".
# You can set this to -1 to disable registration.
#max_users: 1000
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
packages:
'@*/*':
# scoped packages
access: $all
publish: $authenticated
proxy: npmjs
'**':
# allow all users (including non-authenticated users) to read and
# publish all packages
#
# you can specify usernames/groupnames (depending on your auth plugin)
# and three keywords: "$all", "$anonymous", "$authenticated"
access: $all
# allow all known users to publish packages
# (anyone can register by default, remember?)
publish: $authenticated
# if package is not available locally, proxy requests to 'npmjs' registry
proxy: npmjs
# log settings
logs:
- {type: stdout, format: pretty, level: http}
#- {type: file, path: verdaccio.log, level: info}
{{- end }}
@@ -0,0 +1,68 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
labels:
app: {{ template "verdaccio.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "verdaccio.fullname" . }}
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
{{- if .Values.podAnnotations }}
annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
labels:
app: {{ template "verdaccio.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ template "verdaccio.name" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 4873
livenessProbe:
httpGet:
path: /
port: 4873
readinessProbe:
httpGet:
path: /
port: 4873
resources:
{{ toYaml .Values.resources | indent 12 }}
volumeMounts:
{{- if .Values.persistence.mounts }}
{{ toYaml .Values.persistence.mounts | indent 12 }}
{{- end }}
- mountPath: /verdaccio/storage
name: storage
readOnly: false
- mountPath: /verdaccio/conf
name: config
readOnly: true
# Allow non-root user to access PersistentVolume
securityContext:
fsGroup: 1000
volumes:
- name: config
configMap:
name: {{ template "verdaccio.fullname" . }}
{{- if .Values.persistence.volumes }}
{{ toYaml .Values.persistence.volumes | indent 6 }}
{{- end }}
- name: storage
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "verdaccio.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end -}}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
+24
View File
@@ -0,0 +1,24 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
labels:
app: {{ template "verdaccio.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
name: {{ template "verdaccio.fullname" . }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
+35
View File
@@ -0,0 +1,35 @@
apiVersion: v1
kind: Service
metadata:
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
name: {{ template "verdaccio.fullname" . }}
labels:
app: {{ template "verdaccio.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
clusterIP: "{{ .Values.service.clusterIP }}"
{{- if .Values.service.externalIPs }}
externalIPs:
{{ toYaml .Values.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: "{{ .Values.service.loadBalancerIP }}"
{{- end }}
{{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
targetPort: 4873
protocol: TCP
name: {{ .Values.service.name }}
selector:
app: {{ template "verdaccio.name" . }}
release: {{ .Release.Name }}
type: {{ .Values.service.type }}
+62
View File
@@ -0,0 +1,62 @@
image:
repository: verdaccio/verdaccio
tag: 2.6.5
pullPolicy: IfNotPresent
service:
annotations: {}
clusterIP: ""
## List of IP addresses at which the service is available
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
##
externalIPs: []
loadBalancerIP: ""
loadBalancerSourceRanges: []
port: 4873
type: ClusterIP
## Node labels for pod assignment
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
##
nodeSelector: {}
podAnnotations: {}
replicaCount: 1
resources: {}
# limits:
# cpu: 100m
# memory: 512Mi
# requests:
# cpu: 100m
# memory: 512Mi
customConfigMap: false
persistence:
enabled: true
## A manually managed Persistent Volume and Claim
## Requires Persistence.Enabled: true
## If defined, PVC must be created manually before volume will be bound
# existingClaim:
## Verdaccio data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
accessMode: ReadWriteOnce
size: 8Gi
volumes:
# - name: nothing
# emptyDir: {}
mounts:
# - mountPath: /var/nothing
# name: nothing
# readOnly: true