Documentation
¶
Overview ¶
Package integrations knows the proxies Inkwall wires into (0004 §4.2): how to recognise each one's IngressClass or GatewayClass and pods, and which engine adapter its pods use: Traefik, Envoy Gateway, Istio and the HAProxy Kubernetes Ingress Controller.
Index ¶
- Constants
- Variables
- func NoPods() *metav1.LabelSelector
- type Integration
- type Namespaces
- type Selectors
- func (s *Selectors) Equal(o *Selectors) bool
- func (s *Selectors) ForPod(podLabels map[string]string) *Integration
- func (s *Selectors) LabelSelector(name string) *metav1.LabelSelector
- func (s *Selectors) PodSelectors() []labels.Selector
- func (s *Selectors) Selector(name string) labels.Selector
- func (s *Selectors) String() string
Constants ¶
const AnyNamespace = "*"
AnyNamespace among the proxy namespaces makes every namespace one.
const EnvoySocketDir = "/var/run/inkwall-socket"
EnvoySocketDir holds the engine's Unix socket in Envoy Gateway's and Istio's pods.
const HAProxySocketDir = "/var/run/inkwall-socket"
HAProxySocketDir holds the engine's Unix socket in the HAProxy Kubernetes Ingress Controller's pods.
Variables ¶
var ( TraefikMiddlewareGVK = schema.GroupVersionKind{Group: "traefik.io", Version: "v1alpha1", Kind: "Middleware"} TraefikIngressRouteGVK = schema.GroupVersionKind{Group: "traefik.io", Version: "v1alpha1", Kind: "IngressRoute"} )
Traefik's kinds (traefik.io/v1alpha1) the operator reads and writes, and inkwallctl reads.
var ( IstioVirtualServiceGVK = schema.GroupVersionKind{Group: "networking.istio.io", Version: "v1", Kind: "VirtualService"} IstioGatewayGVK = schema.GroupVersionKind{Group: "networking.istio.io", Version: "v1", Kind: "Gateway"} )
Istio's own API (networking.istio.io/v1) the operator reads, and inkwallctl reads: VirtualServices are targets of the istio-ingress integration, bound to Istio's Gateways (not the Gateway API's).
var All = []Integration{Traefik, EnvoyGateway, Istio, HAProxy, IstioIngress}
All are the known integrations.
var DefaultNamespaces = Namespaces{"traefik", "kube-system", "envoy-gateway-system", "istio-ingress", "istio-system", "haproxy-controller"}
DefaultNamespaces are the proxy namespaces unless configured: Traefik's (its own, or kube-system, where k3s and RKE2 run it), Envoy Gateway's, those Istio's docs put its Gateways in (Istio runs a Gateway's pods in the Gateway's namespace), and the HAProxy Kubernetes Ingress Controller's.
var EnvoyGateway = Integration{ Name: "envoy-gateway", GatewayController: "gateway.envoyproxy.io/gatewayclass-controller", PodSelector: labels.Set{"app.kubernetes.io/name": "envoy", "app.kubernetes.io/managed-by": "envoy-gateway"}, Adapter: []string{"ext-proc", "--listen=unix:" + EnvoySocketDir + "/extproc.sock"}, }
EnvoyGateway is the Envoy Gateway integration: the engine, in the Envoy pods through the Gateway's EnvoyProxy, answers the ext_proc filter of each protected HTTPRoute on a Unix socket.
var HAProxy = Integration{ Name: "haproxy", ControllerPrefix: "haproxy.org/ingress-controller/", PodSelector: labels.Set{"app.kubernetes.io/name": "kubernetes-ingress"}, Adapter: []string{"spoe", "--listen=unix:" + HAProxySocketDir + "/spoe.sock"}, }
HAProxy is the HAProxy Kubernetes Ingress Controller integration: the engine, injected into the controller's pods with the SPOE agent's configuration, answers the SPOE filter each protected Ingress's backend loads (0002 §6.4), on a Unix socket.
Its IngressClasses' controller is haproxy.org/ingress-controller/ followed by its --ingress.class (haproxy by default).
var Istio = Integration{ Name: "istio", GatewayController: "istio.io/gateway-controller", PodSelector: labels.Set{"gateway.istio.io/managed": "istio.io-gateway-controller"}, Adapter: []string{"ext-proc", "--listen=unix:" + EnvoySocketDir + "/extproc.sock"}, }
Istio is the Istio integration (its Gateway API implementation): the engine, in the Gateway's pods through the ConfigMap its parametersRef names, answers the ext_proc filter an EnvoyFilter adds for each protected HTTPRoute, on a Unix socket.
var IstioIngress = Integration{ Name: "istio-ingress", PodSelector: labels.Set{"istio": "ingressgateway"}, Adapter: []string{"ext-proc", "--listen=unix:" + EnvoySocketDir + "/extproc.sock"}, SocketContainer: "istio-proxy", PodAnnotations: map[string]string{"sidecar.istio.io/rewriteAppHTTPProbers": "false"}, }
IstioIngress is the integration of Istio's ingress gateways, the ones its istio/gateway Helm chart deploys, which Istio's own Gateways select and VirtualServices bind to: the engine, injected into their pods by the Pod webhook, answers the ext_proc filter an EnvoyFilter adds for each protected VirtualService, on a Unix socket the istio-proxy container mounts. It has no class: Istio's Gateways select pods by label.
var Traefik = Integration{ Name: "traefik", Controller: "traefik.io/ingress-controller", GatewayController: "traefik.io/gateway-controller", PodSelector: labels.Set{"app.kubernetes.io/name": "traefik"}, Adapter: []string{"forward-auth"}, }
Traefik is the Traefik integration: the engine answers its ForwardAuth middleware.
Functions ¶
func NoPods ¶ added in v0.3.0
func NoPods() *metav1.LabelSelector
NoPods is a label selector no pod matches: the Pod webhook's objectSelector when no integration it serves is enabled.
Types ¶
type Integration ¶
type Integration struct {
// Name, e.g. "traefik".
Name string
// Controller is the IngressClass spec.controller of the proxy, if it
// serves Ingresses.
Controller string
// ControllerPrefix, when set, starts the IngressClass spec.controller
// of the proxy instead, followed by a name of the user's.
ControllerPrefix string
// GatewayController is its GatewayClass spec.controllerName, if it
// implements the Gateway API.
GatewayController string
// PodSelector matches the proxy's data-plane pods by default (the
// labels its official Helm chart sets); InkwallConfig can override it
// (Selectors).
PodSelector labels.Set
// Adapter is the engine command and its flags for this proxy.
Adapter []string
// SocketContainer, for a proxy the Pod webhook injects that calls the
// engine on a Unix socket, is the proxy's container: it mounts the
// socket's directory (EnvoySocketDir).
SocketContainer string
// PodAnnotations are set on the pods the Pod webhook injects, for the
// proxy's own injector.
PodAnnotations map[string]string
}
Integration is one proxy.
func ForController ¶
func ForController(controller string) *Integration
ForController returns the integration of an IngressClass or GatewayClass controller, or nil when Inkwall doesn't know it.
func (*Integration) ServesIngresses ¶ added in v0.4.0
func (i *Integration) ServesIngresses(controller string) bool
ServesIngresses reports whether an IngressClass spec.controller is the integration's.
type Namespaces ¶ added in v0.1.5
type Namespaces []string
Namespaces are the proxy namespaces (0004 §4.3): the namespaces whose pods an integration's selector may select. Only their pods get the engine, the trust ConfigMap and read access to the bundle. A selector's labels prove nothing, as whoever may create a pod may set them; the namespace, where only the proxy's operators create pods, does. nil, or AnyNamespace among them, is every namespace.
func ParseNamespaces ¶ added in v0.1.5
func ParseNamespaces(s string) (Namespaces, error)
ParseNamespaces parses a comma-separated list of namespaces, or "*".
func (Namespaces) Any ¶ added in v0.1.5
func (n Namespaces) Any() bool
Any reports whether every namespace is a proxy namespace.
func (Namespaces) Has ¶ added in v0.1.5
func (n Namespaces) Has(ns string) bool
Has reports whether ns is a proxy namespace.
func (Namespaces) LabelSelector ¶ added in v0.1.5
func (n Namespaces) LabelSelector() *metav1.LabelSelector
LabelSelector selects the proxy namespaces by name, for the Pod webhook's namespaceSelector; empty, which selects every namespace, when every namespace is one (the API server's default).
func (Namespaces) String ¶ added in v0.1.5
func (n Namespaces) String() string
String lists the namespaces, for flags and logs.
type Selectors ¶
type Selectors struct {
// contains filtered or unexported fields
}
Selectors are the pod selectors in effect, by integration: each one's default, or InkwallConfig.spec.integrations[].selector. The operator reads them when it starts, since its cache of proxy pods is built from them. A nil *Selectors is the defaults.
func FromConfig ¶
func FromConfig(specs []wafv1alpha1.IntegrationSpec) (*Selectors, []string, error)
FromConfig applies the overrides of an InkwallConfig's integrations. It returns the controllers it ignored, which Inkwall doesn't integrate yet.
func (*Selectors) ForPod ¶
func (s *Selectors) ForPod(podLabels map[string]string) *Integration
ForPod returns the integration whose pods carry podLabels, or nil.
func (*Selectors) LabelSelector ¶
func (s *Selectors) LabelSelector(name string) *metav1.LabelSelector
LabelSelector returns an integration's selector, for the Pod webhook's objectSelector.
func (*Selectors) PodSelectors ¶ added in v0.3.0
PodSelectors are every integration's selector, for the operator's cache of proxy pods: an informer each (a label selector can't express their union).