ansible / awx-resource-operator

41 stars 34 forks source link

revert unique k8s job name change #11

Closed mikeshng closed 4 years ago

mikeshng commented 4 years ago

Signed-off-by: Mike Ng ming@redhat.com

This is to revert the change that was done in https://github.com/ansible/awx-resource-operator/pull/4 As @xiangjingli points out in some cases, there is an infinite amount of jobs being spawned.

I am moving this change outside of https://github.com/ansible/awx-resource-operator/pull/9 so that PR can focus on the discussion around cluster scope. Also that PR moved the Start K8s Runner Job to after Get Job Info which is not accurate).

His original comment is:

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
mikeshng commented 4 years ago

Had a long conversation with Josh and convinced him 1-1 is the way to go :)