eshepelyuk / cmak-operator

CMAK (prev. Kafka Manager) for Kubernetes
MIT License
59 stars 27 forks source link

Installation failed on K8s `1.21.5-gke.1302` due to incompatible `kubeVersion` requirement #45

Closed vovinacci closed 2 years ago

vovinacci commented 2 years ago

We are using managed K8s installation in Google Cloud Platform (GKE) and chart installation fails with

Error: INSTALLATION FAILED: chart requires kubeVersion: >=1.21 which is incompatible with Kubernetes v1.21.5-gke.1302

Looking at the code, it's possible to parametrise Ingress object, based on K8s version using Capabilities built-in object, so kubeVersion could be dropped.

Roughly, this would look like the following:

templates/_utils.tpl:

...

{{- define "kubeVersion" -}}
  {{- default .Capabilities.KubeVersion.Version (regexFind "v[0-9]+\\.[0-9]+\\.[0-9]+" .Capabilities.KubeVersion.Version) -}}
{{- end -}}

{{- define "ingress.apiVersion" -}}
  {{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19.x" (include "kubeVersion" .)) -}}
    {{- print "networking.k8s.io/v1" -}}
  {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
    {{- print "networking.k8s.io/v1beta1" -}}
  {{- else -}}
    {{- print "extensions/v1beta1" -}}
  {{- end -}}
{{- end -}}

templates/ingress.yaml

apiVersion: {{ template "ingress.apiVersion" . }}
...

That would make chart more versatile. If this approach is fine with you, I can open a PR.

Дякую / Thanks.

eshepelyuk commented 2 years ago

Hello I dont like the idea of supporting Ingress beta and would like to avoid this.

But, this is too fast for the issue. First of all I dont understand why current kube version doesnt work for you cluster. As far as i see - your GKE cluster is 1.21 and it should already support Ingress v1

Can you explain this first ?

eshepelyuk commented 2 years ago

Well, i make some skim reading of google and it seem GKE issue. The fix would be just to remove kubeVersion

eshepelyuk commented 2 years ago

https://github.com/eshepelyuk/cmak-operator/releases/tag/1.9.2

vovinacci commented 2 years ago

That was blazing fast. Thank you!