Remove unused files

This commit is contained in:
Santiago Lo Coco 2023-11-15 21:17:08 -03:00
parent ccb404784f
commit f5cc32b78f
17 changed files with 2 additions and 637 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
.venv
.venv
exam/

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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/

View File

@ -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"

View File

@ -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 }}

View File

@ -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 -}}

View File

@ -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 -}}

View File

@ -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

View File

@ -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

View File

@ -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 }}

View File

@ -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

View File

@ -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

View File

@ -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 -}}

View File

@ -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

View File

@ -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