Skip to content

Commit 34b0769

Browse files
authored
Create cloudinary-staging (formerly dev-cloudinary) Helm chart (#10)
1 parent bb76789 commit 34b0769

File tree

8 files changed

+491
-0
lines changed

8 files changed

+491
-0
lines changed

charts/cloudinary-staging/.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/cloudinary-staging/Chart.yaml

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

charts/cloudinary-staging/README.md

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Cloudinary-staging Chart packaged by Indiegogo
2+
3+
The Cloudinary-staging application is responsible for proxying the Cloudinary images in our Staging environment.
4+
5+
## TL;DR
6+
7+
```bash
8+
$ helm repo add indiegogo https://charts.indiegogo.com
9+
$ helm install my-release indiegogo/cloudinary-staging
10+
```
11+
12+
## Introduction
13+
14+
This chart bootstraps a Cloudinary-staging deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
15+
16+
## Prerequisites
17+
18+
- Kubernetes 1.12+
19+
- Helm 3.6.2
20+
21+
## Installing the Chart
22+
23+
To install the chart with the release name `my-release`:
24+
25+
```bash
26+
$ helm install my-release indiegogo/cloudinary-staging
27+
```
28+
29+
The command deploys Cloudinary-staging on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
30+
31+
> **Tip**: List all releases using `helm list`
32+
33+
## Uninstalling the Chart
34+
35+
To uninstall/delete the `my-release` deployment:
36+
37+
```bash
38+
$ helm uninstall my-release
39+
```
40+
41+
> 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:
42+
43+
```bash
44+
$ helm uninstall -n namespace my-release
45+
```
46+
47+
The command removes all the Kubernetes components associated with the chart and deletes the release.
48+
49+
## Parameters
50+
51+
52+
### Common parameters
53+
54+
| Name | Type | Description | Default |
55+
| ------------------- | ------ | -------------------------------------------------------------------------- | ------- |
56+
| `kubeVersion` | string | Override Kubernetes version | `nil` |
57+
| `nameOverride` | string | Partially override names.fullname | `nil` |
58+
| `fullnameOverride` | string | Fully override names.fullname | `nil` |
59+
| `commonLabels` | object | Labels to add to all deployed objects | `{}` |
60+
| `commonAnnotations` | object | Annotations to add to all deployed objects | `{}` |
61+
| `networkPort` | int | Deployment container, Deployment readinessProbe, Ingress, and Service port | `80` |
62+
63+
64+
### Deployment parameters
65+
66+
| Name | Type | Description | Default |
67+
| ------------------------------------ | ------- | ------------------------------------------------------------- | --------------------------- |
68+
| `image.registry` | string | The Docker image registry | `"gcr.io"` |
69+
| `image.repository` | string | The Docker image repository | `"indiegogo-staging/nginx"` |
70+
| `image.tag` | string | The Docker image tag | `'latest'` |
71+
| `image.pullPolicy` | string | The Docker image pull policy | `"IfNotPresent"` |
72+
| `containerPort` | int | Cloudinary container port (overrides `networkPort`) | `nil` |
73+
| `replicaCount` | int | Number of Cloudinary replicas to deploy | `3` |
74+
| `strategy.type` | string | Deployment strategy type | `"RollingUpdate"` |
75+
| `resources.requests` | object | CPU/memory resource requests | `{}` |
76+
| `resources.limits` | object | CPU/memory resource limits | `{}` |
77+
| `readinessProbe.enabled` | boolean | Enable/Disable the default httpGet readinessProbe | `true` |
78+
| `readinessProbe.port` | int | Default readinessProbe httpGet port (overrides `networkPort`) | `nil` |
79+
| `readinessProbe.initialDelaySeconds` | int | Initial delay seconds for readinessProbe | `5` |
80+
| `readinessProbe.periodSeconds` | int | Period seconds for readinessProbe | `5` |
81+
| `readinessProbe.timeoutSeconds` | int | Timeout seconds for readinessProbe | `nil` |
82+
| `readinessProbe.successThreshold` | int | Success threshold for readinessProbe | `nil` |
83+
| `readinessProbe.failureThreshold` | int | Failure threshold for readinessProbe | `nil` |
84+
| `customReadinessProbe` | object | Custom readinessProbe that overrides the default one | `{}` |
85+
| `livenessProbeEnabled` | boolean | Enable the custom livenessProbe | `false` |
86+
| `livenessProbe` | object | Write your custom liveness probe here | `{}` |
87+
88+
89+
### Service parameters
90+
91+
| Name | Type | Description | Default |
92+
| ---------------| ------- | --------------------------------------------------- | ------------ |
93+
| `service.name` | string | Cloudinary Service port (overrides `.Release.Name`) | `"http"` |
94+
| `service.port` | int | Cloudinary Service port (overrides `networkPort`) | `80` |
95+
| `service.type` | string | Cloudinary Service Type | `"NodePort"` |
96+
97+
98+
### Ingress parameters
99+
100+
| Name | Type | Description | Default |
101+
| ----------------------------- | ------- | ---------------------------------------------------- | ------- |
102+
| `ingress.enabled` | boolean | Enable/Disable Ingress | `true` |
103+
| `ingress.backend.serviceName` | string | Ingress rules service name | `nil` |
104+
| `ingress.backend.servicePort` | int | Ingress rules service port (overrides `networkPort`) | `nil` |
105+
| `ingress.customAnnotations` | object | Ingress custom annotations | `{}` |
106+
107+
108+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
109+
110+
```bash
111+
$ helm install my-release \
112+
--set replicaCount=1 \
113+
indiegogo/cloudinary-staging
114+
```
115+
116+
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
117+
118+
```bash
119+
$ helm install my-release -f values.yaml indiegogo/cloudinary-staging
120+
```
121+
122+
> **Tip**: You can use the default [values.yaml](values.yaml)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
kind: ConfigMap
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 "tplValues.render" ( dict "value" .Values.commonLabels "scope" $ ) | nindent 4 }}
9+
{{- end }}
10+
data:
11+
nginx.conf: |
12+
user nginx nginx;
13+
worker_processes auto;
14+
worker_cpu_affinity auto;
15+
worker_rlimit_nofile 65536;
16+
pid /run/nginx.pid;
17+
include /etc/nginx/modules-enabled/*.conf;
18+
daemon off;
19+
pcre_jit on;
20+
error_log stderr warn;
21+
22+
events {
23+
worker_connections 4096;
24+
multi_accept on;
25+
}
26+
27+
http {
28+
sendfile on;
29+
tcp_nopush on;
30+
tcp_nodelay on;
31+
keepalive_timeout 65;
32+
types_hash_max_size 2048;
33+
include /etc/nginx/mime.types;
34+
default_type application/octet-stream;
35+
error_log /dev/stderr debug;
36+
access_log /dev/stdout combined;
37+
38+
map "$http_accept" $f_auto_setting {
39+
default "f_auto";
40+
"~.*image/webp.*" "f_webp,fl_awebp";
41+
"~.*image/jxr.*" "f_wdp";
42+
}
43+
44+
server {
45+
listen 80;
46+
server_name dev.iggcdn.com;
47+
resolver kube-dns.kube-system.svc.cluster.local ipv6=off;
48+
set $cloudinary_upstream_url https://indiegogo-dev-res.cloudinary.com;
49+
50+
location = /healthcheck {
51+
return 200;
52+
}
53+
54+
location ^~ /indiegogo-dev {
55+
# Strip the indiegogo-dev/ prefix
56+
rewrite ^/indiegogo-dev/(.*)$ /$1 last;
57+
}
58+
59+
location ~ f_auto {
60+
# Replace f_auto with appropriate setting based on Accept headers.
61+
# Of interesting note, you can't mix mapped variables with default capture
62+
# variables ($1, $2, etc.) which is why these captures are named.
63+
rewrite ^(?<prefix>.*)f_auto(?<postfix>.*)$ "${prefix}${f_auto_setting}${postfix}" break;
64+
try_files /nonexistent @proxy;
65+
}
66+
67+
location / {
68+
try_files /nonexistent @proxy;
69+
}
70+
71+
location @proxy {
72+
add_header Vary Accept;
73+
expires 7d;
74+
add_header Cache-Control public;
75+
proxy_pass $cloudinary_upstream_url;
76+
proxy_intercept_errors on;
77+
error_page 501 =405 /nonexistent;
78+
}
79+
}
80+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
- name: tz-config
25+
hostPath:
26+
path: /usr/share/zoneinfo/America/Los_Angeles
27+
- name: {{ printf "%s-config" (include "common.names.fullname" .) }}
28+
configMap:
29+
name: {{ include "common.names.fullname" . }}
30+
containers:
31+
- name: {{ include "common.names.fullname" . }}
32+
{{- with .Values.image }}
33+
image: "{{- if contains ":" .repository -}}{{ .repository }}{{- else -}}{{- if .registry -}}{{ .registry }}/{{- end -}}{{ .repository }}:{{ default $.Chart.AppVersion .tag }}{{- end -}}"
34+
{{- end }}
35+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
36+
ports:
37+
- containerPort: {{ default .Values.networkPort .Values.containerPort }}
38+
command: [{{ default "/usr/sbin/nginx" | quote }}]
39+
args:
40+
- {{ "-c" | quote }}
41+
- {{ "/etc/nginx/nginx.conf" | quote }}
42+
{{- if .Values.resources }}
43+
resources: {{- toYaml .Values.resources | nindent 10 }}
44+
{{- end }}
45+
{{- if .Values.readinessProbe.enabled }}
46+
readinessProbe:
47+
httpGet:
48+
path: /healthcheck
49+
port: {{ default .Values.networkPort .Values.readinessProbe.port }}
50+
httpHeaders:
51+
- name: Host
52+
value: dev.iggcdn.com
53+
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
54+
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
55+
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
56+
successThreshold: {{ .Values.readinessProbe.successThreshold }}
57+
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
58+
{{- else if .Values.customReadinessProbe }}
59+
readinessProbe: {{- toYaml .Values.customReadinessProbe | nindent 10 }}
60+
{{- end }}
61+
{{- if .Values.livenessProbeEnabled }}
62+
livenessProbe: {{- toYaml .Values.livenessProbe | nindent 10 }}
63+
{{- end }}
64+
volumeMounts:
65+
- name: tz-config
66+
mountPath: /etc/localtime
67+
readOnly: true
68+
- name: {{ printf "%s-config" (include "common.names.fullname" .) }}
69+
mountPath: /etc/nginx/nginx.conf
70+
readOnly: true
71+
subPath: nginx.conf
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
defaultBackend:
16+
service:
17+
name: {{ default (include "common.names.fullname" .) .Values.ingress.backend.serviceName }}
18+
port:
19+
number: {{ default .Values.networkPort .Values.ingress.backend.servicePort }}
20+
{{- end }}
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: {{ default "common.names.fullname" .Values.service.name }}
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)