Skip to content

Configuration

mricher edited this page Aug 25, 2016 · 6 revisions

zenscaler can be configured via a YAML file named config.yaml found in the working directory. This file is parsed at startup and any error is reported, issuing a log and exiting the program. Sample configuration files can be found under the examples/ directory of project repository.

Alternatively, configuration can be altered at run-time using the API.

Configuration file

zenscaler configuration file is divided into 3 parts.

  • orchestrator specify the targeted orchestrator. A zenscaler instance manage only one orchestrator.
  • scalers list and name all the configured scalers. A scaler define how a specific service will be updated and can be used by multiple rules. Available backends for scalers are docker-compose-cmd and docker-service.
  • rules list and name all rules. A rule is defined by a related scaler, up and down conditions and corresponding probe.

Example

orchestrator:
    engine: "docker"                   # only docker is supported ATM
scalers:                               # scaler section
    whoami-compose:                    # custom id
        type: "docker-compose-cmd"     # what do we use to scale the service ?
        target: "whoami"               # parameter for docker-compose
        config: "docker-compose.yaml"  # parameter for docker-compose
    whoami2-compose:
        type: "docker-compose"
        target: "whoami2"
        config: "docker-compose.yaml"
rules:                                 # rule section
    whoami-cpu-scale:                  # custom name of the service
        target: "whoami"               # name of service as tagged in orchestrator
        probe: "swarm.cpu_average"     # probe to use
        up: "> 0.75"                   # up rule
        down: "< 0.25"                 # down rule
        scaler: whoami-compose         # refer to any scaler id defined above
        refresh: 3s                    # scaler refresh rate
    whoami2-cpu-scale:
        target: "whoami2"
        probe: "cmd.execute"           # probe can be any binary
        cmd: "./some_script.sh"        # retrieve and write a float to stdout
        up: "> 200"
        down: "< 1.67"
        scaler: whoami2-compose
        refresh: 10s
Clone this wiki locally