Skip to content

Commit

Permalink
Merge pull request #3863 from lsst-sqre/tickets/DM-45394/mobu-single-…
Browse files Browse the repository at this point in the history
…file-config

DM-45394 mobu: single file config
  • Loading branch information
fajpunk authored Nov 12, 2024
2 parents 4ac20a9 + 792cf5d commit 145b53f
Show file tree
Hide file tree
Showing 17 changed files with 80 additions and 148 deletions.
2 changes: 1 addition & 1 deletion applications/mobu/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ description: "Continuous integration testing"
home: https://mobu.lsst.io/
sources:
- "https://github.com/lsst-sqre/mobu"
appVersion: 12.0.2
appVersion: 13.0.0
7 changes: 4 additions & 3 deletions applications/mobu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ Continuous integration testing
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity rules for the mobu frontend pod |
| config.autostart | list | `[]` | Autostart specification. Must be a list of mobu flock specifications. Each flock listed will be automatically started when mobu is started. |
| config.debug | bool | `false` | If set to true, include the output from all flocks in the main mobu log and disable structured JSON logging. |
| config.githubCiApp | object | disabled. | Configuration for the GitHub refresh app integration. See https://mobu.lsst.io/operations/github_ci_app.html#add-phalanx-configuration |
| config.githubRefreshApp | object | disabled. | Configuration for the GitHub refresh app integration. See https://mobu.lsst.io/operations/github_refresh_app.html#add-phalanx-configuration |
| config.githubCiApp | string | disabled. | Configuration for the GitHub refresh app integration. See https://mobu.lsst.io/operations/github_ci_app.html#add-phalanx-configuration |
| config.githubRefreshApp | string | disabled. | Configuration for the GitHub refresh app integration. See https://mobu.lsst.io/operations/github_refresh_app.html#add-phalanx-configuration |
| config.logLevel | string | `"INFO"` | Log level. Set to 'DEBUG' to include the output from all flocks in the main mobu log. |
| config.pathPrefix | string | `"/mobu"` | Prefix for mobu's API routes. |
| config.profile | string | `"production"` | One of 'production' or 'development'. 'production' configures structured JSON logging, and 'development' configures unstructured human readable logging. |
| config.slackAlerts | bool | `true` | Whether to send alerts and status to Slack. |
| fullnameOverride | string | `""` | Override the full name for resources (includes the release name) |
| global.baseUrl | string | Set by Argo CD | Base URL for the environment |
Expand Down
11 changes: 0 additions & 11 deletions applications/mobu/templates/configmap-autostart.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions applications/mobu/templates/configmap-github-ci-app.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions applications/mobu/templates/configmap-github-refresh-app.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions applications/mobu/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "mobu.fullname" . }}
labels:
{{- include "mobu.labels" . | nindent 4 }}
data:
config.yaml: |
{{- toYaml .Values.config | nindent 4 }}
48 changes: 5 additions & 43 deletions applications/mobu/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ spec:
type: "Recreate"
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
# Force the pod to restart when the config map is updated.
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand All @@ -31,10 +33,6 @@ spec:
name: {{ template "mobu.fullname" . }}-secret
key: "ALERT_HOOK"
{{- end }}
{{- if .Values.config.autostart }}
- name: "MOBU_AUTOSTART_PATH"
value: "/etc/mobu/autostart.yaml"
{{- end }}
- name: "MOBU_ENVIRONMENT_URL"
value: {{ .Values.global.baseUrl }}
- name: "MOBU_GAFAELFAWR_TOKEN"
Expand All @@ -43,17 +41,13 @@ spec:
name: {{ template "mobu.fullname" . }}-gafaelfawr-token
key: "token"
{{- if .Values.config.githubRefreshApp }}
- name: "MOBU_GITHUB_REFRESH_APP_CONFIG_PATH"
value: "/etc/mobu/github-refresh-app.yaml"
- name: "MOBU_GITHUB_REFRESH_APP_WEBHOOK_SECRET"
valueFrom:
secretKeyRef:
name: {{ template "mobu.fullname" . }}-secret
key: "github-refresh-app-webhook-secret"
{{- end}}
{{- if .Values.config.githubCiApp }}
- name: "MOBU_GITHUB_CI_APP_CONFIG_PATH"
value: "/etc/mobu/github-ci-app.yaml"
- name: "MOBU_GITHUB_CI_APP_ID"
valueFrom:
secretKeyRef:
Expand All @@ -70,17 +64,6 @@ spec:
name: {{ template "mobu.fullname" . }}-secret
key: "github-ci-app-webhook-secret"
{{- end}}
- name: "MOBU_PATH_PREFIX"
value: {{ .Values.config.pathPrefix | quote }}
{{- if .Values.config.debug }}
- name: "MOBU_LOGGING_PROFILE"
value: "development"
- name: "MOBU_LOG_LEVEL"
value: "DEBUG"
{{- else }}
- name: "MOBU_LOGGING_PROFILE"
value: "production"
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
ports:
Expand Down Expand Up @@ -114,29 +97,8 @@ spec:
runAsGroup: 1000
volumes:
- name: "config"
projected:
sources:
{{- if .Values.config.autostart }}
- configMap:
name: {{ include "mobu.fullname" . }}-autostart
items:
- key: autostart.yaml
path: autostart.yaml
{{- end }}
{{- if .Values.config.githubCiApp }}
- configMap:
name: {{ include "mobu.fullname" . }}-github-ci-app
items:
- key: github-ci-app.yaml
path: github-ci-app.yaml
{{- end }}
{{- if .Values.config.githubRefreshApp }}
- configMap:
name: {{ include "mobu.fullname" . }}-github-refresh-app
items:
- key: github-refresh-app.yaml
path: github-refresh-app.yaml
{{- end }}
configMap:
name: "mobu"
- name: "tmp"
emptyDir: {}
{{- with .Values.nodeSelector }}
Expand Down
36 changes: 19 additions & 17 deletions applications/mobu/tests/github_ci_app_enabled_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ suite: Github CI App Integration Enabled
set:
config:
githubCiApp:
accepted_github_orgs:
acceptedGithubOrgs:
- "org1"
- "org2"
users:
Expand All @@ -27,11 +27,6 @@ tests:
- it: "Should inject secrets into the Deployment env"
template: "deployment.yaml"
asserts:
- contains:
path: "spec.template.spec.containers[0].env"
any: true
content:
name: "MOBU_GITHUB_CI_APP_CONFIG_PATH"
- contains:
path: "spec.template.spec.containers[0].env"
any: true
Expand All @@ -48,20 +43,27 @@ tests:
content:
name: "MOBU_GITHUB_CI_APP_WEBHOOK_SECRET"
- it: "Should create a ConfigMap"
template: "configmap-github-ci-app.yaml"
template: "configmap.yaml"
asserts:
- containsDocument:
kind: "ConfigMap"
apiVersion: v1
- equal:
path: "data['github-ci-app.yaml']"
path: "data['config.yaml']"
value: |
accepted_github_orgs:
- org1
- org2
scopes:
- exec:notebook
- read:tap
users:
- bot-mobu-ci-user-1
- bot-mobu-ci-user-2
autostart: []
githubCiApp:
acceptedGithubOrgs:
- org1
- org2
scopes:
- exec:notebook
- read:tap
users:
- bot-mobu-ci-user-1
- bot-mobu-ci-user-2
githubRefreshApp: null
logLevel: INFO
pathPrefix: /mobu
profile: production
slackAlerts: true
44 changes: 15 additions & 29 deletions applications/mobu/tests/github_disabled_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,25 @@ set:
global:
host: "example.com"
tests:
- it: "Should not create a GitHub CI app ingress"
template: "ingress-github-ci-app.yaml"
- it: "Should not include github things in the config file ConfigMap"
template: "configmap.yaml"
asserts:
- hasDocuments:
count: 0
- it: "Should not create a GitHub refresh app ingress"
template: "ingress-github-refresh-app.yaml"
asserts:
- hasDocuments:
count: 0
- it: "Should not create a GitHub CI app ConfigMap"
template: "configmap-github-ci-app.yaml"
asserts:
- hasDocuments:
count: 0
- it: "Should not create a GitHub refresh app ConfigMap"
template: "configmap-github-refresh-app.yaml"
asserts:
- hasDocuments:
count: 0
- containsDocument:
kind: "ConfigMap"
apiVersion: v1
- equal:
path: "data['config.yaml']"
value: |
autostart: []
githubCiApp: null
githubRefreshApp: null
logLevel: INFO
pathPrefix: /mobu
profile: production
slackAlerts: true
- it: "Should not inject GitHub CI app secrets into the Deployment env"
template: "deployment.yaml"
asserts:
- notContains:
path: "spec.template.spec.containers[0].env"
any: true
content:
name: "MOBU_GITHUB_CI_APP_CONFIG_PATH"
- notContains:
path: "spec.template.spec.containers[0].env"
any: true
Expand All @@ -50,11 +41,6 @@ tests:
- it: "Should not inject GitHub refresh app secrets into the Deployment env"
template: "deployment.yaml"
asserts:
- notContains:
path: "spec.template.spec.containers[0].env"
any: true
content:
name: "MOBU_GITHUB_REFRESH_APP_CONFIG_PATH"
- notContains:
path: "spec.template.spec.containers[0].env"
any: true
Expand Down
24 changes: 13 additions & 11 deletions applications/mobu/tests/github_refresh_app_enabled_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ suite: Github Refresh App Integration Enabled
set:
config:
githubRefreshApp:
accepted_github_orgs:
acceptedGithubOrgs:
- "org1"
- "org2"
global:
Expand All @@ -21,25 +21,27 @@ tests:
- it: "Should inject secrets into the Deployment env"
template: "deployment.yaml"
asserts:
- contains:
path: "spec.template.spec.containers[0].env"
any: true
content:
name: "MOBU_GITHUB_REFRESH_APP_CONFIG_PATH"
- contains:
path: "spec.template.spec.containers[0].env"
any: true
content:
name: "MOBU_GITHUB_REFRESH_APP_WEBHOOK_SECRET"
- it: "Should create a ConfigMap"
template: "configmap-github-refresh-app.yaml"
template: "configmap.yaml"
asserts:
- containsDocument:
kind: "ConfigMap"
apiVersion: v1
- equal:
path: "data['github-refresh-app.yaml']"
path: "data['config.yaml']"
value: |
accepted_github_orgs:
- org1
- org2
autostart: []
githubCiApp: null
githubRefreshApp:
acceptedGithubOrgs:
- org1
- org2
logLevel: INFO
pathPrefix: /mobu
profile: production
slackAlerts: true
3 changes: 2 additions & 1 deletion applications/mobu/values-idfdemo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
config:
debug: true
logLevel: DEBUG
profile: development
autostart: []
3 changes: 2 additions & 1 deletion applications/mobu/values-idfdev.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config:
debug: true
logLevel: DEBUG
profile: development
githubRefreshApp:
acceptedGithubOrgs:
- lsst-sqre
Expand Down
1 change: 0 additions & 1 deletion applications/mobu/values-roundtable-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
config:
debug: true
autostart:
- name: "gitlfs"
count: 1
Expand Down
1 change: 0 additions & 1 deletion applications/mobu/values-usdfdev.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
config:
debug: true
githubRefreshApp:
acceptedGithubOrgs:
- lsst-sqre
Expand Down
1 change: 0 additions & 1 deletion applications/mobu/values-usdfint.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
config:
debug: true
githubRefreshApp:
acceptedGithubOrgs:
- lsst-sqre
Expand Down
1 change: 0 additions & 1 deletion applications/mobu/values-usdfprod.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
config:
debug: true
autostart:
- name: "firefighter"
count: 1
Expand Down
15 changes: 10 additions & 5 deletions applications/mobu/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,22 @@ config:
# -- Configuration for the GitHub refresh app integration.
# See https://mobu.lsst.io/operations/github_refresh_app.html#add-phalanx-configuration
# @default -- disabled.
githubRefreshApp: {}
githubRefreshApp: null

# -- Configuration for the GitHub CI app integration.
# -- Configuration for the GitHub refresh app integration.
# See https://mobu.lsst.io/operations/github_ci_app.html#add-phalanx-configuration
# @default -- disabled.
githubCiApp: {}
githubCiApp: null

# -- If set to true, include the output from all flocks in the main mobu log
# and disable structured JSON logging.
debug: false
# -- Log level. Set to 'DEBUG' to include the output from all flocks in the
# main mobu log.
logLevel: INFO

# -- One of 'production' or 'development'. 'production' configures structured
# JSON logging, and 'development' configures unstructured human readable
# logging.
profile: production

# -- Whether to send alerts and status to Slack.
slackAlerts: true
Expand Down

0 comments on commit 145b53f

Please sign in to comment.