-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Fabricio Aguiar <[email protected]>
- Loading branch information
Showing
2 changed files
with
136 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# | ||
# Check for: | ||
# | ||
# - 1 OpenStackAnsibleEE CR | ||
# - 1 failed-play pod | ||
# - 1 failed-play job | ||
# - Correct output from ansible play | ||
# | ||
apiVersion: ansibleee.openstack.org/v1beta1 | ||
kind: OpenStackAnsibleEE | ||
metadata: | ||
name: failed-play | ||
spec: | ||
name: openstackansibleee | ||
play: | | ||
- name: Execution failure | ||
hosts: localhost | ||
tasks: | ||
- name: Copy absent file | ||
ansible.builtin.shell: | | ||
set -euxo pipefail | ||
cp absent failed_op | ||
preserveJobs: true | ||
status: | ||
JobStatus: Failed | ||
conditions: | ||
- message: 'AnsibleExecutionJob error occured Internal error occurred: Job Failed. | ||
Check job logs' | ||
reason: Error | ||
severity: Warning | ||
status: "False" | ||
type: Ready | ||
- message: 'AnsibleExecutionJob error occured Internal error occurred: Job Failed. | ||
Check job logs' | ||
reason: Error | ||
severity: Warning | ||
status: "False" | ||
type: AnsibleExecutionJobReady | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
generateName: failed-play- | ||
labels: | ||
app: openstackansibleee | ||
job-name: failed-play | ||
status: | ||
phase: Failed | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
labels: | ||
app: openstackansibleee | ||
job-name: failed-play | ||
openstackansibleee_cr: failed-play | ||
osaee: "true" | ||
name: failed-play | ||
spec: | ||
backoffLimit: 6 | ||
completionMode: NonIndexed | ||
completions: 1 | ||
parallelism: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: openstackansibleee | ||
batch.kubernetes.io/job-name: failed-play | ||
job-name: failed-play | ||
openstackansibleee_cr: failed-play | ||
osaee: "true" | ||
spec: | ||
containers: | ||
- args: | ||
- ansible-runner | ||
- run | ||
- /runner | ||
- -p | ||
- playbook.yaml | ||
- -i | ||
- failed-play | ||
env: | ||
- name: RUNNER_PLAYBOOK | ||
value: |2+ | ||
- name: Execution failure | ||
hosts: localhost | ||
tasks: | ||
- name: Copy absent file | ||
ansible.builtin.shell: | | ||
set -euxo pipefail | ||
cp absent failed_op | ||
- name: RUNNER_EXTRA_VARS | ||
value: |2+ | ||
aaa: %!s(int=1) | ||
bbb: %!s(int=2) | ||
ccc: %!s(int=3) | ||
envFrom: | ||
- configMapRef: | ||
name: openstack-aee-default-env | ||
image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest | ||
imagePullPolicy: Always | ||
name: openstackansibleee | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Never | ||
schedulerName: default-scheduler | ||
terminationGracePeriodSeconds: 30 | ||
status: | ||
conditions: | ||
- message: Job has reached the specified backoff limit | ||
reason: BackoffLimitExceeded | ||
status: "True" | ||
type: Failed | ||
failed: 7 |
17 changes: 17 additions & 0 deletions
17
tests/kuttl/tests/run_failed_playbook/01-run-absent-file.yaml
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,17 @@ | ||
apiVersion: ansibleee.openstack.org/v1beta1 | ||
kind: OpenStackAnsibleEE | ||
metadata: | ||
name: failed-play | ||
spec: | ||
play: | | ||
- name: Execution failure | ||
hosts: localhost | ||
tasks: | ||
- name: Copy absent file | ||
ansible.builtin.shell: | | ||
set -euxo pipefail | ||
cp absent failed_op | ||
extraVars: | ||
aaa: 1 | ||
ccc: 3 | ||
bbb: 2 |