Add Listen Port to Ingress
This commit is contained in:
parent
b01ec6a09a
commit
72b40a3c66
5 changed files with 18 additions and 3 deletions
|
|
@ -33,6 +33,8 @@ There are two ways to install EasyHAProxy in a Kubernetes cluster. You can use K
|
||||||
3.1. Using Kubernetes Manifest
|
3.1. Using Kubernetes Manifest
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
kubectl create namespace easyhaproxy
|
||||||
|
|
||||||
kubectl apply -f \
|
kubectl apply -f \
|
||||||
https://raw.githubusercontent.com/haproxytech/kubernetes-ingress/master/deploy/haproxy-ingress-daemonset.yaml
|
https://raw.githubusercontent.com/haproxytech/kubernetes-ingress/master/deploy/haproxy-ingress-daemonset.yaml
|
||||||
```
|
```
|
||||||
|
|
@ -45,7 +47,7 @@ Minimal configuration
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
helm repo add byjg https://opensource.byjg.com/helm
|
helm repo add byjg https://opensource.byjg.com/helm
|
||||||
helm repo update
|
helm repo update byjg
|
||||||
kubectl create namespace easyhaproxy
|
kubectl create namespace easyhaproxy
|
||||||
helm upgrade --install ingress byjg/easyhaproxy \
|
helm upgrade --install ingress byjg/easyhaproxy \
|
||||||
--namespace easyhaproxy \
|
--namespace easyhaproxy \
|
||||||
|
|
@ -68,6 +70,8 @@ easyhaproxy:
|
||||||
easyhaproxy: DEBUG
|
easyhaproxy: DEBUG
|
||||||
haproxy: DEBUG
|
haproxy: DEBUG
|
||||||
|
|
||||||
|
listen_extra_ports: []
|
||||||
|
|
||||||
# Make sure to create this
|
# Make sure to create this
|
||||||
masterNode:
|
masterNode:
|
||||||
label: easyhaproxy/node
|
label: easyhaproxy/node
|
||||||
|
|
@ -120,6 +124,7 @@ Caveats:
|
||||||
| easyhaproxy.letsencrypt | (optional) Boolean. It will request letsencript certificates for the ingresses domains. | false | true or false
|
| easyhaproxy.letsencrypt | (optional) Boolean. It will request letsencript certificates for the ingresses domains. | false | true or false
|
||||||
| easyhaproxy.redirect | (optional) Json. Specific a domain and its destination. | *empty* | {"domain":"redirect_url"}
|
| easyhaproxy.redirect | (optional) Json. Specific a domain and its destination. | *empty* | {"domain":"redirect_url"}
|
||||||
| easyhaproxy.mode | (optional) Set the HTTP mode for that connection. | http | http or tcp
|
| easyhaproxy.mode | (optional) Set the HTTP mode for that connection. | http | http or tcp
|
||||||
|
| easyhaproxy.listen_port | (optional) Set the an additional port for that ingress | http | http or tcp
|
||||||
|
|
||||||
**Important**: The annotations are per ingress and applied to all hosts in that ingress configuration.
|
**Important**: The annotations are per ingress and applied to all hosts in that ingress configuration.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ type: application
|
||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,11 @@ spec:
|
||||||
- name: stats
|
- name: stats
|
||||||
containerPort: 1936
|
containerPort: 1936
|
||||||
hostPort: 1936
|
hostPort: 1936
|
||||||
|
{{ range .Values.listen_extra_ports }}
|
||||||
|
- name: extra_{{ . }}
|
||||||
|
containerPort: {{ . }}
|
||||||
|
hostPort: {{ . }}
|
||||||
|
{{- end }}
|
||||||
resources:
|
resources:
|
||||||
{{- toYaml .Values.resources | nindent 12 }}
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ easyhaproxy:
|
||||||
easyhaproxy: DEBUG
|
easyhaproxy: DEBUG
|
||||||
haproxy: DEBUG
|
haproxy: DEBUG
|
||||||
|
|
||||||
|
listen_extra_ports: []
|
||||||
|
|
||||||
# Make sure to create this
|
# Make sure to create this
|
||||||
masterNode:
|
masterNode:
|
||||||
label: easyhaproxy/node
|
label: easyhaproxy/node
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,9 @@ class Kubernetes(ProcessorInterface):
|
||||||
redirect_ssl = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.redirect_ssl")
|
redirect_ssl = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.redirect_ssl")
|
||||||
redirect = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.redirect")
|
redirect = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.redirect")
|
||||||
mode = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.mode")
|
mode = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.mode")
|
||||||
|
listen_port = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.listen_port")
|
||||||
|
if listen_port is None:
|
||||||
|
listen_port = 80
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
data["creation_timestamp"] = ingress.metadata.creation_timestamp.strftime("%x %X")
|
data["creation_timestamp"] = ingress.metadata.creation_timestamp.strftime("%x %X")
|
||||||
|
|
@ -191,7 +194,7 @@ class Kubernetes(ProcessorInterface):
|
||||||
port_number = rule.http.paths[0].backend.service.port.number
|
port_number = rule.http.paths[0].backend.service.port.number
|
||||||
definition = "easyhaproxy.%s_%s" % (rule.host.replace(".", "-"), port_number)
|
definition = "easyhaproxy.%s_%s" % (rule.host.replace(".", "-"), port_number)
|
||||||
rule_data["%s.host" % (definition)] = rule.host
|
rule_data["%s.host" % (definition)] = rule.host
|
||||||
rule_data["%s.port" % (definition)] = "80"
|
rule_data["%s.port" % (definition)] = listen_port
|
||||||
rule_data["%s.localport" % (definition)] = port_number
|
rule_data["%s.localport" % (definition)] = port_number
|
||||||
if rule.host in ssl_hosts:
|
if rule.host in ssl_hosts:
|
||||||
rule_data["%s.clone_to_ssl" % (definition)] = 'true'
|
rule_data["%s.clone_to_ssl" % (definition)] = 'true'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue