Skip to content

Commit 2f4b7dd

Browse files
authored
Create 'circle-webhook-proxy' Helm chart (#14)
1 parent f8775f0 commit 2f4b7dd

File tree

8 files changed

+538
-0
lines changed

8 files changed

+538
-0
lines changed
+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
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: v2
2+
name: circle-webhook-proxy
3+
version: 0.1.0
4+
description: A Helm chart for our CircleCI webhook proxy
5+
type: application
6+
keywords:
7+
- circle-ci
8+
- webhook
9+
- proxy
10+
home: https://github.com/indiegogo/ops_tools/tree/main/docker/circle-webhook-proxy
11+
sources:
12+
- https://github.com/indiegogo/ops_tools/tree/main/docker/circle-webhook-proxy
13+
dependencies:
14+
- name: common
15+
version: "0.1.2"
16+
repository: https://charts.indiegogo.com/
17+
tags:
18+
- indiegogo-common
19+
- name: redis
20+
version: "0.4.6"
21+
repository: https://groundhog2k.github.io/helm-charts/
22+
condition: redis.chartEnabled
23+
maintainers:
24+
- name: DevOps
25+
email: devops@indiegogo.com
26+
appVersion: "a834b72"

charts/circle-webhook-proxy/README.md

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# CircleCI webhook proxy Chart packaged by Indiegogo
2+
3+
The CircleCI webhook proxy intercepts GitHub webhook events of type 'push' which represent a newly pushed commit. It will store the request headers and body into Redis for persistence with a TTL of 7 days by default. Users can have the proxy submit the intercepted 'push' webhook to the upstream CircleCI instance. For more information, see the readme [here](https://github.com/indiegogo/ops_tools/tree/main/docker/circle-webhook-proxy).
4+
5+
## TL;DR
6+
7+
```bash
8+
$ helm repo add indiegogo https://charts.indiegogo.com
9+
$ helm install my-release indiegogo/circle-webhook-proxy
10+
```
11+
12+
## Introduction
13+
14+
This chart bootstraps a CircleCI webhook proxy 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+
## Getting started with default values
22+
23+
To get you started with modifying the default values to your liking/needs, use the below command to grab the latest `values.yaml` file:
24+
25+
```bash
26+
$ helm show values indiegogo/circle-webhook-proxy > values.yaml
27+
```
28+
29+
## Installing the Chart
30+
31+
To install the chart with the release name `my-release`:
32+
33+
```bash
34+
$ helm install my-release indiegogo/circle-webhook-proxy
35+
```
36+
37+
The command deploys CircleCI webhook proxy on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
38+
39+
> **Tip**: List all releases using `helm list`
40+
41+
## Uninstalling the Chart
42+
43+
To uninstall/delete the `my-release` deployment:
44+
45+
```bash
46+
$ helm uninstall my-release
47+
```
48+
49+
> 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:
50+
51+
```bash
52+
$ helm uninstall -n namespace my-release
53+
```
54+
55+
The command removes all the Kubernetes components associated with the chart and deletes the release.
56+
57+
## Parameters
58+
59+
60+
### Common parameters
61+
62+
| Name | Type | Description | Default |
63+
| ------------------ | ------ | ---------------------------------------------------------------- | ------- |
64+
| `kubeVersion` | string | Override Kubernetes version | `nil` |
65+
| `nameOverride` | string | Partially override names.fullname | `nil` |
66+
| `fullnameOverride` | string | Fully override names.fullname | `nil` |
67+
| `commonLabels` | object | Labels to add to all deployed objects | `{}` |
68+
| `networkPort` | int | Deployment container, Deployment livenessProbe, and Service port | `8080` |
69+
70+
71+
### Deployment parameters
72+
73+
| Name | Type | Description | Default |
74+
| ----------------------------------- | ------- | -------------------------------------------------------------- | ------------------------------------------ |
75+
| `image.registry` | string | The Docker image registry | `"gcr.io"` |
76+
| `image.repository` | string | The Docker image repository | `"indiegogo-staging/circle-webhook-proxy"` |
77+
| `image.tag` | string | The Docker image tag | `'latest'` |
78+
| `image.pullPolicy` | string | The Docker image pull policy | `"IfNotPresent"` |
79+
| `environmentIncludeDefault` | boolean | Include/don't include the default environment variables | `true` |
80+
| `environment` | object | Custom/extra environment variables | `{}` |
81+
| `containerPort` | int | Circle webhook proxy container port (overrides `networkPort`) | `nil` |
82+
| `replicaCount` | int | Number of Circle webhook proxy replicas to deploy | `1` |
83+
| `strategy.type` | string | Deployment strategy type | `"RollingUpdate"` |
84+
| `strategy.rollingUpdate` | object | Rolling update deployment strategy options | `{}` |
85+
| `resources.requests` | object | CPU/memory resource requests | `{}` |
86+
| `resources.limits` | object | CPU/memory resource limits | `{}` |
87+
| `livenessProbe.enabled` | boolean | Enable/Disable the default tcpSocket livenessProbe | `true` |
88+
| `livenessProbe.port` | int | Default livenessProbe tcpSocket port (overrides `networkPort`) | `nil` |
89+
| `livenessProbe.initialDelaySeconds` | int | Initial delay seconds for livenessProbe | `nil` |
90+
| `livenessProbe.periodSeconds` | int | Period seconds for livenessProbe | `nil` |
91+
| `livenessProbe.timeoutSeconds` | int | Timeout seconds for livenessProbe | `nil` |
92+
| `livenessProbe.successThreshold` | int | Success threshold for livenessProbe | `nil` |
93+
| `livenessProbe.failureThreshold` | int | Failure threshold for livenessProbe | `nil` |
94+
| `customLivenessProbe` | object | Custom livenessProbe that overrides the default one | `{}` |
95+
| `readinessProbeEnabled` | boolean | Enable the custom readinessProbe | `false` |
96+
| `readinessProbe` | object | Write your custom readiness probe here | `{}` |
97+
98+
99+
### Service parameters
100+
101+
| Name | Type | Description | Default |
102+
| ---------------| ------ | ----------------------------------------------------------- | ------------ |
103+
| `service.port` | int | Circle webhook proxy Service port (overrides `networkPort`) | `nil` |
104+
| `service.type` | string | Circle webhook proxy Service Type | `"NodePort"` |
105+
106+
107+
### Ingress parameters
108+
109+
| Name | Type | Description | Default |
110+
| --------------------------- | ------- | -------------------------- | ----------------- |
111+
| `ingress.enabled` | boolean | Enable/Disable Ingress | `true` |
112+
| `ingress.tls.enabled` | boolean | Enable/Disable Ingress TLS | `false` |
113+
| `ingress.tls.hosts` | list | Ingress TLS host(s) | see `values.yaml` |
114+
| `ingress.tls.secretName` | string | Ingress TLS Secret name | `nil` |
115+
| `ingress.rules.hosts` | list | Ingress rules host(s) | see `values.yaml` |
116+
| `ingress.customAnnotations` | object | Ingress custom annotations | `{}` |
117+
118+
119+
### Redis storage parameters
120+
121+
| Name | Type | Description | Default |
122+
| -------------------------------- | ------- | ----------------------------------------------- | ---------- |
123+
| `persistentVolume.enabled` | boolean | Enable to use an existing Redis persistent disk | `false` |
124+
| `persistentVolume.pdName` | string | Name of the existing persistent disk | `nil` |
125+
| `persistentVolume.reclaimPolicy` | string | Reclamation of the persistent disk resources | `"Retain"` |
126+
127+
128+
### Redis chart parameters
129+
130+
| Name | Type | Description | Default |
131+
| ----------------------------------------- | ------- | ---------------------------------------------- | ------------ |
132+
| `redis.chartEnabled` | boolean | Enable the Redis chart dependency | `true` |
133+
| `redis.fullnameOverride` | string | Fully override the default Redis instance name | `"redis"` |
134+
| `redis.args` | list | Add extra Redis command arguments | `[]` |
135+
| `redis.storage.persistentVolumeClaimName` | string | Set to use an existing Persistent Volume Claim | `nil` |
136+
| `redis.storage.requestedSize` | string | Set to create a new Persistent Volume Claim | `"10Gi"` |
137+
| `redis.storage.className` | string | Type of storage (standard/ssd) | `"standard"` |
138+
139+
140+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
141+
142+
```bash
143+
$ helm install my-release \
144+
--set replicaCount=1 \
145+
indiegogo/circle-webhook-proxy
146+
```
147+
148+
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
149+
150+
```bash
151+
$ helm install my-release -f values.yaml indiegogo/circle-webhook-proxy
152+
```
153+
154+
> **Tip**: You can use the default [values.yaml](values.yaml)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
containers:
24+
- name: {{ include "common.names.fullname" . }}
25+
{{- with .Values.image }}
26+
image: "{{- if contains ":" .repository -}}{{ .repository }}{{- else -}}{{- if .registry -}}{{ .registry }}/{{- end -}}{{ .repository }}:{{ default $.Chart.AppVersion .tag }}{{- end -}}"
27+
{{- end }}
28+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
29+
{{- if or .Values.environmentIncludeDefault .Values.environment }}
30+
env:
31+
{{- if .Values.environmentIncludeDefault }}
32+
- name: APP_ENV
33+
value: production
34+
- name: REDIS_URL
35+
value: redis://redis
36+
{{- end }}
37+
38+
{{- range $key, $value := .Values.environment }}
39+
- name: {{ $key }}
40+
value: {{ $value | quote }}
41+
{{- end }}
42+
{{- end }}
43+
ports:
44+
- containerPort: {{ default .Values.networkPort .Values.containerPort }}
45+
{{- if .Values.resources }}
46+
resources: {{- toYaml .Values.resources | nindent 12 }}
47+
{{- end }}
48+
{{- if .Values.livenessProbe.enabled }}
49+
livenessProbe:
50+
tcpSocket:
51+
port: {{ default .Values.networkPort .Values.livenessProbe.port }}
52+
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
53+
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
54+
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
55+
successThreshold: {{ .Values.livenessProbe.successThreshold }}
56+
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
57+
{{- else if .Values.customLivenessProbe }}
58+
livenessProbe: {{- toYaml .Values.customLivenessProbe | nindent 12 }}
59+
{{- end }}
60+
{{- if .Values.readinessProbeEnabled }}
61+
readinessProbe: {{- toYaml .Values.readinessProbe | nindent 12 }}
62+
{{- end }}
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 and .Values.persistentVolume.enabled (not .Values.redis.storage.persistentVolumeClaimName) }}
2+
apiVersion: v1
3+
kind: PersistentVolume
4+
metadata:
5+
name: {{ printf "%s-redis-data" (include "common.names.fullname" .) }}
6+
spec:
7+
capacity:
8+
storage: {{ .Values.redis.storage.requestedSize }}
9+
accessModes:
10+
- ReadWriteOnce
11+
persistentVolumeReclaimPolicy: {{ .Values.persistentVolume.reclaimPolicy }}
12+
gcePersistentDisk:
13+
pdName: {{ required "To use an existing persistent disk, please set a persistent disk name in values.yaml (persistentVolume.pdName)" .Values.persistentVolume.pdName }}
14+
fsType: ext4
15+
storageClassName: {{ .Values.redis.storage.className }}
16+
claimRef:
17+
name: redis-data-redis-0
18+
namespace: {{ .Release.Namespace | quote }}
19+
{{- 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: {{ 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)