entrypoint

package
v1.14.4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const ExternalSnapshotPort = 8005

take the next port in the range of ambassador ports.

Variables

This section is empty.

Functions

func ConfigIsPresent added in v1.10.0

func ConfigIsPresent(ctx context.Context, configDir string) bool

ConfigIsPresent checks to see if any configuration is actually present in the given configdir.

func ForceEndpoints added in v1.11.2

func ForceEndpoints() bool

ForceEndpoints reflects AMBASSADOR_FORCE_ENDPOINTS, to determine whether we're forcing endpoint watching or (the default) not.

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(ctx context.Context, 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) (clusterID string)

func GetConfigDir

func GetConfigDir(demoMode bool) string

GetConfigDir returns the path to the directory we should check for filesystem config.

func GetDiagdArgs

func GetDiagdArgs(ctx context.Context, demoMode bool) []string

func GetDiagdBindAddress

func GetDiagdBindAddress() string

func GetDiagdBindPort

func GetDiagdBindPort() string

func GetDiagdFlags

func GetDiagdFlags(ctx context.Context, demoMode bool) []string

func GetEnvoyAPIVersion added in v1.13.0

func GetEnvoyAPIVersion() string

func GetEnvoyBaseId

func GetEnvoyBaseId() string

func GetEnvoyBootstrapFile

func GetEnvoyBootstrapFile() string

func GetEnvoyConcurrency added in v1.11.0

func GetEnvoyConcurrency() 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 GetHomeDir added in v1.11.0

func GetHomeDir() string

func GetInterestingTypes added in v1.11.2

func GetInterestingTypes(ctx context.Context, serverTypeList []kates.APIResource) map[string]thingToWatch

GetInterestingTypes takes a list of available server types, and returns the types we think are interesting to watch.

func GetLicenseSecretName

func GetLicenseSecretName() string

func GetLicenseSecretNamespace

func GetLicenseSecretNamespace() string

func GetQueries added in v1.11.2

func GetQueries(ctx context.Context, interestingTypes map[string]thingToWatch) []kates.Query

GetQueries takes a set of interesting types, and returns a set of kates.Query to watch for them.

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(ctx context.Context, Version string, args ...string) error

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.

func NewKubernetesSnapshot added in v1.11.0

func NewKubernetesSnapshot() *snapshotTypes.KubernetesSnapshot

NewKubernetesSnapshot creates a new, empty set of Ambassador inputs.

func ReconcileConsul added in v1.11.0

func ReconcileConsul(ctx context.Context, consul *consul, s *snapshotTypes.KubernetesSnapshot)

func ReconcileSecrets added in v1.11.0

func ReconcileSecrets(ctx context.Context, s *snapshotTypes.KubernetesSnapshot)

ReconcileSecrets figures out which secrets we're actually using, since we don't want to send secrets to Ambassador unless we're using them, since any secret we send will be saved to disk.

Types

type ConsulKey added in v1.11.2

type ConsulKey struct {
	// contains filtered or unexported fields
}

type ConsulStore added in v1.11.2

type ConsulStore struct {
	// contains filtered or unexported fields
}

func NewConsulStore added in v1.11.2

func NewConsulStore() *ConsulStore

func (*ConsulStore) ConsulEndpoint added in v1.11.2

func (c *ConsulStore) ConsulEndpoint(datacenter, service, address string, port int, tags ...string)

func (*ConsulStore) Get added in v1.11.2

func (c *ConsulStore) Get(datacenter, service string) (consulwatch.Endpoints, bool)

type FSWErrorHandler added in v1.10.0

type FSWErrorHandler func(ctx context.Context, err error)

FSWErrorHandler is a handler function for an error.

type FSWEvent added in v1.10.0

type FSWEvent struct {
	// Path is the fully-qualified path of the file that changed.
	Path string
	// Op is the operation for this event.
	Op FSWOp
	// Bootstrap is true IFF this is a synthesized event noting
	// that a file existed at the moment we started watching a
	// directory.
	Bootstrap bool
	// Time is when this event happened
	Time time.Time
}

FSWEvent represents a single interesting event.

func (FSWEvent) String added in v1.10.0

func (event FSWEvent) String() string

String returns a string representation of an FSEvent.

type FSWEventHandler added in v1.10.0

type FSWEventHandler func(ctx context.Context, event FSWEvent)

FSWEventHandler is a handler function for an interesting event.

type FSWOp added in v1.10.0

type FSWOp string

FSWOp specifies the operation for an event.

const (
	// FSWUpdate is an update operation
	FSWUpdate FSWOp = "update"

	// FSWDelete is a delete operation
	FSWDelete FSWOp = "delete"
)

type FSWatcher added in v1.10.0

type FSWatcher struct {
	FSW *fsnotify.Watcher
	// contains filtered or unexported fields
}

FSWatcher is a thing that can watch the filesystem for us, and call handler functions when things change.

The core of an FSWatcher is fsnotify/fsnotify, but we wrap some state around it.

First, fsnotify tries to mark the operation associated with a change -- however, these are not always accurate, since the filesystem tries to coalesce events that are close in time. Therefore FSWatcher doesn't actually look at the operation: everything is just "a change happened".

This causes one interesting problem: given a touch of temporal separation between Create and Write, we may decide to trigger a reconfigure on the Create, before the data have been written. To mitigate against that, we'll wait up to half a second after an event to see if any other events will be happening (with the idea that if you've come within half a second of your cert expiring before renewing it, uh, yeah, maybe you _will_ have some transient errors).

Second, when we start watching a directory, we make sure that "update" events get posted for every file in the directory. These are marked as "bootstrap" events.

Finally, rather than posting things to channels, we call a handler function whenever anything interesting happens, where "interesting" is one of the events above, or an error.

func NewFSWatcher added in v1.10.0

func NewFSWatcher(ctx context.Context) (*FSWatcher, error)

NewFSWatcher instantiates an FSWatcher. At instantiation time, no directories are being watched.

func (*FSWatcher) SetErrorHandler added in v1.10.0

func (fsw *FSWatcher) SetErrorHandler(handler FSWErrorHandler)

SetErrorHandler sets the function that will be used to respond to errors.

func (*FSWatcher) WatchDir added in v1.10.0

func (fsw *FSWatcher) WatchDir(ctx context.Context, dir string, handler FSWEventHandler)

WatchDir starts watching a directory, using a specific handler function. You'll need to separately call WatchDir for subdirectories if you want recursive watches.

type Fake added in v1.11.2

type Fake struct {
	T *testing.T
	// contains filtered or unexported fields
}

The Fake struct is a test harness for edgestack. Its goals are to help us fill out our test pyramid by making it super easy to create unit-like tests directly from the snapshots, bug reports, and other inputs provided by users who find regressions and/or encounter other problems in the field. Since we have no shortage of these reports, if we make it easy to create tests from them, we will fill out our test pyramid quickly and hopefully reduce our rate of regressions. This also means the tests produced this way need to scale well both in terms of execution time/parallelism as well as flakiness since we will quickly have a large number of these tests.

The way this works is by isolating via dependency injection the key portions of the control plane where the bulk of our business logic is implemented. The Fake utilities directly feed this lightweight control plane its input as specified by the test code without passing the resources all the way through a real kubernetes API server and/or a real consul deployment. This is not only significantly more efficient than spinning up real kubernetes and/or consul deployments, but it also lets us precisely control the order of events thereby a) removing the nondeterminism that leads to flaky tests, and b) also allowing us to deliberately create/recreate the sort of low probability sequence of events that are often at the root of heisenbugs.

The key to being able to build tests this way is expressing our business logic as "hermetically sealed" libraries, i.e. libraries with no/few hardcoded dependencies. This doesn't have to be done in a fancy/elegant way, it is well worth practicing "stupidly mechanical dependency injection" in order to quickly excise some business logic of its hardcoded dependencies and enable this sort of testing.

