api-gateway

by Labs64

Helm chartv0.15.15App 0.1.8Verified publisher

Labs64.IO :: API Gateway (AuthProxy + Middlewares)

About this chart

api-gateway

Labs64.IO :: API Gateway (AuthProxy + Middlewares)

Homepage: https://labs64.io

Maintainers

NameEmailUrl
Labs64[email protected]https://labs64.io

Source Code

Requirements

RepositoryNameVersion
file://../chart-libschart-libs0.8.8

Values

KeyTypeDefaultDescription
affinityobject{}
applicationTypestring"python"Security response headers are now emitted as a native Gateway API ResponseHeaderModifier filter on each HTTPRoute rule; the canonical values live in the chart-libs "chart-libs.securityHeaders" helper. (The former Traefik security-headers Middleware has been removed.)
authProxyobject{"address":"","authResponseHeaders":["X-Auth-User","X-Auth-Scopes","X-Auth-Tenant","X-Request-ID"],"maxResponseBodySize":8192,"port":8081,"serviceName":"gateway-common","trustForwardHeader":false}ForwardAuth middleware configuration (OIDC/JWT validation via this chart's own authproxy container)
authProxy.addressstring""Full URL override for the /auth endpoint; when empty the address is derived as http://..svc.cluster.local:/auth
authProxy.authResponseHeaderslist["X-Auth-User","X-Auth-Scopes","X-Auth-Tenant","X-Request-ID"]Identity headers copied from the authproxy response onto the upstream request (the authproxy emits every one on each 2xx, so client values can never pass through)
authProxy.maxResponseBodySizeint8192Maximum size (bytes) of the authproxy's /auth response Traefik will read. The response carries only identity headers and no body, so this is a DoS guard, not a functional limit — set well above authResponseHeaders' combined size.
authProxy.portint8081Service port of the authproxy container
authProxy.serviceNamestring"gateway-common"Service name backing the ForwardAuth address. Must match fullnameOverride above since the authproxy Service is rendered by this same chart.
authProxy.trustForwardHeaderboolfalsePass a caller-supplied X-Forwarded-Method / X-Forwarded-Uri on to the authproxy instead of the method and path Traefik actually serves. Keep it false: the authproxy authorises whatever those two headers name, so with true a caller behind a trusted proxy (the entry point's forwardedHeaders.trustedIPs, e.g. a load balancer that passes request headers through) could have a protected route checked as a public one.
autoscalingobject{"enabled":false,"maxReplicas":3,"minReplicas":1,"targetCPUUtilizationPercentage":80}This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
bufferingobject{"enabled":true,"maxRequestBodyBytes":2621440}Buffering middleware configuration (limits payload sizes to prevent OOM / large event attacks)
buffering.enabledbooltrueEnable the shared buffering middleware
buffering.maxRequestBodyBytesint2621440Maximum allowed request body size in bytes (default 2.5MB)
cerbosobject{"url":"http://labs64io-authz-pdp:3592"}Central Cerbos PDP HTTP endpoint (the authorization decision).
chart-libsobject{}Values passed to the chart-libs library dependency (present so the generated schema accepts the key Helm injects for the dependency) @schema type: object additionalProperties: true @schema
compressobject{"enabled":true,"excludedContentTypes":["image/png","image/jpeg","image/gif","image/webp","application/grpc"],"minResponseBodyBytes":1024}Response-compression middleware (edge optimization for all modules routed through Traefik)
compress.enabledbooltrueEnable the shared compress middleware
compress.excludedContentTypeslist["image/png","image/jpeg","image/gif","image/webp","application/grpc"]Content types excluded from compression (already-compressed formats)
compress.minResponseBodyBytesint1024Do not compress responses below this size (bytes)
enabledbooltrue
envlist[]Raw environment entries appended verbatim to the container. Escape hatch for anything not exposed above; container env wins over envFrom, so an entry here overrides the ConfigMap value of the same name.
externalSecrets.enabledboolfalse
externalSecrets.secretKeystring""Key/path of this module's secret in the external backend; every key becomes an env var. Defaults to the release fullname.
externalSecrets.storeNamestring"local-kubernetes-store"
extraConfigChecksumslist["configmap-routes","configmap-static-policies"]Roll the ACS whenever the generated routes / static-route ConfigMaps change (checksum/config already covers configmap.yaml; these are the extra dynamically generated ConfigMaps this chart mounts).
fullnameOverridestring"gateway-common"Fixed resource-name prefix (instead of the default "-api-gateway") so module charts can reference the shared middlewares by a stable name regardless of release name. Also fixes the name of this chart's own Deployment/Service, which is why authProxy.serviceName below must match this value.
imageobject{"digest":"sha256:c66e36110863cb18b34cb58a6cd5e0abb25589486845140e940f0fc61b18102c","pullPolicy":"IfNotPresent","repository":"labs64/traefik-authproxy","tag":""}This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
image.digeststring"sha256:c66e36110863cb18b34cb58a6cd5e0abb25589486845140e940f0fc61b18102c"Pin the image by digest (sha256:<64 hex>). Takes precedence over tag — the release pipeline sets it so a deployment cannot follow a moved tag.
image.pullPolicystring"IfNotPresent"This sets the pull policy for images.
image.tagstring""Overrides the image tag whose default is the chart appVersion.
imagePullSecretslist[]This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
lifecycle.preStopDrainSecondsint5preStop sleep (seconds) so Traefik/kube-proxy deregister the pod before shutdown; 0 disables
livenessProbeobject{"failureThreshold":3,"httpGet":{"path":"/health","port":8081},"initialDelaySeconds":0,"periodSeconds":10,"timeoutSeconds":2}This is to setup the liveness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
logLevelstring"INFO"Log level for the auth proxy.
nameOverridestring""This is to override the chart name.
networkPolicyobject{"egress":[{"ports":[{"port":3592,"protocol":"TCP"}],"to":[{"podSelector":{"matchLabels":{"app.kubernetes.io/name":"authz-pdp"}}}]}],"enabled":false,"extraIngress":[],"gatewayNamespace":"tools","ingressControllerLabels":{},"observabilityNamespace":"monitoring","toolsEgress":[{"name":"mock-oidc","port":8080}]}NetworkPolicy: allow ingress from Traefik and same-namespace pods only (rendered by chart-libs.networkpolicy)
networkPolicy.egresslist[{"ports":[{"port":3592,"protocol":"TCP"}],"to":[{"podSelector":{"matchLabels":{"app.kubernetes.io/name":"authz-pdp"}}}]}]Egress rules enforcing database-per-service isolation.
networkPolicy.extraIngresslist[]Additional raw ingress rules
networkPolicy.gatewayNamespacestring"tools"Namespace where Traefik runs
networkPolicy.ingressControllerLabelsobject{}Ingress controller pod-selector labels; defaults to the internal Traefik standard (app.kubernetes.io/name: traefik) when empty @schema type: object additionalProperties: true @schema
networkPolicy.observabilityNamespacestring"monitoring"Namespace the observability/OTel collector runs in
networkPolicy.toolsEgresslist[{"name":"mock-oidc","port":8080}]Tools-namespace destinations this service needs (name + port pairs); rendered as scoped egress rules — NOT a blanket allow to the whole tools namespace — to preserve database-per-service isolation.
nodeSelectorobject{}
observabilityobject{"enabled":false,"metricsScrape":false,"otlpEndpoint":"http://$(NODE_IP):4318"}Observability is infrastructure-owned: the same image runs with or without it. When enabled, the image's opentelemetry-instrument entrypoint auto-instruments FastAPI (traces + correlated logs + metrics via OTLP).
observability.enabledboolfalseEnable runtime auto-instrumentation (traces + logs + metrics via OTLP)
observability.metricsScrapeboolfalseEmit prometheus.io/* scrape annotations. Disabled here: the authproxy is a FastAPI service that pushes metrics over OTLP and serves no Prometheus endpoint (its only routes are /health, /health/ready, /reload and /auth). With this on, the collector scraped /actuator/prometheus on the service port and logged a 404 every interval.
observability.otlpEndpointstring"http://$(NODE_IP):4318"OTLP endpoint of the OpenTelemetry Collector
oidcobject{"audience":"account","discoveryUrl":"http://keycloak-http.tools.svc.cluster.local/realms/labs64io/.well-known/openid-configuration","issuer":"","scopesClaimPaths":"scope,realm_access.roles,resource_access.{audience}.roles","tenantClaimPath":"tenant"}OIDC provider settings. Rendered into this chart's ConfigMap and delivered via envFrom, as scalars rather than a raw env list: Helm replaces lists wholesale on merge, so with a list a caller overriding one field had to restate all eight — and silently lost any entry added upstream later.
oidc.audiencestring"account"Expected JWT audience.
oidc.discoveryUrlstring"http://keycloak-http.tools.svc.cluster.local/realms/labs64io/.well-known/openid-configuration"Discovery URL (in-cluster transport; the token issuer is oidc.issuer). Defaults to the upstream codecentric/keycloakx release keycloak in the tools namespace (Service keycloak-http). keycloak: http://keycloak-http.tools.svc.cluster.local/realms/labs64io/.well-known/openid-configuration demo/dev: http://mock-oidc..svc.cluster.local:8080/labs64io/.well-known/openid-configuration
oidc.issuerstring""Canonical JWT issuer. Set this when discovery uses an internal service URL while tokens carry a public issuer; empty falls back to discovery metadata.
oidc.scopesClaimPathsstring"scope,realm_access.roles,resource_access.{audience}.roles"Dot-paths (comma-separated) to collect scopes from the JWT; "{audience}" expands to oidc.audience.
oidc.tenantClaimPathstring"tenant"Dot-path to the tenant claim for X-Auth-Tenant; "-" is emitted when absent.
podAnnotationsobject{}This is for setting Kubernetes Annotations to a Pod. For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
podDisruptionBudgetobject{"enabled":true,"minAvailable":1}PodDisruptionBudget (rendered by chart-libs.pdb)
podLabelsobject{}This is for setting Kubernetes Labels to a Pod. For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
podSecurityContextobject{}
rateLimitobject{"average":100,"burst":50,"global":false,"perUser":true}Rate limit middleware configuration
rateLimit.averageint100Average requests per second
rateLimit.burstint50Burst size
rateLimit.globalboolfalseOne bucket per request host instead of per user: a fixed ceiling on the gateway's total ingress, identical for every caller, with per-tenant limits left to the services. Overrides perUser. Traefik keeps buckets in memory, so the ceiling applies per Traefik replica.
rateLimit.perUserbooltrueRate-limit per authenticated user (X-Auth-User header set by the auth middleware); falls back to per-IP when absent
readinessProbeobject{"failureThreshold":3,"httpGet":{"path":"/health/ready","port":8081},"initialDelaySeconds":0,"periodSeconds":5,"timeoutSeconds":2}This is to setup the readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
replicaCountint2This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ The authproxy sits on the hot path of every protected request - keep at least 2 replicas.
resources.limits.cpustring"200m"
resources.limits.memorystring"256Mi"
resources.requests.cpustring"50m"
resources.requests.memorystring"128Mi"
routesDirstring"/app/routes"Directory of generated .routes.yaml manifests (mounted ConfigMap).
secretsobject{"data":{}}Secret data to be used as environment variables (delivered via envFrom)
securityContext.allowPrivilegeEscalationboolfalse
securityContext.capabilities.drop[0]string"ALL"
securityContext.readOnlyRootFilesystembooltrue
securityCont

Deploy api-gateway with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has api-gateway on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartapi-gateway is pinned at v0.15.15 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply