diff --git a/README.md b/README.md index 0e55dc5..4af60f9 100644 --- a/README.md +++ b/README.md @@ -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 + +``` diff --git a/quick-links-charts/Chart.yaml b/quick-links-charts/Chart.yaml index 0dcf90a..5ba5047 100644 --- a/quick-links-charts/Chart.yaml +++ b/quick-links-charts/Chart.yaml @@ -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 diff --git a/quick-links-charts/templates/deployment.yaml b/quick-links-charts/templates/deployment.yaml index 5633bd7..6bfa05f 100644 --- a/quick-links-charts/templates/deployment.yaml +++ b/quick-links-charts/templates/deployment.yaml @@ -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 }} \ No newline at end of file diff --git a/quick-links-charts/templates/service.yaml b/quick-links-charts/templates/service.yaml index 0c28f2e..48ef066 100644 --- a/quick-links-charts/templates/service.yaml +++ b/quick-links-charts/templates/service.yaml @@ -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 }} diff --git a/quick-links-charts/values.yaml b/quick-links-charts/values.yaml index ce0d860..74082f4 100644 --- a/quick-links-charts/values.yaml +++ b/quick-links-charts/values.yaml @@ -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