Skip to content

Commit 2e1e56d

Browse files
authored
Update chart structure and use latest release. (#6)
1 parent a20705a commit 2e1e56d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1569
-423
lines changed

.bin/disableLdapPort.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
logLevel: debug
2+
resources:
3+
limits:
4+
cpu: "128m"
5+
memory: "64Mi"
6+
replicaCount: 3
7+
customLdifFiles:
8+
00-root.ldif: |-
9+
# Root creation
10+
dn: dc=example,dc=org
11+
objectClass: dcObject
12+
objectClass: organization
13+
o: Example, Inc
14+
service:
15+
enableLdapPort: false
16+
sslLdapPortNodePort: 30636
17+
type: NodePort
18+
initTLSSecret:
19+
tls_enabled: true

.bin/ldif2json

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ BEGIN {
107107
printf(",\n%s:{%s}", json_dict_key, join(json_record, ","))
108108
}
109109
} else {
110-
printf "\n\nKey %s was not found in parsed LDIF record\n\n", key
111-
for (a in attrs) printf "- %s -- %s\n", a, attrs[a][1]
110+
#printf "\n\nKey %s was not found in parsed LDIF record\n\n", key
111+
#for (a in attrs) printf "- %s -- %s\n", a, attrs[a][1]
112112
}
113113

114114
break

.bin/ldif2json.awk

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/usr/bin/env -S gawk -f
2+
3+
# Convert LDIF into JSON
4+
5+
# MIT License
6+
# Copyright (c) 2017 Christopher Harrison
7+
8+
function json_string(str) {
9+
# Convert backslashes to double-backslashes
10+
str = gensub("\\\\", "\\\\\\\\", "g", str)
11+
# Convert a string into an escaped JSON string, with enclosing quotes
12+
return "\"" gensub(/"/, "\\\\\"", "g", str) "\""
13+
}
14+
15+
BEGIN {
16+
FS = "::? "
17+
ORS = ""
18+
19+
in_dn = 0
20+
first_dn = 0
21+
22+
# Array of results
23+
print "["
24+
}
25+
26+
/^#/ || $1 == "version" || $1 == "search" || $1 == "result" {
27+
# Skip comments, version and ldapsearch result entities
28+
next
29+
}
30+
31+
$1 == "dn" {
32+
# We've found an entity
33+
if (first_dn) print ","
34+
print "{"
35+
36+
in_dn = 1
37+
first_dn = 1
38+
39+
# Reset attributes
40+
delete attributes
41+
}
42+
43+
in_dn {
44+
if (NF == 2) {
45+
# New attribute
46+
last_attr = $1
47+
attr_index = 1
48+
if (last_attr in attributes) attr_index = length(attributes[last_attr]) + 1
49+
value = $2
50+
51+
} else {
52+
# Continuation of previous attribute
53+
attr_index = length(attributes[last_attr])
54+
value = attributes[last_attr][attr_index] gensub(/^ /, "", 1)
55+
}
56+
57+
attributes[last_attr][attr_index] = value
58+
}
59+
60+
in_dn && /^$/ {
61+
# Write attributes
62+
first_attr = 0
63+
for (attr in attributes) {
64+
if (first_attr) print ","
65+
print json_string(attr) ":"
66+
first_attr = 1
67+
68+
if (length(attributes[attr]) == 1) {
69+
# Scalar attribute
70+
print json_string(attributes[attr][1])
71+
72+
} else {
73+
# Array attribute
74+
print "["
75+
76+
first_arr = 0
77+
for (i in attributes[attr]) {
78+
if (first_arr) print ","
79+
print json_string(attributes[attr][i])
80+
first_arr = 1
81+
}
82+
83+
print "]"
84+
}
85+
}
86+
87+
# End of entity
88+
print "}"
89+
in_dn = 0
90+
}
91+
92+
END {
93+
# End of array
94+
print "]"
95+
}

.bin/local-test.sh

