Add an ability to install ingress

This commit is contained in:
Nikolai Rodionov 2024-07-15 07:21:43 +02:00
parent b76da1c101
commit df0483ce13
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
3 changed files with 33 additions and 1 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: softplayer-lib-workload
description: A library to be reused accross softplayer charts
type: library
version: 0.1.8
version: 0.2.0
maintainers:
- name: allanger
email: allanger@badhouseplants.net

View File

@ -0,0 +1,28 @@
{{- define "lib.ingress" }}
{{- range $k, $v := .Values.ingress }}
{{- $customName := printf "%s-%s" (include "chart.fullname" $) $k }}
{{- if $v.annotations -}}
{{- $annotations := $v.annotations }}
{{- else }}
{{- $annotations := "" }}
{{- end }}
---
# ---------------------------------------------------------------------
# This ingress is created as a part of softplayer helm library
# please see /lib/tempaltes/ingress/_ingress.tpl
# ---------------------------------------------------------------------
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- include "lib.metadata" (dict "Context" $ "customName" $customName "annotations" $v.annotations)}}
spec:
ingressClassName: $v.class
rules:
{{- with $v.rules }}
{{- tpl ( . | toYaml | nindent 4 | toString) $ }}
{{- end }}
{{- with $v.tls }}
{{- tpl ( . | toYaml | nindent 4 | toString) $ }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -7,6 +7,10 @@ metadata:
{{- end }}
labels:
{{ include "metadata.labels" .Context | indent 4 }}
{{- if .annotations }}
annotations:
{{ .annotations | toYaml | indent 4 }}
{{- end }}
{{- end }}
{{- define "metadata.customName" -}}