wiring

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 64 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wiring sends a proxy's protected routes to the engine (0004 §4.4), through one Integration per proxy. For Traefik: an operator-owned ForwardAuth Middleware in each namespace with protected routes, attached to protected Ingresses through Traefik's router.middlewares annotation, to protected IngressRoutes' routes through their middlewares, and to protected HTTPRoutes' rules through an ExtensionRef filter.

Index

Constants

View Source
const (
	ReasonProgrammed            = "Programmed"
	ReasonControllerUnsupported = "ControllerUnsupported"
	ReasonWiringFailed          = "WiringFailed"
	ReasonPendingRestart        = "PendingRestart"
	ReasonSidecarMissing        = "SidecarMissing"
	ReasonNoTargets             = "NoTargets"
	ReasonInjectionDisabled     = "InjectionDisabled"
	ReasonPending               = "Pending"
	// ReasonUnverified: wired, but not proven in force (the operator's
	// probe, through HAProxy and Istio).
	ReasonUnverified = "Unverified"
	// ReasonNotProbeable: wired, but the probe can't reach the route (a
	// regular expression match, a mutual TLS listener), so it can't be
	// proven in force (#372).
	ReasonNotProbeable = "NotProbeable"
	// ReasonIntegrationDisabled: the operator may not wire the proxy that
	// serves a target (Disable).
	ReasonIntegrationDisabled = "IntegrationDisabled"
	// ReasonUnwired: `inkwall-operator unwire` (helm uninstall) unwired
	// the routes and stopped the operator.
	ReasonUnwired = "Unwired"
	// ReasonResponsesNotInspected: the policy inspects responses, but the
	// proxy serving a target can't send them to the engine (Traefik): its
	// requests are inspected, its responses are not.
	ReasonResponsesNotInspected = "ResponsesNotInspected"
)

Reasons of the Programmed condition.

View Source
const (
	// HAProxySnippetAnnotation and HAProxyStandaloneAnnotation are the
	// controller's.
	HAProxySnippetAnnotation    = "haproxy.org/backend-config-snippet"
	HAProxyStandaloneAnnotation = "haproxy.org/standalone-backend"
	// HAProxyWiredAnnotation marks an Ingress the operator wired; its value
	// is what haproxy.org/standalone-backend was before ("" when unset),
	// restored when it is unwired.
	HAProxyWiredAnnotation = "waf.inkwall.dev/haproxy-wired"
)

Annotations of the HAProxy wiring.

View Source
const (
	// MiddlewareName is the operator's Middleware in each protected
	// namespace; not "inkwall", so it can't take over one made by hand.
	MiddlewareName = "inkwall-waf"
	// MiddlewaresAnnotation lists an Ingress router's Middlewares.
	MiddlewaresAnnotation = "traefik.ingress.kubernetes.io/router.middlewares"
	// WiredAnnotation marks an Ingress, IngressRoute or HTTPRoute the
	// operator wired, with the Middleware it added (MiddlewareRef on an
	// Ingress, MiddlewareName on the others), so it removes exactly that.
	WiredAnnotation = "waf.inkwall.dev/wired"
)

Names of the Traefik wiring.

View Source
const (
	// EnvoyBackend is the operator's Backend, the engine's socket, in each
	// namespace with protected HTTPRoutes.
	EnvoyBackend = "inkwall-engine"
)

Names of the Envoy Gateway wiring.

View Source
const Finalizer = "waf.inkwall.dev/unwire"

Finalizer holds a WAFPolicy until the operator has unwired its routes, so a policy deleted while the operator is down is unwired once it is back. Only the wiring controller adds it; it and `inkwall-operator unwire` remove it.

Variables

View Source
var (
	EnvoyProxyGVK           = schema.GroupVersionKind{Group: "gateway.envoyproxy.io", Version: "v1alpha1", Kind: "EnvoyProxy"}
	EnvoyExtensionPolicyGVK = schema.GroupVersionKind{Group: "gateway.envoyproxy.io", Version: "v1alpha1", Kind: "EnvoyExtensionPolicy"}
	BackendGVK              = schema.GroupVersionKind{Group: "gateway.envoyproxy.io", Version: "v1alpha1", Kind: "Backend"}
	ClientTrafficPolicyGVK  = schema.GroupVersionKind{Group: "gateway.envoyproxy.io", Version: "v1alpha1", Kind: "ClientTrafficPolicy"}
	// GatewayGVK and HTTPRouteGVK are the Gateway API's, read typed.
	GatewayGVK   = schema.GroupVersionKind{Group: gatewayv1.GroupName, Version: "v1", Kind: "Gateway"}
	HTTPRouteGVK = schema.GroupVersionKind{Group: gatewayv1.GroupName, Version: "v1", Kind: "HTTPRoute"}
	// GatewayClassGVK is read unstructured, as discovery does.
	GatewayClassGVK = schema.GroupVersionKind{Group: gatewayv1.GroupName, Version: "v1", Kind: "GatewayClass"}
)

Envoy Gateway's kinds, read and written unstructured: the operator doesn't depend on Envoy Gateway's Go module.

View Source
var (
	IstioVirtualServiceGVK = integrations.IstioVirtualServiceGVK
	IstioGatewayGVK        = integrations.IstioGatewayGVK
)

IstioVirtualServiceGVK and IstioGatewayGVK are Istio's, read unstructured.

View Source
var EnvoyFilterGVK = schema.GroupVersionKind{Group: "networking.istio.io", Version: "v1alpha3", Kind: "EnvoyFilter"}

EnvoyFilterGVK is Istio's EnvoyFilter, read and written unstructured: the operator doesn't depend on Istio's Go module.

Functions

func Controller

func Controller(ing *networkingv1.Ingress, classes map[string]string, defaultClass string) string

Controller returns the controller of the IngressClass serving ing, or "" when it can't be told. classes maps class names to their controllers; defaultClass is the class marked default, if any.

func ForwardAuthMatches

func ForwardAuthMatches(m *unstructured.Unstructured) bool

ForwardAuthMatches reports whether a Middleware's spec is the operator's.

func HAProxySnippet added in v0.4.0

func HAProxySnippet(failOpen, body bool) string

HAProxySnippet is the operator's part of a protected Ingress's backend snippet: the body buffered for the engine when a policy inspects it, the SPOE filter, and the rules on its variables: the probe's answer first (Prober), then, failing closed, 503 without a verdict, a denied gRPC call's answer, and a rule per status the engine denies with; the request ID for the app.

func IngressRoutes added in v0.1.1

func IngressRoutes(ctx context.Context, c client.Client) (routes []unstructured.Unstructured, installed bool, err error)

IngressRoutes lists Traefik's IngressRoutes; installed is false, with none, when their CRD isn't.

func IsDefaultClass

func IsDefaultClass(ic *networkingv1.IngressClass) bool

IsDefaultClass reports whether an IngressClass is the cluster default.

func Middleware

func Middleware(namespace string) *unstructured.Unstructured

Middleware returns the operator's Middleware for namespace.

func MiddlewareRef

func MiddlewareRef(namespace string) string

MiddlewareRef is how an Ingress in namespace refers to the operator's Middleware there.

func VirtualServices added in v0.4.0

func VirtualServices(ctx context.Context, c client.Client) ([]unstructured.Unstructured, error)

VirtualServices lists Istio's VirtualServices; none when their CRD isn't installed.

func WithMiddleware

func WithMiddleware(current, ref string) string

WithMiddleware returns the annotation value with ref added (first, so the engine sees the request before other Middlewares change it), unchanged if present.

func WithRouteMiddleware added in v0.1.1

func WithRouteMiddleware(ir *unstructured.Unstructured, want bool) (bool, error)

WithRouteMiddleware adds the operator's Middleware to every route of an IngressRoute (want), first, or removes it from them. A route refers to it by name only: Traefik looks it up in the IngressRoute's namespace, which needs no allowCrossNamespace. The user's Middlewares stay, in order. It reports whether ir changed.

func WithRuleFilter added in v0.3.0

func WithRuleFilter(hr *unstructured.Unstructured, sel rules) (bool, error)

