Documentation
¶
Overview ¶
Package discovery finds the cluster's proxies (0004 §4.1): the controllers its IngressClasses and GatewayClasses name, and how far Inkwall wires each, in InkwallConfig.status.proxies.
Index ¶
- Constants
- Variables
- func Disable(proxies []wafv1alpha1.ProxyStatus, disabled map[string]string) []wafv1alpha1.ProxyStatus
- func ExportCondition(sinks []string, reports []enginereport.ReplicaSinks, notReported []NotReported, ...) *metav1.Condition
- func Proxies(ingressClasses, gatewayClasses []Class, kinds map[string][]schema.GroupKind) []wafv1alpha1.ProxyStatus
- type Class
- type NotReported
- type Reconciler
Constants ¶
const ( ReasonConfigured = "Configured" ReasonInvalidSelector = "InvalidSelector" )
Reasons of the InkwallConfig's IntegrationsConfigured condition.
const ( ReasonExporting = "Exporting" ReasonExportFailing = "ExportFailing" ReasonExportConfigInvalid = "ExportConfigInvalid" ReasonExportDropping = "ExportDropping" ReasonExportAddressRefused = "ExportAddressRefused" ReasonExportNotReported = "ExportNotReported" )
Reasons of the InkwallConfig's EventsExported condition (design 0010 §8). When several apply, the first of ExportConfigInvalid, ExportAddressRefused, ExportFailing, ExportNotReported and ExportDropping wins.
const DefaultNotReportedAfter = time.Minute
DefaultNotReportedAfter is how long a configured sink may be missing from a live replica's report (it is starting, or picking the sink up) before it counts as not reported: not exporting from there.
Variables ¶
var GatewayClassGVK = schema.GroupVersionKind{Group: "gateway.networking.k8s.io", Version: "v1", Kind: "GatewayClass"}
GatewayClassGVK is the Gateway API's GatewayClass, whose CRD may be missing.
Functions ¶
func Disable ¶
func Disable(proxies []wafv1alpha1.ProxyStatus, disabled map[string]string) []wafv1alpha1.ProxyStatus
Disable reports the proxies of the disabled integrations (name -> why) Unsupported, with why.
func ExportCondition ¶
func ExportCondition(sinks []string, reports []enginereport.ReplicaSinks, notReported []NotReported, generation int64) *metav1.Condition
ExportCondition folds the replicas' reports of the configured sinks into the EventsExported condition. notReported are the configured sinks missing from the reports past the grace (Missing, held for DefaultNotReportedAfter): not exporting from there. Nil with no sinks, or while nothing is reported nor missing for long.
func Proxies ¶
func Proxies(ingressClasses, gatewayClasses []Class, kinds map[string][]schema.GroupKind) []wafv1alpha1.ProxyStatus
Proxies groups the classes by controller, and says how far Inkwall wires each: an IngressClass's routes are wired when its integration wires Ingresses, a GatewayClass's when it wires HTTPRoutes. kinds are the target kinds each integration wires, by name.
Types ¶
type Class ¶
type Class struct {
Name, Controller string
}
Class is an IngressClass or a GatewayClass.
type NotReported ¶
type NotReported struct{ Sink, Replica string }
NotReported is a configured sink a live replica doesn't report, or, with Replica "", that no live replica reports at all.
func Missing ¶
func Missing(sinks []string, reports []enginereport.ReplicaSinks) []NotReported
Missing lists the configured sinks the fresh reports don't name: per live replica, or with Replica "" when no replica reports at all.
type Reconciler ¶
type Reconciler struct {
Client client.Client
// GatewayClasses watches the GatewayClasses once their CRD is
// installed; nil: they are only read at each reconcile.
GatewayClasses *crdwatch.Kind
// Kinds are the target kinds each integration wires, by name.
Kinds map[string][]schema.GroupKind
// Disabled are the integrations the operator may not wire, by name,
// and why: their proxies are Unsupported.
Disabled map[string]string
// Recorder records an Event on the InkwallConfig when its
// EngineConfigured condition changes, but for the first True; nil:
// none.
Recorder events.EventRecorder
// Reports reads the replicas' engine reports (uncached), in Namespace;
// those older than ReportStale are from replicas that are gone. Nil:
// no EventsExported condition.
Reports client.Reader
Namespace string
ReportStale time.Duration
// NotReportedAfter: a configured sink missing this long from a live
// replica's report, or from every report, is not exporting from there
// (0: DefaultNotReportedAfter).
NotReportedAfter time.Duration
// contains filtered or unexported fields
}
Reconciler writes the discovered proxies into the InkwallConfig, when there is one. It runs on the leader.
func (*Reconciler) SetupWithManager ¶
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers the controller.