-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add -ness checks and refactor migrations
- Loading branch information
Showing
11 changed files
with
352 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
docs/user-guide/advanced-configuration/container-probes.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#### Container Probes | ||
These parameters control the usage of liveness and readiness container probes for | ||
the web and task containers. | ||
|
||
#### Web / Task Container Liveness Check | ||
|
||
The liveness probe queries the status of the supervisor daemon of the container. The probe will fail if it | ||
detects one of the services in a state other than "RUNNING". | ||
|
||
| Name | Description | Default | | ||
| web_liveness_period | Time period in seconds between each probe check. The value of 0 disables the probe. | 0 | | ||
| web_liveness_initial_delay | Initial delay before starting probes in seconds | 5 | | ||
| web_liveness_failure_threshold| Number of consecutive failure events to identify failure of container | 3 | | ||
| web_liveness_timeout | Number of seconds to wait for a probe response from container | 1 | | ||
| task_liveness_period | Time period in seconds between each probe check. The value of 0 disables the probe. | 0 | | ||
| task_liveness_initial_delay | Initial delay before starting probes in seconds | 5 | | ||
| task_liveness_failure_threshold| Number of consecutive failure events to identify failure of container | 3 | | ||
| task_liveness_timeout | Number of seconds to wait for a probe response from container | 1 | | ||
|
||
#### Web Container Readiness Check | ||
|
||
This is a HTTP check against the status endpoint to confirm the system is still able to respond to web requests. | ||
|
||
| Name | Description | Default | | ||
| -------------| ---------------------------------- | ------- | | ||
| web_readiness_period | Time period in seconds between each probe check. The value of 0 disables the probe. | 0 | | ||
| web_readiness_initial_delay | Initial delay before starting probes in seconds | 5 | | ||
| web_readiness_failure_threshold| Number of consecutive failure events to identify failure of container | 3 | | ||
| web_readiness_timeout | Number of seconds to wait for a probe response from container | 1 | | ||
|
||
#### Task Container Readiness Check | ||
|
||
This is a command probe using the builtin check command of the awx-manage utility. | ||
|
||
| Name | Description | Default | | ||
| -------------| ---------------------------------- | ------- | | ||
| task_readiness_period | Time period in seconds between each probe check. The value of 0 disables the probe. | 0 | | ||
| task_readiness_initial_delay | Initial delay before starting probes in seconds | 5 | | ||
| task_readiness_failure_threshold| Number of consecutive failure events to identify failure of container | 3 | | ||
| task_readiness_timeout | Number of seconds to wait for a probe response from container | 1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
|
||
- name: Check for pending migrations | ||
k8s_exec: | ||
namespace: "{{ ansible_operator_meta.namespace }}" | ||
pod: "{{ awx_web_pod_name }}" | ||
container: "{{ ansible_operator_meta.name }}-web" | ||
command: >- | ||
bash -c "awx-manage showmigrations | grep -v '[X]' | grep '[ ]' | wc -l" | ||
changed_when: false | ||
when: awx_web_pod_name != '' | ||
register: database_check | ||
|
||
- block: | ||
- name: Get version of controller for tracking | ||
k8s_exec: | ||
namespace: "{{ ansible_operator_meta.namespace }}" | ||
pod: "{{ awx_web_pod_name }}" | ||
container: "{{ ansible_operator_meta.name }}-web" | ||
command: >- | ||
bash -c "awx-manage --version" | ||
changed_when: false | ||
register: version_check | ||
|
||
- name: Update instance version | ||
set_fact: | ||
version: "{{ version_check.stdout | trim }}" | ||
|
||
# It is possible to do a wait on this task to create the job and wait | ||
# until it completes. Unfortunately, if the job doesn't wait finish within | ||
# the timeout period that is considered an error. We only want this to | ||
# error if there is an issue with creating the job. | ||
- name: Create kubernetes job to perform the migration | ||
k8s: | ||
apply: yes | ||
definition: "{{ lookup('template', 'jobs/migration.yaml.j2') }}" | ||
register: migrate_result | ||
|
||
# This task is really only necessary for new installations. We need to | ||
# ensure the database has a schema loaded before continuing with the | ||
# initialization of admin user, etc. | ||
- name: Watch for the migration job to finish | ||
k8s_info: | ||
kind: Job | ||
namespace: "{{ ansible_operator_meta.namespace }}" | ||
name: "{{ ansible_operator_meta.name }}-migration-{{ version }}" | ||
register: result | ||
until: | ||
- result.resources[0].status.succeeded is defined | ||
- result.resources[0].status.succeeded == 1 | ||
retries: 180 | ||
delay: 5 | ||
ignore_errors: true | ||
|
||
when: | ||
- database_check is defined | ||
- (database_check.stdout|trim) != '0' |
Oops, something went wrong.