Skip to content

Commit 7ead166

Browse files
authored
set client_request_timeout from annotation in the CR (#2077)
add the functionality to accept an annotation in the awx-cr to be able to override the default client_request_timeout value. rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
1 parent c5533f4 commit 7ead166

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

roles/installer/tasks/main.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,31 @@
33
include_tasks: idle_deployment.yml
44
when: idle_deployment | bool
55

6+
- name: Look up details for this deployment
7+
k8s_info:
8+
api_version: "{{ api_version }}"
9+
kind: "{{ kind }}"
10+
name: "{{ ansible_operator_meta.name }}"
11+
namespace: "{{ ansible_operator_meta.namespace }}"
12+
register: this_awx
13+
14+
- name: set annotations based on this_awx
15+
set_fact:
16+
this_annotations: "{{ this_awx['resources'][0]['metadata']['annotations'] | default({}) }}"
17+
18+
- name: set client_request_timeout based on annotation
19+
set_fact:
20+
client_request_timeout: "{{ (this_annotations['aap.ansible.io/client-request-timeout'][:-1]) | int }}"
21+
client_request_timeout_overidden: true
22+
when:
23+
- "'aap.ansible.io/client-request-timeout' in this_annotations"
24+
- this_annotations['aap.ansible.io/client-request-timeout'] is match('^\\d+s$')
25+
26+
- name: client_request_timeout has been changed
27+
debug:
28+
msg: "client_request_timeout's default 30s value has been overriden by the annotation 'aap.ansible.io/client-request-timeout' to {{ client_request_timeout }}s"
29+
when: client_request_timeout_overidden | default(false)
30+
631
- name: Check for presence of old awx Deployment
732
k8s_info:
833
api_version: apps/v1

0 commit comments

Comments
 (0)