+24-17
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if ! kind get clusters -q | grep -q $KIND_CLUSTER_NAME; then
3636
# https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration
3737
# See: https://github.com/containerd/containerd/blob/main/docs/hosts.md
3838
info "Creating a Kind/Kubernetes cluster"
39-
cat <<EOF | kind create cluster --name $KIND_CLUSTER_NAME --image=kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c --config=-
39+
cat <<EOF | kind create cluster --name $KIND_CLUSTER_NAME --image=kindest/node:v1.29.4@sha256:3abb816a5b1061fb15c6e9e60856ec40d56b7b52bcea5f5f1350bc6e2320b6f8 --config=-
4040
kind: Cluster
4141
apiVersion: kind.x-k8s.io/v1alpha4
4242
nodes:
@@ -127,25 +127,29 @@ if ! kubectl get namespace | grep -q projectcontour; then
127127
# https://tanzu.vmware.com/developer/guides/service-routing-contour-refarch/
128128
kubectl apply -f https://projectcontour.io/quickstart/contour.yaml
129129
# https://kind.sigs.k8s.io/docs/user/ingress/
130-
kubectl patch daemonsets -n projectcontour envoy -p '{"spec":{"template":{"spec":{"nodeSelector":{"ingress-ready":"true"},"tolerations":[{"key":"node-role.kubernetes.io/control-plane","operator":"Equal","effect":"NoSchedule"},{"key":"node-role.kubernetes.io/master","operator":"Equal","effect":"NoSchedule"}]}}}}'
130+
kubectl patch daemonsets -n projectcontour envoy -p '{"spec":{"template":{"spec":{"nodeSelector":{"ingress-ready":"true"}}}}}'
131131
info "waiting for resource deployment to finish..."
132132
kubectl --namespace projectcontour rollout status deployments
133133
fi
134134

135135
if ! kubectl get namespace | grep -q chaos-mesh; then
136-
info "Installing Chaos Mesh to enable fault simulation within K8S"
137-
curl -sSL https://mirrors.chaos-mesh.org/v2.6.2/install.sh | bash -s -- --local kind
136+
# see: https://chaos-mesh.org/
137+
helm repo add chaos-mesh https://charts.chaos-mesh.org
138+
kubectl create ns chaos-mesh
139+
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-mesh --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/k3s/containerd/containerd.sock --version 2.6.3
140+
138141
info "waiting for resource deployment to finish..."
139142
kubectl --namespace chaos-mesh rollout status deployments
143+
kubectl --namespace chaos-mesh get po
140144
fi
141145

142146
if kubectl get namespace | grep -q "${NAMESPACE}"; then
143-
info "Remove any lingering persistent volume claims in the ${NAMESPACE}"
144-
kubectl --namespace ${NAMESPACE} delete pvc --all
145-
if helm list --namespace ds --no-headers --short | grep -q openldap; then
147+
if helm list --namespace ${NAMESPACE} --no-headers --short | grep -q openldap; then
146148
info "Uninstall previous deployment of OpenLDAP chart"
147-
helm -n ds uninstall openldap
149+
helm -n ${NAMESPACE} uninstall openldap
148150
fi
151+
info "Remove any lingering persistent volume claims in the ${NAMESPACE}"
152+
kubectl --namespace ${NAMESPACE} delete pvc --all
149153
info "Removing namespace ${NAMESPACE}"
150154
kubectl delete namespace ${NAMESPACE}
151155
fi
@@ -154,28 +158,31 @@ kubectl create namespace ${NAMESPACE}
154158

155159
#kubectl delete jobs --all-namespaces --field-selector status.successful=1
156160

157-
if ! kubectl --namespace $NAMESPACE get secret custom-cert > /dev/null 2>&1; then
161+
if ! kubectl --namespace ${NAMESPACE} get secret myval-certs > /dev/null 2>&1; then
158162
if [ -f "${CERT_DIR}/tls.crt" ] && [ -f "${CERT_DIR}/tls.key" ] && [ -f "${CERT_DIR}/ca.crt" ]
159163
then :
160164
else
161165
! [ -d "${CERT_DIR}" ] && mkdir -p "${CERT_DIR}"
162-
# For "customTLS" we need to provide a certificate, so make one now.
166+
# For "initTLSSecret" we need to provide a certificate, so make one now.
163167
info "Creating TLS certs in ${CERT_DIR}"
164-
openssl req -x509 -newkey rsa:4096 -nodes -subj '/CN=example.com' -keyout "${CERT_DIR}"/tls.key -out "${CERT_DIR}"/tls.crt -days 365 > /dev/null 2>&1
168+
openssl req -x509 -newkey rsa:4096 -nodes -subj '/CN=example.org' -keyout "${CERT_DIR}"/tls.key -out "${CERT_DIR}"/tls.crt -days 365 > /dev/null 2>&1
165169
cp "${CERT_DIR}"/tls.crt "${CERT_DIR}"/ca.crt
166170
fi
167171

