Skip to content

BAAS configuration

Scope of this page

The chart exposes almost all of Dgraph’s configuration: two components (zero and alpha), a backup system, and every Dgraph flag through extraFlags and configFile. This page documents the OIDC settings, the scope map, and the chart values likely to need changing.

For everything else — Dgraph flags, cluster sizing, sharding, enterprise features — see the Dgraph documentation:

Application configuration

baas has no single configuration value: each section below says which chart value its settings go into.

OIDC authentication

How baas validates users’ OIDC tokens and decides what each user may do from the scope map. Set these through the chart’s alpha.extraEnvs.

ValueDescription
BAAS_OIDC_URL
[Required]
  • Base URL of the OIDC provider.
  • Default: http://keycloak:80
  • Example: http://keycloak:80
  • Type: string
BAAS_OIDC_REALM
[Required when BAAS_OIDC_ENABLE_GENERIC_OIDC is false]
  • Keycloak realm.
  • Default: libre
  • Example: libre
  • Type: string
BAAS_OIDC_CLIENT_ID
[Required]
  • Client ID. Also the audience expected in user tokens unless BAAS_OIDC_CUSTOM_AUDIENCE is set.
  • Example: libreBaas
  • Type: string
OIDC_SECRET
[Required]
  • Client secret paired with BAAS_OIDC_CLIENT_ID. Supply from a Kubernetes Secret through alpha.secrets.
  • Example: Qm7xT2vLp9RcW4nZk8HbY3jDf6sGa1Ue
  • Type: string
BAAS_OIDC_SYNC_ROLES
  • Pushes the roles defined in the scope map up to Keycloak so they can be assigned there. Works with Keycloak only, so it has no effect when BAAS_OIDC_ENABLE_GENERIC_OIDC is true.
  • Default: false
  • Example: false
  • Type: boolean
BAAS_OIDC_SCOPEMAP
[Required]
  • Path on disk to the JSON scope map described below. Set this to the path that map is mounted at, made up of the mount directory given in the alpha.scopemap section and the filename the map is stored under.
  • Default: /dgraph/additional-config/scopemap.json
  • Example: /dgraph/additional-config/scopemap.json
  • Type: string
BAAS_OIDC_CA_FILE
  • CA certificate for TLS connections to the OIDC server. This is automatically set to /certs/ca.pem by the chart when alpha.caFile is provided.
  • Example: /certs/ca.pem
  • Type: string
BAAS_OIDC_ENABLE_GENERIC_OIDC
  • Switches to a generic OIDC provider such as Okta rather than Keycloak-specific handling.
  • Default: false
  • Example: false
  • Type: boolean
BAAS_OIDC_CUSTOM_AUDIENCE
  • Audience to expect in user tokens in place of BAAS_OIDC_CLIENT_ID.
  • Example: rhize
  • Type: string
BAAS_OIDC_CUSTOM_ROLES_KEY
  • Claim to read roles from when using a non-Keycloak provider.
  • Default: rhize.com/roles
  • Example: rhize.com/roles
  • Type: string
BAAS_OIDC_CUSTOM_PERMISSIONS_KEY
  • Claim to read permissions from when using a non-Keycloak provider.
  • Default: rhize.com/permissions
  • Example: rhize.com/permissions
  • Type: string

alpha.scopemap

The scope map defines who may do what, and is the one piece of this chart you are most likely to edit. The scope map is a single JSON document, rendered into an …-alpha-scopemap ConfigMap and mounted at /dgraph/additional-config.

ValueDescription
alpha.scopemap
[Required]
  • Map whose single key is the filename and whose value is the JSON document. Set the value to empty to disable scope-based authorisation, which also drops the ConfigMap and the mount.
  • Default: the chart’s own scope map
  • Example: see the example block below
  • Type: map

The document has three top-level fields:

FieldDescription
rulesList of rules, each granting the roles it names a set of actions on a set of resources. The fields of a rule are in the next table.
resourcesNamed groups of GraphQL types, as a map of group name to a list of type names. A type has to be in a group for any rule to reach it. The default groups are listed below.
jurisdictionsEvery jurisdiction a rule can grant, as dot-separated names such as site1.area2. The default set is just default.

Each rule has these fields:

