Skip to content

Commit 2c27705

Browse files
authored
Merge pull request #220 from devtron-labs/haproxy-ingress
feat: Added haproxy-ingress
2 parents 3e94d85 + 9de4d92 commit 2c27705

33 files changed

+2310
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v2
2+
appVersion: v0.14.6
3+
description: Ingress controller for HAProxy loadbalancer
4+
icon: https://haproxy-ingress.github.io/favicons/favicon-256.png
5+
keywords:
6+
- haproxy
7+
- ingress
8+
name: jcmhproxy-ingress
9+
type: application
10+
version: 0.14.6

charts/jcmhproxy-ingress/README.md

Lines changed: 277 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
HAProxy Ingress has been installed!
2+
3+
{{- if contains "NodePort" .Values.controller.service.type }}
4+
5+
HAProxy is exposed as a `NodePort` type service.
6+
Get the application URL by running these commands:
7+
8+
export HTTP_NODE_PORT=$(kubectl --namespace {{ .Release.Namespace }} get services -o jsonpath="{.spec.ports[0].nodePort}" {{ include "haproxy-ingress.fullname" . }})
9+
export HTTPS_NODE_PORT=$(kubectl --namespace {{ .Release.Namespace }} get services -o jsonpath="{.spec.ports[1].nodePort}" {{ include "haproxy-ingress.fullname" . }})
10+
export NODE_IP=$(kubectl --namespace {{ .Release.Namespace }} get nodes -o jsonpath="{.items[0].status.addresses[1].address}")
11+
12+
echo "Visit http://$NODE_IP:$HTTP_NODE_PORT to access your application via HTTP."
13+
echo "Visit https://$NODE_IP:$HTTPS_NODE_PORT to access your application via HTTPS."
14+
15+
{{- else if contains "LoadBalancer" .Values.controller.service.type }}
16+
17+
HAProxy is exposed as a `LoadBalancer` type service.
18+
It may take a few minutes for the LoadBalancer IP to be available.
19+
You can watch the status by running:
20+
21+
kubectl --namespace {{ .Release.Namespace }} get services {{ include "haproxy-ingress.fullname" . }} -o wide -w
22+
23+
{{- else if contains "ClusterIP" .Values.controller.service.type }}
24+
25+
HAProxy is exposed as a `ClusterIP` type service.
26+
Get the application URL by running these commands:
27+
28+
export POD_NAME=$(kubectl --namespace {{ .Release.Namespace }} get pods -o jsonpath="{.items[0].metadata.name}" -l "app={{ include "haproxy-ingress.name" . }},component={{ .Values.controller.name }},release={{ .Release.Name }}")
29+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
30+
echo "Visit http://127.0.0.1:8080 to access your application."
31+
32+
{{- end }}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{{/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2+
*
3+
* Name (defaults to "haproxy-ingress") and a fully qualified name
4+
* (defaults to "<release>-haproxy-ingress") of controller and a variant with `.Values.defaultBackend.name`
5+
* for the default backend.
6+
*
7+
* We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
8+
* If release name contains the chart name, it will be used as a full name.
9+
*
10+
*/}}
11+
{{- define "haproxy-ingress.name" -}}
12+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
13+
{{- end }}
14+
15+
{{- define "haproxy-ingress.fullname" -}}
16+
{{- if .Values.fullnameOverride }}
17+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
18+
{{- else }}
19+
{{- $name := default .Chart.Name .Values.nameOverride }}
20+
{{- if contains $name .Release.Name }}
21+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
22+
{{- else }}
23+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
24+
{{- end }}
25+
{{- end }}
26+
{{- end }}
27+
28+
{{- define "haproxy-ingress.defaultBackend.name" -}}
29+
{{- printf "%s-%s" .Chart.Name .Values.defaultBackend.name | trunc 63 | trimSuffix "-" }}
30+
{{- end }}
31+
32+
{{- define "haproxy-ingress.defaultBackend.fullname" -}}
33+
{{- $name := default .Chart.Name .Values.nameOverride }}
34+
{{- if contains $name .Release.Name }}
35+
{{- printf "%s-%s" .Release.Name .Values.defaultBackend.name | trunc 63 | trimSuffix "-" }}
36+
{{- else }}
37+
{{- printf "%s-%s-%s" .Release.Name $name .Values.defaultBackend.name | trunc 63 | trimSuffix "-" }}
38+
{{- end }}
39+
{{- end }}
40+
41+
42+
{{/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
43+
*
44+
* Common and selector labels
45+
*
46+
* We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
47+
*
48+
*/}}
49+
{{- define "haproxy-ingress.chart" -}}
50+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
51+
{{- end }}
52+
53+
{{- define "haproxy-ingress.labels" -}}
54+
helm.sh/chart: {{ include "haproxy-ingress.chart" . }}
55+
{{ include "haproxy-ingress.selectorLabels" . }}
56+
{{- if .Chart.AppVersion }}
57+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
58+
{{- end }}
59+
app.kubernetes.io/managed-by: {{ .Release.Service }}
60+
{{- end }}
61+
62+
{{- define "haproxy-ingress.selectorLabels" -}}
63+
app.kubernetes.io/name: {{ include "haproxy-ingress.name" . }}
64+
app.kubernetes.io/instance: {{ .Release.Name }}
65+
{{- end }}
66+
67+
{{- define "haproxy-ingress.defaultBackend.labels" -}}
68+
helm.sh/chart: {{ include "haproxy-ingress.chart" . }}
69+
{{ include "haproxy-ingress.defaultBackend.selectorLabels" . }}
70+
{{- if .Chart.AppVersion }}
71+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
72+
{{- end }}
73+
app.kubernetes.io/managed-by: {{ .Release.Service }}
74+
{{- end }}
75+
76+
{{- define "haproxy-ingress.defaultBackend.selectorLabels" -}}
77+
app.kubernetes.io/name: {{ include "haproxy-ingress.defaultBackend.name" . }}
78+
app.kubernetes.io/instance: {{ .Release.Name }}
79+
{{- end }}
80+
81+
82+
{{/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
83+
*
84+
* Create the name of the service account to use
85+
*
86+
*/}}
87+
{{- define "haproxy-ingress.serviceAccountName" -}}
88+
{{- if .Values.serviceAccount.create }}
89+
{{- default (include "haproxy-ingress.fullname" .) .Values.serviceAccount.name }}
90+
{{- else }}
91+
{{- default "default" .Values.serviceAccount.name }}
92+
{{- end }}
93+
{{- end }}
94+
95+
96+
{{/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
97+
*
98+
* Construct the path for publish-service
99+
*
100+
*/}}
101+
{{- define "haproxy-ingress.controller.publishServicePath" -}}
102+
{{- if .Values.controller.publishService.pathOverride }}
103+
{{- .Values.controller.publishService.pathOverride | trimSuffix "-" }}
104+
{{- else }}
105+
{{- printf "%s/%s" "$(POD_NAMESPACE)" (include "haproxy-ingress.fullname" .) | trimSuffix "-" }}
106+
{{- end }}
107+
{{- end }}

0 commit comments

Comments
 (0)