usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ tree . ├── etherpad-lite-k8s │   ├── configmap.yaml │   ├── deployment.yaml │   ├── kustomization.yaml │   └── service.yaml ├── etherpad-lite-k8s-kubedb-mysql │   ├── configmap.yaml │   ├── deployment.yaml │   ├── kustomization.yaml │   └── name-prefix-transformer-config.yaml ├── kubedb-mysql-etherpad-lite │   ├── etherpad-mysql.yaml │   ├── kustomization.yaml │   ├── README.md │   └── transformer-config-kubedb.yaml ├── kubedb-mysql-etherpad-lite-with-init-script │   ├── etherpad-mysql-init-configmap.yaml │   ├── etherpad-mysql-with-init-script.yaml │   └── kustomization.yaml └── test-etherpad-lite-mysql-with-namePrefix └── kustomization.yaml 6 directories, 16 files usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat etherpad-lite-k8s/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: etherpad data: settings.json: | { "skinName":"colibris", "title":"Etherpad on Kubernetes" } usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat etherpad-lite-k8s/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: etherpad spec: replicas: 1 selector: matchLabels: app: etherpad template: metadata: labels: app: etherpad spec: containers: - name: etherpad image: etherpad/etherpad:1.7.5 ports: - containerPort: 9001 name: web volumeMounts: - name: "config" mountPath: "/opt/etherpad/settings.json" subPath: "settings.json" volumes: - name: config configMap: name: etherpad usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat etherpad-lite-k8s/kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - configmap.yaml - deployment.yaml - service.yaml usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat etherpad-lite-k8s/service.yaml apiVersion: v1 kind: Service metadata: name: etherpad spec: selector: app: etherpad ports: - name: web port: 80 targetPort: web usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat etherpad-lite-k8s-kubedb-mysql/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: etherpad data: settings.json: | { "skinName":"colibris", "title":"Etherpad on Kubernetes w/ MySQL", "dbType": "${ETHERPAD_DB_TYPE:mysql}", "dbSettings": { "database": "${ETHERPAD_DB_DATABASE}", "host": "${ETHERPAD_DB_HOST}", "password": "${ETHERPAD_DB_PASSWORD}", "user": "${ETHERPAD_DB_USER}" } } usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat etherpad-lite-k8s-kubedb-mysql/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: etherpad spec: template: spec: containers: - name: etherpad env: - name: ETHERPAD_DB_TYPE value: mysql - name: ETHERPAD_DB_HOST value: $(MYSQL_SERVICE) - name: ETHERPAD_DB_DATABASE value: etherpad_lite_db - name: ETHERPAD_DB_USER valueFrom: secretKeyRef: name: etherpad-mysql-auth key: username - name: ETHERPAD_DB_PASSWORD valueFrom: secretKeyRef: name: etherpad-mysql-auth key: password volumeMounts: - name: "config" mountPath: "/opt/etherpad-lite/settings.json" subPath: "settings.json" usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat etherpad-lite-k8s-kubedb-mysql/kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization bases: - ../kubedb-mysql-etherpad-lite-with-init-script - ../etherpad-lite-k8s patchesStrategicMerge: - configmap.yaml - deployment.yaml images: - name: etherpad/etherpad # This is required until etherpad-lite 1.8 comes out to be able to use env vars in settings.json newTag: latest configurations: - name-prefix-transformer-config.yaml usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat etherpad-lite-k8s-kubedb-mysql/name-prefix-transformer-config.yaml namePrefix: - apiVersion: apps/v1 kind: Deployment path: spec/template/spec/containers/env/valueFrom/secretKeyRef/name usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat kubedb-mysql-etherpad-lite/etherpad-mysql.yaml apiVersion: kubedb.com/v1alpha1 kind: MySQL metadata: name: etherpad-mysql spec: version: "5.7.25" storageType: Durable terminationPolicy: WipeOut storage: storageClassName: "default" accessModes: - ReadWriteOnce resources: requests: storage: 1Gi usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat kubedb-mysql-etherpad-lite/kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - etherpad-mysql.yaml vars: - name: MYSQL_SERVICE objref: apiVersion: kubedb.com/v1alpha1 kind: MySQL name: etherpad-mysql fieldref: fieldpath: metadata.name configurations: - transformer-config-kubedb.yaml usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat kubedb-mysql-etherpad-lite/README.md # kubedb-mysql-etherpad-lite This is *just* the kubedb MySQL resource for etherpad-lite. Compose it with something like ../etherpad-lite-k8s to get a full setup. usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat kubedb-mysql-etherpad-lite/kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - etherpad-mysql.yaml vars: - name: MYSQL_SERVICE objref: apiVersion: kubedb.com/v1alpha1 kind: MySQL name: etherpad-mysql fieldref: fieldpath: metadata.name configurations: - transformer-config-kubedb.yaml usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat kubedb-mysql-etherpad-lite/transformer-config-kubedb.yaml namePrefix: - apiVersion: kubedb.com/v1alpha1 kind: MySQL path: spec/init/scriptSource/configMap/name nameReference: - version: v1 kind: ConfigMap fieldSpecs: - version: kubedb.com/v1alpha1 kind: MySQL path: spec/init/scriptSource usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat kubedb-mysql-etherpad-lite-with-init-script/etherpad-mysql-init-configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: etherpad-mysql-init data: init.sql: | create database `etherpad_lite_db`; use `etherpad_lite_db`; CREATE TABLE `store` ( `key` varchar(100) COLLATE utf8mb4_bin NOT NULL DEFAULT '', `value` longtext COLLATE utf8mb4_bin NOT NULL, PRIMARY KEY (`key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat kubedb-mysql-etherpad-lite-with-init-script/etherpad-mysql-with-init-script.yaml apiVersion: kubedb.com/v1alpha1 kind: MySQL metadata: name: etherpad-mysql spec: init: scriptSource: configMap: name: etherpad-mysql-init usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat kubedb-mysql-etherpad-lite-with-init-script/kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization bases: - ../kubedb-mysql-etherpad-lite resources: - etherpad-mysql-init-configmap.yaml patchesStrategicMerge: - etherpad-mysql-with-init-script.yaml usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$ cat test-etherpad-lite-mysql-with-namePrefix/kustomization.yaml bases: - ../etherpad-lite-k8s-kubedb-mysql namePrefix: test-namePrefix- usuari@CASCA:~/Nextcloud/EC/Documents/fct/k9/serveis/etherpad/etherpad-lite/lib$