kubesphere / ks-installer

Install KubeSphere on existing Kubernetes cluster
https://kubesphere.io
Apache License 2.0
532 stars 746 forks source link

elasticsearch-logging-curator blocking install on kubernetes >= 1.25 #2187

Open brandan-schmitz opened 1 year ago

brandan-schmitz commented 1 year ago

Kubernetes 1.25 removed support for CronJob API version batch/v1beta1 which is what the current chart version for the elasticsearch-logging-curator is set to use. This chart should be updated either by manually updating what is set in _helpers.tpl within that archive or by sourcing an updated version of the chart.

The simple fix is to replace the following section of the _helpers.tpl file in the roles/common/files/elasticsearch/elasticsearch-curator-1.3.3.tgz

{{/*
Return the appropriate apiVersion for cronjob APIs.
*/}}
{{- define "cronjob.apiVersion" -}}
{{- if semverCompare "< 1.8-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "batch/v2alpha1" }}
{{- else if semverCompare ">=1.8-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "batch/v1beta1" }}
{{- end -}}
{{- end -}}

With this that adds a section to use the correct version in k8s 1.21 as that is when it became available.

{{/*
Return the appropriate apiVersion for cronjob APIs.
*/}}
{{- define "cronjob.apiVersion" -}}
{{- if semverCompare "< 1.21-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "batch/v1beta1" }}
{{- else if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "batch/v1" }}
{{- end -}}
{{- end -}}

I have tested this change on K8s v1.27.1 and it allows this to be installed. This change should allow it to be installed on k8s 1.8 and above.

brandan-schmitz commented 1 year ago

I am willing to submit a PR if that will speed this along.

wanjunlei commented 1 year ago

I am willing to submit a PR if that will speed this along.

Thanks a lot, this will speed up our release.

wanjunlei commented 1 year ago

/cc @wenchajun