From 8608a487d680bcb0b08ef30aac5b7796ead635e7 Mon Sep 17 00:00:00 2001 From: Will Tran Date: Tue, 9 May 2017 14:56:17 -0400 Subject: [PATCH 1/3] Conditional dependency on postgres. Fixes #1056 --- stable/concourse/requirements.yaml | 1 + stable/concourse/templates/secrets.yaml | 4 ++++ stable/concourse/templates/web-deployment.yaml | 8 ++++++++ stable/concourse/values.yaml | 11 +++++++++++ 4 files changed, 24 insertions(+) diff --git a/stable/concourse/requirements.yaml b/stable/concourse/requirements.yaml index 8e2aa4661dde..3fcbb5423e6e 100644 --- a/stable/concourse/requirements.yaml +++ b/stable/concourse/requirements.yaml @@ -2,3 +2,4 @@ dependencies: - name: postgresql version: 0.3.0 repository: https://kubernetes-charts.storage.googleapis.com/ + condition: postgresql.enabled diff --git a/stable/concourse/templates/secrets.yaml b/stable/concourse/templates/secrets.yaml index 3205fac9a331..0178ad946a63 100644 --- a/stable/concourse/templates/secrets.yaml +++ b/stable/concourse/templates/secrets.yaml @@ -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 }} diff --git a/stable/concourse/templates/web-deployment.yaml b/stable/concourse/templates/web-deployment.yaml index 597eb19f4568..9e14bac36f2b 100644 --- a/stable/concourse/templates/web-deployment.yaml +++ b/stable/concourse/templates/web-deployment.yaml @@ -21,6 +21,7 @@ spec: args: - "web" env: + {{ if .Values.postgresql.enabled }} - name: POSTGRES_HOST valueFrom: configMapKeyRef: @@ -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: diff --git a/stable/concourse/values.yaml b/stable/concourse/values.yaml index 44e0756c51a5..25806aac8dfd 100644 --- a/stable/concourse/values.yaml +++ b/stable/concourse/values.yaml @@ -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 From 34e01ad32244d7004033d730c5f69389a80cab7d Mon Sep 17 00:00:00 2001 From: Will Tran Date: Tue, 27 Jun 2017 21:06:26 -0400 Subject: [PATCH 2/3] Update readme for conditional PostgreSQL dependency Also add a section on restarting workers --- stable/concourse/README.md | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/stable/concourse/README.md b/stable/concourse/README.md index d3f83487b36b..d986f039d688 100644 --- a/stable/concourse/README.md +++ b/stable/concourse/README.md @@ -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. @@ -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` | @@ -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 + +``` From f204dce47d9c4590a45f337986a3d51965405752 Mon Sep 17 00:00:00 2001 From: Vic Iglesias Date: Wed, 5 Jul 2017 17:24:10 -0700 Subject: [PATCH 3/3] Update Chart.yaml --- stable/concourse/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable/concourse/Chart.yaml b/stable/concourse/Chart.yaml index 859b51a618ec..d07e6cf74bee 100644 --- a/stable/concourse/Chart.yaml +++ b/stable/concourse/Chart.yaml @@ -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: