entrypoint

package
v1.9.1-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

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

func GetAnnotations(resources ...kates.Object) (result []kates.Object)

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 GetAppDir

func GetAppDir() string

func GetClusterID

func GetClusterID(ctx context.Context) string

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:

  1. The diagd process.
  2. Envoy

The entrypoint process manages two other goroutines:

  1. The watcher goroutine that watches for changes in ambassador inputs and notifies diagd.
  2. 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"`
	DevPortals        []*amb.DevPortal        `json:"DevPortal"`

	// 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

func NewGroup

func NewGroup(parent context.Context, grace time.Duration) *Group

func (*Group) Go

func (g *Group) Go(name string, f func(context.Context))

Launch a goroutine as part of the group.

func (*Group) Wait

func (g *Group) Wait() map[string]interface{}

Wait for all goroutines in the group to finish, and return a map of any errors. No news is good news. If the map does not contain an entry for the goroutine, then it exited normally.

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 Ref

type Ref struct {
	Namespace string
	Name      string
}

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 Stopper

type Stopper interface {
	Stop()
}

type Watcher

type Watcher interface {
	Watch(resolver *amb.ConsulResolver, mapping *amb.Mapping, endpoints chan consulwatch.Endpoints) Stopper
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL