From f5cc32b78f869e56d7dc70b1959ed6b348848675 Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Wed, 15 Nov 2023 21:17:08 -0300 Subject: [PATCH] Remove unused files --- .gitignore | 3 +- exam/api-deployment.yaml | 59 --------- exam/client-deployment.yaml | 41 ------ exam/db-deployment.yaml | 103 ---------------- exam/exam/.helmignore | 23 ---- exam/exam/Chart.yaml | 21 ---- exam/exam/templates/_helpers.tpl | 62 ---------- exam/exam/templates/api.yaml | 15 --- exam/exam/templates/client.yaml | 15 --- exam/exam/templates/deployment.yaml | 137 --------------------- exam/exam/templates/minikube-ingress.yaml | 28 ----- exam/exam/templates/postgres-pv-claim.yaml | 14 --- exam/exam/templates/postgres-pv.yaml | 17 --- exam/exam/templates/postgres-secrets.yaml | 12 -- exam/exam/templates/postgres.yaml | 15 --- exam/exam/values.yaml | 47 ------- exam/ingress.yaml | 27 ---- 17 files changed, 2 insertions(+), 637 deletions(-) delete mode 100644 exam/api-deployment.yaml delete mode 100644 exam/client-deployment.yaml delete mode 100644 exam/db-deployment.yaml delete mode 100644 exam/exam/.helmignore delete mode 100644 exam/exam/Chart.yaml delete mode 100644 exam/exam/templates/_helpers.tpl delete mode 100644 exam/exam/templates/api.yaml delete mode 100644 exam/exam/templates/client.yaml delete mode 100644 exam/exam/templates/deployment.yaml delete mode 100644 exam/exam/templates/minikube-ingress.yaml delete mode 100644 exam/exam/templates/postgres-pv-claim.yaml delete mode 100644 exam/exam/templates/postgres-pv.yaml delete mode 100644 exam/exam/templates/postgres-secrets.yaml delete mode 100644 exam/exam/templates/postgres.yaml delete mode 100644 exam/exam/values.yaml delete mode 100644 exam/ingress.yaml diff --git a/.gitignore b/.gitignore index b694934..84e052e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.venv \ No newline at end of file +.venv +exam/ diff --git a/exam/api-deployment.yaml b/exam/api-deployment.yaml deleted file mode 100644 index 4f16b23..0000000 --- a/exam/api-deployment.yaml +++ /dev/null @@ -1,59 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: api - labels: - app: api -spec: - ports: - - port: 5000 - selector: - app: api - tier: backend - type: ClusterIP ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: api - labels: - app: api -spec: - replicas: 1 - selector: - matchLabels: - app: api - tier: backend - strategy: - type: Recreate - template: - metadata: - labels: - app: api - tier: backend - spec: - containers: - - image: api:prod - name: api - env: - - name: POSTGRES_DB - value: api-db - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: postgres-secrets - key: password - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: postgres-secrets - key: username - - name: DATABASE_URL - value: postgresql://$(POSTGRES_USER):$(POSTGRES_PASS)@api-db/$(POSTGRES_DB) - - name: APP_SETTINGS - value: src.config.ProductionConfig - - name: PORT - value: "5000" - ports: - - containerPort: 5000 - name: api diff --git a/exam/client-deployment.yaml b/exam/client-deployment.yaml deleted file mode 100644 index a44ee34..0000000 --- a/exam/client-deployment.yaml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: client - labels: - app: client -spec: - ports: - - port: 8080 - targetPort: 80 - selector: - app: client - tier: frontend - type: ClusterIP ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: client - labels: - app: client -spec: - replicas: 1 - selector: - matchLabels: - app: client - tier: frontend - strategy: - type: Recreate - template: - metadata: - labels: - app: client - tier: frontend - spec: - containers: - - image: client:prod - name: client - ports: - - containerPort: 80 - name: client diff --git a/exam/db-deployment.yaml b/exam/db-deployment.yaml deleted file mode 100644 index 664780c..0000000 --- a/exam/db-deployment.yaml +++ /dev/null @@ -1,103 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: postgres - labels: - app: postgres -spec: - ports: - - port: 5432 - selector: - app: postgres - tier: postgres - clusterIP: None ---- -apiVersion: v1 -kind: PersistentVolume -metadata: - name: postgres-pv - labels: - type: local -spec: - capacity: - storage: 1Gi - volumeMode: Filesystem - accessModes: - - ReadWriteOnce - persistentVolumeReclaimPolicy: Retain - storageClassName: manual - # TODO: change hostPath (short.slc.ar/YkdtaD) - hostPath: - path: /tmp/minikube/postgres ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: postgres-pv-claim - labels: - app: db -spec: - accessModes: - - ReadWriteOnce - storageClassName: manual - resources: - requests: - storage: 1Gi ---- -apiVersion: v1 -kind: Secret -metadata: - name: postgres-secrets -type: Opaque -data: - username: dXNlcm5hbWU= - password: cGFzc3dvcmQxMjM0 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: db - labels: - app: db -spec: - replicas: 1 - selector: - matchLabels: - app: db - tier: postgres - strategy: - type: Recreate - template: - metadata: - labels: - app: db - tier: postgres - spec: - containers: - - image: db:prod - name: postgres - env: - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: postgres-secrets - key: password - - name: PGDATA - value: /var/lib/postgresql/data/pgdata - - name: POSTGRES_DB - value: db - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: postgres-secrets - key: username - ports: - - containerPort: 5432 - name: postgres - volumeMounts: - - name: postgres-pv-storage - mountPath: /var/lib/postgresql/data - volumes: - - name: postgres-pv-storage - persistentVolumeClaim: - claimName: postgres-pv-claim \ No newline at end of file diff --git a/exam/exam/.helmignore b/exam/exam/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/exam/exam/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/exam/exam/Chart.yaml b/exam/exam/Chart.yaml deleted file mode 100644 index 8e6a594..0000000 --- a/exam/exam/Chart.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v2 -name: exam -description: A Helm chart for Kubernetes -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "0.1.0" diff --git a/exam/exam/templates/_helpers.tpl b/exam/exam/templates/_helpers.tpl deleted file mode 100644 index 3430f17..0000000 --- a/exam/exam/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "exam.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "exam.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "exam.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "exam.labels" -}} -helm.sh/chart: {{ include "exam.chart" . }} -{{ include "exam.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "exam.selectorLabels" -}} -app.kubernetes.io/name: {{ include "exam.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "exam.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "exam.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/exam/exam/templates/api.yaml b/exam/exam/templates/api.yaml deleted file mode 100644 index 0d7755f..0000000 --- a/exam/exam/templates/api.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "exam.fullname" . }}-api - labels: - app: api - {{- include "exam.labels" . | nindent 4 }} -spec: - type: {{ .Values.api.type }} - selector: - app: api - tier: backend - {{- include "exam.selectorLabels" . | nindent 4 }} - ports: - {{- .Values.api.ports | toYaml | nindent 2 -}} \ No newline at end of file diff --git a/exam/exam/templates/client.yaml b/exam/exam/templates/client.yaml deleted file mode 100644 index 53a78e6..0000000 --- a/exam/exam/templates/client.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "exam.fullname" . }}-client - labels: - app: client - {{- include "exam.labels" . | nindent 4 }} -spec: - type: {{ .Values.client.type }} - selector: - app: client - tier: frontend - {{- include "exam.selectorLabels" . | nindent 4 }} - ports: - {{- .Values.client.ports | toYaml | nindent 2 -}} \ No newline at end of file diff --git a/exam/exam/templates/deployment.yaml b/exam/exam/templates/deployment.yaml deleted file mode 100644 index 6309dd9..0000000 --- a/exam/exam/templates/deployment.yaml +++ /dev/null @@ -1,137 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "exam.fullname" . }}-api - labels: - app: api - {{- include "exam.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.api.replicas }} - selector: - matchLabels: - app: api - tier: backend - {{- include "exam.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - app: api - tier: backend - {{- include "exam.selectorLabels" . | nindent 8 }} - spec: - containers: - - env: - - name: POSTGRES_DB - value: {{ quote .Values.api.api.env.postgresDb }} - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - key: password - name: {{ include "exam.fullname" . }}-postgres-secrets - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - key: username - name: {{ include "exam.fullname" . }}-postgres-secrets - - name: DATABASE_URL - value: {{ quote .Values.api.api.env.databaseUrl }} - - name: APP_SETTINGS - value: {{ quote .Values.api.api.env.appSettings }} - - name: PORT - value: {{ quote .Values.api.api.env.port }} - - name: KUBERNETES_CLUSTER_DOMAIN - value: {{ quote .Values.kubernetesClusterDomain }} - image: {{ .Values.api.api.image.repository }}:{{ .Values.api.api.image.tag | default - .Chart.AppVersion }} - name: api - ports: - - containerPort: 5000 - name: api - resources: {} ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "exam.fullname" . }}-client - labels: - app: client - {{- include "exam.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.client.replicas }} - selector: - matchLabels: - app: client - tier: frontend - {{- include "exam.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - app: client - tier: frontend - {{- include "exam.selectorLabels" . | nindent 8 }} - spec: - containers: - - env: - - name: KUBERNETES_CLUSTER_DOMAIN - value: {{ quote .Values.kubernetesClusterDomain }} - image: {{ .Values.client.client.image.repository }}:{{ .Values.client.client.image.tag - | default .Chart.AppVersion }} - name: client - ports: - - containerPort: 80 - name: client - resources: {} ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "exam.fullname" . }}-db - labels: - app: db - {{- include "exam.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.db.replicas }} - selector: - matchLabels: - app: db - tier: postgres - {{- include "exam.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - app: db - tier: postgres - {{- include "exam.selectorLabels" . | nindent 8 }} - spec: - containers: - - env: - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - key: password - name: {{ include "exam.fullname" . }}-postgres-secrets - - name: PGDATA - value: {{ quote .Values.db.postgres.env.pgdata }} - - name: POSTGRES_DB - value: {{ quote .Values.db.postgres.env.postgresDb }} - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - key: username - name: {{ include "exam.fullname" . }}-postgres-secrets - - name: KUBERNETES_CLUSTER_DOMAIN - value: {{ quote .Values.kubernetesClusterDomain }} - image: {{ .Values.db.postgres.image.repository }}:{{ .Values.db.postgres.image.tag - | default .Chart.AppVersion }} - name: postgres - ports: - - containerPort: 5432 - name: postgres - resources: {} - volumeMounts: - - mountPath: /var/lib/postgresql/data - name: postgres-pv-storage - volumes: - - name: postgres-pv-storage - persistentVolumeClaim: - claimName: {{ include "exam.fullname" . }}-postgres-pv-claim \ No newline at end of file diff --git a/exam/exam/templates/minikube-ingress.yaml b/exam/exam/templates/minikube-ingress.yaml deleted file mode 100644 index 07a03ec..0000000 --- a/exam/exam/templates/minikube-ingress.yaml +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: {{ include "exam.fullname" . }}-minikube-ingress - labels: - {{- include "exam.labels" . | nindent 4 }} - annotations: - nginx.ingress.kubernetes.io/rewrite-target: /$2 - nginx.ingress.kubernetes.io/ssl-redirect: "false" - nginx.ingress.kubernetes.io/use-regex: "true" -spec: - rules: - - http: - paths: - - backend: - service: - name: '{{ include "exam.fullname" . }}-client' - port: - number: 8080 - path: /()(.*) - pathType: ImplementationSpecific - - backend: - service: - name: '{{ include "exam.fullname" . }}-api' - port: - number: 5000 - path: /api(/|$)(.*) - pathType: ImplementationSpecific \ No newline at end of file diff --git a/exam/exam/templates/postgres-pv-claim.yaml b/exam/exam/templates/postgres-pv-claim.yaml deleted file mode 100644 index a6b9373..0000000 --- a/exam/exam/templates/postgres-pv-claim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ include "exam.fullname" . }}-postgres-pv-claim - labels: - app: db - {{- include "exam.labels" . | nindent 4 }} -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: {{ .Values.pvc.postgresPvClaim.storageRequest | quote }} - storageClassName: {{ .Values.pvc.postgresPvClaim.storageClass | quote }} \ No newline at end of file diff --git a/exam/exam/templates/postgres-pv.yaml b/exam/exam/templates/postgres-pv.yaml deleted file mode 100644 index 78b96c2..0000000 --- a/exam/exam/templates/postgres-pv.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: {{ include "exam.fullname" . }}-postgres-pv - labels: - type: local - {{- include "exam.labels" . | nindent 4 }} -spec: - accessModes: - - ReadWriteOnce - capacity: - storage: 1Gi - hostPath: - path: /tmp/minikube/postgres - persistentVolumeReclaimPolicy: Retain - storageClassName: manual - volumeMode: Filesystem \ No newline at end of file diff --git a/exam/exam/templates/postgres-secrets.yaml b/exam/exam/templates/postgres-secrets.yaml deleted file mode 100644 index b7f6f50..0000000 --- a/exam/exam/templates/postgres-secrets.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "exam.fullname" . }}-postgres-secrets - labels: - {{- include "exam.labels" . | nindent 4 }} -data: - password: {{ required "postgresSecrets.password is required" .Values.postgresSecrets.password - | b64enc | quote }} - username: {{ required "postgresSecrets.username is required" .Values.postgresSecrets.username - | b64enc | quote }} -type: Opaque \ No newline at end of file diff --git a/exam/exam/templates/postgres.yaml b/exam/exam/templates/postgres.yaml deleted file mode 100644 index c2e358e..0000000 --- a/exam/exam/templates/postgres.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "exam.fullname" . }}-postgres - labels: - app: postgres - {{- include "exam.labels" . | nindent 4 }} -spec: - type: {{ .Values.postgres.type }} - selector: - app: postgres - tier: postgres - {{- include "exam.selectorLabels" . | nindent 4 }} - ports: - {{- .Values.postgres.ports | toYaml | nindent 2 -}} \ No newline at end of file diff --git a/exam/exam/values.yaml b/exam/exam/values.yaml deleted file mode 100644 index f02ad0f..0000000 --- a/exam/exam/values.yaml +++ /dev/null @@ -1,47 +0,0 @@ -api: - api: - env: - appSettings: src.config.ProductionConfig - databaseUrl: postgresql://$(POSTGRES_USER):$(POSTGRES_PASS)@api-db/$(POSTGRES_DB) - port: "5000" - postgresDb: api-db - image: - repository: api - tag: prod - ports: - - port: 5000 - targetPort: 0 - replicas: 1 - type: ClusterIP -client: - client: - image: - repository: client - tag: prod - ports: - - port: 8080 - targetPort: 80 - replicas: 1 - type: ClusterIP -db: - postgres: - env: - pgdata: /var/lib/postgresql/data/pgdata - postgresDb: db - image: - repository: db - tag: 13.3 - replicas: 1 -kubernetesClusterDomain: cluster.local -postgres: - ports: - - port: 5432 - targetPort: 0 - type: ClusterIP -postgresSecrets: - password: "username" - username: "password1234" -pvc: - postgresPvClaim: - storageClass: manual - storageRequest: 1Gi diff --git a/exam/ingress.yaml b/exam/ingress.yaml deleted file mode 100644 index 55f26b0..0000000 --- a/exam/ingress.yaml +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: minikube-ingress - annotations: - nginx.ingress.kubernetes.io/ssl-redirect: "false" - nginx.ingress.kubernetes.io/use-regex: "true" - nginx.ingress.kubernetes.io/rewrite-target: /$2 -spec: - rules: - # - host: kube.slc.ar - - http: - paths: - - path: /()(.*) - pathType: ImplementationSpecific - backend: - service: - name: client - port: - number: 8080 - - path: /api(/|$)(.*) - pathType: ImplementationSpecific - backend: - service: - name: api - port: - number: 5000 \ No newline at end of file