LDAP cache (ldap-cache)

About the service

ParameterDescription
System name chartshturval-auth
Componentsh-ldap-cache
Cluster AssignmentSync LDAP user and group data in Redis and HTTP API for viewing, updating and flushing cache.
CriticalYes, if LDAP integration is used
Namespaceshturval-backend

ldap-cache is included in the Helm chart shturval-auth. The cache data is used by backend API, and the LDAP configuration is associated with authn-server.

Contents

  1. Review
  2. Architecture
  3. Installation/deployment
  4. Diagnostics
  5. Lifecycle
  6. Service parameters

1. Review

Purpose: support fast backend API responses to requests for user and directory group data by updating the Redis cache in the background and monitoring the LDAP configuration from the Secret platform. The /cache/... HTTP layer handles administrative synchronization activities and list fetching.

Features

ContourPurpose
User cache controllerBackground synchronization of user records in Redis users.
Group cache controllerBackground synchronization of groups into a separate Redis.
HTTP API GinDirectory cache methods: list, refresh, flush.
Watcher Secret ldap-configUpdates connection configuration when Secret changes.
Cron watcher via /cache/config.jsonSets the intervals for synchronization tasks when mounting a file.

Initiation scripts

EventInitiatorEffect
Start of servicepod ReadyRedis clients are created.
Auto refreshLocal cron scheduleThe data set from LDAP is synchronized.
Manual refresh/list/flushbackend APIData is updated or read immediately.
LDAP Secret changedAdministratorSource parameters are reinitialized.

Limitations and implications

LimitConsequence
HTTP listens only :8083The port cannot be changed without a compatible change in delivery.
CORS always AllowAllOriginsConsider the service’s network surface.
Both Redis required for users and groupsThe absence of Redis blocks the start.
The file /cache/config.json is needed for dynamic cronCheck mount if the schedule should be different from defaults.

Place in the chain of command

Backend API accesses the HTTP endpoint of the service in scenarios where retrieval of cached directory entities is needed. In parallel, authn-server uses the directory configuration from Secret for login-flow.

Key Features

CharacteristicsDescription
Binarsh-ldap-cache
Process port0.0.0.0:8083
Helm installation objectshelm/auth/templates/dep-ldap-cache.yaml, Service svc-ldap-cache
StorageTwo separately configurable Redis: users and groups

2. Architecture

ComponentRole
sh-ldap-cacheGin process and two background cache controllers: users and groups.
Redis users/groupsSeparate storage of user and group caches.
Secret watcherReceiving and updating Secret ldap-config.
Cron configTiming parameters for synchronization tasks.

3. Installation / deployment

The service is supplied by chart shturval-auth. LDAP, Redis and synchronization schedule settings are changed via ShturvalServicePatch (SSP) for SSC shturval-auth.

4. Diagnostics

kubectl get svc -n "${NAMESPACE}"
kubectl get pods -n "${NAMESPACE}" -o wide
kubectl logs -n "${NAMESPACE}" deployment/DEPLOYMENT_LDAP_CACHE --tail=200

Substitute the Deployment name and NAMESPACE for the actual Helm release.

SymptomReasonAction
Pod goes into CrashLoop until readyRedis unavailableCheck USER_STORE_ADDR, GROUP_STORE_ADDR and network connectivity.
Cache long staleCron file unavailable or schedule errorRestore mount /cache/config.json.
LDAP Secret changes were not included in the serviceWatcher stuck or RBAC unavailableCheck service rights and pod events.

5. Life cycle

StepMemberResult
1The process creates Redis storesA connection error causes the pod to restart.
2Watcher SecretConfigures LDAP settings for cache controllers.
3Cache controllerSupports background synchronization tasks.
4HTTP LayerServes requests from backend and operator tools.

Stateful reconcile of operator CRs is not performed.

6. Service parameters

VariablePurpose
USER_STORE_ADDR, GROUP_STORE_ADDRRedis coordinates.
USER_STORE_DB_INDEX, GROUP_STORE_DB_INDEXRedis logical database index.
USER_STORE_PASSWD, GROUP_STORE_PASSWDRedis client password.
STORE_MASTER, SENTINEL_PASSWDSentinel topology.
CACHE_SCAN_SIZE, CACHE_MAX_CONCURRENT_WORKERSCache scanning and LDAP query concurrency options.
LDAP_REQUEST_PAGE_SIZE, LDAP_REQUEST_TIMEOUT_SECBehavior of LDAP queries.
POD_NAMESPACENamespace pod.

The contents of the Secret ldap-config and the config.json fields define the DN, TLS, and specific parameters for connecting to the directory.