From 12845d41578bc7c124b7df98a951441f7a86cbbe Mon Sep 17 00:00:00 2001 From: arodindev Date: Sun, 4 Aug 2024 12:06:19 +0200 Subject: [PATCH] outsource k8s to devops-boilerplate repo --- README.md | 13 +----- k8s/kustomization.yaml | 8 ---- k8s/mongodb/deployment.yaml | 89 ------------------------------------- k8s/namespace.yaml | 6 --- k8s/todoapp/deployment.yaml | 86 ----------------------------------- k8s/todoapp/istio.yaml | 47 -------------------- 6 files changed, 2 insertions(+), 247 deletions(-) delete mode 100644 k8s/kustomization.yaml delete mode 100644 k8s/mongodb/deployment.yaml delete mode 100644 k8s/namespace.yaml delete mode 100644 k8s/todoapp/deployment.yaml delete mode 100644 k8s/todoapp/istio.yaml diff --git a/README.md b/README.md index 3685219..55ab9f7 100644 --- a/README.md +++ b/README.md @@ -5,27 +5,18 @@ * [Poetry](https://python-poetry.org/docs/#installation) installed * Docker installed -## Getting started +## Getting Started -TODO +TODO: Tilt + Docker compose ## Development -TODO: Tilt + Docker compose - Rename the `.env.sample` file to `.env` within the project folder or export the `MONGODB_URI` environment variable manually with `$ export MONGODB_URI=`. The application can be started in development mode via Poetry. ```bash poetry run start ``` -Pull MongoDB and run it: - -```bash -docker pull mongo -docker run -p 27017:27017 mongo -``` - #### Running tests locally using Tox If you want to run tests and checks locally in an isolated environment. Useful if you want to make sure that all tests pass before passing new code to a CI/CD pipeline. diff --git a/k8s/kustomization.yaml b/k8s/kustomization.yaml deleted file mode 100644 index 3a3d5be..0000000 --- a/k8s/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: todoapp -resources: - - namespace.yaml - - todoapp/deployment.yaml - - todoapp/istio.yaml - - mongodb/deployment.yaml diff --git a/k8s/mongodb/deployment.yaml b/k8s/mongodb/deployment.yaml deleted file mode 100644 index 2d6e03c..0000000 --- a/k8s/mongodb/deployment.yaml +++ /dev/null @@ -1,89 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: mongo - labels: - app: db - release: primary -spec: - selector: - matchLabels: - app: db - release: primary - template: - metadata: - labels: - app: db - release: primary - spec: - containers: - - name: mongo - image: mongo:latest - ports: - - containerPort: 27017 - imagePullPolicy: Always - resources: - limits: - memory: 250Mi - cpu: 100m - requests: - memory: 50Mi - cpu: 50m - volumeMounts: - - name: storage - mountPath: /data/db - readOnly: false - volumes: - - name: storage - persistentVolumeClaim: - claimName: mongo-pvc - readOnly: false - ---- - -apiVersion: v1 -kind: Service -metadata: - name: mongo - labels: - app: db - release: primary -spec: - type: ClusterIP - ports: - - name: mongo - port: 27017 - targetPort: 27017 - selector: - app: db - release: primary - ---- - -apiVersion: v1 -kind: PersistentVolume -metadata: - name: mongo-pv -spec: - capacity: - storage: 256Mi - accessModes: - - ReadWriteOnce - hostPath: - path: /tmp/db - ---- - -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: mongo-pvc - labels: - app: db - release: primary -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 256Mi diff --git a/k8s/namespace.yaml b/k8s/namespace.yaml deleted file mode 100644 index 6ab9c86..0000000 --- a/k8s/namespace.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: todoapp - labels: - istio-injection: enabled diff --git a/k8s/todoapp/deployment.yaml b/k8s/todoapp/deployment.yaml deleted file mode 100644 index acc56cc..0000000 --- a/k8s/todoapp/deployment.yaml +++ /dev/null @@ -1,86 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: todoapp - labels: - app: todoapp - release: primary -spec: - selector: - matchLabels: - app: todoapp - release: primary - template: - metadata: - labels: - app: todoapp - release: primary - spec: - containers: - - name: todoapp - image: ghcr.io/arodindev/todoapp:v0.0.1 - ports: - - containerPort: 8000 - imagePullPolicy: Always - readinessProbe: - httpGet: - path: /api/v1/healthz - port: 8000 - initialDelaySeconds: 5 - livenessProbe: - httpGet: - path: /api/v1/healthz - port: 8000 - initialDelaySeconds: 5 - resources: - limits: - memory: 250Mi - cpu: 100m - requests: - memory: 50Mi - cpu: 50m - ---- - -apiVersion: v1 -kind: Service -metadata: - name: todoapp - labels: - app: todoapp -spec: - type: ClusterIP - ports: - - port: 80 - targetPort: 8000 - selector: - app: todoapp - ---- - -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: todoapp - labels: - app: todoapp -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: todoapp - minReplicas: 1 - maxReplicas: 1 - metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 80 - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 80 diff --git a/k8s/todoapp/istio.yaml b/k8s/todoapp/istio.yaml deleted file mode 100644 index 887dfa8..0000000 --- a/k8s/todoapp/istio.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: networking.istio.io/v1alpha3 -kind: VirtualService -metadata: - name: todoapp -spec: - hosts: - - todoapp.acme.com - - todoapp - gateways: - - todoapp - http: - - route: - - destination: - host: todoapp - subset: primary - port: - number: 80 - ---- - -apiVersion: networking.istio.io/v1alpha3 -kind: DestinationRule -metadata: - name: todoapp -spec: - host: todoapp - subsets: - - name: primary - labels: - release: primary - ---- - -apiVersion: networking.istio.io/v1alpha3 -kind: Gateway -metadata: - name: todoapp -spec: - selector: - istio: ingressgateway - servers: - - port: - number: 80 - name: http - protocol: HTTP - hosts: - - todoapp.acme.com