controllerwrite

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package controllerwrite validates the narrow set of workload and plan writes issued by the operator manager identity, and protects reserved result credentials against writes from any principal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SchemaPolicyFingerprint

func SchemaPolicyFingerprint(schema *operatorv1alpha1.PtahSchema) (string, error)

SchemaPolicyFingerprint is the policy binding this admission side requires a plan to carry, exported for the fixture that stands up a plan it must accept. A fixture that spells the policy a second time agrees with nothing the day the policy grows a field.

Types

type JobBuilder

type JobBuilder interface {
	Build(
		schema *operatorv1alpha1.PtahSchema,
		operation operatorv1alpha1.ActiveOperationStatus,
		plan *operatorv1alpha1.PtahSchemaPlan,
	) (*batchv1.Job, error)
	BuildMigration(
		migration *operatorv1alpha1.PtahMigration,
		operation operatorv1alpha1.MigrationOperationStatus,
		plan *operatorv1alpha1.PtahMigrationPlan,
	) (*batchv1.Job, error)
	// ManagerIdentity is the manager's own release, which a plan it creates
	// records.
	ManagerIdentity() (controllerImage, controllerRevision, runnerImage string)
}

JobBuilder is the immutable Job construction contract used by the schema controller. The production dependency should be workload.Builder.

type ResultCredentialValidator

type ResultCredentialValidator interface {
	ValidateCreate(context.Context, *corev1.Secret) error
	ValidateRecordCreate(context.Context, *operatorv1alpha1.PtahResultRecord) error
	AuthorizePublication(context.Context, resultstore.Binding) (resultdelivery.Identity, error)
}

type ValidationHandler

type ValidationHandler struct {
	Validator *Validator
}

ValidationHandler adapts Validator to controller-runtime admission.

func (*ValidationHandler) Handle

Handle implements controller-runtime admission.Handler.

type Validator

type Validator struct {
	Reader          client.Reader
	Jobs            JobBuilder
	ManagerUsername string
	// ResultCredentials remains nil until the installation has delivery trust.
	// Reserved credential writes are still guarded while issuance is disabled.
	ResultCredentials ResultCredentialValidator
	ResultCleanup     *resultcleanup.Policy
}

Validator checks requests using uncached API reads. Reader must be the manager's direct API reader, never its informer cache.

func (*Validator) Validate

Validate verifies one admission request. It performs no mutation and treats dry-run requests exactly like requests that may be persisted.

Jump to

Keyboard shortcuts

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