controller

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConditionPolicyCompliant is the condition type for policy compliance.
	ConditionPolicyCompliant = "PolicyCompliant"
	// ConditionReady is the condition type for readiness.
	ConditionReady = "Ready"
)

Variables

This section is empty.

Functions

func ClampTokenLifetime

func ClampTokenLifetime(requested string, maxLifetime string, defaultLifetime string) string

ClampTokenLifetime returns the effective lifetime, clamped to the policy ceiling.

func ComputeProducedTctxFields

func ComputeProducedTctxFields(tt *v1alpha1.TransactionType) []string

ComputeProducedTctxFields returns all tctx fields a TransactionType produces.

func ValidateTransactionTypeAgainstPolicy

func ValidateTransactionTypeAgainstPolicy(tt *v1alpha1.TransactionType, policy *v1alpha1.TokenPolicy) []string

ValidateTransactionTypeAgainstPolicy checks a TransactionType against a TokenPolicy. Returns a list of violations (empty if compliant).

Types

type CELRule

type CELRule struct {
	Name    string `json:"name"`
	CEL     string `json:"cel"`
	Message string `json:"message"`
}

CELRule is a named CEL expression for verification.

type GenerationRule

type GenerationRule struct {
	// Namespace is the namespace this rule applies to.
	Namespace string `json:"namespace"`
	// Name is the TransactionType name.
	Name string `json:"name"`
	// Endpoint is the path+method that triggers token generation.
	Endpoint v1alpha1.EndpointSpec `json:"endpoint"`
	// Purpose is the transaction purpose (included in tctx).
	Purpose string `json:"purpose"`
	// Scope is the requested scope for the TxToken.
	Scope string `json:"scope"`
	// TctxMapping defines how to extract tctx fields from the request.
	TctxMapping map[string]v1alpha1.TctxFieldMapping `json:"tctxMapping,omitempty"`
	// TctxEnrichments defines computed tctx fields.
	TctxEnrichments []v1alpha1.TctxEnrichment `json:"tctxEnrichments,omitempty"`
	// RctxFields lists rctx fields to populate.
	RctxFields []string `json:"rctxFields,omitempty"`
	// TokenLifetime is the effective lifetime after policy clamping.
	TokenLifetime string `json:"tokenLifetime"`
}

GenerationRule represents a compiled generation rule pushed to the TTS.

type RulePublisher

type RulePublisher interface {
	UpdateGenerationRules(rules []GenerationRule)
	UpdateVerificationRules(rules []VerificationRule)
}

RulePublisher is implemented by ruleserver.RuleServer to push rules to ext-auth instances.

type ServiceTokenRequirementReconciler

type ServiceTokenRequirementReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	RulePublisher RulePublisher
}

ServiceTokenRequirementReconciler reconciles ServiceTokenRequirement objects.

func (*ServiceTokenRequirementReconciler) Reconcile

func (*ServiceTokenRequirementReconciler) SetupWithManager

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

type TransactionTypeReconciler

type TransactionTypeReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	RulePublisher RulePublisher
}

TransactionTypeReconciler reconciles TransactionType objects.

func (*TransactionTypeReconciler) Reconcile

func (*TransactionTypeReconciler) SetupWithManager

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

type VerificationRule

type VerificationRule struct {
	// Namespace is the namespace this rule applies to.
	Namespace string `json:"namespace"`
	// Name is the ServiceTokenRequirement name.
	Name string `json:"name"`
	// ServiceName is the Kubernetes service this applies to.
	ServiceName string `json:"serviceName"`
	// RequiredScope is the minimum required scope.
	RequiredScope string `json:"requiredScope,omitempty"`
	// RequiredTctxFields lists required tctx fields.
	RequiredTctxFields []string `json:"requiredTctxFields,omitempty"`
	// CELRules are pre-validated CEL expressions.
	CELRules []CELRule `json:"celRules,omitempty"`
	// ExcludedEndpoints lists endpoints that bypass verification.
	ExcludedEndpoints []v1alpha1.EndpointSpec `json:"excludedEndpoints,omitempty"`
	// AutoNarrow enables automatic scope narrowing.
	AutoNarrow bool `json:"autoNarrow,omitempty"`
}

VerificationRule represents a compiled verification rule pushed to the ext auth adapter.

Directories

Path Synopsis
Package ruleserver implements a gRPC streaming server that distributes generation and verification rules from the kontxt controller to ext-auth adapter instances.
Package ruleserver implements a gRPC streaming server that distributes generation and verification rules from the kontxt controller to ext-auth adapter instances.

Jump to

Keyboard shortcuts

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