Skip to content

Commit

Permalink
Implement Helm deployment and update configurations
Browse files Browse the repository at this point in the history
Switch the deployment process to Helm by introducing a Helm release for the todoapp chart, including a dependency on MySQL. Update configuration details such as the DB_HOST, and ensure consistency with resource names by changing configMap and adding a mysql-service. Remove manual Kubernetes apply commands from the bootstrap script in favor of using Helm for deployment and management.
  • Loading branch information
Andr1yK committed Dec 8, 2024
1 parent 9bcc2b0 commit 6e71b88
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 20 deletions.
19 changes: 2 additions & 17 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash
kubectl apply -f .infrastructure/mysql/ns.yml
kubectl apply -f .infrastructure/mysql/configMap.yml
kubectl apply -f .infrastructure/mysql/secret.yml
kubectl apply -f .infrastructure/mysql/service.yml
kubectl apply -f .infrastructure/mysql/statefulSet.yml

kubectl apply -f .infrastructure/app/ns.yml
kubectl apply -f .infrastructure/app/pv.yml
kubectl apply -f .infrastructure/app/pvc.yml
kubectl apply -f .infrastructure/app/secret.yml
kubectl apply -f .infrastructure/app/configMap.yml
kubectl apply -f .infrastructure/app/clusterIp.yml
kubectl apply -f .infrastructure/app/nodeport.yml
kubectl apply -f .infrastructure/app/hpa.yml
kubectl apply -f .infrastructure/app/deployment.yml
kubectl taint nodes -l app=mysql app=mysql:NoSchedule

# Install Ingress Controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
# kubectl apply -f .infrastructure/ingress/ingress.yml
helm install todoapp-release ./helm-chart/todoapp
4 changes: 4 additions & 0 deletions helm-chart/todoapp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ version: 1.0.0

# The app version number, reflective of the application's current version. Use quotes.
appVersion: "1.16.0"

dependencies:
- name: mysql
version: 0.1.0
2 changes: 1 addition & 1 deletion helm-chart/todoapp/charts/mysql/templates/statefulSet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ spec:
{{- range .values }}
- {{ . }}
{{ end }}
topologyKey: {{ .topologyKey }}}
topologyKey: {{ .topologyKey }}
{{- end }}
nodeAffinity:
{{- with .Values.mysql.nodeAffinity }}
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/todoapp/templates/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ spec:
secretName: {{ .Chart.Name }}-secret
- name: app-config-volume
configMap:
name: app-config
name: {{ .Chart.Name }}-config
affinity:
{{- with .Values.todoapp.nodeAffinity }}
nodeAffinity:
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/todoapp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ todoapp:
DB_NAME: "app_db"
DB_USER: "app_user"
DB_PASSWORD: "1234"
DB_HOST: "mysql-0.mysql.mysql.svc.cluster.local"
DB_HOST: "mysql-0.mysql-service.mysql.svc.cluster.local"

resources:
cpu:
Expand Down

0 comments on commit 6e71b88

Please sign in to comment.