|
| 1 | +--- |
| 2 | +apiVersion: batch/v1 |
| 3 | +kind: Job |
| 4 | +metadata: |
| 5 | + name: create-ldap-user |
| 6 | +spec: |
| 7 | + template: |
| 8 | + spec: |
| 9 | + containers: |
| 10 | + - name: create-ldap-user |
| 11 | + image: bitnamilegacy/openldap:2.5 |
| 12 | + command: |
| 13 | + - /bin/bash |
| 14 | + - -euxo |
| 15 | + - pipefail |
| 16 | + - -c |
| 17 | + args: |
| 18 | + - | |
| 19 | + ldapadd \ |
| 20 | + -D cn=admin,dc=example,dc=org \ |
| 21 | + -w admin \ |
| 22 | + -f /stackable/ldap-users/integrationtest \ |
| 23 | + || true |
| 24 | +
|
| 25 | + ldappasswd \ |
| 26 | + -D cn=admin,dc=example,dc=org \ |
| 27 | + -w admin \ |
| 28 | + -s integrationtest \ |
| 29 | + cn=integrationtest,ou=users,dc=example,dc=org |
| 30 | +
|
| 31 | + # Check that the user works |
| 32 | + ldapsearch \ |
| 33 | + -D cn=integrationtest,ou=users,dc=example,dc=org \ |
| 34 | + -w integrationtest \ |
| 35 | + -b ou=users,dc=example,dc=org |
| 36 | + env: |
| 37 | + - name: NAMESPACE |
| 38 | + valueFrom: |
| 39 | + fieldRef: |
| 40 | + fieldPath: metadata.namespace |
| 41 | + - name: LDAPURI |
| 42 | + value: ldaps://openldap.$(NAMESPACE).svc.cluster.local:1636/ |
| 43 | + - name: LDAPTLS_CACERT |
| 44 | + value: /stackable/tls/ca.crt |
| 45 | + volumeMounts: |
| 46 | + - name: ldap-users |
| 47 | + mountPath: /stackable/ldap-users |
| 48 | + - name: tls |
| 49 | + mountPath: /stackable/tls |
| 50 | + securityContext: |
| 51 | + allowPrivilegeEscalation: false |
| 52 | + capabilities: |
| 53 | + drop: |
| 54 | + - ALL |
| 55 | + runAsNonRoot: true |
| 56 | + resources: |
| 57 | + requests: |
| 58 | + memory: 128Mi |
| 59 | + cpu: 100m |
| 60 | + limits: |
| 61 | + memory: 128Mi |
| 62 | + cpu: 400m |
| 63 | + volumes: |
| 64 | + - name: ldap-users |
| 65 | + configMap: |
| 66 | + name: ldap-users |
| 67 | + - name: tls |
| 68 | + ephemeral: |
| 69 | + volumeClaimTemplate: |
| 70 | + metadata: |
| 71 | + annotations: |
| 72 | + secrets.stackable.tech/class: tls |
| 73 | + spec: |
| 74 | + storageClassName: secrets.stackable.tech |
| 75 | + accessModes: |
| 76 | + - ReadWriteOnce |
| 77 | + resources: |
| 78 | + requests: |
| 79 | + storage: "1" |
| 80 | + serviceAccountName: test-service-account |
| 81 | + restartPolicy: OnFailure |
| 82 | +--- |
| 83 | +apiVersion: v1 |
| 84 | +kind: ConfigMap |
| 85 | +metadata: |
| 86 | + name: ldap-users |
| 87 | +data: |
| 88 | + integrationtest: | |
| 89 | + dn: cn=integrationtest,ou=users,dc=example,dc=org |
| 90 | + objectClass: inetOrgPerson |
| 91 | + objectClass: posixAccount |
| 92 | + objectClass: shadowAccount |
| 93 | + cn: integrationtest |
| 94 | + uid: integrationtest |
| 95 | + givenName: Stackable |
| 96 | + sn: Integration-Test |
| 97 | + mail: integrationtest@stackable.de |
| 98 | + uidNumber: 16842 |
| 99 | + gidNumber: 100 |
| 100 | + homeDirectory: /home/integrationtest |
| 101 | + loginShell: /bin/bash |
| 102 | + userPassword: {crypt}x |
| 103 | + shadowLastChange: 0 |
| 104 | + shadowMax: 0 |
| 105 | + shadowWarning: 0 |
0 commit comments