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

bugfix: Support batch/v1beta1 cronjobs for compatibility before Kubernetes v1.21 #3280

Conversation

TrafalgarZZZ
Copy link
Member

Ⅰ. Describe what this PR does

batchv1.CronJobs is not supported before Kubernetes v1.20 so that Fluid now fails to run on K8s v1.20 with the following error:


if kind is a CRD, it should be installed before calling Start  {"kind": "CronJob.batch", "error": "no matches for kind \"CronJob\" in version \"batch[/](https://github.com/fluid-cloudnative/fluid/compare/master...TrafalgarZZZ:bugfix/compatibility_for_batch_v1beta1?expand=1#)v1\""}

This PR fixes by firstly listing all supported API resources in the batch/v1 group version through discovery client and check if cronjobs resource exists. If not, it fallbacks to use batch/v1beta1 for cronjobs.

Ⅱ. Does this pull request fix one issue?

#3279

Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Merging #3280 (490d36b) into master (72a6426) will not change coverage.
The diff coverage is n/a.

❗ Current head 490d36b differs from pull request most recent head f30d3ef. Consider uploading reports for the commit f30d3ef to get more accurate results

@@           Coverage Diff           @@
##           master    #3280   +/-   ##
=======================================
  Coverage   65.48%   65.48%           
=======================================
  Files         397      397           
  Lines       23170    23170           
=======================================
  Hits        15173    15173           
  Misses       6214     6214           
  Partials     1783     1783           

@TrafalgarZZZ
Copy link
Member Author

/test fluid-e2e

@zwwhdls
Copy link
Member

zwwhdls commented Jun 12, 2023

/lgtm
/approve

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
@fluid-e2e-bot fluid-e2e-bot bot removed the lgtm label Jun 12, 2023
@@ -0,0 +1,35 @@
package compatibility
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add license header.

)

var batchV1CronJobCompatible = false

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving this file to pkg/utils/kubeclient?

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
@TrafalgarZZZ TrafalgarZZZ force-pushed the bugfix/compatibility_for_batch_v1beta1 branch from 9d9ad69 to f30d3ef Compare June 12, 2023 11:22
@sonarcloud
Copy link

sonarcloud bot commented Jun 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.7% 0.7% Duplication

@TrafalgarZZZ
Copy link
Member Author

/test fluid-e2e

Copy link
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Jun 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cheyang, zwwhdls

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fluid-e2e-bot fluid-e2e-bot bot merged commit 0583537 into fluid-cloudnative:master Jun 12, 2023
10 checks passed
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

3 participants