Skip to content

Commit

Permalink
Refactor Helm chart and update deployment scripts
Browse files Browse the repository at this point in the history
Deleted obsolete Helm chart templates and configuration files to streamline deployment. Renamed and relocated remaining template files for better organization. Updated build script to use Helm for package building and deployment to improve efficiency.
  • Loading branch information
dan-omb committed Sep 12, 2024
1 parent 333b8be commit e330244
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 79 deletions.
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ pytest.ini
/media/
/opal/env.*


**/__pycache__/
/build/yaml/secrets/omb_secrets.yaml
/build/yaml/secrets/dan_secrets.yaml

/build/env_settings/*
/build/opal/omb_values.yaml
/build/opal/values.yaml
/build/helm_output.yaml
/build/opal.yaml
/build/opal-0.2.1.tgz
/build/opal-0.2.2.tgz
/build/opal-0.2.3.tgz
/build/opal-0.2.4.tgz
7 changes: 4 additions & 3 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ docker push 192.168.42.100:5050/opal-webapp
docker build -t 192.168.42.100:5050/opal-db -f Dockerfile_db .
docker push 192.168.42.100:5050/opal-db

kubectl apply -f yaml/app/
kubectl apply -f yaml/db/
kubectl apply -f yaml/nginx/
helm package ./opal/ --app-version $(cat ../version.txt)

#helm install opal opal-$(cat opal/Chart.yaml| grep version: | cut -d' ' -f2).tgz --atomic --create-namespace --debug
helm template opal opal-$(cat opal/Chart.yaml| grep version: | cut -d' ' -f2).tgz > helm_output.yaml
16 changes: 0 additions & 16 deletions build/helm-chart/values.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions build/helm-chart/yaml/secrets/opal_secrets.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion build/helm-chart/Chart.yaml → build/opal/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.2.0
version: 0.2.4

# 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: opal-webapp-config
namespace: opal
repo:
webapp: 192.168.42.100:5050/opal-webapp:latest
db: 192.168.42.100:5050/opal-db:latest
nginx: nginx:1.25
data:
ENVIRONMENT: prod
DEBUG: "False"
Expand All @@ -24,3 +25,10 @@ data:
DB_NAME: opal
LOG_FILE: /usr/src/logs/debug.log
ENABLE_DJANGO_AUTH: "False"
secret:
db:
POSTGRES_PASSWORD: Uk9PVF9EQl9QQVNTV09SRAo= #ROOT_DB_PASSWORD
POSTGRES_OPAL_PASSWORD: Uk9PVF9EQl9QQVNTV09SRAo= #OPAL_USER_DB_PASSWORD
#tls:
# tls.crt: TLS_CERT
# tls.key: TLS_PRIVATE_KEY
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: Service
metadata:
name: opal-webapp-service
namespace: {{ .Values.namespace | quote }}
spec:
ports:
- name: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: opal-webapp
namespace: {{ .Values.namespace | quote }}
labels:
app: opal-webapp
spec:
Expand All @@ -23,13 +22,6 @@ spec:
restartPolicy: Always
imagePullSecrets:
- name: harbor
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: DoesNotExist
containers:
- name: opal-webapp
image: {{ .Values.repo.webapp }}
Expand All @@ -54,7 +46,7 @@ spec:
name: staticfiles
envFrom:
- configMapRef:
name: opal-webapp-config
name: opal-config
env:
- name: DB_PASSWORD
valueFrom:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: staticfiles-pvc
namespace: {{ .Values.namespace | quote }}
spec:
storageClassName: manual
accessModes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: Service
metadata:
name: opal-postgres-db
namespace: {{ .Values.namespace | quote }}
spec:
ports:
- name: postgres
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: opal-postgres-db
namespace: {{ .Values.namespace | quote }}
labels:
app: opal-postgres-db
spec:
Expand All @@ -23,13 +22,6 @@ spec:
restartPolicy: Always
imagePullSecrets:
- name: harbor
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: DoesNotExist
containers:
- name: opal-postgres-db
image: {{ .Values.repo.db }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
namespace: {{ .Values.namespace | quote }}
spec:
storageClassName: manual
accessModes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-cm
namespace: {{ .Values.namespace | quote }}
data:
default.conf: |
server {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: Service
metadata:
name: nginx-service
namespace: {{ .Values.namespace | quote }}
spec:
ports:
- name: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-static
namespace: {{ .Values.namespace | quote }}
labels:
app: nginx-static
spec:
Expand All @@ -26,13 +25,6 @@ spec:
restartPolicy: Always
imagePullSecrets:
- name: harbor
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: DoesNotExist
containers:
- name: nginx-static
image: {{ .Values.repo.nginx }}
Expand Down
8 changes: 8 additions & 0 deletions build/opal/templates/opal-cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: opal-config
data:
{{- range $key, $value := .Values.data }}
{{ $key }}: {{ $value | quote }}
{{- end }}
File renamed without changes.
21 changes: 21 additions & 0 deletions build/opal/templates/opal_secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Secret
metadata:
name: opal-passwords
namespace: {{ .Values.namespace | quote }}
type: Opaque
data:
POSTGRES_PASSWORD: Uk9PVF9EQl9QQVNTV09SRAo= #ROOT_DB_PASSWORD
POSTGRES_OPAL_PASSWORD: Uk9PVF9EQl9QQVNTV09SRAo= #OPAL_USER_DB_PASSWORD
---
#apiVersion: v1
#kind: Secret
#metadata:
# name: tls-cert
# namespace: {{ .Values.namespace | quote }}
#type: kubernetes.io/tls
#data:
# tls.crt: TLS_CERT
# tls.key: TLS_PRIVATE_KEY
#---

2 changes: 1 addition & 1 deletion playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
- name: chmod startup script
file:
path: /usr/src/app/startup.sh
mode: '0550'
mode: '0555'
owner: opal_deploy
group: opal

Expand Down

0 comments on commit e330244

Please sign in to comment.