Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put babysitter configuration in ConfigMap. #82

Merged
merged 2 commits into from
Oct 23, 2023
Merged

Put babysitter configuration in ConfigMap. #82

merged 2 commits into from
Oct 23, 2023

Commits on Oct 23, 2023

  1. Put babysitter configuration in ConfigMap.

    Previously, babysitter configuration was proto encoded, base64 encoded,
    and passed to the babysitter via environment variable. This PR instead
    puts the configuration in a ConfigMap:
    
    ```yaml
    apiVersion: v1
    data:
      config.textpb: |
        namespace:  "default"
        deployment_id:  "e98a6946-49c2-4773-98c6-48b89a6c926f"
        trace_service_url:  "http://collatz-jaeger-60914c47:14268/api/traces"
        listeners:  {
          key:  "collatz"
          value:  20000
        }
      weaver.toml: |
        [serviceweaver]
        binary = "./collatz"
        rollout = "5m"
        colocate = [
          [
            "github.com/ServiceWeaver/weaver/examples/collatz/Even",
            "github.com/ServiceWeaver/weaver/examples/collatz/Odd"
          ]
        ]
    
        [kube]
        listeners.collatz = {public = true}
        repo = "docker.io/themwhittaker/"
    kind: ConfigMap
    metadata:
      creationTimestamp: null
      name: config-e98a6946
      namespace: default
    ```
    
    The configuration includes the original `weaver.toml` file and a
    `config.textpb` file that includes a prototext encoded
    `BabysitterConfig` proto (which replaces `ReplicaSetConfig`). These
    files are mounted into the babysitter containers and passed to the
    babysitter as command line arguments:
    
    ```yaml
    containers:
    - args:
      - babysitter
      - /weaver/weaver.toml
      - /weaver/config.textpb
      - github.com/ServiceWeaver/weaver/Main
      image: docker.io/themwhittaker/collatz:e98a6946
      name: serviceweaver
      volumeMounts:
      - mountPath: /weaver/weaver.toml
        name: config
        subPath: weaver.toml
      - mountPath: /weaver/config.textpb
        name: config
        subPath: config.textpb
    volumes:
    - configMap:
        name: config-e98a6946
      name: config
    ```
    
    This change takes us a step closer to `weaver kube exec`, if that's
    something we end up doing. It also makes the generated YAML more
    readable and self-explanatory.
    mwhittaker committed Oct 23, 2023
    Configuration menu
    Copy the full SHA
    29939ef View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    170f381 View commit details
    Browse the repository at this point in the history