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

Different versions of K8S support different cronjob versions and policy version #116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wuchang0201
Copy link
Contributor

if kubernetes version < 1.21 and >1.19,cronjob and policy version should be batch/v1beta1

@wuchang0201
Copy link
Contributor Author

#93

#42

@wuchang0201
Copy link
Contributor Author

example:
image

@@ -1,8 +1,12 @@
{{- if .Values.enableAuditApiserver }}
{{- $policyVersion := default "v1beta1" -}}
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What version does "semverCompare" represent?
if it represent the version of kubernetes, i can not understand the "semver" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"SemverCompare" is a built-in function
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Has these code been tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Has these code been tested?

Yes, there are test result images above it

apiVersion: batch/v1
{{- else if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: batch/v1beta1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any other diff with "v1beta1" and "v1" of CronJob?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there any other diff with "v1beta1" and "v1" of CronJob?

From k8s 1.19 to 1.29, there are only v1beta1 and v1

README-zh_CN.md Outdated
@@ -56,6 +56,7 @@ Lunettes 可以识别容器生命周期每个交付阶段的开始和结尾,
# install lunettes
# 该过程开启apiserver的审计功能,apiserver会发生重启
helm upgrade --install lunettes oci://registry-1.docker.io/lunettes/lunettes-chart --version [version]

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove useless blank lines to avoid conflicts with other pr merges

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please remove useless blank lines to avoid conflicts with other pr merges

done

@@ -25,7 +25,7 @@ Note: Beginning in Helm v3.8.0, OCI support is enabled by default, and it gradua

```bash
helm upgrade --install lunettes oci://registry-1.docker.io/lunettes/lunettes-chart --version [version]

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove useless blank lines to avoid conflicts with other pr merges

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please remove useless blank lines to avoid conflicts with other pr merges

done

@@ -1,4 +1,8 @@
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not use the same method here as in the previous policyversion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not use the same method here as in the previous policyversion?

Directly using nested yaml files will result in an error and requires passing variables

@@ -1,8 +1,12 @@
{{- if .Values.enableAuditApiserver }}
{{- $policyVersion := default "v1beta1" -}}
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Has these code been tested?

Copy link
Collaborator

@linuzb linuzb left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants