Skip to content

Commit

Permalink
Migrate to Bitnami Mongo DB Chart (#50)
Browse files Browse the repository at this point in the history
* Breaking change: Move from single mongo deployment to mongodb helm chart. No upgrade path for data. Must be done manually.
* Use sorry-cypress 1.0.3
  • Loading branch information
tico24 authored Jun 14, 2021
1 parent 0d4940d commit 74c154c
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 209 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
fetch-depth: "0"

- name: Set up Helm
uses: azure/setup-helm@v1
Expand All @@ -36,10 +36,15 @@ jobs:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1
uses: helm/chart-testing-action@v2.1.0
with:
version: v3.4.0

# - name: Add dependency chart repos
# run: |
# helm repo add minio https://helm.min.io/ --force-update
# helm repo add mongodb https://charts.bitnami.com/bitnami --force-update

- name: Run chart-testing (list-changed)
id: list-changed
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:

- name: Add dependency chart repos
run: |
helm repo add minio https://helm.min.io/
helm repo add minio https://helm.min.io/ --force-update
helm repo add mongodb https://charts.bitnami.com/bitnami --force-update
- name: Run chart-releaser
uses: helm/[email protected]
Expand Down
6 changes: 0 additions & 6 deletions charts/sorry-cypress/Chart.lock

This file was deleted.

8 changes: 6 additions & 2 deletions charts/sorry-cypress/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: sorry-cypress
description: A Helm chart for Sorry Cypress
type: application
version: 0.1.37
appVersion: 0.6.1
version: 1.0.0-alpha
appVersion: 1.0.3
home: https://sorry-cypress.dev/
sources:
- https://github.com/sorry-cypress/sorry-cypress
Expand All @@ -16,3 +16,7 @@ dependencies:
repository: https://helm.min.io/
version: 8.0.9
condition: minio.enabled
- name: mongodb
repository: https://charts.bitnami.com/bitnami
version: 10.19.0
condition: mongodb.enabled
3 changes: 3 additions & 0 deletions charts/sorry-cypress/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.0
## Breaking Changes
Uses the bitnami mongodb helm chart. There is no automated upgrade path from previous versions... you will have to manually migrate data.
Binary file removed charts/sorry-cypress/charts/minio-8.0.9.tgz
Binary file not shown.
3 changes: 0 additions & 3 deletions charts/sorry-cypress/ci/mongo-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@
director:
environmentVariables:
executionDriver: "../execution/mongo/driver"

mongo:
enabled: true
12 changes: 8 additions & 4 deletions charts/sorry-cypress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ Create the s3 secret
{{/*
Determine the MongoDB hostname.
*/}}
{{- define "mongo.hostname" -}}
{{- if .Values.mongo.enabled }}
{{- printf "%s-%s" (include "sorry-cypress-helm.fullname" .) "mongo" -}}
{{- define "mongodb.hostname" -}}
{{- if .Values.mongodb.enabled }}
{{- if eq .Values.mongodb.architecture "standalone" }}
{{- printf "%s-%s" (include "sorry-cypress-helm.fullname" .) "mongodb" -}}
{{- else }}
{{- printf "%s-%s" (include "sorry-cypress-helm.fullname" .) "mongodb-headless" -}}
{{- end }}
{{- else }}
{{- printf "%s" .Values.mongo.mongoServer -}}
{{- printf "%s" .Values.mongodb.mongoServer -}}
{{- end }}
{{- end }}

Expand Down
6 changes: 3 additions & 3 deletions charts/sorry-cypress/templates/deployment-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ spec:
{{- end }}
containers:
- env:
{{- if .Values.mongo.enabled }}
{{- if .Values.mongodb.enabled }}
- name: MONGODB_DATABASE
value: {{ .Values.mongo.mongoDatabase }}
value: {{ .Values.mongodb.mongoDatabase }}
- name: MONGODB_URI
value: mongodb://{{ include "mongo.hostname" . }}:{{ .Values.mongo.service.port }}
value: mongodb://{{ include "mongodb.hostname" . }}:{{ .Values.mongodb.service.port }}
{{- end }}
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.api.image.pullPolicy }}
Expand Down
4 changes: 2 additions & 2 deletions charts/sorry-cypress/templates/deployment-director.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ spec:
value: {{ .Values.director.environmentVariables.executionDriver }}
{{- if eq .Values.director.environmentVariables.executionDriver "../execution/mongo/driver" }}
- name: MONGODB_DATABASE
value: {{ .Values.mongo.mongoDatabase }}
value: {{ .Values.mongodb.mongoDatabase }}
- name: MONGODB_URI
value: mongodb://{{ include "mongo.hostname" . }}:{{ .Values.mongo.service.port }}
value: mongodb://{{ include "mongodb.hostname" . }}:{{ .Values.mongodb.service.port }}
{{- end }}
- name: SCREENSHOTS_DRIVER
value: {{ .Values.director.environmentVariables.screenshotsDriver }}
Expand Down
71 changes: 0 additions & 71 deletions charts/sorry-cypress/templates/deployment-mongo.yml

