syntax = "proto3";

package linkerd2.config;

import "google/protobuf/duration.proto";

option go_package = "github.com/linkerd/linkerd2/controller/gen/config";

message All {
  Global global = 1;
  Proxy proxy = 2;
  Install install = 3;
}

message Global {
  string linkerd_namespace = 1;
  bool cni_enabled = 2;

  // Control plane version
  string version = 3;

  // If present, configures identity.
  IdentityContext identity_context = 4;

  AutoInjectContext auto_inject_context = 6 [deprecated=true];

  bool omitWebhookSideEffects = 7;

  // Override default `cluster.local`
  string cluster_domain = 8;
}

message Proxy {
  Image proxy_image = 1;
  Image proxy_init_image = 2;

  Port control_port = 3;
  repeated PortRange ignore_inbound_ports = 4;
  repeated PortRange ignore_outbound_ports = 5;
  Port inbound_port = 6;
  Port admin_port = 7;
  Port outbound_port = 8;

  ResourceRequirements resource = 9;

  int64 proxy_uid = 10;
  LogLevel log_level = 11;
  bool disable_external_profiles = 12;

  string proxy_version = 13;

  string proxy_init_image_version = 14;

  Image debug_image = 15;
  string debug_image_version = 16;
}

message Image {
  string image_name = 1;
  string pull_policy = 2;
}

message Port {
  uint32 port = 1;
}

message PortRange {
  string port_range = 1;
}

message ResourceRequirements {
  string request_cpu = 1;
  string request_memory = 2;
  string limit_cpu = 3;
  string limit_memory = 4;
}

message AutoInjectContext { option deprecated = true; }

message IdentityContext {
  string trust_domain = 1;
  string trust_anchors_pem = 2;

  google.protobuf.Duration issuance_lifetime = 3;
  google.protobuf.Duration clock_skew_allowance = 4;
  string scheme = 5;
}

message LogLevel {
  string level = 1;
}

// Stores information about the last installation/upgrade.
//
// Useful for driving upgrades.
message Install {
  reserved 1;
  //string uuid = 1;

  // The CLI version that drove the last install or upgrade.
  string cli_version = 2;

  // The CLI arguments to the install (or upgrade) command, indicating the
  // installer's intent.
  repeated Flag flags = 3;

  message Flag {
    string name = 1;
    string value = 2;
  }
}
