Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
428 changes: 428 additions & 0 deletions k8s/HELM.md

Large diffs are not rendered by default.

447 changes: 447 additions & 0 deletions k8s/LAB10.md

Large diffs are not rendered by default.

43 changes: 0 additions & 43 deletions k8s/deployment.yml

This file was deleted.

1 change: 1 addition & 0 deletions k8s/dinfochart/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/charts/
23 changes: 23 additions & 0 deletions k8s/dinfochart/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
24 changes: 24 additions & 0 deletions k8s/dinfochart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: dinfochart
description: A Helm chart for devops-infoservice

# 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: "1.1.1"
Empty file.
62 changes: 62 additions & 0 deletions k8s/dinfochart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "dinfochart.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 "dinfochart.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 "dinfochart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "dinfochart.labels" -}}
helm.sh/chart: {{ include "dinfochart.chart" . }}
{{ include "dinfochart.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "dinfochart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "dinfochart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "dinfochart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "dinfochart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
41 changes: 41 additions & 0 deletions k8s/dinfochart/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "dinfochart.fullname" . }}
labels:
{{- include "dinfochart.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "dinfochart.selectorLabels" . | nindent 6 }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1 # Extra pods during update
maxUnavailable: 0 # Ensure availability
template:
metadata:
labels:
{{- include "dinfochart.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
ports:
- containerPort: {{ .Values.service.port }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
20 changes: 20 additions & 0 deletions k8s/dinfochart/templates/hooks/post-install-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: batch/v1
kind: Job
metadata:
name: '{{ include "dinfochart.fullname" . }}-post-install'
labels:
{{- include "dinfochart.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: '{{ include "dinfochart.fullname" . }}-post-install'
spec:
restartPolicy: Never
containers:
- name: post-install-job
image: busybox
command: ['sh', '-c', 'echo Post-install validation && sleep 1 && echo Validation passed']
20 changes: 20 additions & 0 deletions k8s/dinfochart/templates/hooks/pre-install-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: batch/v1
kind: Job
metadata:
name: '{{ include "dinfochart.fullname" . }}-pre-install'
labels:
{{- include "dinfochart.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: '{{ include "dinfochart.fullname" . }}-pre-install'
spec:
restartPolicy: Never
containers:
- name: pre-install-job
image: busybox
command: ['sh', '-c', 'echo Pre-install task running && sleep 1 && echo Pre-install completed']
14 changes: 14 additions & 0 deletions k8s/dinfochart/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "dinfochart.fullname" . }}
labels:
{{- include "dinfochart.labels" . | nindent 4 }}
spec:
type: NodePort
selector:
{{- include "dinfochart.selectorLabels" . | nindent 4 }}
ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
19 changes: 19 additions & 0 deletions k8s/dinfochart/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
replicaCount: 1

image:
tag: "latest"

resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 64Mi

service:
type: NodePort

livenessProbe:
initialDelaySeconds: 5
periodSeconds: 10
23 changes: 23 additions & 0 deletions k8s/dinfochart/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
replicaCount: 5

image:
tag: "1.0.0" # Specific version

resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 200m
memory: 256Mi

service:
type: LoadBalancer

livenessProbe:
initialDelaySeconds: 30
periodSeconds: 5

readinessProbe:
initialDelaySeconds: 10
periodSeconds: 3
32 changes: 32 additions & 0 deletions k8s/dinfochart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
replicaCount: 5
image:
repository: timurusmanov/devops-infoservice
tag: "1.1.1"
pullPolicy: IfNotPresent

service:
type: NodePort
port: 80
targetPort: 5000

resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi

livenessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 10
periodSeconds: 5

readinessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 5
periodSeconds: 3
13 changes: 0 additions & 13 deletions k8s/service.yml

This file was deleted.

Loading