ansible / awx-resource-operator

41 stars 34 forks source link

make the ansible job operator cluster scoped #9

Closed xiangjingli closed 4 years ago

xiangjingli commented 4 years ago

EDIT: the k8s job name changes in this PR has been moved to https://github.com/ansible/awx-resource-operator/pull/11

Signed-off-by: Xiangjing Li xiangli@redhat.com

The PR mainly addresses the two issues:

  1. in ansible job operator, we can't generate a unique k8s job name for running tower jobs. If so, the ansible job operator is triggered to launch new k8s jobs in an endless loop. In the following ansible task, the state is set to present, meaning a k8s job will be created if it doesn't exist.
    - name: Start K8s Runner Job
    k8s:
    state: present
    definition: "{{ lookup('template', 'job_definition.yml') }}"

    According to ansible k8s module guide, https://docs.ansible.com/ansible/latest/modules/k8s_module.html

    state determines if an object should be created, patched, or deleted. When set to present, an object will be created, if it does not already exist
  2. make the ansible job operator cluster scoped. Now the ansible job operator supports to watch the AnsiblJob CRs in all namespaces.
mikeshng commented 4 years ago

@xiangjingli I created a new https://github.com/ansible/awx-resource-operator/pull/11 for undo the unique k8s job name change so this PR can focus on the cluster scope change. Just a fyi, your previous change in this PR moved the Start K8s Runner Job to after Get Job Info so that needed a change as well.

xiangjingli commented 4 years ago

A new PR will be created to replace the PR