Skip to content

Commit

Permalink
Merge pull request #18 from spagno/enhancement-sts
Browse files Browse the repository at this point in the history
added statefulset with pvc configuration
  • Loading branch information
bdashrad committed Mar 7, 2020
2 parents aeabd71 + ec5f208 commit f3bfbb6
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 25 deletions.
49 changes: 26 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,32 @@ helm install privatebin/privatebin

See values.yaml for full documentation

| Parameter | Description | Default |
| ---------------------------------- | -------------------------------------------------- | ------------------------------------------------ |
| `replicaCount` | Number of replicas | `1` |
| `image.repository` | Container image name | `privatebin/nginx-fpm-alpine` |
| `image.tag` | Container image tag | `` |
| `image.pullPolicy` | Container image pull policy | `IfNotPresent` |
| `nameOverride` | Name Override | `""` |
| `fullnameOverride` | FullName Override | `""` |
| `service.type` | Service type (ClusterIP, NodePort or LoadBalancer) | `ClusterIP` |
| `service.port` | Ports exposed by service | `80` |
| `service.portName` | Name of exposed port, becomes LB protocol on ELB | `http` |
| `service.annotations` | Service annotations | `{}` |
| `service.loadBalancerSourceRanges` | Load balancer allowed source CIDRs | None |
| `ingress.enabled` | Enables Ingress | `false` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.hosts.host` | Ingress accepted hostnames | `privatebin.local` |
| `ingress.hosts.path` | Ingress path | `\` |
| `ingress.tls` | Ingress TLS configuration | `[]` |
| `resources` | Pod resource requests & limits | `{}` |
| `nodeSelector` | Node selector | `{}` |
| `tolerations` | Tolerations | `[]` |
| `affinity` | Affinity or Anti-Affinity | `{}` |
| `configs` | List of files to put in cfg path | `{}` |
| Parameter | Description | Default |
| ---------------------------- | -------------------------------------------------- | ------------------------------------------------ |
| `replicaCount` | Number of replicas | `1` |
| `image.repository` | Container image name | `privatebin/nginx-fpm-alpine` |
| `image.tag` | Container image tag | `` |
| `image.pullPolicy` | Container image pull policy | `IfNotPresent` |
| `nameOverride` | Name Override | `""` |
| `fullnameOverride` | FullName Override | `""` |
| `datapath` | Datapath for persistent data | `/srv/data` |
| `controller.kind` | Controller kind (StatefulSet, Deployment, Both) | `Deployment` |
| `controller.pvc.requests` | Requests for PVC (only with StatefulSet) | `1Gi` |
| `controller.pvc.storageClass`| StorageClass to use for PVC (only with StatefulSet)| `""` |
| `service.type` | Service type (ClusterIP, NodePort or LoadBalancer) | `ClusterIP` |
| `service.port` | Ports exposed by service | `80` |
| `service.portName` | Name of exposed port, becomes LB protocol on ELB | `http` |
| `service.annotations` | Service annotations | `{}` |
| `ingress.enabled` | Enables Ingress | `false` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.hosts.host` | Ingress accepted hostnames | `privatebin.local` |
| `ingress.hosts.path` | Ingress path | `\` |
| `ingress.tls` | Ingress TLS configuration | `[]` |
| `resources` | Pod resource requests & limits | `{}` |
| `nodeSelector` | Node selector | `{}` |
| `tolerations` | Tolerations | `[]` |
| `affinity` | Affinity or Anti-Affinity | `{}` |
| `configs` | List of files to put in cfg path | `{}` |

## Upgrades
Standard helm upgrade process applies.
Expand Down
2 changes: 1 addition & 1 deletion privatebin/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: A Helm chart for installing PrivateBin
name: privatebin
home: https://privatebin.info/
icon: https://raw.githubusercontent.com/PrivateBin/assets/master/images/preview/icon.png
version: 0.3.1
version: 0.4.0
maintainers:
- name: bdashrad
email: bdashrad@gmail.com
Expand Down
3 changes: 2 additions & 1 deletion privatebin/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
{{- if or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both") }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -57,3 +57,4 @@ spec:
- name: configs
configMap:
name: {{ include "privatebin.fullname" . }}-configs
{{- end }}
77 changes: 77 additions & 0 deletions privatebin/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{{- if or (eq .Values.controller.kind "StatefulSet") (eq .Values.controller.kind "Both") }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "privatebin.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "privatebin.name" . }}
helm.sh/chart: {{ include "privatebin.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ include "privatebin.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "privatebin.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: configs
mountPath: /srv/cfg
- name: storage
mountPath: {{ .Values.datapath }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: configs
configMap:
name: {{ include "privatebin.fullname" . }}-configs
volumeClaimTemplates:
- metadata:
name: storage
spec:
accessModes: [ "ReadWriteMany" ]
{{- if .Values.controller.pvc.storageClass }}
{{- if (eq "-" .Values.controller.pvc.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.controller.pvc.storageClass }}"
{{- end }}
{{- end }}
resources:
requests:
storage: {{ .Values.controller.pvc.requests }}
volumeMode: Filesystem
{{- end }}
14 changes: 14 additions & 0 deletions privatebin/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ image:

nameOverride: ""
fullnameOverride: ""
datapath: "/srv/data"

service:
type: ClusterIP
Expand All @@ -24,6 +25,19 @@ service:
## Limit load balancer source ips to list of CIDRs (where available)
# loadBalancerSourceRanges: []

controller:
kind: "Deployment"
pvc:
requests: "1Gi"
## logstash 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: "-"

ingress:
enabled: false
annotations: {}
Expand Down

0 comments on commit f3bfbb6

Please sign in to comment.