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

fix: Use correct cron job kind when discovering API versions #1554

Merged
merged 2 commits into from
May 31, 2024

Conversation

banjoh
Copy link
Member

@banjoh banjoh commented May 30, 2024

Description, Motivation and Context

Use correct cron job kind when discovering API versions

Fixes: #1553

Checklist

  • New and existing tests pass locally with introduced changes.
  • Tests for the changes have been added (for bug fixes / features)
  • The commit message(s) are informative and highlight any breaking changes
  • Any documentation required has been added/updated. For changes to https://troubleshoot.sh/ create a PR here

Does this PR introduce a breaking change?

  • Yes
  • No

@banjoh banjoh requested a review from a team as a code owner May 30, 2024 13:30
@banjoh banjoh added the type::bug Something isn't working label May 30, 2024
adamancini
adamancini previously approved these changes May 30, 2024
@diamonwiggins
Copy link
Member

I've approved, but I guess I do have a question. The issue this is referencing says that the issue was batch/v1beta1/cronjobs vs batch/v1/cronjobs. Does changing this from CronJobs to CronJob actually fix this?

@diamonwiggins diamonwiggins self-requested a review May 30, 2024 19:37
@banjoh
Copy link
Member Author

banjoh commented May 31, 2024

I've approved, but I guess I do have a question. The issue this is referencing says that the issue was batch/v1beta1/cronjobs vs batch/v1/cronjobs. Does changing this from CronJobs to CronJob actually fix this?

It does. Below is a snippet of the API description object fetched from the API server during discovery. The "kind": "CronJob") field is used in discovery.HasResource() to select the resource. That condition always failed due to the typo. The API call we see in the logs contains a concatenation of values from "groupVersion" and "name" fields. Hope that makes sense.

  {
    "groupVersion": "batch/v1",
    "resources": [
      {
        "name": "cronjobs",
        "singularName": "cronjob",
        "namespaced": true,
        "kind": "CronJob",
        "verbs": [
          "create",
          "delete",
          "deletecollection",
          "get",
          "list",
          "patch",
          "update",
          "watch"
        ],
        "shortNames": [
          "cj"
        ],
        "categories": [
          "all"
        ]
      },

@banjoh banjoh merged commit ce15527 into replicatedhq:main May 31, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug::normal type::bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Usage of kubernetes deprecated cronjob API when newer APIs are present
3 participants