Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record the generation allowing for items to be patched #129

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roles/credential/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
when:
- ansiblecred_info['resources'][0]['status']['isFinished'] is defined
- ansiblecred_info['resources'][0]['status']['isFinished']
- ansiblecred_info['resources'][0]['status']['generation'] is defined
- ansiblecred_info['resources'][0]['status']['generation']|int == ansiblecred_info['resources'][0]['metadata']['generation']|int

- block:
- name: Check number of attempts to execute the job have been made
Expand Down Expand Up @@ -84,6 +86,7 @@
name: "{{ ansible_operator_meta.name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
status:
generation: "{{ ansiblecred_info['resources'][0]['metadata']['generation'] }}"
k8sJob:
created: true
message: |-
Expand Down
3 changes: 3 additions & 0 deletions roles/instancegroup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
when:
- ansibleig_info['resources'][0]['status']['isFinished'] is defined
- ansibleig_info['resources'][0]['status']['isFinished']
- ansibleig_info['resources'][0]['status']['generation'] is defined
- ansibleig_info['resources'][0]['status']['generation']|int == ansibleig_info['resources'][0]['metadata']['generation']|int

- block:
- name: Check number of attempts to execute the job have been made
Expand Down Expand Up @@ -98,6 +100,7 @@
name: "{{ ansible_operator_meta.name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
status:
generation: "{{ ansibleig_info['resources'][0]['metadata']['generation'] }}"
k8sJob:
created: true
message: |-
Expand Down
5 changes: 4 additions & 1 deletion roles/project/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
when:
- ansibleproj_info['resources'][0]['status']['isFinished'] is defined
- ansibleproj_info['resources'][0]['status']['isFinished']
- ansibleproj_info['resources'][0]['status']['generation'] is defined
- ansibleproj_info['resources'][0]['status']['generation']|int == ansibleproj_info['resources'][0]['metadata']['generation']|int

- block:
- name: Check number of attempts to execute the job have been made
Expand Down Expand Up @@ -77,13 +79,14 @@
set_fact:
_project_name: "{{ name}}"

- name: Update AnsibleProject status with K8s job info
- name: Update AnsibleProject status with K8s job info and generation
operator_sdk.util.k8s_status:
api_version: tower.ansible.com/v1alpha1
kind: AnsibleProject
name: "{{ ansible_operator_meta.name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
status:
generation: "{{ ansibleproj_info['resources'][0]['metadata']['generation'] }}"
k8sJob:
created: true
message: |-
Expand Down
3 changes: 3 additions & 0 deletions roles/schedule/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
when:
- ansiblesched_info['resources'][0]['status']['isFinished'] is defined
- ansiblesched_info['resources'][0]['status']['isFinished']
- ansiblesched_info['resources'][0]['status']['generation'] is defined
- ansiblesched_info['resources'][0]['status']['generation']|int == ansiblesched_info['resources'][0]['metadata']['generation']|int

- block:
- name: Check number of attempts to execute the job have been made
Expand Down Expand Up @@ -84,6 +86,7 @@
name: "{{ ansible_operator_meta.name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
status:
generation: "{{ ansiblesched_info['resources'][0]['metadata']['generation'] }}"
k8sJob:
created: true
message: |-
Expand Down
13 changes: 7 additions & 6 deletions watches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@
group: tower.ansible.com
kind: AnsibleJob
role: job
watchDependentResources: True
# finalizer:
# name: finalizer.tower.ansible.com
# vars:
# tower_resource_state: absent

- version: v1alpha1
group: tower.ansible.com
kind: JobTemplate
role: jobtemplate
watchDependentResources: True
- version: v1alpha1
group: tower.ansible.com
kind: AnsibleProject
role: project
watchDependentResources: True
- version: v1alpha1
group: tower.ansible.com
kind: AnsibleWorkflow
Expand All @@ -26,20 +22,25 @@
group: tower.ansible.com
kind: AnsibleCredential
role: credential
watchDependentResources: True
- version: v1alpha1
group: tower.ansible.com
kind: AnsibleSchedule
role: schedule
watchDependentResources: True
- version: v1alpha1
group: tower.ansible.com
kind: AnsibleInstanceGroup
role: instancegroup
watchDependentResources: True
- version: v1alpha1
group: tower.ansible.com
kind: WorkflowTemplate
role: workflowtemplate
watchDependentResources: True
- version: v1alpha1
group: tower.ansible.com
kind: AnsibleInventory
role: inventory
watchDependentResources: True
#+kubebuilder:scaffold:watch