Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix helm chart #208

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f4b3062
Update values.yaml
tripathishikha1 Jul 2, 2024
c9bd30a
Update deployment.yaml
tripathishikha1 Jul 2, 2024
aacd79f
Update service.yaml
tripathishikha1 Jul 2, 2024
f6dda48
Create _helpers.yaml
tripathishikha1 Jul 2, 2024
f086ea5
Update Chart.yaml
tripathishikha1 Jul 2, 2024
a206b8e
Update values.yaml
tripathishikha1 Jul 2, 2024
f0989d4
Update service.yaml
tripathishikha1 Jul 2, 2024
7832e88
Update deployment.yaml
tripathishikha1 Jul 2, 2024
5247568
Update _helpers.yaml
tripathishikha1 Jul 2, 2024
ee0312c
Update Chart.yaml
tripathishikha1 Jul 2, 2024
afb77ea
Update Chart.yaml
tripathishikha1 Jul 2, 2024
e12387c
Update values.yaml
tripathishikha1 Jul 2, 2024
441baad
Update Chart.yaml
tripathishikha1 Jul 2, 2024
b3ef059
Update ct.yaml
tripathishikha1 Jul 2, 2024
5e18317
Update ct.yaml
tripathishikha1 Jul 2, 2024
47a923d
Update ct.yaml
tripathishikha1 Jul 2, 2024
5bad692
Update ct.yaml
tripathishikha1 Jul 2, 2024
3324606
Update values.yaml
tripathishikha1 Jul 3, 2024
9a183d9
Update deployment.yaml
tripathishikha1 Jul 3, 2024
2374bf3
Update deployment.yaml
tripathishikha1 Jul 3, 2024
848abe8
Update service.yaml
tripathishikha1 Jul 3, 2024
08d5440
Update _helpers.yaml
tripathishikha1 Jul 3, 2024
25783fa
Update values.yaml
tripathishikha1 Jul 4, 2024
66023ca
Update deployment.yaml
tripathishikha1 Jul 4, 2024
87461a0
Update service.yaml
tripathishikha1 Jul 4, 2024
e3e82c4
Create hpa.yaml
tripathishikha1 Jul 4, 2024
412565e
Update Chart.yaml
tripathishikha1 Jul 4, 2024
2da3fb1
Merge branch 'main' into fix-helm-chart
tripathishikha1 Jul 5, 2024
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
9 changes: 5 additions & 4 deletions charts/microservice/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
apiVersion: v2
name: microservice
description: A Helm chart for a microservice in Kubernetes
description: A Helm chart for Kubernetes
type: application
version: 0.1.2
appVersion: "0.1.2"
version: 0.1.0
appVersion: "1.0"
maintainers:
- name: Opstree Solutions
- name: Shikha Tripathi
email: [email protected]
53 changes: 53 additions & 0 deletions charts/microservice/templates/_helpers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{/* vim: set filetype=mustache: */}}

{{/*
Create a defautl fully qualified app name
It will use the release name to give the app name
*/}}

{{- define "app.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 60 | 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 "app.tempname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 60 | 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 }}

{{- define "app.fullname" -}}
{{- printf "%s-%s" ( include "app.tempname" . ) "app" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "app.labels" -}}
app: {{ include "app.tempname" . }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "app.selectorLabels" -}}
app: {{ include "app.tempname" . }}
{{- end }}%

{{/*
service name
*/}}
{{- define "app.servicename" -}}
{{- printf "%s-%s" ( include "app.tempname" . ) "svc" | trunc 63 | trimSuffix "-" }}
{{- end }}%
34 changes: 32 additions & 2 deletions charts/microservice/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,36 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
- containerPort: {{ .Values.containerPorts.http }}
name: http
protocol: TCP
- containerPort: {{ .Values.containerPorts.https }}
name: https
protocol: TCP
- containerPort: {{ .Values.containerPorts.custom }}
name: custom-port
protocol: TCP
resources:
requests:
memory: "{{ .Values.resources.requests.memory }}"
cpu: "{{ .Values.resources.requests.cpu }}"
limits:
memory: "{{ .Values.resources.limits.memory }}"
cpu: "{{ .Values.resources.limits.cpu }}"
{{- if .Values.liveness.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.liveness.path }}
port: {{ .Values.liveness.port }}
initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
periodSeconds: {{ .Values.liveness.periodSeconds }}
{{- end}}
{{- if .Values.readiness.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.readiness.path }}
port: {{ .Values.readiness.port }}
initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
periodSeconds: {{ .Values.readiness.periodSeconds }}
failureThreshold: {{ .Values.readiness.failureThreshold }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/microservice/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.hpa.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "app.fullname" . }}
labels:
{{- include "app.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "app.fullname" . }}
minReplicas: {{ .Values.hpa.minReplicas }}
maxReplicas: {{ .Values.hpa.maxReplicas }}
averageUtilization: {{ .Values.hpa.targetCPUUtilizationPercentage }}
{{- end }}
12 changes: 9 additions & 3 deletions charts/microservice/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "app.fullname" . }}-svc
name: {{ include "app.servicename" . }}
labels:
{{- include "app.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
selector:
{{- include "app.selectorLabels" . | nindent 4 }}
ports:
- port: {{ .Values.service.port }}
- name: http
port: {{ .Values.servicePorts.http }}
targetPort: http
protocol: TCP
name: http
- name: https
port: {{ .Values.servicePorts.https }}
targetPort: https
protocol: TCP
selector:
{{- include "app.selectorLabels" . | nindent 4 }}
37 changes: 36 additions & 1 deletion charts/microservice/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,42 @@ image:
repository: nginx
pullPolicy: IfNotPresent
tag: "latest"
containerPorts:
http: 80
https: 443
custom: 8080

servicePorts:
http: 80
https: 443
custom: 8080

service:
type: ClusterIP
type: ClusterIP

resources:
requests:
memory: "128Mi"
cpu: "250m"
limits:
memory: "256Mi"
cpu: "500m"
hpa:
enabled: true
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 50

liveness:
enabled: false
path: /alive
port: 80
initialDelaySeconds: 3
periodSeconds: 3
readiness:
enabled: false
path: /ready
port: 80
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 3
13 changes: 5 additions & 8 deletions ct.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
remote: origin
target-branch: main
chart-dirs:
chart_dirs:
- charts
chart-repos:
- ot-helm=https://ot-container-kit.github.io/helm-charts
excluded-charts:
- mysql
validate_chart_schema: true
validate-maintainers: true
helm-extra-args: --strict
target_branch: main # or the appropriate branch name
Loading