Skip to content

Commit

Permalink
add k8s-resources chart
Browse files Browse the repository at this point in the history
  • Loading branch information
zubenkoivan committed Feb 16, 2022
1 parent 4e1cb5a commit 54bcc73
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
22 changes: 22 additions & 0 deletions charts/k8s-resources/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode
6 changes: 6 additions & 0 deletions charts/k8s-resources/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
version: 1.0.0
appVersion: 1.0.0
type: library
name: k8s-resources
description: K8s resources
33 changes: 33 additions & 0 deletions charts/k8s-resources/templates/_ingress.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "k8s.ingress.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) -}}
{{- 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 -}}

{{/*
Return if ingress is stable.
*/}}
{{- define "k8s.ingress.isStable" -}}
{{- eq (include "k8s.ingress.apiVersion" .) "networking.k8s.io/v1" -}}
{{- end -}}

{{/*
Return if ingress supports ingressClassName.
*/}}
{{- define "k8s.ingress.supportsIngressClassName" -}}
{{- or (eq (include "k8s.ingress.isStable" .) "true") (and (eq (include "k8s.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}}
{{- end -}}

{{/*
Return if ingress supports pathType.
*/}}
{{- define "k8s.ingress.supportsPathType" -}}
{{- or (eq (include "k8s.ingress.isStable" .) "true") (and (eq (include "k8s.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}}
{{- end -}}

0 comments on commit 54bcc73

Please sign in to comment.