FieldDescription
idIdentifier of the rule.
descriptionWhat the rule is for.
rolesRoles the rule applies to. A user matches when their token carries any of them: a libreBaas client role in Keycloak, or a value of the claim named by BAAS_OIDC_CUSTOM_ROLES_KEY with generic OIDC.
resourcesTypes the rule covers. * covers every group, <group>.* every type in one group, <group>.<Type> one type in that group, and a type name on its own covers that type.
actionsOperations the rule allows, from query, mutation, delete, and subscription. * allows all four.
jurisdictionsJurisdictions the rule grants for its resources and actions, taken from the top-level jurisdictions list. * matches every remaining level, so site1.* covers every jurisdiction under site1. They reach the schema’s @auth rules through the Jurisdiction macro.

The default scope map groups the types as follows. Each group also lists the matching …AggregateResult types, and most include Comment and HierarchyScope.

GroupTypes
adminA single entry, admin.
auditNone.
bpmnNone.
librePlatform types: access permissions, comments, environment variables, secrets, signatures and signature reasons, menus, and Libre services.
materialMaterial lots and sublots, and their properties.
operations-definitionOperations definitions and segments, their material bills and parameter specifications, and the equipment, material, personnel, and physical asset specifications.
operations-scheduleOperations schedules and requests, segment requirements and parameters, and the equipment, material, personnel, and physical asset requirements.
operations-performanceOperations performance, responses, and capabilities, segment responses and data, and the equipment, material, personnel, and physical asset actuals and capabilities.
process-segmentProcess segments, their dependencies, parameters, and versions.
resourcesThe resource model: equipment, material classes, definitions, and lots, personnel, physical assets, operational locations, data sources and subscriptions, events and operations events, units of measure, and resource relationship networks.
testTest specifications, criteria, results, and property measurements.
work-definitionWork masters and directives, workflow specifications, state models, forms, and the workflow’s runtime types, such as timers, messages, and errors.
work-scheduleWork schedules and requests, job lists and orders, and work calendars.
work-performanceWork performance and responses, and job responses and their data.

The default scope map contains one rule: admin can do everything everywhere. Anything more granular has to be added. Adding a new GraphQL type to the schema also means adding it to a group here, or no rule can reach it.

A scope map with one rule, letting the operator role query the types grouped under resources:

alpha:
  scopemap:
    scopemap.json: |
      {
        "rules": [
          {
            "id": "rule-001",
            "description": "Operators can read resources",
            "roles": ["operator"],
            "resources": ["resources.*"],
            "actions": ["query"],
            "jurisdictions": ["*"]
          }
        ],
        "jurisdictions": ["default"],
        "resources": {
          "resources": ["Equipment", "EquipmentClass"]
        }
      }

alpha.cdc

Change data capture, which publishes every mutation to one destination, chosen by alpha.cdc.sink.

ValueDescription
alpha.cdc.enabled
  • Enables change data capture.
  • Default: false
  • Example: false
  • Type: boolean
alpha.cdc.sink
  • Where changes are sent: nats, kafka, solace, http, or file. Only the values for that sink are used.
  • Default: nats
  • Example: nats
  • Type: string
alpha.cdc.topic
  • Topic changes are published to on Kafka or Solace.
  • Default: dgraph-cdc
  • Example: dgraph-cdc
  • Type: string
alpha.cdc.nats
[Required when alpha.cdc.sink is nats]
  • NATS endpoint URL. Credentials can be embedded, as in nats://user:password@nats:4222. Changes are published to the libreBaas_cdc JetStream stream.
  • Default: nats://nats:4222
  • Example: nats://nats:4222
  • Type: string
alpha.cdc.replicas
  • JetStream replica count of that stream.
  • Default: 1
  • Example: 1
  • Type: integer
alpha.cdc.kafka.brokers
[Required when alpha.cdc.sink is kafka]
  • Comma-separated list of Kafka brokers.
  • Example: redpanda:9092
  • Type: string
alpha.cdc.kafka.saslUser
  • SASL username. SASL is used only when both the username and password are set.
  • Example: cdc
  • Type: string
alpha.cdc.kafka.saslPassword
  • SASL password.
  • Example: ExamplePassword123
  • Type: string
alpha.cdc.kafka.saslMechanism
  • SASL mechanism: PLAIN, SCRAM-SHA-256, or SCRAM-SHA-512.
  • Default: PLAIN
  • Example: PLAIN
  • Type: string
alpha.cdc.kafka.caCert
  • Path inside the container to a CA certificate. Setting it turns on TLS.
  • Example: /certs/kafka-ca.pem
  • Type: string
alpha.cdc.kafka.clientCert
  • Path inside the container to a client certificate for mutual TLS, used with alpha.cdc.kafka.clientKey.
  • Example: /certs/kafka-client.pem
  • Type: string
alpha.cdc.kafka.clientKey
  • Path inside the container to the client certificate’s private key.
  • Example: /certs/kafka-client.key
  • Type: string