See TestFakeHello, TestFakeHelloWithEnvoyConfig, and TestFakeHelloConsul for examples of how to get started using this struct to write tests.

func NewFake added in v1.11.2

func NewFake(t *testing.T, config FakeConfig) *Fake

NewFake will construct a new Fake object. See RunFake for a convenient way to handle construct, Setup, and Teardown of a Fake with one line of code.

func RunFake added in v1.11.2

func RunFake(t *testing.T, config FakeConfig, ambMeta *snapshot.AmbassadorMetaInfo) *Fake

RunFake will create a new fake, invoke its Setup method and register its Teardown method as a Cleanup function with the test object.

func (*Fake) AssertEndpointsEmpty added in v1.12.0

func (f *Fake) AssertEndpointsEmpty(timeout time.Duration)

func (*Fake) AutoFlush added in v1.11.2

func (f *Fake) AutoFlush(enabled bool)

AutoFlush will cause a flush whenever any inputs are modified.

func (*Fake) ConsulEndpoint added in v1.11.2

func (f *Fake) ConsulEndpoint(datacenter, service, address string, port int, tags ...string)

ConsulEndpoint stores the supplied consul endpoint data.

func (*Fake) Delete added in v1.11.2

func (f *Fake) Delete(kind, namespace, name string)

Delete will removes the specified resource from the fake k8s datastore.

func (*Fake) Flush added in v1.11.2

func (f *Fake) Flush()

Feed will cause inputs from all datasources to be delivered to the control plane.

func (*Fake) GetEndpoints added in v1.12.0

func (f *Fake) GetEndpoints(predicate func(*ambex.Endpoints) bool) *ambex.Endpoints

func (*Fake) GetEnvoyConfig added in v1.11.2

func (f *Fake) GetEnvoyConfig(predicate func(*bootstrap.Bootstrap) bool) *bootstrap.Bootstrap

GetEnvoyConfig will return the next envoy config that satisfies the supplied predicate.

func (*Fake) GetSnapshot added in v1.11.2

func (f *Fake) GetSnapshot(predicate func(*snapshot.Snapshot) bool) *snapshot.Snapshot

GetSnapshot will return the next snapshot that satisfies the supplied predicate.

func (*Fake) GetSnapshotEntry added in v1.11.2

func (f *Fake) GetSnapshotEntry(predicate func(SnapshotEntry) bool) SnapshotEntry

GetSnapshotEntry will return the next SnapshotEntry that satisfies the supplied predicate.

func (*Fake) SendIstioCertUpdate added in v1.11.2

func (f *Fake) SendIstioCertUpdate(update IstioCertUpdate)

SendIstioCertUpdate sends the supplied Istio certificate update.

func (*Fake) SetAmbassadorMeta added in v1.12.0

func (f *Fake) SetAmbassadorMeta(ambMeta *snapshot.AmbassadorMetaInfo)

sets the ambassador meta info that should get sent in each snapshot

func (*Fake) Setup added in v1.11.2

func (f *Fake) Setup()

Setup will start up all the goroutines needed for this fake edgestack instance. Depending on the FakeConfig supplied wen constructing the Fake, this may also involve launching external processes, you should therefore ensure that you call Teardown whenever you call Setup.

func (*Fake) Teardown added in v1.11.2

func (f *Fake) Teardown()

Teardown will clean up anything that Setup has started. It is idempotent. Note that if you use RunFake Setup will be called and Teardown will be automatically registered as a Cleanup function with the supplied testing.T

func (*Fake) Upsert added in v1.11.2

func (f *Fake) Upsert(resource kates.Object)

Upsert will update (or if necessary create) the supplied resource in the fake k8s datastore.

func (*Fake) UpsertFile added in v1.11.2

func (f *Fake) UpsertFile(filename string)

UpsertFile will parse the contents of the file as yaml and feed them into the control plane created or updating any overlapping resources that exist.

