-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenldap-k8s.yaml
212 lines (211 loc) · 4.7 KB
/
openldap-k8s.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# kubectl create ns auth-system
# wget -q https://raw.githubusercontent.com/cloudcafetech/k8s-ad-integration/main/ldap-records.ldif
# ldapadd -x -H ldap://$HIP:30389 -D "cn=admin,dc=cloudcafe,dc=org" -w StrongAdminPassw0rd -f ldap-records.ldif
# ldapsearch -x -H ldap://$HIP:30389 -D "cn=admin,dc=cloudcafe,dc=org" -b "dc=cloudcafe,dc=org" -w "StrongAdminPassw0rd"
apiVersion: v1
kind: ConfigMap
metadata:
name: openldap
namespace: auth-system
data:
LDAP_DOMAIN: cloudcafe.org
LDAP_ORGANISATION: cloudcafe
LDAP_TLS_VERIFY_CLIENT: try
---
apiVersion: v1
kind: Secret
metadata:
name: openldap
namespace: auth-system
type: Opaque
data:
LDAP_ADMIN_PASSWORD: U3Ryb25nQWRtaW5QYXNzdzByZA==
LDAP_BINDPASS: U3Ryb25nQWRtaW5QYXNzdzByZA==
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: openldap-pvc-data
namespace: auth-system
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: openldap-pvc-etc
namespace: auth-system
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
labels:
app: openldap
name: openldap
namespace: auth-system
spec:
type: "NodePort"
ports:
- name: "port-689"
port: 689
protocol: TCP
targetPort: 689
- name: "port-389"
port: 389
protocol: TCP
targetPort: 389
nodePort: 30389
selector:
app: openldap
---
apiVersion: v1
kind: Service
metadata:
name: ldap-pass
namespace: auth-system
spec:
ports:
- name: ldap-pass-http
port: 8765
protocol: TCP
targetPort: 80
selector:
app: ldap-pass
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: openldap
name: openldap
namespace: auth-system
spec:
replicas: 1
selector:
matchLabels:
app: openldap
template:
metadata:
labels:
app: openldap
spec:
containers:
- image: docker.io/osixia/openldap:latest
name: openldap
envFrom:
- configMapRef:
name: openldap
- secretRef:
name: openldap
ports:
- name: "port-389"
containerPort: 389
- name: "port-689"
containerPort: 689
volumeMounts:
- name: openldap-pvc-data
mountPath: "/var/lib/ldap"
- name: openldap-pvc-etc
mountPath: "/etc/ldap/slapd.d"
volumes:
- name: openldap-pvc-data
persistentVolumeClaim:
claimName: openldap-pvc-data
- name: openldap-pvc-etc
persistentVolumeClaim:
claimName: openldap-pvc-etc
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: ldap-pass
name: ldap-pass
namespace: auth-system
spec:
replicas: 1
selector:
matchLabels:
app: ldap-pass
template:
metadata:
labels:
app: ldap-pass
spec:
containers:
- image: docker.io/tiredofit/self-service-password:latest
name: ldap-pass
envFrom:
- secretRef:
name: openldap
env:
- name: LDAP_SERVER
value: ldap://openldap.auth-system:389
- name: LDAP_BASE_SEARCH
value: ou=people,dc=cloudcafe,dc=org
- name: LDAP_BINDDN
value: cn=admin,dc=cloudcafe,dc=org
- name: LDAP_FULLNAME_ATTRIBUTE
value: cn
- name: LDAP_LOGIN_ATTRIBUTE
value: mail
- name: LDAP_MAIL_ATTRIBUTE
value: mail
- name: MAIL_FROM
value: noreply@example.com
- name: MAIL_FROM_NAME
value: Self Service Password
- name: SMTP_HOST
value: smtp.example.com
- name: SMTP_PASS
value: smtppassword
- name: SMTP_PORT
value: "587"
- name: SMTP_SECURE_TYPE
value: tls
- name: SMTP_TIMEOUT
value: "30"
- name: SMTP_USER
value: noreply@example.com
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: selfsigned-issuer
#cert-manager.io/cluster-issuer: private-ca
nginx.ingress.kubernetes.io/proxy-body-size: "0"
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
name: ldap-pass
namespace: auth-system
spec:
ingressClassName: nginx
tls:
- hosts:
- passchange.apps.k8s.cloudcafe.tech
secretName: ldap-pass-cert
rules:
- host: passchange.apps.k8s.cloudcafe.tech
http:
paths:
- backend:
service:
name: ldap-pass
port:
number: 8765
path: /
pathType: Prefix