168-
info "Installing certificate materials into the Kubernets cluster as secrets named 'custom-cert' which we use in the 'myval.yaml' values file."
169-
kubectl --namespace "${NAMESPACE}" create secret generic custom-cert --from-file="${CERT_DIR}"/tls.crt --from-file="${CERT_DIR}"/tls.key --from-file="${CERT_DIR}"/ca.crt
172+
info "Installing certificate materials into the Kubernets cluster as secrets named 'myval-certs' which we use in the 'myval.yaml' values file."
173+
kubectl --namespace "${NAMESPACE}" create secret generic myval-certs --from-file="${CERT_DIR}"/tls.crt --from-file="${CERT_DIR}"/tls.key --from-file="${CERT_DIR}"/ca.crt
174+
# kubectl get secret myval-certs -n "${NAMESPACE}" -o yaml
170175
fi
171176

172177
if ! helm --namespace "${NAMESPACE}" list | grep -q openldap; then
173178
info "Install openldap chart with 'myval.yaml' testing config"
174-
helm install --namespace "${NAMESPACE}" openldap -f .bin/myval.yaml openldap
179+
helm install --namespace "${NAMESPACE}" --values .bin/myval.yaml openldap .
180+
#kubectl --namespace ds create secret generic my-super-secret --from-literal=LDAP_ADMIN_PASSWORD=Not@SecurePassw0rd --from-literal=LDAP_CONFIG_ADMIN_PASSWORD=Not@SecurePassw0rd
181+
#helm install --namespace "${NAMESPACE}" --values .bin/singleNode.yaml openldap .
175182
info "waiting for helm deployment to finish..."
176-
# kubectl --namespace ds get events --watch &
177-
# ( kubectl --namespace ${NAMESPACE} wait --for=condition=Ready --timeout=30s pod/openldap-0 || \
178-
# kubectl --namespace ${NAMESPACE} logs -l app.kubernetes.io/name=openldap --all-containers=true --timestamps=true --prefix=true --tail=-1 --ignore-errors --follow ) &
183+
kubectl --namespace ${NAMESPACE} get events --watch &
184+
( kubectl --namespace ${NAMESPACE} wait --for=condition=Ready --timeout=30s pod/openldap-0 || \
185+
kubectl --namespace ${NAMESPACE} logs -l app.kubernetes.io/name=openldap --all-containers=true --timestamps=true --prefix=true --tail=-1 --ignore-errors --follow ) &
179186
kubectl --namespace "${NAMESPACE}" rollout status sts openldap
180187
fi
181188

.bin/myval.yaml

+54-16
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,48 @@
1-
logLevel: debug
2-
env:
3-
LDAP_LOGLEVEL: "16640"
4-
# LDAP_LOGLEVEL: "-1"
5-
SYMAS_DEBUG: "true"
6-
SYMAS_DEBUG_SETUP: "false"
71
image:
82
# From repository https://hub.docker.com/r/symas/openldap/
93
repository: symas/openldap
104
# repository: localhost:5001/openldap
11-
tag: 2.6.6-debian-11-r19
5+
tag: 2.6.8
126
# tag: test
137
pullPolicy: Always
8+
logLevel: debug
9+
env:
10+
LDAP_LOGLEVEL: "16640"
11+
# LDAP_LOGLEVEL: "-1"
12+
SYMAS_DEBUG: "true"
13+
SYMAS_DEBUG_SETUP: "false"
1414
resources:
1515
limits:
1616
cpu: "128m"
1717
memory: "64Mi"
1818
replicaCount: 3
19-
service:
20-
ldapPortNodePort: 30389
21-
sslLdapPortNodePort: 30636
22-
type: NodePort
2319
ltb-passwd:
24-
enabled: true
2520
ingress:
2621
hosts:
2722
- "ssl-ldap2.example"
2823
phpldapadmin:
29-
enabled: true
3024
ingress:
3125
hosts:
3226
- "phpldapadmin.example"
33-
customTLS:
34-
enabled: true
35-
secret: "custom-cert"
3627
customSchemaFiles:
28+
00-memberof.ldif: |-
29+
# Load memberof module
30+
dn: cn=module,cn=config
31+
cn: module
32+
objectClass: olcModuleList
33+
olcModuleLoad: memberof
34+
olcModulePath: /opt/bitnami/openldap/lib/openldap
35+
36+
dn: olcOverlay=memberof,olcDatabase={2}mdb,cn=config
37+
changetype: add
38+
objectClass: olcOverlayConfig
39+
objectClass: olcMemberOf
40+
olcOverlay: memberof
41+
olcMemberOfRefint: TRUE
3742
10_owncloud_schema.ldif: |-
43+
# This LDIF files describes the ownCloud schema and can be used to
44+
# add two optional attributes: ownCloudQuota and ownCloudUUID
45+
# The ownCloudUUID is used to store a unique, non-reassignable, persistent identifier for users and groups
3846
dn: cn=owncloud,cn=schema,cn=config
3947
objectClass: olcSchemaConfig
4048
cn: owncloud
@@ -55,6 +63,7 @@ customSchemaFiles:
5563
MAY ( ownCloudQuota $ ownCloudUUID ) )
5664
customLdifFiles:
5765
00-root.ldif: |-
66+
# Root creation
5867
dn: dc=example,dc=org
5968
objectClass: dcObject
6069
objectClass: organization
@@ -79,3 +88,32 @@ customLdifFiles:
7988
uid: jdupond
8089
uidnumber: 1000
8190
userpassword: {MD5}KOULhzfBhPTq9k7a9XfCGw==
91+
03-test-memberof.ldif: |-
92+
dn: ou=Group,dc=example,dc=org
93+
objectclass: organizationalUnit
94+
ou: Group
95+
96+
dn: ou=People,dc=example,dc=org
97+
objectclass: organizationalUnit
98+
ou: People
99+
100+
dn: uid=test1,ou=People,dc=example,dc=org
101+
objectclass: account
102+
uid: test1
103+
104+
dn: cn=testgroup,ou=Group,dc=example,dc=org
105+
objectclass: groupOfNames
106+
cn: testgroup
107+
member: uid=test1,ou=People,dc=example,dc=org
108+
service:
109+
ldapPortNodePort: 30389
110+
sslLdapPortNodePort: 30636
111+
type: NodePort
112+
initTLSSecret:
113+
tls_enabled: true
114+
image:
115+
registry: docker.io
116+
repository: alpine/openssl
117+
tag: latest
118+
pullPolicy: IfNotPresent
119+
secret: "myval-certs"