WithRuleFilter adds the operator's Middleware, as an ExtensionRef filter, first to the rules of an HTTPRoute that sel selects, and removes it from the others. The reference has no namespace: Traefik looks the Middleware up in the HTTPRoute's. The user's filters stay, in order. It reports whether hr changed.

func WithoutMiddleware

func WithoutMiddleware(current, ref string) string

WithoutMiddleware returns the annotation value without ref.

Types

type Config added in v0.3.0

type Config struct {
	// Pods select the proxies' pods; nil: the defaults.
	Pods *integrations.Selectors
	// Watches of kinds whose CRD may be missing, once it is installed;
	// nil: only read at each reconcile.
	IngressRoutes, HTTPRoutes, Gateways, GatewayClasses, EnvoyProxies, ExtensionPolicies, TrafficPolicies *crdwatch.Kind
	// EnvoyFilters, VirtualServices and IstioGateways are Istio's.
	EnvoyFilters, VirtualServices, IstioGateways *crdwatch.Kind
	// Sidecar is the engine Envoy Gateway's and Istio's pods get, before
	// the InkwallConfig's settings.
	Sidecar injection.Sidecar
	// Prober probes HAProxy's wired routes; nil: none is.
	Prober *Prober
}

Config is what the integrations need besides the clients.

type EnvoyGateway added in v0.3.0

type EnvoyGateway struct {
	Client client.Client
	// APIReader reads the operator's objects uncached.
	APIReader client.Reader
	// Pods selects Envoy Gateway's Envoy pods.
	Pods labels.Selector
	// Sidecar is the engine put into the Envoy pods, before the
	// InkwallConfig's engine settings.
	Sidecar injection.Sidecar
	// Watches of kinds whose CRD may be missing; nil: only read at each
	// reconcile.
	HTTPRoutes, Gateways, GatewayClasses, EnvoyProxies, ExtensionPolicies, TrafficPolicies *crdwatch.Kind
}

EnvoyGateway is the wiring of Envoy Gateway: its HTTPRoutes.

func (*EnvoyGateway) Kinds added in v0.3.0

func (*EnvoyGateway) Kinds() []schema.GroupKind

Kinds implements Integration.

func (*EnvoyGateway) Name added in v0.3.0

func (*EnvoyGateway) Name() string

Name implements Integration.

func (*EnvoyGateway) Unwire added in v0.3.0

func (e *EnvoyGateway) Unwire(ctx context.Context, c client.Client) (map[string]int, error)

Unwire implements Integration: the routes stop calling the engine, then the engine leaves the Envoy pods (Envoy Gateway rolls them), and the users' Gateways and EnvoyProxies are as they were.

func (*EnvoyGateway) Watch added in v0.3.0

Watch implements Integration.

func (*EnvoyGateway) Wire added in v0.3.0

func (e *EnvoyGateway) Wire(ctx context.Context, targets map[Target]bool, off bool) (*Result, error)

Wire implements Integration: it puts the engine into the Envoy pods of the Gateways serving protected HTTPRoutes, attaches the engine to those routes once the pods have it, and removes the rest.

func (*EnvoyGateway) Wired added in v0.3.0

func (e *EnvoyGateway) Wired(ctx context.Context, tg Target) (bool, error)

Wired implements Integration: the route has the operator's EnvoyExtensionPolicy.

type HAProxy added in v0.4.0

type HAProxy struct {
	Client client.Client
	// APIReader reads targets uncached.
	APIReader client.Reader
	// Pods selects the controller's pods (integrations.Selectors).
	Pods labels.Selector
	// Prober probes the wired routes; nil: none is, and every route stays
	// Unverified.
	Prober *Prober
}

HAProxy is the wiring of the HAProxy Kubernetes Ingress Controller: its Ingresses.

func (*HAProxy) Kinds added in v0.4.0

func (*HAProxy) Kinds() []schema.GroupKind

Kinds implements Integration.

func (*HAProxy) Name added in v0.4.0

func (*HAProxy) Name() string

Name implements Integration.

func (*HAProxy) Unwire added in v0.4.0

func (*HAProxy) Unwire(ctx context.Context, c client.Client) (map[string]int, error)

Unwire implements Integration: it removes the operator's snippet from every Ingress it wired, and restores standalone-backend.

func (*HAProxy) Watch added in v0.4.0

