Skip to content

Commit 76e7edb

Browse files
authored
Create 'Storybook' Helm chart (#17)
1 parent 14c6cd0 commit 76e7edb

9 files changed

+516
-0
lines changed

charts/storybook/.helmignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

charts/storybook/Chart.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v2
2+
name: storybook
3+
version: 0.1.0
4+
description: A Helm chart for Storybook
5+
type: application
6+
keywords:
7+
- storybook
8+
home: https://github.com/indiegogo/ops_tools/tree/main/docker/storybook
9+
sources:
10+
- https://github.com/indiegogo/ops_tools/tree/main/docker/storybook
11+
dependencies:
12+
- name: common
13+
version: "0.1.2"
14+
repository: https://charts.indiegogo.com/
15+
tags:
16+
- indiegogo-common
17+
maintainers:
18+
- name: DevOps
19+
email: devops@indiegogo.com
20+
appVersion: "b0d7aa9"

charts/storybook/README.md

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Storybook Chart packaged by Indiegogo
2+
3+
## TL;DR
4+
5+
```bash
6+
$ helm repo add indiegogo https://charts.indiegogo.com
7+
$ helm install my-release indiegogo/storybook
8+
```
9+
10+
## Introduction
11+
12+
This chart bootstraps a Storybook deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
13+
14+
## Prerequisites
15+
16+
- Kubernetes 1.12+
17+
- Helm 3.6.2
18+
19+
## Getting started with default values
20+
21+
To get you started with modifying the default values to your liking/needs, use the below command to grab the latest `values.yaml` file:
22+
23+
```bash
24+
$ helm show values indiegogo/storybook > values.yaml
25+
```
26+
27+
## Installing the Chart
28+
29+
To install the chart with the release name `my-release`:
30+
31+
```bash
32+
$ helm install my-release indiegogo/storybook
33+
```
34+
35+
The command deploys Storybook on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
36+
37+
> **Tip**: List all releases using `helm list`
38+
39+
## Uninstalling the Chart
40+
41+
To uninstall/delete the `my-release` deployment:
42+
43+
```bash
44+
$ helm uninstall my-release
45+
```
46+
47+
> NOTE: If you used `-n namespace` when you installed the chart, be sure to use it again when you uninstall the chart, otherwise the associated dependency Kubernetes resources will not be deleted:
48+
49+
```bash
50+
$ helm uninstall -n namespace my-release
51+
```
52+
53+
The command removes all the Kubernetes components associated with the chart and deletes the release.
54+
55+
## Parameters
56+
57+
58+
### Common parameters
59+
60+
| Name | Type | Description | Default |
61+
| ------------------ | ------ | ---------------------------------------------------------------- | ------- |
62+
| `kubeVersion` | string | Override Kubernetes version | `nil` |
63+
| `nameOverride` | string | Partially override names.fullname | `nil` |
64+
| `fullnameOverride` | string | Fully override names.fullname | `nil` |
65+
| `commonLabels` | object | Labels to add to all deployed objects | `{}` |
66+
| `networkPort` | int | Deployment container, Deployment livenessProbe, and Service port | `80` |
67+
68+
69+
### Deployment parameters
70+
71+
| Name | Type | Description | Default |
72+
| ------------------------ | ------- | -------------------------------------------------- | ------------------------------- |
73+
| `image.registry` | string | The Docker image registry | `"gcr.io"` |
74+
| `image.repository` | string | The Docker image repository | `"indiegogo-staging/storybook"` |
75+
| `image.tag` | string | The Docker image tag | `'latest'` |
76+
| `image.pullPolicy` | string | The Docker image pull policy | `"IfNotPresent"` |
77+
| `environment` | object | Custom/extra environment variables | `{}` |
78+
| `containerPort` | int | Storybook container port (overrides `networkPort`) | `nil` |
79+
| `replicaCount` | int | Number of Storybook replicas to deploy | `1` |
80+
| `strategy.type` | string | Deployment strategy type | `"RollingUpdate"` |
81+
| `strategy.rollingUpdate` | object | Rolling update deployment strategy options | `{}` |
82+
| `resources.requests` | object | CPU/memory resource requests | `{}` |
83+
| `resources.limits` | object | CPU/memory resource limits | `{}` |
84+
| `livenessProbeEnabled` | boolean | Enable the custom livenessProbe | `true` |
85+
| `livenessProbe` | object | Write your custom liveness probe here | `{}` |
86+
| `readinessProbeEnabled` | boolean | Enable the custom readinessProbe | `false` |
87+
| `readinessProbe` | object | Write your custom readiness probe here | `{}` |
88+
| `usePacificTime` | boolean | Use Pacific time instead of UTC in container | `false` |
89+
90+
91+
### Service parameters
92+
93+
| Name | Type | Description | Default |
94+
| ---------------| ------ | ------------------------------------------------ | ------------ |
95+
| `service.port` | int | Storybook Service port (overrides `networkPort`) | `nil` |
96+
| `service.type` | string | Storybook Service Type | `"NodePort"` |
97+
98+
99+
### Ingress parameters
100+
101+
| Name | Type | Description | Default |
102+
| --------------------------- | ------- | -------------------------- | ----------------- |
103+
| `ingress.enabled` | boolean | Enable/Disable Ingress | `true` |
104+
| `ingress.tls.enabled` | boolean | Enable/Disable Ingress TLS | `false` |
105+
| `ingress.tls.hosts` | list | Ingress TLS host(s) | see `values.yaml` |
106+
| `ingress.tls.secretName` | string | Ingress TLS Secret name | `nil` |
107+
| `ingress.rules.hosts` | list | Ingress rules host(s) | see `values.yaml` |
108+
| `ingress.customAnnotations` | object | Ingress custom annotations | `{}` |
109+
110+
111+
### Storage parameters
112+
113+
| Name | Type | Description | Default |
114+
| ---------------------------------------- | ------- | ------------------------------------------------- | ------------ |
115+
| `storage.requestedSize` | string | Size of Persistent Volume Claim/Persistent Volume | `"10Gi"` |
116+
| `storage.className` | string | Type of storage (standard/ssd) | `"standard"` |
117+
| `storage.persistentVolume.enabled` | boolean | Enable to use an existing persistent disk | `false` |
118+
| `storage.persistentVolume.pdName` | string | Name of the existing persistent disk | `nil` |
119+
| `storage.persistentVolume.reclaimPolicy` | string | Reclamation of the persistent disk resources | `"Retain"` |
120+
121+
122+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
123+
124+
```bash
125+
$ helm install my-release \
126+
--set replicaCount=1 \
127+
indiegogo/storybook
128+
```
129+
130+
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
131+
132+
```bash
133+
$ helm install my-release -f values.yaml indiegogo/storybook
134+
```
135+
136+
> **Tip**: You can use the default [values.yaml](values.yaml)
+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
kind: Deployment
2+
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
3+
metadata:
4+
name: {{ include "common.names.fullname" . }}
5+
namespace: {{ .Release.Namespace | quote }}
6+
labels: {{- include "common.labels.standard" . | nindent 4 }}
7+
{{- if .Values.commonLabels }}
8+
{{- include "common.tplValues.render" ( dict "value" .Values.commonLabels "scope" $ ) | nindent 4 }}
9+
{{- end }}
10+
spec:
11+
selector:
12+
matchLabels:
13+
app: {{ include "common.names.fullname" . }}
14+
replicas: {{ .Values.replicaCount }}
15+
{{- if .Values.strategy }}
16+
strategy: {{- toYaml .Values.strategy | nindent 4 }}
17+
{{- end }}
18+
template:
19+
metadata:
20+
labels:
21+
app: {{ include "common.names.fullname" . }}
22+
spec:
23+
volumes:
24+
{{- if .Values.usePacificTime }}
25+
- name: tz-config
26+
hostPath:
27+
path: /usr/share/zoneinfo/America/Los_Angeles
28+
{{- end }}
29+
- name: {{ include "common.names.fullname" . }}
30+
persistentVolumeClaim:
31+
claimName: {{ include "common.names.fullname" . }}
32+
initContainers:
33+
- name: setup
34+
{{- with .Values.image }}
35+
image: "{{- if contains ":" .repository -}}{{ .repository }}{{- else -}}{{- if .registry -}}{{ .registry }}/{{- end -}}{{ .repository }}:{{ default $.Chart.AppVersion .tag }}{{- end -}}"
36+
{{- end }}
37+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
38+
command: ["/bin/bash"]
39+
args:
40+
- "-c"
41+
- "chown -R nginx:nginx /var/www/upload"
42+
volumeMounts:
43+
- name: {{ include "common.names.fullname" . }}
44+
mountPath: /var/www/upload
45+
securityContext:
46+
runAsUser: 0
47+
containers:
48+
- name: {{ include "common.names.fullname" . }}
49+
{{- with .Values.image }}
50+
image: "{{- if contains ":" .repository -}}{{ .repository }}{{- else -}}{{- if .registry -}}{{ .registry }}/{{- end -}}{{ .repository }}:{{ default $.Chart.AppVersion .tag }}{{- end -}}"
51+
{{- end }}
52+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
53+
{{- if .Values.environment }}
54+
env:
55+
{{- range $key, $value := .Values.environment }}
56+
- name: {{ $key }}
57+
value: {{ $value | quote }}
58+
{{- end }}
59+
{{- end }}
60+
ports:
61+
- containerPort: {{ default .Values.networkPort .Values.containerPort }}
62+
{{- if .Values.resources }}
63+
resources: {{- toYaml .Values.resources | nindent 12 }}
64+
{{- end }}
65+
command: ["/usr/sbin/nginx"]
66+
args:
67+
- "-g"
68+
- "daemon off;"
69+
{{- if .Values.livenessProbeEnabled }}
70+
livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }}
71+
{{- end }}
72+
{{- if .Values.readinessProbeEnabled }}
73+
readinessProbe: {{- toYaml .Values.readinessProbe | nindent 12 }}
74+
{{- end }}
75+
volumeMounts:
76+
{{- if .Values.usePacificTime }}
77+
- name: tz-config
78+
mountPath: /etc/localtime
79+
readOnly: true
80+
{{- end }}
81+
- name: {{ include "common.names.fullname" . }}
82+
mountPath: /var/www/upload
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{{- if .Values.ingress.enabled }}
2+
kind: Ingress
3+
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
4+
metadata:
5+
name: {{ include "common.names.fullname" . }}
6+
namespace: {{ .Release.Namespace | quote }}
7+
labels: {{- include "common.labels.standard" . | nindent 4 }}
8+
{{- if .Values.commonLabels }}
9+
{{- include "common.tplValues.render" ( dict "value" .Values.commonLabels "scope" $ ) | nindent 4 }}
10+
{{- end }}
11+
{{- if .Values.ingress.customAnnotations }}
12+
annotations: {{- toYaml .Values.ingress.customAnnotations | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
{{- if .Values.ingress.tls.enabled }}
16+
tls:
17+
- hosts:
18+
{{- range .Values.ingress.tls.hosts }}
19+
- {{ . }}
20+
{{- end }}
21+
secretName: {{ printf "%s-tls" (default (index (required "You must add a host in the 'ingress.tls.hosts' list in values.yaml" .Values.ingress.tls.hosts) 0) .Values.ingress.tls.secretName) | replace "." "-" }}
22+
{{- end }}
23+
rules:
24+
{{- range .Values.ingress.rules.hosts }}
25+
- host: {{ .host }}
26+
http:
27+
paths:
28+
{{- range .paths }}
29+
- path: {{ .path }}
30+
pathType: {{ .pathType }}
31+
backend:
32+
service:
33+
name: {{ .service.name }}
34+
port:
35+
number: {{ .service.port.number }}
36+
{{- end }}
37+
{{- end }}
38+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if .Values.storage.persistentVolume.enabled }}
2+
apiVersion: v1
3+
kind: PersistentVolume
4+
metadata:
5+
name: {{ include "common.names.fullname" . }}
6+
spec:
7+
capacity:
8+
storage: {{ .Values.storage.requestedSize }}
9+
accessModes:
10+
- ReadWriteOnce
11+
persistentVolumeReclaimPolicy: {{ .Values.storage.persistentVolume.reclaimPolicy }}
12+
gcePersistentDisk:
13+
pdName: {{ required "To use an existing persistent disk, please set a persistent disk name in values.yaml (storage.persistentVolume.pdName)" .Values.storage.persistentVolume.pdName }}
14+
fsType: ext4
15+
storageClassName: {{ .Values.storage.className }}
16+
claimRef:
17+
name: {{ include "common.names.fullname" . }}
18+
namespace: {{ .Release.Namespace | quote }}
19+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
kind: PersistentVolumeClaim
2+
apiVersion: v1
3+
metadata:
4+
name: {{ include "common.names.fullname" . }}
5+
namespace: {{ .Release.Namespace | quote }}
6+
spec:
7+
storageClassName: {{ .Values.storage.className }}
8+
resources:
9+
requests:
10+
storage: {{ .Values.storage.requestedSize }}
11+
accessModes:
12+
- ReadWriteOnce
13+
{{- if .Values.storage.persistentVolume.enabled }}
14+
volumeName: {{ include "common.names.fullname" . }}
15+
{{- end }}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: {{ include "common.names.fullname" . }}
5+
namespace: {{ .Release.Namespace | quote }}
6+
labels: {{- include "common.labels.standard" . | nindent 4 }}
7+
{{- if .Values.commonLabels }}
8+
{{- include "common.tplValues.render" ( dict "value" .Values.commonLabels "scope" $ ) | nindent 4 }}
9+
{{- end }}
10+
spec:
11+
ports:
12+
- name: {{ include "common.names.fullname" . }}
13+
port: {{ default .Values.networkPort .Values.service.port }}
14+
protocol: TCP
15+
selector:
16+
app: {{ include "common.names.fullname" . }}
17+
type: {{ .Values.service.type }}

0 commit comments

Comments
 (0)