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

Change ansible k8s_info tasks api_version for Job kind to batch/v1 #1833

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from

Conversation

guillaumelfv
Copy link
Contributor

SUMMARY

Switch api_version from v1 to batch/v1 for k8s_info tasks using Kind: Job in migrate_schema.yml

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
ADDITIONAL INFORMATION

The API version of Job in all recent version of Kubernetes is:

❯ kubectl api-resources | grep job
cronjobs                           cj                                   batch/v1                               true         CronJob
jobs                                                                    batch/v1                               true         Job

The migration task fails consistently after 15 minutes, causing the operator to retry the entire playbook. This issue arises because the k8s_info task doesn't use the correct api_version to retrieve the job status. According to the documentation, the api_version defaults to v1 if not specified.

Manually testing with a custom playbook showed that updating the api_version to the correct version resolves the issue, allowing the task to retrieve the job status correctly.

To address this, the following change was tested locally:

From:

- name: Watch for the migration job to finish
  k8s_info:
    kind: Job
    namespace: "awx"
    name: "awx-migration-24.2.0"
  register: result

- debug: var=result

To:

- name: Watch for the migration job to finish
  k8s_info:
    api_version: batch/v1
    kind: Job
    namespace: "awx"
    name: "awx-migration-24.2.0"
  register: result

- debug: var=result

This change ensures that the correct api_version is used, resolving the issue with the task.

This is similar to another changes that was opened by us and merged in the past: #1299

@rooftopcellist rooftopcellist enabled auto-merge (squash) May 22, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants