diff --git a/k8s/deployment/mariadb-deployment.yaml b/k8s/deployment/mariadb-deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8d711f3e8f60d337a89d825be009685a22c85aa2 --- /dev/null +++ b/k8s/deployment/mariadb-deployment.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mariadb + namespace: myaktion +spec: + selector: + matchLabels: + run: mariadb + replicas: 1 + template: + metadata: + annotations: + linkerd.io/inject: enabled + labels: + run: mariadb + spec: + containers: + - name: mariadb + image: mariadb:10.5 + imagePullPolicy: IfNotPresent + env: + - name: MYSQL_ROOT_PASSWORD + value: root + - name: MYSQL_DATABASE + value: myaktion + volumeMounts: + - mountPath: /var/lib/mysql + name: myaktion-pv + volumes: + - name: myaktion-pv + persistentVolumeClaim: + claimName: myaktion-pv-claim diff --git a/k8s/deployment/myaktion-deployment.yaml b/k8s/deployment/myaktion-deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..400755b4631dcd8e3eb6574b658d9b40df86abfd --- /dev/null +++ b/k8s/deployment/myaktion-deployment.yaml @@ -0,0 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: myaktion + namespace: myaktion +spec: + selector: + matchLabels: + run: myaktion + replicas: 1 + template: + metadata: + annotations: + linkerd.io/inject: enabled + labels: + run: myaktion + spec: + containers: + - name: myaktion + image: schmolli/myaktion-go:1.0.1 + imagePullPolicy: Always + env: + - name: DB_CONNECT + value: mariadb:3306 + - name: LOG_LEVEL + value: info diff --git a/k8s/ingressroute/myaktion-ingressroute.yaml b/k8s/ingressroute/myaktion-ingressroute.yaml new file mode 100644 index 0000000000000000000000000000000000000000..02b4c19d543e89eff20343df11cff9954955e049 --- /dev/null +++ b/k8s/ingressroute/myaktion-ingressroute.yaml @@ -0,0 +1,48 @@ +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + annotations: + kubernetes.io/ingress.class: traefik + creationTimestamp: null + name: myaktion-ingressroute + namespace: myaktion +spec: + routes: + + - kind: Rule + match: Path(`/health`) && Method(`GET`) + services: + - kind: Service + name: myaktion + namespace: myaktion + port: 8000 + + - kind: Rule + match: Path(`/campaigns`) && Method(`POST`) + middlewares: + - name: fw-auth-mw + namespace: default + services: + - kind: Service + name: myaktion + namespace: myaktion + port: 8000 + + - kind: Rule + match: Path(`/campaigns`) || Path(`/campaigns/{id:[0-9]+}`) && Method(`GET`) + middlewares: + - name: fw-auth-mw + namespace: default + services: + - kind: Service + name: myaktion + namespace: myaktion + port: 8000 + + - kind: Rule + match: Path(`/campaigns/{id:[0-9]+}/donation`) && Method(`POST`) + services: + - kind: Service + name: myaktion + namespace: myaktion + port: 8000 diff --git a/k8s/namespace/myaktion-namespace.yaml b/k8s/namespace/myaktion-namespace.yaml new file mode 100644 index 0000000000000000000000000000000000000000..32994301008173f6b13fac7f8281f15810e23c8e --- /dev/null +++ b/k8s/namespace/myaktion-namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: myaktion diff --git a/k8s/persistedvolume/myaktion-pv.yaml b/k8s/persistedvolume/myaktion-pv.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cc1a15142eb4555fd165afba8b71e5c7ac6e195e --- /dev/null +++ b/k8s/persistedvolume/myaktion-pv.yaml @@ -0,0 +1,31 @@ +kind: PersistentVolume +apiVersion: v1 +metadata: + name: myaktion-pv + namespace: myaktion + labels: + type: local +spec: + storageClassName: standard + capacity: + storage: 100M + accessModes: + - ReadWriteOnce + hostPath: + path: "/User/schmolli/data/myaktion" +--- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + app: myaktion + name: myaktion-pv-claim + namespace: myaktion +spec: + storageClassName: standard + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100M diff --git a/k8s/service/mariadb-service.yaml b/k8s/service/mariadb-service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dcaa7c0f5a2dcf47450f37b81faee0f9cac7fe65 --- /dev/null +++ b/k8s/service/mariadb-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: mariadb + namespace: myaktion +spec: + type: ClusterIP + ports: + - port: 3306 + targetPort: 3306 + selector: + run: mariadb diff --git a/k8s/service/myaktion-service.yaml b/k8s/service/myaktion-service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1c169ece58ebd206ea252c5f4b530ad2542a70f3 --- /dev/null +++ b/k8s/service/myaktion-service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: myaktion + namespace: myaktion +spec: + type: ClusterIP + ports: + - port: 8000 + targetPort: 8000 + name: "http" + selector: + run: myaktion