apiVersion: apps/v1
kind: Deployment
metadata:
  name: gitea-ldap-sync
spec:
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: gitea-ldap-sync
    spec:
      containers:
        - name: gitea-ldap-sync
          image: ghcr.io/janosmiko/gitea-ldap-sync:latest
          imagePullPolicy: Always
          env:
            - name: DEBUG
              value: "true"
            - name: GITEA_BASE_URL
              value: https://user@gitea.example.com
            - name: GITEA_TOKEN
              valueFrom:
                secretKeyRef:
                  key: gitea-token
                  name: gitea-ldap-sync
            - name: LDAP_URL
              value: ldap.example.com
            - name: LDAP_PORT
              value: "636"
            - name: LDAP_USE_TLS
              value: 'true'
            - name: LDAP_ALLOW_INSECURE_TLS
              value: 'false'
            - name: LDAP_BIND_DN
              value: 'cn=admin,DC=ldap,DC=example,DC=com'
            - name: LDAP_BIND_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: ldap-bind-password
                  name: gitea-ldap-sync
            - name: LDAP_USER_SEARCH_BASE
              value: 'ou=users,DC=ldap,DC=example,DC=com'
            - name: LDAP_USER_FILTER
              value: '(&(objectClass=user)(memberOf=*))'
            - name: LDAP_USER_USERNAME_ATTRIBUTE
              value: 'sAMAccountName'
            - name: LDAP_USER_FULLNAME_ATTRIBUTE
              value: 'cn'
            - name: LDAP_USER_FIRST_NAME_ATTRIBUTE
              value: 'name'
            - name: LDAP_USER_SURNAME_ATTRIBUTE
              value: ''
            - name: LDAP_USER_EMAIL_ATTRIBUTE
              value: 'mail'
            - name: LDAP_USER_PUBLIC_SSH_KEY_ATTRIBUTE
              value: 'sshPublicKey'
            - name: LDAP_USER_AVATAR_ATTRIBUTE
              value: 'avatar'
            - name: LDAP_ADMIN_FILTER
              value: ''
            - name: LDAP_RESTRICTED_FILTER
              value: ''
            - name: LDAP_GROUP_SEARCH_BASE
              value: 'ou=groups,DC=ldap,DC=example,DC=com'
            - name: LDAP_GROUP_FILTER
              value: '(&(objectClass=group))'
            - name: LDAP_GROUP_NAME_ATTRIBUTE
              value: 'cn'
            - name: LDAP_GROUP_FULLNAME_ATTRIBUTE
              value: 'cn'
            - name: LDAP_GROUP_DESCRIPTION_ATTRIBUTE
              value: 'cn'
            - name: LDAP_SUBGROUP_SEARCH_BASE
              value: 'ou=groups,DC=ldap,DC=example,DC=com'
            - name: LDAP_SUBGROUP_FILTER
              value: '(&(objectClass=group)(memberOf=*))'
            - name: LDAP_SUBGROUP_NAME_ATTRIBUTE
              value: 'cn'
            - name: LDAP_SUBGROUP_DESCRIPTION_ATTRIBUTE
              value: 'cn'
            - name: LDAP_EXCLUDE_USERS
              value: 'root'
            - name: LDAP_EXCLUDE_USERS_REGEX
              value: ''
            - name: LDAP_EXCLUDE_GROUPS
              value: ''
            - name: LDAP_EXCLUDE_GROUPS_REGEX
              value: ''
            - name: LDAP_EXCLUDE_SUBGROUPS
              value: ''
            - name: LDAP_EXCLUDE_SUBGROUPS_REGEX
              value: ''
            - name: LDAP_TRIM_PARENT_NAME
              value: 'false'
            - name: LDAP_SUBGROUP_SEPARATOR
              value: "/"
            - name: CRON_TIMER
              value: '@every 1m'
            - name: SYNC_CONFIG_CREATE_GROUPS
              value: 'true'
            - name: SYNC_CONFIG_FULL_SYNC
              value: 'false'
  selector:
    matchExpressions:
      - key: app
        operator: In
        values:
          - gitea-ldap-sync
