ambient

package
v0.0.0-...-edf464d Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Overview

nolint: gocritic

nolint: gocritic

nolint: gocritic

nolint: gocritic

nolint: gocritic

nolint: gocritic

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendNonNil

func AppendNonNil[T any](data []T, i *T) []T

func FindPortName

func FindPortName(pod *v1.Pod, name string) (int32, bool)

func GetPodCondition

func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)

func GetPodConditionFromList

func GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.PodCondition)

GetPodConditionFromList extracts the provided condition from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the condition is not present.

func GetPodReadyCondition

func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition

func IsPodReady

func IsPodReady(pod *v1.Pod) bool

IsPodReady is copied from kubernetes/pkg/api/v1/pod/utils.go

func IsPodReadyConditionTrue

func IsPodReadyConditionTrue(status v1.PodStatus) bool

IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.

func MakeSource

func MakeSource(o controllers.Object) model.TypedObject

MakeSource is a helper to turn an Object into a model.TypedObject.

func MeshConfigCollection

func MeshConfigCollection(configMaps krt.Collection[*v1.ConfigMap], options Options, withDebug krt.CollectionOption) krt.Singleton[MeshConfig]

func PushXds

func PushXds[T any](xds model.XDSUpdater, f func(T) model.ConfigKey) func(events []krt.Event[T], initialSync bool)

func RegisterEdsShim

func RegisterEdsShim(
	xdsUpdater model.XDSUpdater,
	Workloads krt.Collection[model.WorkloadInfo],
	WorkloadsByServiceKey krt.Index[string, model.WorkloadInfo],
	Services krt.Collection[model.ServiceInfo],
	ServicesByAddress krt.Index[networkAddress, model.ServiceInfo],
	withDebug krt.CollectionOption,
)

RegisterEdsShim handles triggering xDS events when Envoy EDS needs to change. Most of ambient index works to build `workloadapi` types - Workload, Service, etc. Envoy uses a different API, with different relationships between types. To ensure Envoy are updated properly on changes, we compute this information. Currently, this is only used to trigger events. Ideally, the information we are using in Envoy and the event trigger are using the same data directly.

func ReportWaypointAttachmentDenied

func ReportWaypointAttachmentDenied(waypoint string) *model.StatusMessage

func ReportWaypointIsNotReady

func ReportWaypointIsNotReady(waypoint string) *model.StatusMessage

func ReportWaypointUnsupportedTrafficType

func ReportWaypointUnsupportedTrafficType(waypoint string, ttype string) *model.StatusMessage

Types

type InboundBinding

type InboundBinding struct {
	Port     uint32
	Protocol workloadapi.ApplicationTunnel_Protocol
}

type Index

type Index interface {
	Lookup(key string) []model.AddressInfo
	All() []model.AddressInfo
	WorkloadsForWaypoint(key model.WaypointKey) []model.WorkloadInfo
	ServicesForWaypoint(key model.WaypointKey) []model.ServiceInfo
	SyncAll()
	NetworksSynced()
	Run(stop <-chan struct{})
	HasSynced() bool
	model.AmbientIndexes
}

func New

func New(options Options) Index

type LookupNetwork

type LookupNetwork func(endpointIP string, labels labels.Instance) network.ID

type LookupNetworkGateways

type LookupNetworkGateways func() []model.NetworkGateway

type MeshConfig

type MeshConfig struct {
	*meshapi.MeshConfig
}

func (MeshConfig) Equals

func (m MeshConfig) Equals(other MeshConfig) bool

func (MeshConfig) ResourceName

func (m MeshConfig) ResourceName() string

type NamespaceHostname

type NamespaceHostname struct {
	Namespace string
	Hostname  string
}

func (NamespaceHostname) String

func (n NamespaceHostname) String() string

type Options

type Options struct {
	Client kubeclient.Client

	Revision              string
	SystemNamespace       string
	DomainSuffix          string
	ClusterID             cluster.ID
	XDSUpdater            model.XDSUpdater
	LookupNetwork         LookupNetwork
	LookupNetworkGateways LookupNetworkGateways
	StatusNotifier        *activenotifier.ActiveNotifier

	Debugger *krt.DebugHandler
}

type TargetRef

type TargetRef struct {
	Kind      string
	Namespace string
	Name      string
	UID       types.UID
}

TargetRef is a subset of the Kubernetes ObjectReference which has some fields we don't care about

func (TargetRef) String

func (t TargetRef) String() string

type Waypoint

type Waypoint struct {
	krt.Named

	// Addresses this Waypoint is reachable by. For stock Istio waypoints, this
	// is usually the hostname. There will always be at least one address in this
	// list.
	Address *workloadapi.GatewayAddress

	// DefaultBinding for an inbound zTunnel to use to connect to a Waypoint it captures.
	// This is applied to the Workloads that are instances of the current Waypoint.
	DefaultBinding *InboundBinding

	// TrafficType controls whether Service or Workload can reference this
	// waypoint. Must be one of "all", "service", "workload".
	TrafficType string

	// ServiceAccounts from instances of the waypoint.
	// This only handles Pods. If we wish to support non-pod waypoints, we'll
	// want to index ServiceEntry/WorkloadEntry or possibly allow specifying
	// the ServiceAccounts directly on a Gateway resource.
	ServiceAccounts []string
	AllowedRoutes   WaypointSelector
}

func (Waypoint) AllowsAttachmentFromNamespace

func (w Waypoint) AllowsAttachmentFromNamespace(namespace *v1.Namespace) bool

func (Waypoint) AllowsAttachmentFromNamespaceOrLookup

func (w Waypoint) AllowsAttachmentFromNamespaceOrLookup(ctx krt.HandlerContext, Namespaces krt.Collection[*v1.Namespace], namespace string) bool

func (Waypoint) Equals

func (w Waypoint) Equals(other Waypoint) bool

func (*Waypoint) GetAddress

func (w *Waypoint) GetAddress() *workloadapi.GatewayAddress

GetAddress is a nil-safe traversal method for Waypoint

func (Waypoint) ResourceName

func (w Waypoint) ResourceName() string

type WaypointSelector

type WaypointSelector struct {
	FromNamespaces v1beta1.FromNamespaces
	Selector       labels.Selector
}

func (WaypointSelector) Equals

func (w WaypointSelector) Equals(other WaypointSelector) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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