ext

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package ext exposes a CEL Library (CelExt) that registers Kuadrant specific functions and constants for use inside policy CEL expressions.

The library introduces helper member functions on policy objects:

self.findGateways()       -> []*Gateway
self.findAuthPolicies()   -> []*Policy (AuthPolicy kind)
targetRef.findGateways()  -> []*Gateway

These functions query the in‑memory DAG maintained by the extension service to discover related Gateways and Policies based on target references. The symbol __KUADRANT_VERSION is also exported so expressions can branch on the extension feature set (e.g. == "1_dev").

The package is imported indirectly by using CelExt(DAG) as a cel.EnvOption. Extension authors generally do not need to interact with internals beyond supplying a DAG implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CelExt

func CelExt(dag DAG) cel.EnvOption

CelExt returns a cel.EnvOption that installs the Kuadrant CEL library.

The returned library contributes:

  • Member functions on kuadrant.v1.Policy and kuadrant.v1.TargetRef: self.findGateways() / targetRef.findGateways() -> []*kuadrant.v1.Gateway self.findAuthPolicies() -> []*kuadrant.v1.Policy (AuthPolicy subset)
  • A constant __KUADRANT_VERSION describing the feature level (e.g. "1_dev").

The provided DAG implementation is invoked to satisfy these functions. Only the small surface in the DAG interface is required, allowing callers to supply lightweight test doubles.

Types

type DAG

type DAG interface {
	// FindGatewaysFor returns all Gateways that match the provided target
	// references.
	FindGatewaysFor([]*v1.TargetRef) ([]*v1.Gateway, error)
	// FindPoliciesFor returns policies of the requested type matching the
	// target references.
	FindPoliciesFor([]*v1.TargetRef, machinery.Policy) ([]*v1.Policy, error)
}

DAG defines the minimal graph queries required by the CEL extension. It is intentionally small so that extensions and tests can easily supply an implementation without depending on internal Kuadrant graph types.

Jump to

Keyboard shortcuts

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