Watch implements Integration: Ingresses (their annotations), classes, the controller's pods, the policies' settings (the wiring controller watches them), and the probe's results.

func (*HAProxy) Wire added in v0.4.0

func (h *HAProxy) Wire(ctx context.Context, targets map[Target]bool, off bool) (*Result, error)

Wire implements Integration: it wires every protected Ingress of the controller's class, and unwires the rest.

func (*HAProxy) Wired added in v0.4.0

func (h *HAProxy) Wired(ctx context.Context, tg Target) (bool, error)

Wired implements Integration: the Ingress carries HAProxyWiredAnnotation.

type Integration added in v0.3.0

type Integration interface {
	// Name is integrations.Integration.Name, e.g. "traefik", and the
	// integration label of the wiring metrics.
	Name() string
	// Kinds are the target kinds it wires.
	Kinds() []schema.GroupKind
	// Watch has c reconcile when what the wiring reads, besides the
	// policies, changes: routes, classes, the proxy's pods, its own
	// objects.
	Watch(c controller.Controller, cache cache.Cache, h handler.EventHandler) error
	// Wire wires the targets (those of the live policies, of its kinds)
	// that its proxy serves, and unwires every other route it wired; with
	// off, it unwires them all. It reports on each target, and on what it
	// couldn't do with an error; a nil Result means it did nothing.
	Wire(ctx context.Context, targets map[Target]bool, off bool) (*Result, error)
	// Wired reports whether a target is still wired, read from the API
	// server: a policy being deleted is released once none of its targets
	// is. A target that doesn't exist isn't.
	Wired(ctx context.Context, t Target) (bool, error)
	// Unwire removes all of its wiring, at uninstall. It counts what it
	// changed, by kind.
	Unwire(ctx context.Context, c client.Client) (map[string]int, error)
}

Integration is the wiring of one proxy (0004 §4.2): the target kinds it wires, how, and what it reports on each target. integrations.Integration describes the same proxy to discovery and injection. The wiring controller runs every integration at each reconcile; several may share a kind (Ingress, HTTPRoute), each wiring the targets its proxy serves.

func Disable added in v0.3.0

func Disable(in Integration, why string, c client.Client, cfg Config) Integration