alpha.cdc.solace.host
[Required when alpha.cdc.sink is solace]
  • Solace broker address, tcp:// or tcps:// with the port.
  • Example: tcp://solace:55555
  • Type: string
alpha.cdc.solace.vpn
  • Solace Message VPN on the broker.
  • Default: default
  • Example: default
  • Type: string
alpha.cdc.solace.user
  • Solace username.
  • Example: cdc
  • Type: string
alpha.cdc.solace.password
  • Solace password.
  • Example: ExamplePassword123
  • Type: string
alpha.cdc.solace.topic
  • Topic used when alpha.cdc.topic is not set.
  • Example: rhize/cdc
  • Type: string
alpha.cdc.solace.trustStore
  • Path inside the container to a TLS trust store directory, for a tcps:// host.
  • Example: /certs/solace
  • Type: string
alpha.cdc.http
[Required when alpha.cdc.sink is http]
  • URL each mutation is sent to as a JSON POST.
  • Example: http://ingest:8080/cdc
  • Type: string
alpha.cdc.file
[Required when alpha.cdc.sink is file]
  • Directory inside the container that changes are written to as a log file.
  • Example: /dgraph/cdc
  • Type: string

Mutations published to Kafka with SASL:

alpha:
  cdc:
    enabled: true
    sink: kafka
    topic: dgraph-cdc
    kafka:
      brokers: redpanda:9092
      saslUser: cdc
      saslPassword: ExamplePassword123
      saslMechanism: SCRAM-SHA-256

Helm chart values

The shared values documented in shared-helm-values.md do not apply to this chart, which nests everything under zero, alpha, backups, and global. The values below are the ones likely to need changing.

Image

ValueDescription
image.registry
  • Registry of the container image for both zero and alpha.
  • Default: registry.gitlab.com
  • Example: registry.gitlab.com
  • Type: string
image.repository
  • Repository of the image.
  • Default: libremfg/baas
  • Example: libremfg/baas
  • Type: string
image.tag
  • Image tag. Pinned in the values file rather than tracking appVersion.
  • Default: v4.5.0
  • Example: v4.5.0
  • Type: string
image.pullPolicy
  • When the kubelet fetches the image. Always pulls on every pod start, which is what a moving tag such as latest needs. IfNotPresent pulls only when the tag is missing from the node. Never never pulls, so the image has to be on the node already.
  • Default: IfNotPresent
  • Example: IfNotPresent
  • Type: string
image.pullSecrets
  • Image pull secrets, which must already exist in the namespace.
  • Example: [regcred-gitlab]
  • Type: list

Alpha

ValueDescription
alpha.replicaCount
  • Number of alpha pods. Should be a multiple of zero.shardReplicaCount for a balanced cluster.
  • Default: 3
  • Example: 3
  • Type: integer
alpha.configFile
  • Map of filename to file contents, rendered into a ConfigMap mounted at /dgraph/config and passed as DGRAPH_ALPHA_CONFIG. The default sets lru_mb, the security whitelist, and telemetry. Only the first key alphabetically is passed to Dgraph.
  • Default: the chart’s own config.yaml
  • Example: see the example block below
  • Type: map
alpha.extraFlags
  • Raw string spliced into the dgraph alpha command line. The way to reach any Dgraph flag the chart does not model.
  • Example: --security whitelist=10.0.0.0/8
  • Type: string
alpha.extraEnvs
[Required]
  • Extra container environment variables, and where the BAAS_OIDC_* variables have to go. A list set here replaces the chart’s own rather than adding to it, so repeat every entry this deployment still wants: DGRAPH_ALPHA_WHITELIST, which the chart sets to 0.0.0.0:255.255.255.255 and so disables the IP whitelist entirely, and the OIDC settings that carry a default in the table above.
  • Default: DGRAPH_ALPHA_WHITELIST and the OIDC settings shown with a default above
  • Example: see the example block below
  • Type: list
alpha.extraEnvFrom
  • Extra envFrom entries referencing a ConfigMap or Secret.
  • Example: see the example block below
  • Type: list
alpha.secrets.useExistingSecret
  • Injects OIDC_SECRET from an existing Kubernetes Secret.
  • Default: false
  • Example: true
  • Type: boolean
alpha.secrets.secretName
[Required when alpha.secrets.useExistingSecret is true]
  • Kubernetes Secret holding the OIDC client secret.
  • Example: libre-client-secrets
  • Type: string
