Fetch Kubernetes version depending upon the deployment environment and support ingress in all kubernetes version

Hi Everyone,
Is there an alternative supported by replicated to get cluster version.
Like helm have .Capabilities bundle to get kubeversion.
semverCompare “>=1.19-0” .Capabilities.KubeVersion.GitVersion

The use case is that, we want to update our ingress manifest depending upon the kubernetes version they are running.

A vague idea of what I have currently done:

---
# repl{{ if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
apiVersion: networking.k8s.io/v1
# repl{{ else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }}
apiVersion: networking.k8s.io/v1beta1
# repl{{ else }}
apiVersion: extensions/v1beta1
# repl{{end }}
kind: Ingress
metadata:
  name: ingress-name
  annotations:
# repl{{ if semverCompare "<1.18-0" .Capabilities.KubeVersion.GitVersion }}
    kubernetes.io/ingress.class: 'repl{{ ConfigOption "ingress_class_name" }}'
# repl{{ end }}
    kots.io/placeholder: repl{{ printf "'true'" }}repl{{ ConfigOption "ingress_annotations" | nindent 4 }}
spec:
... incomplete example

---

Thanks in advance for any suggestion or help.

1 Like

Hi Arya!

Thank you for asking your question.

Unfortunately this is not possible today, but sounds like a great field to add to our Static Context.

The best way to get this in front of our product team is to submit a feature request via the Vendor Portal. This will create a feature request in our internal system and allows our product team to follow up directly with you if they have questions.

One more thing…

When Replicated deploys a Helm Chart it uses the Helm CLI. If you have your ingress defined as a Helm Chart then you should be able to take advantage of .Capabilities.