ansible / awx-resource-operator

41 stars 34 forks source link

after job wait, update the ansiblejob cr with the ansiblejob result #3

Closed mikeshng closed 4 years ago

mikeshng commented 4 years ago

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

The current status is control by operator-sdk which represent the status of launching the kube job (not ansible job). As long as the kube job is launched successfully, then it's always going to show Successful.

status:
  conditions:
  - ansibleResult:
      changed: 0
      completion: 2020-08-11T19:51:56.946445
      failures: 0
      ok: 5
      skipped: 0
    lastTransitionTime: "2020-08-11T19:50:52Z"
    message: Awaiting next reconciliation
    reason: Successful
    status: "True"
    type: Running

In this PR, we are introducing statusAnsibleJob which actually represent the ansible tower job status. See below: When running:

  statusAnsibleJob:
    status: pending

When completed:

  statusAnsibleJob:
    elapsed: "6.196"
    finished: "2020-08-19T15:47:45.412138Z"
    started: "2020-08-19T15:47:39.216242Z"
    status: successful

So the end result will look something like this:

  status:
    conditions:
    - ansibleResult:
        changed: 0
        completion: 2020-08-19T15:47:51.316016
        failures: 0
        ok: 5
        skipped: 0
      lastTransitionTime: "2020-08-19T15:47:02Z"
      message: Awaiting next reconciliation
      reason: Successful
      status: "True"
      type: Running
  statusAnsibleJob:
    elapsed: "6.196"
    finished: "2020-08-19T15:47:45.412138Z"
    started: "2020-08-19T15:47:39.216242Z"
    status: successful
mikeshng commented 4 years ago

@maxamillion could you please take a look if you have some cycles? Thanks.