alpha.secrets.secretKey
[Required when alpha.secrets.useExistingSecret is true]
  • Name of the entry within that Secret.
  • Example: libreBaas
  • Type: string
alpha.caFile
  • PEM CA certificate. When set, the certificate is mounted at /certs and BAAS_OIDC_CA_FILE is set to /certs/ca.pem. Give it as a YAML block, alpha.caFile: |, with the certificate’s lines indented beneath.
  • Example: -----BEGIN CERTIFICATE-----…
  • Type: string
alpha.persistence.size
  • Volume size per alpha pod.
  • Default: 10Gi
  • Example: 10Gi
  • Type: string
alpha.persistence.storageClass
  • Storage class. Empty uses the cluster default; - disables dynamic provisioning.
  • Example: gp3
  • Type: string
alpha.resources
  • Resource requests and limits for each alpha pod. Raise the memory request in line with the size of the data set.
  • Default: 2Gi memory and 100m CPU requested, no limits
  • Example: see the example block below
  • Type: object
alpha.service.type
  • How the Service is reached. ClusterIP gives an address that only works inside the cluster. NodePort also opens a fixed port on every node. LoadBalancer additionally asks the cloud provider for an external address. ExternalName points the Service at a DNS name instead of at pods.
  • Default: ClusterIP
  • Example: ClusterIP
  • Type: string
alpha.ingress.enabled
  • Creates an Ingress for the alpha HTTP endpoint. Overridden by global.ingress when that is enabled.
  • Default: false
  • Example: false
  • Type: boolean
alpha.encryption.enabled
  • Turns on Dgraph enterprise encryption at rest.
  • Default: false
  • Example: false
  • Type: boolean
alpha.encryption.file
[Required when alpha.encryption.enabled is true]
  • Map of filename to the base64 encoded encryption key, mounted at /dgraph/enc. The filename must match the encryption_key_file Dgraph setting.
  • Example: {enc_key_file: RXhhbXBsZUVuY0tleTE2Ygo=}
  • Type: map
alpha.antiAffinity
  • soft or hard pod anti-affinity. soft allows two alphas on one node, so hard is safer for production.
  • Default: soft
  • Example: soft
  • Type: string
alpha.initContainers.init.enabled
  • Runs one init container before alpha starts.
  • Default: false
  • Example: false
  • Type: boolean
alpha.initContainers.init.command
  • Command the init container runs. The default waits for a file to appear at /dgraph/doneinit and blocks alpha until something else writes it, so replace it with the command you want to run first.
  • Default: the wait-for-file command
  • Example: [sh, -c, "until nc -z baas-zero-headless 5080; do sleep 2; done"]
  • Type: list
alpha.terminationGracePeriodSeconds
  • How long an alpha is given to shut down. Much longer than zero’s 60, because an alpha needs time to flush.
  • Default: 600
  • Example: 600
  • Type: integer

An alpha sized for a larger data set, the OIDC endpoint it needs, and one setting passed through its own config file. The environment variables the chart ships are repeated here, since the list replaces them:

alpha:
  configFile:
    config.yaml: |
      lru_mb: 2048
  extraEnvs:
    - name: DGRAPH_ALPHA_WHITELIST
      value: 0.0.0.0:255.255.255.255
    - name: BAAS_OIDC_URL
      value: "http://keycloak:80"
    - name: BAAS_OIDC_REALM
      value: "libre"
    - name: BAAS_OIDC_CLIENT_ID
      value: "libreBaas"
    - name: BAAS_OIDC_SCOPEMAP
      value: /dgraph/additional-config/scopemap.json
  extraEnvFrom:
    - secretRef:
        name: my-secret
  resources:
    requests:
      memory: 8Gi
      cpu: 2

Zero

ValueDescription
zero.replicaCount
  • Number of zero pods. Should be odd, for Raft quorum.
  • Default: 3
  • Example: 3
  • Type: integer
zero.shardReplicaCount
  • How many alpha replicas hold each data shard.
  • Default: 3
  • Example: 3
  • Type: integer
zero.persistence.size
  • Volume size per zero pod.
  • Default: 10Gi
  • Example: 10Gi
  • Type: string
zero.persistence.storageClass
  • Storage class. Empty uses the cluster default; - disables dynamic provisioning.
  • Example: gp3
  • Type: string
zero.resources
  • Resource requests and limits for each zero pod.
  • Default: 250Mi memory and 50m CPU requested, no limits
  • Example: see the example block below
  • Type: object
zero.service.type
  • How the zero Service is reached. Takes the same values as alpha.service.type.
  • Default: ClusterIP
  • Example: ClusterIP
  • Type: string

