Skip to content

Commit

Permalink
fix maintenance static
Browse files Browse the repository at this point in the history
  • Loading branch information
Sispheor committed Dec 11, 2023
1 parent 840510d commit 0cb3f04
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
1 change: 0 additions & 1 deletion k8s/squest_k8s/tasks/02-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
kubernetes.core.k8s:
kubeconfig: "{{ k8s_kubeconfig_path }}"
state: present
# namespace: "{{ squest_namespace }}"
namespace: "default" # mandatory as they have hardcoded hooks in default NS
definition: "{{ lookup('file', 'mariadb-operator.v0.22.0.yml') | from_yaml_all }}"

Expand Down
21 changes: 16 additions & 5 deletions k8s/squest_k8s/tasks/05-django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,10 @@
volumeMounts:
- mountPath: /app/static
name: django-static
- mountPath: /app/media
name: django-media
restartPolicy: Never
volumes:
- name: django-media
persistentVolumeClaim:
claimName: django-media
- name: django-static
readOnly: true
persistentVolumeClaim:
claimName: django-static

Expand Down Expand Up @@ -261,6 +257,7 @@
persistentVolumeClaim:
claimName: django-media
- name: django-static
readOnly: true
persistentVolumeClaim:
claimName: django-static
- name: nginx-config
Expand Down Expand Up @@ -319,3 +316,17 @@
name: django
port:
number: 8080

- name: Wait until Django deployment available
kubernetes.core.k8s_info:
kubeconfig: "{{ k8s_kubeconfig_path }}"
api_version: "apps/v1"
kind: Deployment
name: "django"
namespace: "{{ squest_namespace }}"
wait: yes
wait_sleep: 10
wait_timeout: 600
wait_condition:
type: Available
status: "True"
13 changes: 7 additions & 6 deletions k8s/squest_k8s/tasks/07-maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
data:
nginx.conf: "{{ lookup('file', playbook_dir + '/../docker/maintenance.nginx.conf') }}"
maintenance.html: "{{ lookup('file', playbook_dir + '/../docker/maintenance.html') }}"
binaryData:
squest_logo_v2_300_300.png: "{{ lookup('file', playbook_dir + '/../project-static/squest/img/squest_logo_v2_300_300.png') |b64encode }}"

- name: Deploy maintenance static page
kubernetes.core.k8s:
Expand Down Expand Up @@ -56,14 +58,11 @@
- name: nginx-config-maintenance
mountPath: /usr/share/nginx/html/index.html
subPath: maintenance.html
- mountPath: /usr/share/nginx/html/squest_logo_v2_300_300.png
name: django-static
subPath: ./squest/img/squest_logo_v2_300_300.png
- name: nginx-config-maintenance
mountPath: /usr/share/nginx/html/squest_logo_v2_300_300.png
subPath: squest_logo_v2_300_300.png
restartPolicy: Always
volumes:
- name: django-static
persistentVolumeClaim:
claimName: django-static
- name: nginx-config-maintenance
configMap:
name: nginx-config-maintenance
Expand All @@ -72,6 +71,8 @@
path: nginx.conf
- key: maintenance.html
path: maintenance.html
- key: squest_logo_v2_300_300.png
path: squest_logo_v2_300_300.png

- name: Maintenance service
kubernetes.core.k8s:
Expand Down
8 changes: 4 additions & 4 deletions k8s/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
rules:
- host: "{{ squest_host_url }}"
- host: "{{ squest_django.ingress.host }}"
http:
paths:
- pathType: Prefix
Expand All @@ -30,7 +30,7 @@
port:
number: 80

- name: Update Django env as config map
- name: Update Django env config map
kubernetes.core.k8s:
kubeconfig: "{{ k8s_kubeconfig_path }}"
namespace: "{{ squest_namespace }}"
Expand All @@ -43,7 +43,7 @@
app: squest
service: django
name: django-env
data: "{{ squest_django_env }}"
data: "{{ squest_django.env }}"

- name: Delete migration job
kubernetes.core.k8s:
Expand Down Expand Up @@ -168,7 +168,7 @@
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
rules:
- host: "{{ squest_host_url }}"
- host: "{{ squest_django.ingress.host }}"
http:
paths:
- pathType: Prefix
Expand Down

0 comments on commit 0cb3f04

Please sign in to comment.