Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Concourse postgres conditional dependency (#1390)
Browse files Browse the repository at this point in the history
* Conditional dependency on postgres.

Fixes #1056

* Update readme for conditional PostgreSQL dependency

Also add a section on restarting workers

* Update Chart.yaml
  • Loading branch information
Will Tran authored and Vic Iglesias committed Jul 6, 2017
1 parent 2f79f75 commit 40a297e
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stable/concourse/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: concourse
version: 0.1.3
version: 0.2.0
description: Concourse is a simple and scalable CI system.
icon: https://avatars1.githubusercontent.com/u/7809479
keywords:
Expand Down
49 changes: 49 additions & 0 deletions stable/concourse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ Scaling should typically be managed via the `helm upgrade` command, but `Statefu
$ kubectl scale statefulset my-release-worker --replicas=3
```

### Restarting workers

If worker pods go down, their persistent volumes are changed, or if you're having other issues with them, you'll need to restart the workers. Concourse workers were designed to be deployed onto infrastructure VMs which are less "ephemeral" than pods, so it isn't good at detecting when a worker goes down and comes back under the same hostname.

Scale the workers down to 0:

```
kubectl scale statefulset concourse-worker --replicas=0
```

And then `fly workers` until the workers are detected to be `stalled`. Then for each worker
```
fly prune-worker -w concourse-worker-0
fly prune-worker -w concourse-worker-1
...
```
And finally

```
kubectl scale statefulset concourse-worker --replicas=3
```

## Configuration

The following tables lists the configurable parameters of the Concourse chart and their default values.
Expand Down Expand Up @@ -110,6 +134,8 @@ The following tables lists the configurable parameters of the Concourse chart an
| `persistence.worker.class` | Concourse Worker Persistent Volume Storage Class | `generic` |
| `persistence.worker.accessMode` | Concourse Worker Persistent Volume Access Mode | `ReadWriteOnce` |
| `persistence.worker.size` | Concourse Worker Persistent Volume Storage Size | `10Gi` |
| `postgresql.enabled` | Enable PostgreSQL as a chart dependency | `true` |
| `postgresql.uri` | PostgreSQL connection URI | `nil` |
| `postgresql.postgresUser` | PostgreSQL User to create | `concourse` |
| `postgresql.postgresPassword` | PostgreSQL Password for the new user | `concourse` |
| `postgresql.postgresDatabase` | PostgreSQL Database to create | `concourse` |
Expand Down Expand Up @@ -244,3 +270,26 @@ web:
hosts:
- concourse.domain.com
```
### PostgreSQL
By default, this chart will use a PostgreSQL database deployed as a chart dependency. You can also bring your own PostgreSQL. To do so, set the following in your custom `values.yaml` file:

```yaml
## Configuration values for the postgresql dependency.
## ref: https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md
##
postgresql:
## Use the PostgreSQL chart dependency.
## Set to false if bringing your own PostgreSQL.
##
enabled: false
## If bringing your own PostgreSQL, the full uri to use
## e.g. postgres://concourse:changeme@my-postgres.com:5432/concourse?sslmode=require
##
uri: postgres://concourse:changeme@my-postgres.com:5432/concourse?sslmode=require
```
1 change: 1 addition & 0 deletions stable/concourse/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ dependencies:
- name: postgresql
version: 0.3.0
repository: https://kubernetes-charts.storage.googleapis.com/
condition: postgresql.enabled
4 changes: 4 additions & 0 deletions stable/concourse/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ metadata:
heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{ if .Values.postgresql.enabled }}
postgresql-user: {{ .Values.postgresql.postgresUser | b64enc | quote }}
{{ else }}
postgresql-uri: {{ .Values.postgresql.uri | b64enc | quote }}
{{ end }}
basic-auth-username: {{ .Values.concourse.username | b64enc | quote }}
basic-auth-password: {{ .Values.concourse.password | b64enc | quote }}
host-key: {{ .Values.concourse.hostKey | b64enc | quote }}
Expand Down
8 changes: 8 additions & 0 deletions stable/concourse/templates/web-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ spec:
args:
- "web"
env:
{{ if .Values.postgresql.enabled }}
- name: POSTGRES_HOST
valueFrom:
configMapKeyRef:
Expand All @@ -43,6 +44,13 @@ spec:
key: postgresql-database
- name: CONCOURSE_POSTGRES_DATA_SOURCE
value: postgres://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST)/$(POSTGRES_DATABASE)?sslmode=disable
{{ else }}
- name: CONCOURSE_POSTGRES_DATA_SOURCE
valueFrom:
secretKeyRef:
name: {{ template "concourse.fullname" . }}
key: postgresql-uri
{{ end }}
- name: POD_IP
valueFrom:
fieldRef:
Expand Down
11 changes: 11 additions & 0 deletions stable/concourse/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,17 @@ persistence:
## ref: https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md
##
postgresql:

## Use the PostgreSQL chart dependency.
## Set to false if bringing your own PostgreSQL.
##
enabled: true

## If bringing your own PostgreSQL, the full uri to use
## e.g. postgres://concourse:changeme@my-postgres.com:5432/concourse?sslmode=disable
##
# uri:

### PostgreSQL User to create.
##
postgresUser: concourse
Expand Down

0 comments on commit 40a297e

Please sign in to comment.