Skip to content

Commit

Permalink
Ingress API is served via networking.k8s.io/v1beta1 API
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranzke committed Mar 20, 2019
1 parent 94cd93b commit 525f0df
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 37 deletions.
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: {{ include "ingressversion" . }}
kind: Ingress
metadata:
annotations:
Expand Down
Expand Up @@ -7,10 +7,10 @@
core/v1/LimitRange
core/v1/ResourceQuota
core/v1/ServiceAccount
extensions/v1beta1/Ingress
extensions/v1beta1/PodSecurityPolicy
{{ include "ingressversion" . }}/Ingress
{{ include "podsecuritypolicyversion" .}}/PodSecurityPolicy
{{ include "networkpolicyversion" . }}/NetworkPolicy
policy/v1beta1/PodDisruptionBudget
{{ include "poddisruptionbudgetversion" . }}/PodDisruptionBudget
{{ include "rbacversion" . }}/ClusterRole
{{ include "rbacversion" . }}/ClusterRoleBinding
{{ include "rbacversion" . }}/Role
Expand Down
@@ -1,5 +1,5 @@
{{- if .Values.emailConfigs }}
apiVersion: extensions/v1beta1
apiVersion: {{ include "ingressversion" . }}
kind: Ingress
metadata:
annotations:
Expand All @@ -23,4 +23,4 @@ spec:
serviceName: alertmanager-client
servicePort: 9093
path: /
{{- end }}
{{- end }}
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: {{ include "ingressversion" . }}
kind: Ingress
metadata:
annotations:
Expand Down
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: {{ include "ingressversion" . }}
kind: Ingress
metadata:
annotations:
Expand Down
28 changes: 0 additions & 28 deletions charts/shoot-addons/charts/kube-lego/templates/NOTES.txt

This file was deleted.

8 changes: 8 additions & 0 deletions charts/utils-templates/templates/_versions.tpl
Expand Up @@ -83,3 +83,11 @@ policy/v1beta1
{{- define "podsecuritypolicyversion" -}}
policy/v1beta1
{{- end -}}

{{- define "ingressversion" -}}
{{- if semverCompare ">= 1.14-0" .Capabilities.KubeVersion.GitVersion -}}
networking.k8s.io/v1beta1
{{- else -}}
extensions/v1beta1
{{- end -}}
{{- end -}}
12 changes: 11 additions & 1 deletion pkg/client/kubernetes/ingresses.go
Expand Up @@ -14,7 +14,17 @@

package kubernetes

import "github.com/gardener/gardener/pkg/utils"

// DeleteIngress deletes an Ingress object.
func (c *Clientset) DeleteIngress(namespace, name string) error {
return c.kubernetes.ExtensionsV1beta1().Ingresses(namespace).Delete(name, &defaultDeleteOptions)
k8sVersionLessThan114, err := utils.CompareVersions(c.Version(), "<", "1.14")
if err != nil {
return err
}

if k8sVersionLessThan114 {
return c.kubernetes.ExtensionsV1beta1().Ingresses(namespace).Delete(name, &defaultDeleteOptions)
}
return c.kubernetes.NetworkingV1beta1().Ingresses(namespace).Delete(name, &defaultDeleteOptions)
}

0 comments on commit 525f0df

Please sign in to comment.