This file was deleted.

13 changes: 0 additions & 13 deletions charts/sorry-cypress/templates/service-mongo.yml

This file was deleted.

58 changes: 0 additions & 58 deletions charts/sorry-cypress/templates/statefulset-mongo.yml

This file was deleted.

8 changes: 4 additions & 4 deletions charts/sorry-cypress/templates/test/test-connections.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ spec:
args: ['{{ include "sorry-cypress-helm.fullname" . }}-director:{{ .Values.director.service.port }}']
restartPolicy: Never
---
{{- if .Values.mongo.enabled }}
{{- if .Values.mongodb.enabled }}
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "sorry-cypress-helm.fullname" . }}-test-mongo-connection"
name: "{{ include "sorry-cypress-helm.fullname" . }}-test-mongodb-connection"
labels:
app.kubernetes.io/name: "{{ include "sorry-cypress-helm.fullname" . }}-test-mongo-connection"
app.kubernetes.io/name: "{{ include "sorry-cypress-helm.fullname" . }}-test-mongodb-connection"
annotations:
"helm.sh/hook": test-success
"helm.sh/hook-delete-policy": hook-succeeded
Expand All @@ -49,7 +49,7 @@ spec:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "sorry-cypress-helm.fullname" . }}-mongo:{{ .Values.mongo.service.port }}']
args: ['{{ include "sorry-cypress-helm.fullname" . }}-mongodb-headless:{{ .Values.mongodb.service.port }}']
restartPolicy: Never
{{- end }}
---
Expand Down
51 changes: 11 additions & 40 deletions charts/sorry-cypress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ api:
service:
port: 4000

# If you are using v10.0.0-beta.15 or greater, you can enable a readinessProbe for the API pods.
readinessProbe:
enabled: false
enabled: true
periodSeconds: 5
timeoutSeconds: 3
successThreshold: 2
Expand Down Expand Up @@ -178,51 +177,20 @@ director:
# hosts:
# - chart-example.local

mongo:
# You need to ensure that director.environmentVariables.executionDriver is set to "../execution/mongo/driver" if you want mongo.enabled to be true.
mongodb:
# You need to ensure that director.environmentVariables.executionDriver is set to "../execution/mongo/driver" if you want the director to use mongodb.
enabled: true

mongoDatabase: "sorry-cypress"

# Ignored if mongo.enabled is set to true
mongoServer: ""

image:
repository: mongo
pullPolicy: Always
tag: "4.0"

nodeSelector: {}

tolerations: []

affinity: {}

# If enabled, you can use any values from the mongodb helm chart: https://github.com/bitnami/charts/blob/master/bitnami/mongodb/values.yaml
# Below are the bare minimim to get you started.
architecture: replicaset
auth:
enabled: false
persistence:
enabled: false
accessMode: "ReadWriteOnce"
size: "1Gi"

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

# Set annotations for pods
podAnnotations: {}

# Additional pod labels
podLabels: {}

service:
port: 27017

s3:
bucketName: example-bucket
Expand Down Expand Up @@ -254,6 +222,9 @@ s3:
minio:
enabled: false

# If enabled, you can include any values from the minio helm chart: https://github.com/minio/charts/blob/master/minio/values.yaml
# Below are the bare minimim to get you started.

endpoint: storage.yourdomain.com
url: http://storage.yourdomain.com

Expand Down
1 change: 1 addition & 0 deletions lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ remote: origin
target-branch: main
chart-repos:
- minio=https://helm.min.io
- mongodb=https://charts.bitnami.com/bitnami
chart-dirs:
- charts
1 change: 1 addition & 0 deletions test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ remote: origin
target-branch: main
chart-repos:
- minio=https://helm.min.io
- mongodb=https://charts.bitnami.com/bitnami
chart-dirs:
- charts
helm-extra-args: --timeout 600s

0 comments on commit 74c154c

Please sign in to comment.