Skip to content

Commit a25c6f4

Browse files
authored
Extend role to deploy asgi container (#71)
* extend role to deploy asgi container * fix varibale name * rename variables and remove wsgi overrides * set USE_GUNICORN to empty string in asgi * add comment * set enable_asgi default value to false
1 parent 1cfc7b7 commit a25c6f4

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

defaults/main.yml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ k8s_container_ingress_annotations: {}
137137
k8s_container_ingress_path_type: Prefix
138138
k8s_container_ingress_paths:
139139
- /
140+
k8s_asgi_container_ingress_paths:
141+
- /ws
140142
# An empty string, or the contents of a file generated by the `htpasswd` command
141143
k8s_container_htpasswd: ""
142144
# List of dictionaries to mount the specified content as a data volume
@@ -148,21 +150,33 @@ k8s_container_htpasswd: ""
148150
# file_name: content
149151
k8s_container_data_volumes: []
150152

151-
k8s_web_containers:
152-
- name: "{{ k8s_container_name }}"
153-
image: "{{ k8s_container_image }}"
154-
image_pull_policy: "{{ k8s_container_image_pull_policy }}"
155-
tag: "{{ k8s_container_image_tag }}"
156-
replicas: "{{ k8s_container_replicas }}"
157-
strategy: "{{ k8s_container_strategy }}"
158-
resources: "{{ k8s_container_resources }}"
159-
port: "{{ k8s_container_port }}"
160-
protocol: "{{ k8s_container_protocol }}"
161-
ingress_annotations: "{{ k8s_container_ingress_annotations }}"
162-
ingress_paths: "{{ k8s_container_ingress_paths }}"
163-
environment: "{{ k8s_environment_variables }}"
164-
htpasswd: "{{ k8s_container_htpasswd }}"
165-
data_volumes: "{{ k8s_container_data_volumes }}"
153+
# When set to true, both wsgi and asgi containers for libyavotes app are deployed. When set to false, only wsgi container is deployed.
154+
k8s_enable_asgi: false
155+
156+
k8s_base_web_container:
157+
name: "{{ k8s_container_name }}"
158+
image: "{{ k8s_container_image }}"
159+
image_pull_policy: "{{ k8s_container_image_pull_policy }}"
160+
tag: "{{ k8s_container_image_tag }}"
161+
replicas: "{{ k8s_container_replicas }}"
162+
strategy: "{{ k8s_container_strategy }}"
163+
resources: "{{ k8s_container_resources }}"
164+
port: "{{ k8s_container_port }}"
165+
protocol: "{{ k8s_container_protocol }}"
166+
ingress_annotations: "{{ k8s_container_ingress_annotations }}"
167+
ingress_paths: "{{ k8s_container_ingress_paths }}"
168+
environment: "{{ k8s_environment_variables }}"
169+
htpasswd: "{{ k8s_container_htpasswd }}"
170+
data_volumes: "{{ k8s_container_data_volumes }}"
171+
172+
k8s_web_container_asgi_override:
173+
name: "{{ k8s_container_name }}-asgi"
174+
ingress_paths: "{{ k8s_asgi_container_ingress_paths }}"
175+
environment: "{{ k8s_environment_variables | combine({'USE_GUNICORN': ''}) }}"
176+
177+
k8s_asgi_web_container: "{{ k8s_base_web_container | combine(k8s_web_container_asgi_override, recursive=true) }}"
178+
179+
k8s_web_containers: "{{ [k8s_base_web_container, k8s_asgi_web_container] if k8s_enable_asgi else [k8s_base_web_container] }}"
166180

167181
k8s_worker_enabled: false
168182
k8s_worker_name: "celery-worker"

0 commit comments

Comments
 (0)