Autopilot Config Files

Table of Contents

Top

autopilot.proto

The following Schema defines the structure of the autopilot.yaml configuration file.

This file is used to generate and re-generate the project structure, as well as execute tasks related to build and deployment. It can be consumed both via the ap CLI as well as in codegen packages.

AutopilotProject

The AutopilotProject file is the root configuration file for the project itself.

This file will be used to build and deploy the autopilot operator. It is loaded automatically by the autopilot CLI. Its default location is ‘autopilot.yaml’

Field Type Label Description
kind string the name (kubernetes Kind) of the top-level CRD for the operator Specified via the ap init <Kind> command
apiVersion string the ApiVersion of the top-level CRD for the operator
operatorName string the name of the Operator this is used to name and label loggers, k8s resources, and metrics exposed by the operator. Should be valid Kube resource names.
phases []Phase repeated Each phase represents a different stage in the lifecycle of the CRD (e.g. Pending/Succeeded/Failed).
Each phase specifies a unique name and its own set of inputs and outputs.
enableFinalizer bool enable use of a Finalizer to handle object deletion
customParameters []Parameter repeated custom Parameters which extend Autopilot’s builtin types
queries []MetricsQuery repeated custom Queries which extend Autopilot’s metrics queries

MetricsQuery

MetricsQueries extend the query options available to workers. MetricsQueries are accessible to workers via generated client code that lives in /pkg/metrics

The following MetricsQuery:

name: success-rate
parameters:
- Name
- Namespace
- Interval
queryTemplate: |
    sum(
        rate(
            envoy_cluster_upstream_rq{
                kubernetes_namespace="{{ .Namespace }}",
                kubernetes_pod_name=~"{{ .Name }}-[0-9a-zA-Z]+(-[0-9a-zA-Z]+)",
                envoy_response_code!~"5.*"
            }[{{ .Interval }}]
        )
    )
    /
    sum(
        rate(
            envoy_cluster_upstream_rq{
                kubernetes_namespace="{{ .Namespace }}",
                kubernetes_pod_name=~"{{ .Name }}-[0-9a-zA-Z]+(-[0-9a-zA-Z]+)"
            }[{{ .Interval }}]
        )
    )
    * 100

would produce the following metrics Interface:

type CanaryDeploymentMetrics interface {
    metrics.Client
    GetIstioSuccessRate(ctx context.Context, Namespace, Name, Interval string) (*metrics.QueryResult, error)
    GetIstioRequestDuration(ctx context.Context, Namespace, Name, Interval string) (*metrics.QueryResult, error)
    GetEnvoySuccessRate(ctx context.Context, Namespace, Name, Interval string) (*metrics.QueryResult, error)
    GetEnvoyRequestDuration(ctx context.Context, Namespace, Name, Interval string) (*metrics.QueryResult, error)
}
Field Type Label Description
name string
queryTemplate string
parameters []string repeated

Parameter

Custom Parameters allow code to be generated for inputs/outputs that are not built-in to Autopilot. These types must be Kubernetes-compatible Go structs.

Field Type Label Description
lowerName string the fully lower-case name of this resource e.g. “pods”, “services”, “replicasets”, “configmaps”
singleName string the singular CamelCased name of the resource equivalent to Kind
pluralName string the plural CamelCased name of the resource equivalent to the pluralized form of Kind
importPrefix string import prefix used by generated code
package string go package (import path) to the go struct for the resource
apiGroup string Kubernetes API group for the resource e.g. “networking.istio.io”
isCrd bool indicates whether the resource is a CRD if true, the Resource will be added to the operator’s runtime.Scheme

Phase

MeshProviders provide an interface to monitoring and managing a specific mesh.

Autopilot does not abstract the mesh API - Autopilot developers must still reason able about Provider-specific CRDs. Autopilot’s job is to abstract operational concerns such as discovering control plane configuration and monitoring metrics.

Field Type Label Description
name string name of the phase. must be unique
description string description of the phase. used for comments and docs
initial bool indicates whether this is the initial phase of the system. exactly one phase must be the initial phase
final bool indicates whether this is a “final” or “resting” phase of the system. when the CRD is in the final phase, no more processing will be done on it
inputs []string repeated the set of inputs for this phase the inputs will be retrieved by the scheduler and passed to the worker as input parameters

custom inputs can be defined in the autopilot.yaml | | outputs | []string | repeated | the set of outputs for this phase the inputs will be propagated to k8s storage (etcd) by the scheduler.

custom outputs can be defined in the autopilot.yaml |

Top

autopilot-operator.proto

autopilot-operator.proto defines the API Schema for the autopilot-operator.yaml configuration file. this file provides the bootstrap configuration that is loaded to the operator at boot-time/runtime

AutopilotOperator

The AutopilotOperator file is the bootstrap Configuration file for the Operator. It is stored and mounted to the operator as a Kubernetes ConfigMap. The Operator will hot-reload when the configuration file changes. Default name is ‘autopilot-operator.yaml’ and should be stored in the project root.

Field Type Label Description
version string version of the operator used for logging and metrics default is “0.0.1”
meshProvider MeshProvider meshProvider determines how the operator will connect to a service mesh Default is “SMI”
controlPlaneNs string controlPlaneNs is the namespace the control plane lives in Default is “istio-system”
workInterval google.protobuf.Duration workInterval to sets the interval at which CRD workers resync. Default is 5s
metricsAddr string Serve metrics on this address. Set to empty string to disable metrics defaults to “:9091”
enableLeaderElection bool Enable leader election. This will prevent more than one operator from running at a time defaults to true
watchNamespace string if non-empty, watchNamespace will restrict the Operator to watching resources in a single namespace if empty (default), the Operator must have Cluster-scope RBAC permissions (ClusterRole/Binding) can also be set via the WATCH_NAMESPACE environment variable
leaderElectionNamespace string The namespace to use for Leader Election (requires read/write ConfigMap permissions) defaults to the watchNamespace
logLevel google.protobuf.UInt32Value Log level for the operator’s logger values: 0 - Debug 1 - Info 2 - Warn 3 - Error 4 - DPanic 5 - Panic 6 - Fatal Defaults to Info

MeshProvider

MeshProviders provide an interface to monitoring and managing a specific mesh. Autopilot does not abstract the mesh API - Autopilot developers must still reason able about Provider-specific CRDs. Autopilot’s job is to abstract operational concerns such as discovering control plane configuration and monitoring metrics.

Name Number Description
Istio 0 the Operator will utilize Istio mesh for metrics and configuration
Custom 1 the Operator will utilize a locally deployed Prometheus instance for metrics (Currently unimplemented)