Skip to main content
Version: 1.0.x

Flow Configurations

Learn how to efficiently structure and manage your flow configurations, ensuring they fit seamlessly into your API Consumption Gateway setup.

By organizing flows, quotas, and path parameters in a clear, maintainable way, you gain direct control over traffic handling, performance optimization, and security enforcement, all through familiar YAML syntax.

Folder Structure

To configure flows, several YAML files must be placed in the correct directories. The folder structure should look like this:

├── quotas
├── flows
├── path_params
├── certs
│ ├── mtls
│ └── tls
├── gateway_config.yaml
├── metrics.yaml

Each folder or file serves a specific purpose in the flow configuration system:

  • gateway_config.yaml: Central configuration file where you define mTLS settings, domain configurations, and other key settings.
  • metrics.yaml: Defines the metrics for API traffic and system performance monitoring.
  • quotas/: Contains YAML files that define API quotas, allowing for rate-limiting and consumption control.
  • path_params/: Holds path parameters that help manage dynamic endpoints by consolidating multiple URL patterns.
  • flows/: Contains the flow YAML files, which define how requests and responses are processed through various processors, filters, and quotas.
  • certs/mtls/: Stores certificates used for Mutual TLS (mTLS) configurations between Lunar.dev Gateway and secure upstream services.
  • certs/tls/: Holds certificates for general TLS encryption to secure communication between clients and the Lunar.dev Gateway.

Once the YAML files are set up, you need to load the flows into the Lunar.dev API Consumption Gateway. Here's how to do it using Docker and Kubernetes.

note

File names for Lunar's YAML configurations don't need to follow a specific convention (e.g., quota.yaml). As long as the file is placed in the correct folder, Lunar will automatically detect and apply it.

Loading Flows in Docker

To load flows in a Docker environment, use the following command:

docker exec lunar-proxy load_flows

This command loads the flows defined in the YAML files into the running Lunar.dev API Consumption Gateway container.

Loading Flows in Kubernetes

For Kubernetes environments, use the following command:

kubectl exec <lunar-proxy-pod-name> -- load_flows

This command loads the flow configuration into the Lunar Gateway running in your Kubernetes cluster.

Managing Configuration with Helm Chart

To deploy Lunar.dev with a Helm chart, follow these steps to set up and apply ConfigMaps for flows and quotas.

Create ConfigMaps for Flows and Quotas:

Use these commands to create ConfigMaps from your flow and quota YAML directories:

kubectl create configmap my-flows-config --from-file=./flows/
kubectl create configmap my-quotas-config --from-file=./quotas/

Ensure --from-file points to the directory containing your YAML files.

Prepare a Helm Override File:

Create a file (e.g., override-values.yaml) to customize your configuration. This file should specify lunarStreams and the ConfigMap names, as shown:

lunarStreamsEnabled: true
configMapNames:
flows: flows-config-test
quotas: quotas-config-test

Install or Upgrade the Helm Chart:

With your values file prepared, install or update the Lunar Proxy with Helm:

helm install my-proxy lunar/lunar-proxy -f ./override-values.yaml
note

By default, flows are enabled in 1.0.x gateway's versions. To switch back to configurations using policies.yaml, set the following:

  • Docker: LUNAR_STREAMS_ENABLED=false
  • Kubernetes (values.yaml): lunarStreamsEnabled: false

Restart the service after updating these settings to apply changes.