func (*Fake) UpsertYAML added in v1.11.2

func (f *Fake) UpsertYAML(yaml string)

UpsertYAML will parse the provided YAML and feed the resources in it into the control plane, creating or updating any overlapping resources that exist.

type FakeConfig added in v1.11.2

type FakeConfig struct {
	EnvoyConfig bool          // If true then the Fake will produce envoy configs in addition to Snapshots.
	DiagdDebug  bool          // If true then diagd will have debugging enabled
	Timeout     time.Duration // How long to wait for snapshots and/or envoy configs to become available.
}

FakeConfig provides option when constructing a new Fake.

type FastpathProcessor added in v1.13.0

type FastpathProcessor func(context.Context, *ambex.FastpathSnapshot)

type IstioCert added in v1.10.0

type IstioCert struct {
	// contains filtered or unexported fields
}

IstioCert holds all the state we need to manage an Istio certificate.

func NewIstioCert added in v1.10.0

func NewIstioCert(dir string, name string, namespace string, updateChannel chan IstioCertUpdate) *IstioCert

NewIstioCert instantiates an IstioCert to manage a certificate that Istio will write into directory "dir", should have the given "name" and appear to live in K8s namespace "namespace", and will have updates posted to "updateChannel" whenever the cert changes.

What's with this namespace business? Well, Ambassador may be running in single-namespace mode, so causing our cert to appear to be in the same namespace as Ambassador will just be less confusing for everyone.

XXX Nomenclature is a little odd here. Istio is writing a _certificate_, but we're supplying it to the rest of Ambassador as a thing that looks like a Kubernetes TLS _Secret_ -- so we call this class an IstioCert, but the thing it's posting to the updateChannel includes a kates.Secret. Names are hard.

func (*IstioCert) HandleEvent added in v1.10.0

func (icert *IstioCert) HandleEvent(ctx context.Context, name string, deleted bool)

HandleEvent tells an IstioCert to update its internal state because a file in its directory has been written. If all the cert files have been updated closely enough in time, Update will decide that it's time to actually update the cert, and it'll send an IstioCertUpdate over the Updates channel.

func (*IstioCert) Secret added in v1.10.0

func (icert *IstioCert) Secret(ctx context.Context) (*kates.Secret, bool)

Secret generates a kates.Secret for this IstioCert. Since this involves reading PEM, it can fail, so it logs and returns a status.

func (*IstioCert) SetFetchTime added in v1.10.0

func (icert *IstioCert) SetFetchTime(fetchTime timeFetcher)

SetFetchTime will change the function we use to get the current time.

func (*IstioCert) SetReadPEM added in v1.10.0

func (icert *IstioCert) SetReadPEM(readPEM pemReader)

SetReadPEM will change the function we use to read PEM files.

func (*IstioCert) String added in v1.10.0

func (icert *IstioCert) String() string

String returns a string representation of this IstioCert.

type IstioCertSource added in v1.11.2

type IstioCertSource interface {
	Watch(ctx context.Context) IstioCertWatcher
}

type IstioCertUpdate added in v1.10.0

type IstioCertUpdate struct {
	Op        string        // "update" or "delete"
	Name      string        // secret name
	Namespace string        // secret namespace
	Secret    *kates.Secret // IstioCert secret
}

IstioCertUpdate gets sent over the IstioCert's Updates channel whenever the cert changes

XXX This will morph into a more general "internally-generated resource" thing later.

type IstioCertWatcher added in v1.11.2

type IstioCertWatcher interface {
	Changed() chan IstioCertUpdate
}

type K8sKey added in v1.11.2

type K8sKey struct {
	Kind      string
	Namespace string
	Name      string
}

type K8sSource added in v1.11.2

type K8sSource interface {
	Watch(ctx context.Context, queries ...kates.Query) K8sWatcher
}

type K8sStore added in v1.11.2

type K8sStore struct {
	// contains filtered or unexported fields
}

