Documentation ¶
Index ¶
- func GetAgentService() string
- func GetAmbId(resource kates.Object) amb.AmbassadorID
- func GetAmbassadorConfigBaseDir() string
- func GetAmbassadorDebug() string
- func GetAmbassadorFieldSelector() string
- func GetAmbassadorId() string
- func GetAmbassadorLabelSelector() string
- func GetAmbassadorNamespace() string
- func GetAmbassadorRoot() string
- func GetAnnotations(resources ...kates.Object) (result []kates.Object)
- func GetAppDir() string
- func GetClusterID(ctx context.Context) string
- func GetConfigDir() string
- func GetDiagdArgs() []string
- func GetDiagdBindAddress() string
- func GetDiagdBindPort() string
- func GetDiagdFlags() []string
- func GetEnvoyBaseId() string
- func GetEnvoyBootstrapFile() string
- func GetEnvoyConfigFile() string
- func GetEnvoyDir() string
- func GetEnvoyFlags() []string
- func GetEventHost() string
- func GetEventPath() string
- func GetEventUrl() string
- func GetLicenseSecretName() string
- func GetLicenseSecretNamespace() string
- func GetSidecarHost() string
- func GetSidecarPath() string
- func GetSidecarUrl() string
- func GetSnapshotDir() string
- func IsAmbassadorSingleNamespace() bool
- func IsDiagdOnly() bool
- func IsEdgeStack() bool
- func IsEnvoyAvailable() bool
- func IsKnativeEnabled() bool
- func Main()
- type AmbassadorInputs
- type Group
- type ModuleSecrets
- type Ref
- type Snapshot
- type Stopper
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAgentService ¶
func GetAgentService() string
func GetAmbId ¶
func GetAmbId(resource kates.Object) amb.AmbassadorID
GetAmbId extracts the AmbassadorId from the kubernetes resource.
func GetAmbassadorConfigBaseDir ¶
func GetAmbassadorConfigBaseDir() string
func GetAmbassadorDebug ¶
func GetAmbassadorDebug() string
func GetAmbassadorFieldSelector ¶
func GetAmbassadorFieldSelector() string
func GetAmbassadorId ¶
func GetAmbassadorId() string
func GetAmbassadorLabelSelector ¶
func GetAmbassadorLabelSelector() string
func GetAmbassadorNamespace ¶
func GetAmbassadorNamespace() string
func GetAmbassadorRoot ¶
func GetAmbassadorRoot() string
func GetAnnotations ¶
GetAnnotations extracts and converts any parseable annotations from the supplied resource. It omits any malformed annotations and does not report the errors. This is ok for now because the python code will catch and report any errors.
func GetClusterID ¶
func GetConfigDir ¶
func GetConfigDir() string
func GetDiagdArgs ¶
func GetDiagdArgs() []string
func GetDiagdBindAddress ¶
func GetDiagdBindAddress() string
func GetDiagdBindPort ¶
func GetDiagdBindPort() string
func GetDiagdFlags ¶
func GetDiagdFlags() []string
func GetEnvoyBaseId ¶
func GetEnvoyBaseId() string
func GetEnvoyBootstrapFile ¶
func GetEnvoyBootstrapFile() string
func GetEnvoyConfigFile ¶
func GetEnvoyConfigFile() string
func GetEnvoyDir ¶
func GetEnvoyDir() string
func GetEnvoyFlags ¶
func GetEnvoyFlags() []string
func GetEventHost ¶
func GetEventHost() string
func GetEventPath ¶
func GetEventPath() string
func GetEventUrl ¶
func GetEventUrl() string
func GetLicenseSecretName ¶
func GetLicenseSecretName() string
func GetLicenseSecretNamespace ¶
func GetLicenseSecretNamespace() string
func GetSidecarHost ¶
func GetSidecarHost() string
func GetSidecarPath ¶
func GetSidecarPath() string
func GetSidecarUrl ¶
func GetSidecarUrl() string
func GetSnapshotDir ¶
func GetSnapshotDir() string
func IsAmbassadorSingleNamespace ¶
func IsAmbassadorSingleNamespace() bool
func IsDiagdOnly ¶
func IsDiagdOnly() bool
func IsEdgeStack ¶
func IsEdgeStack() bool
func IsEnvoyAvailable ¶
func IsEnvoyAvailable() bool
func IsKnativeEnabled ¶
func IsKnativeEnabled() bool
func Main ¶
func Main()
This is the main ambassador entrypoint. It launches and manages two other processes:
- The diagd process.
- Envoy
The entrypoint process manages two other goroutines:
- The watcher goroutine that watches for changes in ambassador inputs and notifies diagd.
- The ambex goroutine that feeds envoy configuration updates via ADS.
Dataflow Diagram
Kubernetes Watches | | (k8s resources, subscription) | \|/ consul endpoints, subscription) entrypoint[watcher]<----------------------------------- Consul Watches | | (Snapshot, POST) | \|/ diagd | | (envoy config resources, pushed via writing files + SIGHUP) | \|/ entrypoint[ambex] | | (envoy config resources, ADS subscription) | \|/ envoy
Notation:
The arrows point in the direction that data flows. Each arrow is labeled with a tuple of the data type, and a short description of the nature of communication.
The golang entrypoint process assembles all the ambassador inputs from kubernetes and consul. When it has a complete/consistent set of inputs, it passes the complete snapshot of inputs along to diagd along with a list of deltas and invalid objects. This snapshot is fully detailed in snapshot.go
The entrypoint goes to some trouble to ensure shared fate between all three processes as well as all the goroutines it manages, i.e. if any one of them dies for any reason, the whole process will shutdown and some larger process manager (e.g. kubernetes) is expected to take note and restart if appropriate.
Types ¶
type AmbassadorInputs ¶
type AmbassadorInputs struct { // k8s resources IngressClasses []*kates.IngressClass `json:"ingressclasses"` Ingresses []*kates.Ingress `json:"ingresses"` Services []*kates.Service `json:"service"` Endpoints []*kates.Endpoints `json:"Endpoints"` // ambassador resources Hosts []*amb.Host `json:"Host"` Mappings []*amb.Mapping `json:"Mapping"` TCPMappings []*amb.TCPMapping `json:"TCPMapping"` Modules []*amb.Module `json:"Module"` TLSContexts []*amb.TLSContext `json:"TLSContext"` // plugin services AuthServices []*amb.AuthService `json:"AuthService"` RateLimitServices []*amb.RateLimitService `json:"RateLimitService"` LogServices []*amb.LogService `json:"LogService"` TracingServices []*amb.TracingService `json:"TracingService"` // resolvers ConsulResolvers []*amb.ConsulResolver `json:"ConsulResolver"` KubernetesEndpointResolvers []*amb.KubernetesEndpointResolver `json:"KubernetesEndpointResolver"` KubernetesServiceResolvers []*amb.KubernetesServiceResolver `json:"KubernetesServiceResolver"` KNativeClusterIngresses []*kates.Unstructured `json:"clusteringresses.networking.internal.knative.dev,omitempty"` KNativeIngresses []*kates.Unstructured `json:"ingresses.networking.internal.knative.dev,omitempty"` AllSecrets []*kates.Secret `json:"-"` Secrets []*kates.Secret `json:"secret"` // contains filtered or unexported fields }
func (*AmbassadorInputs) ReconcileConsul ¶
func (s *AmbassadorInputs) ReconcileConsul(ctx context.Context, consul *consul)
func (*AmbassadorInputs) ReconcileSecrets ¶
func (s *AmbassadorInputs) ReconcileSecrets()
func (*AmbassadorInputs) Render ¶
func (a *AmbassadorInputs) Render() string
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
XXX: should we replace with Luke's stuff? Manage a group of related goroutines:
- if one dies, we all die
- even if one of us is poorly behaved
- capture all background errors so it is easy to ensure they are repeated when the program terminates and not swallowed in log output
- always report poorly behaved goroutines that refuse to exit
type ModuleSecrets ¶
type ModuleSecrets struct { Defaults struct { TLSSecretNamespacing bool `json:"tls_secret_namespacing"` } `json:"defaults"` Upstream struct { Secret string `json:"secret"` } `json:"upstream"` Server struct { Secret string `json:"secret"` } `json:"server"` Client struct { Secret string `json:"secret"` } `json:"client"` }
type Snapshot ¶
type Snapshot struct { // The Kubernetes field contains all the ambassador inputs from kubernetes. Kubernetes *AmbassadorInputs // The Consul field contains endpoint data for any mappings setup to use a // consul resolver. Consul *watt.ConsulSnapshot // The Deltas field contains a list of deltas to indicate what has changed // since the prior snapshot. This is only computed for the Kubernetes // portion of the snapshot. Changes in the Consul endpoint data are not // reflected in this field. Deltas []*kates.Delta // The Invalid field contains any kubernetes resources that have failed // validation. Invalid []*kates.Unstructured }
The snapshot type represents a complete configuration snapshot as sent to diagd.
type Watcher ¶
type Watcher interface {
Watch(resolver *amb.ConsulResolver, mapping *amb.Mapping, endpoints chan consulwatch.Endpoints) Stopper
}