Browse Source

Merge branch 'turcan-startup.sh--ldap_add_or_modify--log-helper-fix' into hotfix-1.2.5

Bertrand Gouny 6 years ago
parent
commit
c3c2c47f95

+ 2 - 1
.gitignore

@@ -1,2 +1,3 @@
 /.*
-!/.git*
+!/.git*
+/VOLUMES

+ 1 - 1
README.md

@@ -82,7 +82,7 @@ This should output:
 	# numResponses: 3
 	# numEntries: 2
 
-If you have the following error, OpenLDAP is not started yet, maybe you are too fast or maybe your computer is to slow, as you want... but wait some time before retrying.
+If you have the following error, OpenLDAP is not started yet, maybe you are too fast or maybe your computer is too slow, as you want... but wait for some time before retrying.
 
 		ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
 

+ 1 - 0
example/kubernetes/using-secrets/.gitignore

@@ -0,0 +1 @@
+ldap-secret.yaml

+ 14 - 0
example/kubernetes/using-secrets/Makefile

@@ -0,0 +1,14 @@
+ldap-secret.yaml: example
+	$(eval PWD := $(shell pwd -P))
+	$(eval ENV_DIR := $(shell echo ${PWD}/environment))
+	ENV_YAML=$(shell ${ENV_DIR}/file-to-base64.sh ${ENV_DIR}/my-env.yaml) \
+	ENV_STARTUP_YAML=$(shell ${ENV_DIR}/file-to-base64.sh ${ENV_DIR}/my-env.startup.yaml) \
+	envsubst < ldap-secret.tpl > ldap-secret.yaml
+
+example: environment/my-env.startup.yaml environment/my-env.yaml
+
+environment/my-env.startup.yaml:
+	cd environment ; cp my-env.startup.yaml.example my-env.startup.yaml
+
+environment/my-env.yaml:
+	cd environment ; cp my-env.yaml.example my-env.yaml

+ 7 - 0
example/kubernetes/using-secrets/README.md

@@ -0,0 +1,7 @@
+# Generating ldap-secret.yaml
+
+`make example`
+
+Then edit the yaml files in the environment directory to have the desired paraneters, and then make the secret file:
+
+`make ldap-secret.yaml`

+ 2 - 0
example/kubernetes/using-secrets/environment/.gitignore

@@ -0,0 +1,2 @@
+my-env.startup.yaml
+my-env.yaml

+ 0 - 0
example/kubernetes/using-secrets/environment/my-env.startup.yaml → example/kubernetes/using-secrets/environment/my-env.startup.yaml.example


+ 0 - 0
example/kubernetes/using-secrets/environment/my-env.yaml → example/kubernetes/using-secrets/environment/my-env.yaml.example


+ 11 - 0
example/kubernetes/using-secrets/ldap-secret.tpl

@@ -0,0 +1,11 @@
+apiVersion: "v1"
+kind: "List"
+items:
+  - kind: "Secret"
+    apiVersion: "v1"
+    metadata:
+      name: "ldap-secret"
+    data:
+      # files in environment/* converted into base64 with file-to-base64.sh
+      env.yaml: "$ENV_YAML"
+      env.startup.yaml: "$ENV_STARTUP_YAML"

File diff suppressed because it is too large
+ 0 - 10
example/kubernetes/using-secrets/ldap-secret.yaml


+ 2 - 2
image/service/slapd/startup.sh

@@ -74,9 +74,9 @@ if [ ! -e "$FIRST_START_DONE" ]; then
       sed -i "s|{{ LDAP_READONLY_USER_PASSWORD_ENCRYPTED }}|${LDAP_READONLY_USER_PASSWORD_ENCRYPTED}|g" $LDIF_FILE
     fi
     if grep -iq changetype $LDIF_FILE ; then
-        ldapmodify -Y EXTERNAL -Q -H ldapi:/// -f $LDIF_FILE 2>&1 | log-helper debug || ldapmodify -h localhost -p 389 -D cn=admin,$LDAP_BASE_DN -w "$LDAP_ADMIN_PASSWORD" -f $LDIF_FILE 2>&1 | log-helper debug
+        ( ldapmodify -Y EXTERNAL -Q -H ldapi:/// -f $LDIF_FILE 2>&1 || ldapmodify -h localhost -p 389 -D cn=admin,$LDAP_BASE_DN -w "$LDAP_ADMIN_PASSWORD" -f $LDIF_FILE 2>&1 ) | log-helper debug
     else
-        ldapadd -Y EXTERNAL -Q -H ldapi:/// -f $LDIF_FILE |& log-helper debug || ldapadd -h localhost -p 389 -D cn=admin,$LDAP_BASE_DN -w "$LDAP_ADMIN_PASSWORD" -f $LDIF_FILE 2>&1 | log-helper debug
+        ( ldapadd -Y EXTERNAL -Q -H ldapi:/// -f $LDIF_FILE 2>&1 || ldapadd -h localhost -p 389 -D cn=admin,$LDAP_BASE_DN -w "$LDAP_ADMIN_PASSWORD" -f $LDIF_FILE 2>&1 ) | log-helper debug
     fi
   }
 

Some files were not shown because too many files changed in this diff