mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-01-24 07:59:02 +00:00
[reverse-proxy] Initial release (#1085)
This commit is contained in:
parent
bf7728eec7
commit
5a106b60f9
26
charts/stable/reverse-proxy/.helmignore
Normal file
26
charts/stable/reverse-proxy/.helmignore
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# 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/
|
||||||
|
# OWNERS file for Kubernetes
|
||||||
|
OWNERS
|
||||||
|
# helm-docs templates
|
||||||
|
*.gotmpl
|
20
charts/stable/reverse-proxy/Chart.yaml
Normal file
20
charts/stable/reverse-proxy/Chart.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
version: 1.0.0
|
||||||
|
description: Creates ingress reverse-proxies for external hosts with minimum boilerplate
|
||||||
|
name: reverse-proxy
|
||||||
|
appVersion: 1.2.0
|
||||||
|
kubeVersion: ">=1.16.0-0"
|
||||||
|
keywords:
|
||||||
|
- reverse-proxy
|
||||||
|
- ingress
|
||||||
|
home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/reverse-proxy
|
||||||
|
icon: https://kubernetes.io/images/wheel.svg
|
||||||
|
sources:
|
||||||
|
- https://kubernetes.io/docs/concepts/services-networking/ingress/
|
||||||
|
maintainers:
|
||||||
|
- name: angelnu
|
||||||
|
email: git@angelnu.com
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
repository: https://library-charts.k8s-at-home.com
|
||||||
|
version: 3.3.0
|
123
charts/stable/reverse-proxy/README.md
Normal file
123
charts/stable/reverse-proxy/README.md
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
# reverse-proxy
|
||||||
|
|
||||||
|
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: 1.2.0](https://img.shields.io/badge/AppVersion-1.2.0-informational?style=flat-square)
|
||||||
|
|
||||||
|
Creates ingress reverse-proxies for external hosts with minimum boilerplate
|
||||||
|
|
||||||
|
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/k8s-at-home/charts/issues/new/choose)**
|
||||||
|
|
||||||
|
## Source Code
|
||||||
|
|
||||||
|
* <https://kubernetes.io/docs/concepts/services-networking/ingress/>
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Kubernetes: `>=1.16.0-0`
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
| Repository | Name | Version |
|
||||||
|
|------------|------|---------|
|
||||||
|
| https://library-charts.k8s-at-home.com | common | 3.3.0 |
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm repo add k8s-at-home https://k8s-at-home.com/charts/
|
||||||
|
helm repo update
|
||||||
|
helm install reverse-proxy k8s-at-home/reverse-proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installing the Chart
|
||||||
|
|
||||||
|
To install the chart with the release name `reverse-proxy`
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm install reverse-proxy k8s-at-home/reverse-proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
## Uninstalling the Chart
|
||||||
|
|
||||||
|
To uninstall the `reverse-proxy` deployment
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm uninstall reverse-proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
|
||||||
|
Other values may be used from the [values.yaml](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml) from the [common library](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common).
|
||||||
|
|
||||||
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm install reverse-proxy \
|
||||||
|
--set env.TZ="America/New York" \
|
||||||
|
k8s-at-home/reverse-proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm install reverse-proxy k8s-at-home/reverse-proxy -f values.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom configuration
|
||||||
|
|
||||||
|
N/A
|
||||||
|
|
||||||
|
## Values
|
||||||
|
|
||||||
|
**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common)
|
||||||
|
|
||||||
|
| Key | Type | Default | Description |
|
||||||
|
|-----|------|---------|-------------|
|
||||||
|
| generateTLS.enabled | bool | `true` | Enable automatic generation of ingress TLS section based on ingress.hosts.*.host |
|
||||||
|
| generateTLS.secretName | string | default ingress TLS certificate | certificate to use |
|
||||||
|
| ingressPort.http | int | `80` | Ingress port for non-TLS |
|
||||||
|
| ingressPort.tls | int | `443` | Ingress port for TLS |
|
||||||
|
| instances[0].enabled | bool | true | enable this reverse proxy. |
|
||||||
|
| instances[0].externalName | string | `"google.com"` | host name behind this reverse proxy |
|
||||||
|
| instances[0].ingress.annotations | object | `{}` | Provide additional annotations which may be required |
|
||||||
|
| instances[0].ingress.hosts[0].host | string | `"example.cluster.local"` | |
|
||||||
|
| instances[0].ingress.hosts[0].path | string | / | Path. Helm template can be passed |
|
||||||
|
| instances[0].ingress.tls | list | `[{"hosts":["example.cluster.local"],"secretName":null}]` | Configure TLS for the ingress. Both secretName and hosts can process a Helm template. if not set the generateTLS settigs are used |
|
||||||
|
| instances[0].ip | string | `"192.168.1.1"` | IP address behind this reverse proxy Has no effect if externalName is set |
|
||||||
|
| instances[0].name | string | `"example"` | |
|
||||||
|
| instances[0].port | int | 80 | Port used by host behind this reverse proxy |
|
||||||
|
| instances[0].test | bool | true | add a test for this reverse proxy. It can be tested with `helm test <chart_name>` |
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common#changelog).
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
### [1.0.0]
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
|
||||||
|
- Initial version
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
|
||||||
|
- N/A
|
||||||
|
|
||||||
|
#### Removed
|
||||||
|
|
||||||
|
- N/A
|
||||||
|
|
||||||
|
[1.0.0]: #100
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
- See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/)
|
||||||
|
- Open an [issue](https://github.com/k8s-at-home/charts/issues/new/choose)
|
||||||
|
- Ask a [question](https://github.com/k8s-at-home/organization/discussions)
|
||||||
|
- Join our [Discord](https://discord.gg/sTMX7Vh) community
|
||||||
|
|
||||||
|
----------------------------------------------
|
||||||
|
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
|
146
charts/stable/reverse-proxy/README.md.gotmpl
Normal file
146
charts/stable/reverse-proxy/README.md.gotmpl
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
{{- define "custom.repository.organization" -}}
|
||||||
|
k8s-at-home
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.repository.url" -}}
|
||||||
|
https://github.com/k8s-at-home/charts
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.helm.url" -}}
|
||||||
|
https://k8s-at-home.com/charts/
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.helm.path" -}}
|
||||||
|
{{ template "custom.repository.organization" . }}/{{ template "chart.name" . }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.notes" -}}
|
||||||
|
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/k8s-at-home/charts/issues/new/choose)**
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.requirements" -}}
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
{{ template "chart.kubeVersionLine" . }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.dependencies" -}}
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
{{ template "chart.requirementsTable" . }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.install.tldr" -}}
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm repo add {{ template "custom.repository.organization" . }} {{ template "custom.helm.url" . }}
|
||||||
|
helm repo update
|
||||||
|
helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }}
|
||||||
|
```
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.install" -}}
|
||||||
|
## Installing the Chart
|
||||||
|
|
||||||
|
To install the chart with the release name `{{ template "chart.name" . }}`
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }}
|
||||||
|
```
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.uninstall" -}}
|
||||||
|
## Uninstalling the Chart
|
||||||
|
|
||||||
|
To uninstall the `{{ template "chart.name" . }}` deployment
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm uninstall {{ template "chart.name" . }}
|
||||||
|
```
|
||||||
|
|
||||||
|
The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.configuration.header" -}}
|
||||||
|
## Configuration
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.configuration.readValues" -}}
|
||||||
|
Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
|
||||||
|
Other values may be used from the [values.yaml](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml) from the [common library](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common).
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.configuration.example.set" -}}
|
||||||
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm install {{ template "chart.name" . }} \
|
||||||
|
--set env.TZ="America/New York" \
|
||||||
|
{{ template "custom.helm.path" . }}
|
||||||
|
```
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.configuration.example.file" -}}
|
||||||
|
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }} -f values.yaml
|
||||||
|
```
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.valuesSection" -}}
|
||||||
|
## Values
|
||||||
|
|
||||||
|
**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common)
|
||||||
|
|
||||||
|
{{ template "chart.valuesTable" . }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.support" -}}
|
||||||
|
## Support
|
||||||
|
|
||||||
|
- See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/)
|
||||||
|
- Open an [issue](https://github.com/k8s-at-home/charts/issues/new/choose)
|
||||||
|
- Ask a [question](https://github.com/k8s-at-home/organization/discussions)
|
||||||
|
- Join our [Discord](https://discord.gg/sTMX7Vh) community
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{ template "chart.header" . }}
|
||||||
|
|
||||||
|
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
|
||||||
|
|
||||||
|
{{ template "chart.description" . }}
|
||||||
|
|
||||||
|
{{ template "custom.notes" . }}
|
||||||
|
|
||||||
|
{{ template "chart.sourcesSection" . }}
|
||||||
|
|
||||||
|
{{ template "custom.requirements" . }}
|
||||||
|
|
||||||
|
{{ template "custom.dependencies" . }}
|
||||||
|
|
||||||
|
{{ template "custom.install.tldr" . }}
|
||||||
|
|
||||||
|
{{ template "custom.install" . }}
|
||||||
|
|
||||||
|
{{ template "custom.uninstall" . }}
|
||||||
|
|
||||||
|
{{ template "custom.configuration.header" . }}
|
||||||
|
|
||||||
|
{{ template "custom.configuration.readValues" . }}
|
||||||
|
|
||||||
|
{{ template "custom.configuration.example.set" . }}
|
||||||
|
|
||||||
|
{{ template "custom.configuration.example.file" . }}
|
||||||
|
|
||||||
|
{{ template "custom.custom.configuration" . }}
|
||||||
|
|
||||||
|
{{ template "custom.valuesSection" . }}
|
||||||
|
|
||||||
|
{{ template "custom.changelog" . }}
|
||||||
|
|
||||||
|
{{ template "custom.support" . }}
|
||||||
|
|
||||||
|
{{ template "helm-docs.versionFooter" . }}
|
||||||
|
{{ "" }}
|
27
charts/stable/reverse-proxy/README_CHANGELOG.md.gotmpl
Normal file
27
charts/stable/reverse-proxy/README_CHANGELOG.md.gotmpl
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{{- define "custom.changelog.header" -}}
|
||||||
|
## Changelog
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.changelog" -}}
|
||||||
|
{{ template "custom.changelog.header" . }}
|
||||||
|
|
||||||
|
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common#changelog).
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
### [1.0.0]
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
|
||||||
|
- Initial version
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
|
||||||
|
- N/A
|
||||||
|
|
||||||
|
#### Removed
|
||||||
|
|
||||||
|
- N/A
|
||||||
|
|
||||||
|
[1.0.0]: #100
|
||||||
|
{{- end -}}
|
9
charts/stable/reverse-proxy/README_CONFIG.md.gotmpl
Normal file
9
charts/stable/reverse-proxy/README_CONFIG.md.gotmpl
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{{- define "custom.custom.configuration.header" -}}
|
||||||
|
## Custom configuration
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "custom.custom.configuration" -}}
|
||||||
|
{{ template "custom.custom.configuration.header" . }}
|
||||||
|
|
||||||
|
N/A
|
||||||
|
{{- end -}}
|
55
charts/stable/reverse-proxy/ci/ct-values.yaml
Normal file
55
charts/stable/reverse-proxy/ci/ct-values.yaml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# TLS not enabled by default in k3s traefik
|
||||||
|
generateTLS:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
instances:
|
||||||
|
- name: example-ipk
|
||||||
|
test: false
|
||||||
|
ip: 1.1.1.1
|
||||||
|
ingress:
|
||||||
|
annotations:
|
||||||
|
# See https://stackoverflow.com/questions/49431284/forward-to-externalname-with-traefik-in-kubernetes-as-the-documenation-suggests
|
||||||
|
traefik.frontend.passHostHeader: "false"
|
||||||
|
hosts:
|
||||||
|
- host: traefik.kube-system
|
||||||
|
# host: nginx-ingress-nginx-controller.nginx
|
||||||
|
paths:
|
||||||
|
- path: /example-ip
|
||||||
|
|
||||||
|
- name: example-tls
|
||||||
|
test: false
|
||||||
|
ip: 1.1.1.1
|
||||||
|
port: 443
|
||||||
|
ingress:
|
||||||
|
annotations:
|
||||||
|
traefik.frontend.passHostHeader: "false"
|
||||||
|
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
|
||||||
|
traefik.ingress.kubernetes.io/redirect-entry-point: https
|
||||||
|
hosts:
|
||||||
|
- host: traefik.kube-system
|
||||||
|
paths:
|
||||||
|
- path: /example-tls
|
||||||
|
|
||||||
|
- name: example-http
|
||||||
|
test: false
|
||||||
|
externalName: example.com
|
||||||
|
ingress:
|
||||||
|
annotations:
|
||||||
|
traefik.frontend.passHostHeader: "false"
|
||||||
|
hosts:
|
||||||
|
- host: traefik.kube-system
|
||||||
|
paths:
|
||||||
|
- path: /example-http
|
||||||
|
|
||||||
|
- name: example-custom
|
||||||
|
test: false
|
||||||
|
externalName: example.com
|
||||||
|
ingress:
|
||||||
|
annotations:
|
||||||
|
traefik.frontend.passHostHeader: "false"
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- example-custom-tls.cluster.local
|
||||||
|
secretName:
|
||||||
|
hosts:
|
||||||
|
- host: example-custom-tls.cluster.local
|
20
charts/stable/reverse-proxy/templates/NOTES.txt
Normal file
20
charts/stable/reverse-proxy/templates/NOTES.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
The following ingress reverse proxies were deployed:
|
||||||
|
{{- range $instance := .Values.instances }}
|
||||||
|
{{- $reference := printf "%s:%.0f" (default .externalName .ip) ( .port | default 80.0 ) }}
|
||||||
|
{{- if or ( not ( hasKey . "enabled" ) ) .enabled }}
|
||||||
|
{{- range $host := $instance.ingress.hosts }}
|
||||||
|
{{- if not .paths }}
|
||||||
|
{{- $_ := set . "paths" ( list ( dict "path" "/" ) ) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $schema := "http" }}
|
||||||
|
{{- $ingressPort := $.Values.ingressPort.http }}
|
||||||
|
{{- if or $.Values.generateTLS.enabled (hasKey $instance.ingress "tls" ) }}
|
||||||
|
{{- $schema = "https" }}
|
||||||
|
{{- $ingressPort = $.Values.ingressPort.tls }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .paths }}
|
||||||
|
- {{ $schema }}://{{ $host.host }}:{{ $ingressPort }}{{ .path }} -> {{ $reference }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
20
charts/stable/reverse-proxy/templates/common.yaml
Normal file
20
charts/stable/reverse-proxy/templates/common.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{{/* Make sure all variables are set properly */}}
|
||||||
|
{{- include "common.values.setup" . }}
|
||||||
|
|
||||||
|
{{/* Append the hardcoded settings */}}
|
||||||
|
{{- define "reverse-proxy.harcodedValues" -}}
|
||||||
|
|
||||||
|
# Disable Deployment
|
||||||
|
controller:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
# Disable Service
|
||||||
|
service:
|
||||||
|
main:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
{{- $_ := mergeOverwrite .Values (include "reverse-proxy.harcodedValues" . | fromYaml) -}}
|
||||||
|
|
||||||
|
{{/* Render the templates */}}
|
||||||
|
{{ include "common.all" . }}
|
18
charts/stable/reverse-proxy/templates/endpoint.yaml
Normal file
18
charts/stable/reverse-proxy/templates/endpoint.yaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{{- range .Values.instances }}
|
||||||
|
{{- if or ( not ( hasKey . "enabled" ) ) .enabled }}
|
||||||
|
{{- if .ip -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Endpoints
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" $ }}-{{ .name }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels" $ | nindent 4 }}
|
||||||
|
subsets:
|
||||||
|
- addresses:
|
||||||
|
- ip: {{ .ip }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .port | default 80 }}
|
||||||
|
---
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
60
charts/stable/reverse-proxy/templates/ingress.yaml
Normal file
60
charts/stable/reverse-proxy/templates/ingress.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
{{- range .Values.instances }}
|
||||||
|
{{- if or ( not ( hasKey . "enabled" ) ) .enabled }}
|
||||||
|
{{- $name := printf "%s-%s" (include "common.names.fullname" $) .name }}
|
||||||
|
{{- $svcPort := .port | default 80 }}
|
||||||
|
---
|
||||||
|
apiVersion: {{ include "common.capabilities.ingress.apiVersion" $ }}
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels" $ | nindent 4 }}
|
||||||
|
{{- with .ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .ingress.ingressClassName }}
|
||||||
|
ingressClassName: {{ .ingressClassName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .ingress.tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ tpl . $ | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .secretName }}
|
||||||
|
secretName: {{ tpl .secretName $ | quote}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if $.Values.generateTLS.enabled }}
|
||||||
|
tls:
|
||||||
|
{{- range .ingress.hosts }}
|
||||||
|
- hosts:
|
||||||
|
- {{ tpl .host $ | quote }}
|
||||||
|
{{- if $.Values.generateTLS.secretName }}
|
||||||
|
secretName: {{ tpl $.Values.generateTLS.secretName $ | quote}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .ingress.hosts }}
|
||||||
|
- host: {{ tpl .host $ | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- if not .paths }}
|
||||||
|
{{- $_ := set . "paths" ( list ( dict "path" "/" ) ) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .paths }}
|
||||||
|
- path: {{ tpl .path $ | quote }}
|
||||||
|
pathType: {{ default "Prefix" .pathType }}
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: {{ $name }}
|
||||||
|
port:
|
||||||
|
number: {{ $svcPort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
19
charts/stable/reverse-proxy/templates/service.yaml
Normal file
19
charts/stable/reverse-proxy/templates/service.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{{- range .Values.instances }}
|
||||||
|
{{- if or ( not ( hasKey . "enabled" ) ) .enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" $ }}-{{ .name }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels" $ | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
{{- if .externalName }}
|
||||||
|
type: ExternalName
|
||||||
|
externalName: {{ .externalName }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: {{ .port | default 80 }}
|
||||||
|
---
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,44 @@
|
|||||||
|
{{- $wget_opts := printf "--spider -T %0.f" .Values.connectionTest.readtimeout }}
|
||||||
|
{{- range $instance := .Values.instances }}
|
||||||
|
{{- if or ( not ( hasKey $instance "enabled" ) ) $instance.enabled }}
|
||||||
|
{{- if or ( not ( hasKey $instance "test" ) ) ( $instance.test ) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: "{{ include "common.names.fullname" $ }}-{{ .name }}-test-connection"
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels" $ | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": test-success
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wget
|
||||||
|
image: busybox
|
||||||
|
command: ['sh']
|
||||||
|
args:
|
||||||
|
- '-ecx'
|
||||||
|
- |
|
||||||
|
{{- range $host := $instance.ingress.hosts }}
|
||||||
|
{{- if not .paths }}
|
||||||
|
{{- $_ := set . "paths" ( list ( dict "path" "/" ) ) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $schema := "http" }}
|
||||||
|
{{- $ingressPort := $.Values.ingressPort.http }}
|
||||||
|
{{- if or $.Values.generateTLS.enabled (hasKey $instance.ingress "tls" ) }}
|
||||||
|
{{- $schema = "https" }}
|
||||||
|
{{- $ingressPort = $.Values.ingressPort.tls }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .paths }}
|
||||||
|
for i in $(seq 1 {{ $.Values.connectionTest.tries }}); do
|
||||||
|
[ $i -gt 1 ] && sleep {{ $.Values.connectionTest.waitretry }}
|
||||||
|
wget {{ $wget_opts }} {{ $schema }}://{{ $host.host }}:{{ $ingressPort }}{{ .path }} && s=0 && break || s=$?
|
||||||
|
done
|
||||||
|
[ $s -gt 0 ] && exit $s
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
exit 0
|
||||||
|
restartPolicy: Never
|
||||||
|
---
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
60
charts/stable/reverse-proxy/values.yaml
Normal file
60
charts/stable/reverse-proxy/values.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#
|
||||||
|
# IMPORTANT NOTE
|
||||||
|
#
|
||||||
|
# This chart inherits from our common library chart. You can check the default values/options here:
|
||||||
|
# https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml
|
||||||
|
#
|
||||||
|
|
||||||
|
generateTLS:
|
||||||
|
# -- Enable automatic generation of ingress TLS section
|
||||||
|
# based on ingress.hosts.*.host
|
||||||
|
enabled: true
|
||||||
|
# -- certificate to use
|
||||||
|
# @default -- default ingress TLS certificate
|
||||||
|
secretName: ""
|
||||||
|
|
||||||
|
instances:
|
||||||
|
- name: example
|
||||||
|
# -- enable this reverse proxy.
|
||||||
|
# @default -- true
|
||||||
|
enabled: false
|
||||||
|
# -- add a test for this reverse proxy.
|
||||||
|
# It can be tested with `helm test <chart_name>`
|
||||||
|
# @default -- true
|
||||||
|
test: true
|
||||||
|
# -- host name behind this reverse proxy
|
||||||
|
externalName: google.com
|
||||||
|
# -- IP address behind this reverse proxy
|
||||||
|
# Has no effect if externalName is set
|
||||||
|
ip: 192.168.1.1
|
||||||
|
# -- Port used by host behind this reverse proxy
|
||||||
|
# @default -- 80
|
||||||
|
port: 80
|
||||||
|
ingress:
|
||||||
|
# -- Provide additional annotations which may be required
|
||||||
|
annotations: {}
|
||||||
|
# -- Configure TLS for the ingress. Both secretName and hosts can process a Helm template.
|
||||||
|
# if not set the generateTLS settigs are used
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- example.cluster.local
|
||||||
|
secretName:
|
||||||
|
hosts:
|
||||||
|
- host: example.cluster.local
|
||||||
|
# -- Path. Helm template can be passed
|
||||||
|
# @default -- /
|
||||||
|
path: /
|
||||||
|
|
||||||
|
ingressPort:
|
||||||
|
# -- Ingress port for non-TLS
|
||||||
|
http: 80
|
||||||
|
# -- Ingress port for TLS
|
||||||
|
tls: 443
|
||||||
|
|
||||||
|
connectionTest:
|
||||||
|
# -- seconds to wait before next retry
|
||||||
|
waitretry: 2
|
||||||
|
# -- second to wait in case no data is received and then try again
|
||||||
|
readtimeout: 2
|
||||||
|
# -- tries to connect
|
||||||
|
tries: 30
|
Loading…
Reference in New Issue
Block a user