fix typo for homeworks 13 directory

This commit is contained in:
2022-12-23 09:46:05 +07:00
parent b5268a1370
commit 2e7a604149
67 changed files with 9 additions and 9 deletions

View File

@@ -0,0 +1,23 @@
# 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

@@ -0,0 +1,24 @@
apiVersion: v2
name: project
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: 1.0.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: "1.0.0"

View File

@@ -0,0 +1,6 @@
---------------------------------------------------------
Content of NOTES.txt appears after deploy.
Deployed version {{ .Chart.AppVersion }}.
---------------------------------------------------------

View File

@@ -0,0 +1,6 @@
{{/*
Dynamic hostpath for database PV
*/}}
{{- define "project.database.pv.hostpath" -}}
{{- print .Values.database.hostVolumePath "/" .Release.Namespace "/" .Values.environment }}
{{- end }}

View File

@@ -0,0 +1,33 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: backend
name: {{ .Chart.Name }}-{{ .Values.environment }}-backend
spec:
replicas: {{ .Values.backend.replicasCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: backend
template:
metadata:
labels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: backend
spec:
containers:
- image: {{ .Values.image.name }}:backend-latest
imagePullPolicy: Always
name: backend
env:
- name: DATABASE_URL
value: "postgresql://{{ .Values.database.settings.user }}:{{ .Values.database.settings.password }}@postgres:5432/{{ .Values.database.settings.dbName }}"
ports:
- name: web
containerPort: 9000
resources:
{{- toYaml .Values.backend.resources | nindent 12 }}
terminationGracePeriodSeconds: 30

View File

@@ -0,0 +1,12 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-{{ .Values.environment }}-backend
spec:
ports:
- name: web
port: 9000
selector:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: backend

View File

@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Chart.Name }}-{{ .Values.environment }}-postgres-config
labels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: database
data:
POSTGRES_DB: {{ .Values.database.settings.dbName }}
POSTGRES_USER: {{ .Values.database.settings.user }}
POSTGRES_PASSWORD: {{ .Values.database.settings.password }}
PGDATA: {{ .Values.database.settings.dbPath | quote }}

View File

@@ -0,0 +1,17 @@
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Chart.Name }}-{{ .Values.environment }}-{{.Release.Namespace}}-postgres-pv-volume
labels:
type: local
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: database
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
hostPath:
path: {{ include "project.database.pv.hostpath" . | quote }}

View File

@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Chart.Name }}-{{ .Values.environment }}-postgres-pv-claim
labels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: database
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi

View File

@@ -0,0 +1,17 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-{{ .Values.environment }}-database
spec:
type: ClusterIP
clusterIP: None
ports:
- name: {{ .Chart.Name }}-{{ .Values.environment }}-postgresql
port: 5432
targetPort: 5432
protocol: TCP
selector:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: database
db-kind: postgresql

View File

@@ -0,0 +1,46 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: database
db-kind: postgresql
name: {{ .Chart.Name }}-{{ .Values.environment }}-database
spec:
selector:
matchLabels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: database
db-kind: postgresql
serviceName: postgres
replicas: 1
podManagementPolicy: "Parallel"
updateStrategy:
type: "RollingUpdate"
template:
metadata:
labels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: database
db-kind: postgresql
spec:
terminationGracePeriodSeconds: 60
containers:
- name: postgres
image: postgres:13-alpine
imagePullPolicy: "IfNotPresent"
ports:
- name: postgresql
containerPort: 5432
protocol: TCP
envFrom:
- configMapRef:
name: {{ .Chart.Name }}-{{ .Values.environment }}-postgres-config
volumeMounts:
- mountPath: {{ .Values.database.settings.dbPath | quote }}
name: {{ .Chart.Name }}-{{ .Values.environment }}-postgres-volume
volumes:
- name: {{ .Chart.Name }}-{{ .Values.environment }}-postgres-volume
persistentVolumeClaim:
claimName: {{ .Chart.Name }}-{{ .Values.environment }}-postgres-pv-claim

View File

@@ -0,0 +1,33 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: frontend
name: {{ .Chart.Name }}-{{ .Values.environment }}-frontend
spec:
replicas: {{ .Values.frontend.replicasCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: frontend
template:
metadata:
labels:
app: {{ .Chart.Name }}-{{ .Values.environment }}
service: frontend
spec:
containers:
- image: {{ .Values.image.name }}:frontend-latest
imagePullPolicy: Always
name: frontend
env:
- name: BASE_URL
value: "http://{{ .Chart.Name }}-{{ .Values.environment }}-backend:9000"
ports:
- name: web
containerPort: 80
resources:
{{- toYaml .Values.frontend.resources | nindent 12 }}
terminationGracePeriodSeconds: 30

View File

@@ -0,0 +1,32 @@
environment: production
image:
name: dannecron/netology-devops-k8s-app
backend:
replicasCount: 1
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
frontend:
replicasCount: 1
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
database:
settings:
user: db_user
password: db_passwd
dbName: news
dbPath: "/var/lib/postgresql/data"
hostVolumePath: "/mnt/pgsql_data"