.bin/randomUser.ldif

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dn: cn=John Doe,dc=example,dc=org
2+
cn: John Doe
3+
gidnumber: 400
4+
givenname: John
5+
homedirectory: /home/users/jdoe
6+
objectclass: inetOrgPerson
7+
objectclass: posixAccount
8+
objectclass: top
9+
sn: Doe
10+
uid: jdoe
11+
uidnumber: 9001
12+
userpassword: {MD5}KOULhzfBhPTq9k7a9XfCGw==

.bin/simpleUser.ldif

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dn: cn=Jean Dupond,dc=example,dc=org
2+
cn: Jean Dupond
3+
gidnumber: 500
4+
givenname: Jean
5+
homedirectory: /home/users/jdupond
6+
objectclass: inetOrgPerson
7+
objectclass: posixAccount
8+
objectclass: top
9+
sn: Dupond
10+
uid: jdupond
11+
uidnumber: 1000
12+
userpassword: {MD5}KOULhzfBhPTq9k7a9XfCGw==

.bin/singleNode.yaml

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
logLevel: debug
22
env:
33
LDAP_LOGLEVEL: "16640"
4+
# LDAP_LOGLEVEL: "-1"
45
SYMAS_DEBUG: "true"
5-
SYMAS_SETUP_DEBUG: "false"
6+
SYMAS_DEBUG_SETUP: "false"
67
image:
78
# From repository https://hub.docker.com/r/symas/openldap/
89
repository: symas/openldap
9-
tag: 2.6.6-debian-11
10+
# repository: localhost:5001/openldap
11+
tag: 2.6.8
12+
# tag: test
1013
pullPolicy: Always
1114
pullSecrets: []
15+
global:
16+
ldapDomain: "singlenode.org"
17+
existingSecret: "my-super-secret"
1218
resources:
1319
limits:
1420
cpu: "128m"
@@ -21,12 +27,14 @@ ltb-passwd:
2127
hosts:
2228
- "ssl-ldap2.example"
2329
phpldapadmin:
24-
ingress:
25-
hosts:
26-
- "phpldapadmin.example"
27-
customTLS:
2830
enabled: false
31+
readinessProbe:
32+
enabled: false
33+
livenessProbe:
34+
enabled: false
2935
service:
30-
ldapPortNodePort: 30389
36+
enableLdapPort: false
3137
sslLdapPortNodePort: 30636
3238
type: NodePort
39+
initTLSSecret:
40+
tls_enabled: true

0 commit comments

Comments
 (0)