Skip to content

Commit

Permalink
Make containerPort and hostPort customizable (#4252)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome authored Aug 21, 2023
1 parent c44b1a5 commit b79e90b
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 10 deletions.
14 changes: 8 additions & 6 deletions deployments/helm-chart/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ spec:
{{ toYaml .Values.controller.lifecycle | indent 10 }}
{{- end }}
ports:
- name: http
containerPort: 80
hostPort: 80
- name: https
containerPort: 443
hostPort: 443
{{- range $key, $value := .Values.controller.containerPort }}
- name: {{ $key }}
containerPort: {{ $value }}
protocol: TCP
{{- if and $.Values.controller.hostPort.enable (index $.Values.controller.hostPort $key) }}
hostPort: {{ index $.Values.controller.hostPort $key }}
{{- end }}
{{- end }}
{{ if .Values.controller.customPorts }}
{{ toYaml .Values.controller.customPorts | indent 8 }}
{{ end }}
Expand Down
12 changes: 8 additions & 4 deletions deployments/helm-chart/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ spec:
{{ toYaml .Values.controller.lifecycle | indent 10 }}
{{- end }}
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
{{- range $key, $value := .Values.controller.containerPort }}
- name: {{ $key }}
containerPort: {{ $value }}
protocol: TCP
{{- if and $.Values.controller.hostPort.enable (index $.Values.controller.hostPort $key) }}
hostPort: {{ index $.Values.controller.hostPort $key }}
{{- end }}
{{- end }}
{{- if .Values.controller.customPorts }}
{{ toYaml .Values.controller.customPorts | indent 8 }}
{{- end }}
Expand Down
29 changes: 29 additions & 0 deletions deployments/helm-chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,35 @@
true
]
},
"hostPort": {
"type": "object",
"default": {},
"title": "The hostPort Schema",
"patternProperties": {
"^.*$": {
"anyOf": [
{
"$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.api.core.v1.ContainerPort/properties/hostPort"
},
{
"type": "boolean"
}
]
}
},
"additionalProperties": false
},
"containerPort": {
"type": "object",
"default": {},
"title": "The containerPort Schema",
"patternProperties": {
"^.*$": {
"$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.api.core.v1.ContainerPort/properties/containerPort"
}
},
"additionalProperties": false
},
"dnsPolicy": {
"type": "string",
"allOf": [
Expand Down
18 changes: 18 additions & 0 deletions deployments/helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ controller:
## Enables the Ingress Controller pods to use the host's network namespace.
hostNetwork: false

## The hostPort configuration for the Ingress Controller pods.
hostPort:
## Enables hostPort for the Ingress Controller pods.
enable: false

## The HTTP hostPort configuration for the Ingress Controller pods.
http: 80

## The HTTPS hostPort configuration for the Ingress Controller pods.
https: 443

containerPort:
## The HTTP containerPort configuration for the Ingress Controller pods.
http: 80

## The HTTPS containerPort configuration for the Ingress Controller pods.
https: 443

## DNS policy for the Ingress Controller pods
dnsPolicy: ClusterFirst

Expand Down

0 comments on commit b79e90b

Please sign in to comment.