A zero with a larger memory request:

zero:
  resources:
    requests:
      memory: 1Gi

Backups

Dgraph enterprise backups, run as Kubernetes CronJobs that call the alpha admin endpoint.

ValueDescription
backups.full.enabled
  • Creates the full backup CronJob.
  • Default: false
  • Example: false
  • Type: boolean
backups.full.schedule
  • Cron schedule for full backups, in server time. The default runs at midnight.
  • Default: 0 0 * * *
  • Example: 0 0 * * *
  • Type: string
backups.incremental.enabled
  • Creates the incremental backup CronJob.
  • Default: false
  • Example: false
  • Type: boolean
backups.incremental.schedule
  • Cron schedule for incremental backups, in server time. The default runs hourly except at midnight.
  • Default: 0 1-23 * * *
  • Example: 0 1-23 * * *
  • Type: string
backups.destination
[Required when backups.full.enabled or backups.incremental.enabled is true]
  • Where backups are written: a file path or an s3://… URL.
  • Default: /dgraph/backups
  • Example: /dgraph/backups
  • Type: string
backups.subpath
  • Subdirectory under the destination. The default embeds a date command so full and related incremental backups land together, which means the subpath has to be a directory name that matches the backup schedule.
  • Default: dgraph_$(date +%Y%m%d)
  • Example: dgraph_$(date +%Y%m%d)
  • Type: string
backups.nfs.enabled
  • Mounts an NFS export into the alpha pods for backups. Needs an existing NFS server.
  • Default: false
  • Example: false
  • Type: boolean
backups.nfs.server
[Required when backups.nfs.enabled is true]
  • Address of the NFS server.
  • Example: nfs.example.com
  • Type: string
backups.nfs.path
[Required when backups.nfs.enabled is true]
  • Exported path on the NFS server.
  • Example: /exports/dgraph
  • Type: string
backups.nfs.storage
  • Size of the NFS volume.
  • Default: 512Gi
  • Example: 512Gi
  • Type: string
backups.nfs.mountPath
  • Where the export is mounted in the alpha pods.
  • Default: /dgraph/backups
  • Example: /dgraph/backups
  • Type: string
backups.volume.enabled
  • Mounts an existing PVC into the alpha pods for backups.
  • Default: false
  • Example: false
  • Type: boolean
backups.volume.claim
[Required when backups.volume.enabled is true]
  • Name of the PVC. With more than one alpha pod the claim must be ReadWriteMany.
  • Example: dgraph-backups
  • Type: string
backups.volume.mountPath
  • Where the claim is mounted in the alpha pods.
  • Default: /dgraph/backups/
  • Example: /dgraph/backups/
  • Type: string
backups.admin.auth_token
  • Auth token protecting /login and /admin, which must match the alpha configuration.
  • Example: exampleDgraphAuthToken123
  • Type: string
backups.keys.s3.access
[Required when backups.destination is an s3:// URL]
  • AWS access key id, injected as AWS_ACCESS_KEY_ID. Supply from a Kubernetes Secret.
  • Example: AKIAIOSFODNN7EXAMPLE
  • Type: string
backups.keys.s3.secret
[Required when backups.destination is an s3:// URL]
  • AWS secret access key, injected as AWS_SECRET_ACCESS_KEY. Supply from a Kubernetes Secret.
  • Example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
  • Type: string

Global

ValueDescription
global.domain
  • Cluster DNS domain used to build the peer addresses alpha and zero use to find each other. Change the domain only on a cluster with a non-standard DNS domain.
  • Default: cluster.local
  • Example: cluster.local
  • Type: string
global.ingress.enabled
  • Creates one Ingress for alpha, overriding alpha.ingress.
  • Default: false
  • Example: false
  • Type: boolean
global.ingress.alpha_hostname
[Required when global.ingress.enabled is true]
  • Hostname the Ingress routes to alpha.
  • Example: baas.example.libremfg.ai
  • Type: string
global.ingress.certResolver
  • Traefik certificate resolver.
  • Default: production
  • Example: production
  • Type: string
global.ingress.tls
  • TLS configuration for the Ingress, as a list of entries, each pairing the hostnames it covers with the Secret holding the certificate.
  • Example: see the example block below
  • Type: list
global.ingress.annotations
  • Annotations for the Ingress.
  • Example: see the example block below
  • Type: map

One Ingress for alpha, terminating TLS with an existing Secret:

global:
  ingress:
    tls:
      - hosts:
          - baas.example.libremfg.ai
        secretName: baas-tls
    annotations:
      kubernetes.io/ingress.class: traefik