Adding openldap + ldap user manager
This commit is contained in:
		@@ -0,0 +1,50 @@
 | 
			
		||||
{{- if .Values.test.enabled -}}
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: Pod
 | 
			
		||||
metadata:
 | 
			
		||||
  name: "{{ template "openldap.fullname" . }}-test-{{ randAlphaNum 5 | lower }}"
 | 
			
		||||
  labels:
 | 
			
		||||
    app: {{ template "openldap.name" . }}
 | 
			
		||||
    chart: {{ template "openldap.chart" . }}
 | 
			
		||||
    release: {{ .Release.Name }}
 | 
			
		||||
    heritage: {{ .Release.Service }}
 | 
			
		||||
{{- if .Values.extraLabels }}
 | 
			
		||||
{{ toYaml .Values.extraLabels | indent 4 }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
  annotations:
 | 
			
		||||
    "helm.sh/hook": test-success
 | 
			
		||||
spec:
 | 
			
		||||
  initContainers:
 | 
			
		||||
    - name: test-framework
 | 
			
		||||
      image: {{ .Values.test.image.repository }}:{{ .Values.test.image.tag }}
 | 
			
		||||
      command:
 | 
			
		||||
        - "bash"
 | 
			
		||||
        - "-c"
 | 
			
		||||
        - |
 | 
			
		||||
          set -ex
 | 
			
		||||
          # copy bats to tools dir
 | 
			
		||||
          cp -R /usr/local/libexec/ /tools/bats/
 | 
			
		||||
      volumeMounts:
 | 
			
		||||
        - mountPath: /tools
 | 
			
		||||
          name: tools
 | 
			
		||||
  containers:
 | 
			
		||||
    - name: {{ .Release.Name }}-test
 | 
			
		||||
      image: {{ .Values.test.image.repository }}:{{ .Values.test.image.tag }}
 | 
			
		||||
      envFrom:
 | 
			
		||||
        - secretRef:
 | 
			
		||||
            name: {{ template "openldap.secretName" . }}
 | 
			
		||||
      command: ["/tools/bats/bats", "-t", "/tests/run.sh"]
 | 
			
		||||
      volumeMounts:
 | 
			
		||||
        - mountPath: /tests
 | 
			
		||||
          name: tests
 | 
			
		||||
          readOnly: true
 | 
			
		||||
        - mountPath: /tools
 | 
			
		||||
          name: tools
 | 
			
		||||
  volumes:
 | 
			
		||||
    - name: tests
 | 
			
		||||
      configMap:
 | 
			
		||||
        name: {{ template "openldap.fullname" . }}-tests
 | 
			
		||||
    - name: tools
 | 
			
		||||
      emptyDir: {}
 | 
			
		||||
  restartPolicy: Never
 | 
			
		||||
{{- end -}}
 | 
			
		||||
@@ -0,0 +1,22 @@
 | 
			
		||||
{{- if .Values.test.enabled -}}
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: ConfigMap
 | 
			
		||||
metadata:
 | 
			
		||||
  name: {{ template "openldap.fullname" . }}-tests
 | 
			
		||||
  labels:
 | 
			
		||||
    app: {{ template "openldap.name" . }}
 | 
			
		||||
    chart: {{ template "openldap.chart" . }}
 | 
			
		||||
    release: {{ .Release.Name }}
 | 
			
		||||
    heritage: {{ .Release.Service }}
 | 
			
		||||
{{- if .Values.extraLabels }}
 | 
			
		||||
{{ toYaml .Values.extraLabels | indent 4 }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
data:
 | 
			
		||||
  run.sh: |-
 | 
			
		||||
    @test "Testing connecting to slapd server" {
 | 
			
		||||
      # Ideally, this should be in the docker image, but there is not a generic image we can use
 | 
			
		||||
      # with bats and ldap-utils installed. It is not worth for now to push an image for this.
 | 
			
		||||
      apt-get update && apt-get install -y ldap-utils
 | 
			
		||||
      ldapsearch -x -H ldap://{{ template "openldap.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.ldapPort }} -b "dc=example,dc=org" -D "cn=admin,dc=example,dc=org" -w $LDAP_ADMIN_PASSWORD
 | 
			
		||||
    }
 | 
			
		||||
{{- end -}}
 | 
			
		||||
		Reference in New Issue
	
	Block a user