A K8sStore is implement just enough data structures to mock the watch aspect of kubernetes for testing purposes. It holds a map of kubernetes resources. Whenever any of these resources change it computes a delta and adds it to the list of deltas. The store is also capable of creating cursors that can be used to track multiple watches independently consuming the deltas at different rates.

func NewK8sStore added in v1.11.2

func NewK8sStore() *K8sStore

NewK8sStore creates a new and empty store.

func (*K8sStore) Cursor added in v1.11.2

func (k *K8sStore) Cursor() *K8sStoreCursor

A Cursor allows multiple views of the same stream of deltas. The cursors implement a bootstrap semantic where they will generate synthetic Add deltas for every resource that currently exists, and from that point on report the real deltas that actually occur on the store.

func (*K8sStore) Delete added in v1.11.2

func (k *K8sStore) Delete(kind, namespace, name string)

Delete will remove the identified resource from the store.

func (*K8sStore) Upsert added in v1.11.2

func (k *K8sStore) Upsert(resource kates.Object)

Upsert will either update or insert the given object depending on whether or not an object with that key already exists. Note that this is currently done based solely on the key (namespace, name) of the resource. Theoretically resources are assigned UUIDs and so in theory we could detect changes to the name and namespace, however I'm not even sure how kubernetes handles this or if it even permits that, so I am not going to attempt to consider those cases, and that may well result in some very obscure edgecases around changing names/namespaces that behave differently different from kubernetes.

func (*K8sStore) UpsertFile added in v1.11.2

func (k *K8sStore) UpsertFile(filename string)

UpsertFile will parse the yaml manifests in the referenced file and Upsert each resource from the file.

func (*K8sStore) UpsertYAML added in v1.11.2

func (k *K8sStore) UpsertYAML(yaml string)

UpsertYAML will parse the provided YAML and feed the resources in it into the control plane, creating or updating any overlapping resources that exist.

type K8sStoreCursor added in v1.11.2

type K8sStoreCursor struct {
	// contains filtered or unexported fields
}

func (*K8sStoreCursor) Get added in v1.11.2

func (kc *K8sStoreCursor) Get() (map[K8sKey]kates.Object, []*kates.Delta)

Get returns a map of resources plus all the deltas that lead to the map being in its current state.

type K8sWatcher added in v1.11.2

type K8sWatcher interface {
	Changed() chan struct{}
	FilteredUpdate(target interface{}, deltas *[]*kates.Delta, predicate func(*kates.Unstructured) bool) bool
}

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"`
}

ModuleSecrets is... a hack. It's sort of a mashup of the chunk of the Ambassador Module and the chunk of the TLS Module that are common, because they're able to specify secrets. However... first, I don't think the TLS Module actually supported tls_secret_namespacing. Second, the Ambassador Module at least supports arbitrary origination context names -- _any_ key in the TLS dictionary will get turned into an origination context.

I seriously doubt that either of these will actually affect anyone at this remove, but... yeah.

type Notifier added in v1.11.2

type Notifier struct {
	// contains filtered or unexported fields
}

The Notifier struct buffers up notifications to multiple listeners. This is used as plumbing to wire up watchers for the K8sStore and ConsulStore. A monotonically increasing changeCount field functions as a logical clock tracking how many changes have occured. The notifyCount field tracks how many of these changes are to be communicated to listeners. Each listener also tracks its own count which starts at zero. This ensures that new listeners are always notified of changes that have happened prior to the listener being created.

func NewNotifier added in v1.11.2

func NewNotifier() *Notifier

NewNotifier constructs a new notifier struct that is ready for use.

func (*Notifier) AutoNotify added in v1.11.2

func (n *Notifier) AutoNotify(enabled bool)

AutoNotify controls the notification mode.

func (*Notifier) Changed added in v1.11.2

func (n *Notifier) Changed()

Changed signals that a change has occured that will eventually need to be communicated to all listeners.

func (*Notifier) Listen added in v1.11.2

