Skip to content

Commit

Permalink
feat: add helm charts
Browse files Browse the repository at this point in the history
  • Loading branch information
sujeet-agrahari committed Feb 15, 2024
1 parent beaf33d commit 8cef232
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 36 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,12 @@ REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379
***

[Kubernetes Introduction](https://github.com/sujeet-agrahari/quick-links/blob/main/kubernetes/Introduction.md)

### Helm

```
helm upgrade quick-links ./quick-links-charts
helm upgrade quick-links ./quick-links-charts --recreate-pods
```
2 changes: 1 addition & 1 deletion quick-links-charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v2
name: quick-links-chart
name: quick-links
description: A Helm chart for deploying quick-links service
version: 0.1.0
32 changes: 11 additions & 21 deletions quick-links-charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}-quick-links
name: {{ .Values.deployment.name }}
spec:
replicas: {{ .Values.replicaCount }}
replicas: {{ .Values.deployment.replicaCount }}
selector:
matchLabels:
app: quick-links
app: {{.Values.app_name }}
template:
metadata:
labels:
app: quick-links
app: {{.Values.app_name }}
spec:
containers:
- name: quick-links
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
- name: {{.Values.app_name }}
image: "{{ .Values.deployment.image.repository }}:{{ .Values.deployment.image.tag }}"
imagePullPolicy: {{ .Values.deployment.image.pullPolicy }}
env:
- name: DB_HOST
value: {{ .Values.env.DB_HOST }}
- name: DB_PORT
value: {{ .Values.env.DB_PORT }}
- name: DB_USER
value: {{ .Values.env.DB_USER }}
- name: DB_PASSWORD
value: {{ .Values.env.DB_PASSWORD }}
- name: DB_NAME
value: {{ .Values.env.DB_NAME }}
- name: REDIS_HOST
value: {{ .Values.env.REDIS_HOST }}
- name: REDIS_PASSWORD
value: {{ .Values.env.REDIS_PASSWORD }}
{{- range $key, $value := .Values.deployment.env }}
- name: {{ $key }}
value: {{ quote $value }}
{{- end }}
4 changes: 2 additions & 2 deletions quick-links-charts/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ metadata:
name: {{ .Values.service.name }}
spec:
selector:
app: quick-links
app: {{ .Values.app_name }}
ports:
- name: quick-links
- name: {{ .Values.app_name }}
protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
Expand Down
27 changes: 15 additions & 12 deletions quick-links-charts/values.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
replicaCount: 2
image:
repository: quick-links
tag: dev
pullPolicy: Never
env:
DB_HOST: 'postgres-postgresql-ha-pgpool'
DB_USER: 'postgres'
DB_PASSWORD: 'password'
DB_NAME: 'quicklink'
REDIS_HOST: 'redis-master'
REDIS_PASSWORD: 'Mx765t6kQe'
app_name: quick-links

deployment:
name: quick-links-deployment
replicaCount: 2
image:
repository: quick-links
tag: prod
pullPolicy: Never
env:
DB_HOST: 'postgres-postgresql-ha-pgpool'
DB_USER: 'postgres'
DB_PASSWORD: 'password'
DB_NAME: 'quicklink'
REDIS_HOST: 'redis-master'
REDIS_PASSWORD: 'pyL9vFnIpw'

service:
name: quick-links-service
type: ClusterIP
Expand Down

0 comments on commit 8cef232

Please sign in to comment.