Disable wraps an integration the operator may not wire, and why (its ClusterRole isn't granted, 0004 §7). The wrapper neither watches nor touches the proxy's objects, which it may not read; it reads only the routes and classes, which every integration may, to report the targets its proxy serves as IntegrationDisabled. It can't unwire them: what it wired before stays wired, and a deleted policy isn't held for it. cfg has the watches of the routes and classes.

func Integrations added in v0.3.0

func Integrations(c client.Client, reader client.Reader, cfg Config) []Integration

Integrations are the wiring of every proxy Inkwall integrates: Traefik, Envoy Gateway, Istio (its Gateway API and its ingress gateways) and the HAProxy Kubernetes Ingress Controller.

type Istio added in v0.4.0

type Istio struct {
	Client client.Client
	// APIReader reads the operator's objects, and ConfigMaps, uncached.
	APIReader client.Reader
	// Pods selects the pods Istio runs for Gateways.
	Pods labels.Selector
	// Sidecar is the engine put into the Gateways' pods, before the
	// InkwallConfig's engine settings.
	Sidecar injection.Sidecar
	// Watches of kinds whose CRD may be missing; nil: only read at each
	// reconcile.
	HTTPRoutes, Gateways, GatewayClasses, EnvoyFilters *crdwatch.Kind
	// Prober proves the wired routes through every gateway pod before they
	// are Programmed (#372); nil: none is, and they stay Unverified. Its
	// results reach the wiring controller through HAProxy's watch of it.
	Prober *Prober
}

Istio is the wiring of Istio: the HTTPRoutes of its Gateways.

func (*Istio) Kinds added in v0.4.0

func (*Istio) Kinds() []schema.GroupKind

Kinds implements Integration.

func (*Istio) Name added in v0.4.0

func (*Istio) Name() string

Name implements Integration.

func (*Istio) Unwire added in v0.4.0

func (i *Istio) Unwire(ctx context.Context, c client.Client) (map[string]int, error)

Unwire implements Integration: the routes stop calling the engine, then the engine leaves the Gateways' pods (Istio rolls them), and the users' Gateways and ConfigMaps are as they were.

func (*Istio) Watch added in v0.4.0

Watch implements Integration.

func (*Istio) Wire added in v0.4.0

func (i *Istio) Wire(ctx context.Context, targets map[Target]bool, off bool) (*Result, error)

Wire implements Integration: it puts the engine into the pods of the Gateways serving protected HTTPRoutes, gives those Gateways an EnvoyFilter for the routes once their pods have it, and removes the rest.

func (*Istio) Wired added in v0.4.0

func (i *Istio) Wired(ctx context.Context, tg Target) (bool, error)

Wired implements Integration: an EnvoyFilter of the operator's wires the route.

type IstioIngress added in v0.4.0

type IstioIngress struct {
	Client client.Client
	// APIReader lists the pods a Gateway selects, uncached: some may not be
	// in the cache (outside the proxy namespaces, other labels).
	APIReader client.Reader
	// Pods selects the gateway pods the Pod webhook injects; PodLabels are
	// its labels, the EnvoyFilters' workloadSelector (nil: the selector
	// isn't plain labels, which an EnvoyFilter can't use).
	Pods      labels.Selector
	PodLabels map[string]string
	// Watches of kinds whose CRD may be missing; nil: only read at each
	// reconcile.
	VirtualServices, Gateways, EnvoyFilters *crdwatch.Kind
	// Prober proves the wired routes through every gateway pod before they
	// are Programmed (#372); nil: none is, and they stay Unverified. Its
	// results reach the wiring controller through HAProxy's watch of it.
	Prober *Prober
}

IstioIngress is the wiring of Istio's ingress gateways: their VirtualServices.

func (*IstioIngress) Kinds added in v0.4.0

func (*IstioIngress) Kinds() []schema.GroupKind

Kinds implements Integration.

func (*IstioIngress) Name added in v0.4.0

func (*IstioIngress) Name() string

Name implements Integration.

func (*IstioIngress) Unwire added in v0.4.0

func (i *IstioIngress) Unwire(ctx context.Context, c client.Client) (map[string]int, error)

Unwire implements Integration: the VirtualServices stop calling the engine. The gateway pods keep it until they restart, as Traefik's do.

func (*IstioIngress) Watch added in v0.4.0

Watch implements Integration.

func (*IstioIngress) Wire added in v0.4.0

func (i *IstioIngress) Wire(ctx context.Context, targets map[Target]bool, off bool) (*Result, error)

Wire implements Integration: it gives each namespace of gateway pods serving protected VirtualServices an EnvoyFilter for them, once those pods have the engine, and removes the rest.

func (*IstioIngress) Wired added in v0.4.0

func (i *IstioIngress) Wired(ctx context.Context, tg Target) (bool, error)

Wired implements Integration: an EnvoyFilter of the operator's wires the VirtualService.

type ProbeJob added in v0.5.0

type ProbeJob struct {
	// Route is the route, for the messages and the results' keys.
	Route ProbeRoute
	// Proxy names the proxy in the messages: "HAProxy", "Istio".
	Proxy string
	// Fingerprint changes when the wiring does (the snippet): the route
	// is probed again.
	Fingerprint string
	Targets     []ProbeTarget
	Pods        []ProbePod
}

ProbeJob is what the prober proves for one wired route: that each pod answers the probe on each of its targets (#282, #372).

type ProbePod added in v0.4.0

type ProbePod struct {
	Name      string
	UID       types.UID
	IP        string
	HTTPPort  int32
	HTTPSPort int32
}

ProbePod is a controller pod, probed directly.

type ProbeRoute added in v0.5.0

type ProbeRoute struct {
	Kind string
	Key  types.NamespacedName
}

ProbeRoute names a probed route: "Ingress", "HTTPRoute" or "VirtualService", and its namespace and name.

func (ProbeRoute) String added in v0.5.0

func (r ProbeRoute) String() string

type ProbeTarget added in v0.4.0

type ProbeTarget struct {
	Host    string
	Path    string
	Prefix  bool
	TLS     bool
	Port    int32
	Method  string
	Query   string
	Headers map[string]string
}

ProbeTarget is a request that reaches one of the route's backends: a host (any, for a rule without one), and a Prefix path, under which the probe takes its reserved path, or an Exact one, probed as itself with a query; over TLS when the route has it for the host (HAProxy then redirects plain HTTP, an Istio listener serves only TLS). Method, Query and Headers are what the route's match asks for besides the path (an Istio route); Port, when set, is the listener's on the pod, instead of the pod's HTTP or HTTPS port.

type Prober added in v0.5.0

type Prober struct {
	// Reader reads the bundle Secret, in Namespace, for the probe key.
	Reader    client.Reader
	Namespace string
	// Do sends a probe; nil: over the network.
	Do func(ctx context.Context, pod ProbePod, t ProbeTarget, req *http.Request) (*http.Response, error)
	// Now is the clock; nil: time.Now.
	Now func() time.Time
	// Key returns the probe key engines have; nil: the bundle's.
	Key func(ctx context.Context) ([]byte, error)
	// contains filtered or unexported fields
}

Prober probes the wired HAProxy routes (0002 §6.4): for each pod and route, a GET through the pod's HAProxy to the route, with a MAC under the bundle's probe key, which only the engine behind the route's filter answers (status 299 and its own MAC). It runs on the leader, and triggers a reconcile when a result changes.

func (*Prober) Events added in v0.5.0

func (p *Prober) Events() <-chan event.GenericEvent

Events triggers the wiring controller when a result changes.

func (*Prober) NeedLeaderElection added in v0.5.0

func (*Prober) NeedLeaderElection() bool

NeedLeaderElection implements manager.LeaderElectionRunnable.

func (*Prober) Run added in v0.5.0

func (p *Prober) Run(ctx context.Context)

Run probes what is due once.

func (*Prober) Set added in v0.5.0

func (p *Prober) Set(integration string, jobs []ProbeJob)

Set replaces the routes to probe. Set replaces the routes an integration ("haproxy", "istio", ...) has to probe; the other integrations' stay.

func (*Prober) Start added in v0.5.0

func (p *Prober) Start(ctx context.Context) error

Start probes until ctx ends.

func (*Prober) Unverified added in v0.5.0

func (p *Prober) Unverified(job ProbeJob) string

Unverified is why a route isn't proven on every pod, or "".

type Reconciler

type Reconciler struct {
	Client client.Client
	// PodWebhook is the MutatingWebhookConfiguration that injects the
	// engine: a proxy pod created after it without the engine was missed
	// by the webhook (SidecarMissing), one created before it predates
	// Inkwall (PendingRestart).
	PodWebhook string
	// Integrations wire the proxies (Integrations).
	Integrations []Integration
	// Disabled: the engine isn't injected (--inject=false), so new proxy
	// pods won't have it. Every route the operator wired is unwired, and
	// the policies are released from the finalizer.
	Disabled bool
	// Served gets the pods that serve each policy, for its Enforced
	// condition; nil: not kept.
	Served *distribution.ServedPods
}

Reconciler wires protected routes. It runs on the leader.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (reconcile.Result, error)

Reconcile has every integration wire the protected routes of its proxy and unwire the rest, releases the deleted policies once their routes are unwired, and reports Programmed.

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the controller.

type Result added in v0.3.0

type Result struct {
	// Proxy names the proxy in conditions, e.g. "Traefik".
	Proxy string
	// Targets has each target that exists, or that it can't tell about.
	// One that doesn't exist is left out (Accepted reports it).
	Targets map[Target]TargetState
	// Pods are the proxy's pods, whose engine the wired routes go to.
	Pods []corev1.Pod
	// Rolling: the proxy's own controller replaces its pods without the
	// engine (Envoy Gateway, once its EnvoyProxy has it), rather than the
	// Pod webhook injecting new ones; they are PendingRestart.
	Rolling bool
	// Disabled: the integration is disabled, and why (Disable); the
	// targets its proxy serves aren't wired.
	Disabled string
	// Responses: the proxy sends the engine the responses of the targets
	// whose policies inspect them. Unset, such a policy is not Programmed
	// on its targets (ResponsesNotInspected).
	Responses bool
}

Result is what an integration did, for Programmed.

type Target added in v0.3.0

type Target struct {
	Kind schema.GroupKind
	Key  types.NamespacedName
	// Section is an HTTPRoute's rule (sectionName), or "" for the route.
	Section string
}

Target is a route a policy protects.

type TargetState added in v0.3.0

type TargetState struct {
	// Unsupported: its proxy doesn't serve the target, and why (another
	// proxy does, or none). Another integration may.
	Unsupported string
	// Failed: why it couldn't be wired.
	Failed string
	// Wired: the integration keeps the target wired.
	Wired bool
	// Pending: wired, but not in force yet, and why (the proxy hasn't
	// accepted its configuration yet).
	Pending string
	// Unverified: wired, but not proven in force yet, and why (HAProxy:
	// the probe hasn't shown the filter on every pod).
	Unverified string
	// NotProbeable: wired, but the operator's probe can't reach it, and
	// why (a regular expression match, a mutual TLS listener): it can't be
	// proven in force (#372).
	NotProbeable string
	// Note is said on Programmed, whatever its status: a limit the proxy
	// puts on inspection that fails safe, not missing protection
	// (HAProxy's buffer below body.maxBytes).
	Note string
	// Partly: it is wired, but some of its traffic goes through proxies
	// Inkwall doesn't wire, and which.
	Partly string
}

TargetState is a target as an integration sees it.

type Traefik added in v0.3.0

type Traefik struct {
	Client client.Client
	// APIReader reads Middlewares and targets uncached.
	APIReader client.Reader
	// Pods selects Traefik's pods (integrations.Selectors).
	Pods labels.Selector
	// Watches of IngressRoutes, HTTPRoutes, Gateways and GatewayClasses,
	// once their CRDs are installed; nil: only read at each reconcile.
	IngressRoutes, HTTPRoutes, Gateways, GatewayClasses *crdwatch.Kind
	// contains filtered or unexported fields
}

Traefik is the wiring of Traefik: its Ingresses, IngressRoutes, and the HTTPRoutes of its Gateway API provider.

func (*Traefik) Kinds added in v0.3.0

func (*Traefik) Kinds() []schema.GroupKind

Kinds implements Integration.

func (*Traefik) Name added in v0.3.0

func (*Traefik) Name() string

Name implements Integration.

func (*Traefik) Unwire added in v0.3.0

func (*Traefik) Unwire(ctx context.Context, c client.Client) (map[string]int, error)

Unwire implements Integration: it removes the operator's Middleware from every Ingress, IngressRoute and HTTPRoute it wired, then deletes the Middlewares.

func (*Traefik) Watch added in v0.3.0

Watch implements Integration.

func (*Traefik) Wire added in v0.3.0

func (t *Traefik) Wire(ctx context.Context, targets map[Target]bool, off bool) (*Result, error)

Wire implements Integration: it wires every protected Traefik Ingress and IngressRoute, and unwires the rest.

func (*Traefik) Wired added in v0.3.0

func (t *Traefik) Wired(ctx context.Context, tg Target) (bool, error)

Wired implements Integration: the target carries WiredAnnotation.

type Unwired added in v0.1.1

type Unwired struct {
	// Objects counts the proxies' objects unwired or deleted, by kind.
	Objects  map[string]int
	Policies int
	// Forbidden are the integrations the operator may not unwire (their
	// ClusterRole isn't granted, as when it disabled them): what they
	// wired, if anything, stays.
	Forbidden []string
}

Unwired counts what Unwire changed.

func Unwire

func Unwire(ctx context.Context, c client.Client) (Unwired, error)

Unwire undoes the wiring at uninstall: every integration removes its wiring, keeping the user's own (for Traefik, the operator's Middleware from every Ingress, IngressRoute and HTTPRoute it wired, then the Middlewares it created). Then every WAFPolicy is reported Programmed=False and Ready=False (Unwired), and released from the finalizer, which no operator will remove any more. The proxies then stop sending those routes to the engine, which a proxy pod started after the uninstall doesn't have. Run it with the operator stopped, or it wires them again.

Jump to

Keyboard shortcuts

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