func (n *Notifier) Listen(onChange func()) StopFunc

Listen will invoke the supplied function whenever a change is signaled. Changes will be coalesced if they happen quickly enough. A stop function is returned that when invoked will prevent future changes from notifying the Listener.

func (*Notifier) Notify added in v1.11.2

func (n *Notifier) Notify()

Notify listeners of an and all outstanding changes.

type Queue added in v1.11.2

type Queue struct {
	T *testing.T
	// contains filtered or unexported fields
}

The Queue struct implements a multi-writer/multi-reader concurrent queue where the dequeue operation (the Get() method) takes a predicate that allows it to skip past queue entries until it finds one that satisfies the specified predicate.

func NewQueue added in v1.11.2

func NewQueue(t *testing.T, timeout time.Duration) *Queue

NewQueue constructs a new queue with the supplied timeout.

func (*Queue) Add added in v1.11.2

func (q *Queue) Add(obj interface{})

Add an entry to the queue.

func (*Queue) AssertEmpty added in v1.12.0

func (q *Queue) AssertEmpty(timeout time.Duration, msg string)

AssertEmpty will check that the queue remains empty for the supplied duration.

func (*Queue) Get added in v1.11.2

func (q *Queue) Get(predicate func(interface{}) bool) interface{}

Get will return the next entry that satisfies the supplied predicate.

type ResolverType added in v1.12.0

type ResolverType int
const (
	KubernetesServiceResolver ResolverType = iota
	KubernetesEndpointResolver
	ConsulResolver
)

func (ResolverType) String added in v1.12.0

func (rt ResolverType) String() string

type SnapshotDisposition added in v1.11.2

type SnapshotDisposition int
const (
	// Indicates the watcher is still in the booting process and the snapshot has dangling pointers.
	SnapshotIncomplete SnapshotDisposition = iota
	// Indicates that the watcher is deferring processing of the snapshot because it is considered
	// to be a product of churn.
	SnapshotDefer
	// Indicates that the watcher is dropping the snapshot because it has determined that it is
	// logically a noop.
	SnapshotDrop
	// Indicates that the snapshot is ready to be processed.
	SnapshotReady
)

type SnapshotEntry added in v1.11.2

type SnapshotEntry struct {
	Disposition SnapshotDisposition
	Snapshot    *snapshot.Snapshot
}

type SnapshotHolder added in v1.12.0

type SnapshotHolder struct {
	// contains filtered or unexported fields
}

SnapshotHolder is responsible for holding

func NewSnapshotHolder added in v1.12.0

func NewSnapshotHolder(ambassadorMeta *snapshot.AmbassadorMetaInfo) *SnapshotHolder

func (*SnapshotHolder) ConsulUpdate added in v1.12.0

func (sh *SnapshotHolder) ConsulUpdate(ctx context.Context, consul *consul, fastpathProcessor FastpathProcessor) bool

func (*SnapshotHolder) IstioUpdate added in v1.12.0

func (sh *SnapshotHolder) IstioUpdate(ctx context.Context, istio *istioCertWatchManager,
	icertUpdate IstioCertUpdate) bool

func (*SnapshotHolder) K8sUpdate added in v1.12.0

func (sh *SnapshotHolder) K8sUpdate(ctx context.Context, watcher K8sWatcher, consul *consul,
	fastpathProcessor FastpathProcessor) bool

Get the raw update from the kubernetes watcher, then redo our computed view.

func (*SnapshotHolder) Notify added in v1.12.0

func (sh *SnapshotHolder) Notify(ctx context.Context, encoded *atomic.Value, consul *consul,
	snapshotProcessor SnapshotProcessor)

type SnapshotProcessor added in v1.11.2

type SnapshotProcessor func(context.Context, SnapshotDisposition, []byte)

type StopFunc added in v1.11.2

type StopFunc func()

type Stopper

type Stopper interface {
	Stop()
}

type Watcher

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

Jump to

Keyboard shortcuts

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