Skip to content

Commit

Permalink
Allow to disable port on services.
Browse files Browse the repository at this point in the history
When using service as load balancer, if we setup ldap to be on secure
port only we don't want to expose the insecure port.
Currently there is no way to do that.

With this modification, users can enable or disable exposition of
insecure or secure port on the service.

Default values keep the current behaviour.

Signed-off-by: Guillaume Perrin <guillaume28.perrin@gmail.com>
  • Loading branch information
guillomep committed Apr 19, 2024
1 parent 506808b commit ffc30c3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
- bitnami-common
version: ~2
home: https://www.openldap.org
version: 4.2.2
version: 4.2.3
appVersion: 2.6.6
description: Community developed LDAP software
icon: https://raw.githubusercontent.com/jp-gouin/helm-openldap/master/logo.png
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ Parameters related to Kubernetes.
| `extraDeploy` | extraDeploy Array of extra objects to deploy with the release | `""` |
| `service.annotations` | Annotations to add to the service | `{}` |
| `service.externalIPs` | Service external IP addresses | `[]` |
| `service.enableLdapPort` | Enable LDAP port on the service and headless service | `true` |
| `service.enableSslLdapPort` | Enable SSL LDAP port on the service and headless service | `true` |
| `service.ldapPortNodePort` | Nodeport of External service port for LDAP if service.type is NodePort | `nil` |
| `service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` |
| `service.loadBalancerSourceRanges` | List of IP CIDRs allowed access to load balancer (if supported) | `[]` |
Expand Down
4 changes: 4 additions & 0 deletions templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ spec:
loadBalancerSourceRanges: {{ toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
ports:
{{- if .Values.service.enableLdapPort }}
- name: ldap-port
protocol: TCP
port: {{ .Values.global.ldapPort }}
Expand All @@ -33,6 +34,8 @@ spec:
{{- else if eq .Values.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- end }}
{{- if .Values.service.enableSslLdapPort }}
- name: ssl-ldap-port
protocol: TCP
port: {{ .Values.global.sslLdapPort }}
Expand All @@ -42,6 +45,7 @@ spec:
{{- else if eq .Values.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- end }}
sessionAffinity: {{ .Values.service.sessionAffinity }}
selector:
app.kubernetes.io/component: {{ template "openldap.fullname" . }}
Expand Down
9 changes: 8 additions & 1 deletion templates/svc-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ metadata:
heritage: {{ .Release.Service }}
spec:
ports:
{{- if .Values.service.enableLdapPort }}
- port: {{ .Values.global.ldapPort }}
name: ldap-port
targetPort: ldap-port
{{- end }}
{{- if .Values.service.enableSslLdapPort }}
- port: {{ .Values.global.sslLdapPort }}
name: ssl-ldap-port
targetPort: ssl-ldap-port
{{- end }}
clusterIP: None
selector:
app.kubernetes.io/component: {{ template "openldap.fullname" . }}
release: {{ .Release.Name }}
type: ClusterIP
sessionAffinity: None
sessionAffinity: None
5 changes: 5 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ service:
## If service type NodePort, define the value here
#ldapPortNodePort:
#sslLdapPortNodePort:

# Disable if you do not want to expose port on service
enableLdapPort: true
enableSslLdapPort: true

## List of IP addresses at which the service is available
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
##
Expand Down

0 comments on commit ffc30c3

Please sign in to comment.