7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-06-10 17:52:20 +00:00
tutor/tutor/templates/kustomization.yml
Foad Lind b8f773a5ef feat: Make it possible to customize k8s resources
Currently there is no way for plugins to customize Kubernetes resources
defined in Tutor deployment manifests.
This change makes that possible by taking advantage of the strategic
merge patching mechanism in `kustomization.yml`.
Any resource definition in a `k8s-override` patch in a plugin will
override the resource defined by Tutor, provided that their names match.

Reference: https://github.com/overhangio/tutor/pull/675
2022-06-28 10:30:24 +02:00

67 lines
1.8 KiB
YAML

---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- k8s/namespace.yml
- k8s/deployments.yml
- k8s/jobs.yml
- k8s/services.yml
- k8s/volumes.yml
{{ patch("kustomization-resources") }}
# namespace to deploy all Resources to
namespace: {{ K8S_NAMESPACE }}
# annotations added to all Resources
# https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/commonannotations/
commonAnnotations:
app.kubernetes.io/version: {{ TUTOR_VERSION }}
# labels (and label selectors) added to all Resources
# https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
# https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/commonlabels/
commonLabels:
app.kubernetes.io/instance: openedx-{{ ID }}
app.kubernetes.io/part-of: openedx
app.kubernetes.io/managed-by: tutor
{{ patch("kustomization-commonlabels")|indent(2) }}
configMapGenerator:
- name: caddy-config
files:
- apps/caddy/Caddyfile
options:
labels:
app.kubernetes.io/name: caddy
- name: openedx-settings-lms
files:{% for file in "apps/openedx/settings/lms"|walk_templates %}
- {{ file }}{% endfor %}
options:
labels:
app.kubernetes.io/name: openedx
- name: openedx-settings-cms
files:{% for file in "apps/openedx/settings/cms"|walk_templates %}
- {{ file }}{% endfor %}
options:
labels:
app.kubernetes.io/name: openedx
- name: openedx-config
files:{% for file in "apps/openedx/config"|walk_templates %}
- {{ file }}{% endfor %}
options:
labels:
app.kubernetes.io/name: openedx
- name: redis-config
files:
- apps/redis/redis.conf
options:
labels:
app.kubernetes.io/name: redis
{{ patch("kustomization-configmapgenerator") }}
patchesStrategicMerge:
- k8s/override.yml
{{ patch("kustomization-patches-strategic-merge") }}
{{ patch("kustomization") }}