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 <[email protected]>
  • Loading branch information
guillomep committed Jan 10, 2024
1 parent af8ea7c commit d916647
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
- bitnami-common
version: 1.x.x
home: https://www.openldap.org
version: 4.1.2
version: 4.1.3
appVersion: 2.6.3
description: Community developed LDAP software
icon: https://raw.githubusercontent.com/jp-gouin/helm-openldap/master/logo.png
Expand All @@ -27,4 +27,4 @@ sources:
maintainers:
- name: Jean-Philippe Gouin
email: [email protected]
engine: gotpl
engine: gotpl
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,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 @@ -70,6 +70,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 d916647

Please sign in to comment.