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 ¶
func (h *ValidationHandler) Handle(ctx context.Context, req cradmission.Request) cradmission.Response
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 judges every deletion of a result record. The manager sets it
// with delivery on or off; with none, no record can be deleted.
ResultCleanup *resultcleanup.Policy
}
Validator checks requests using uncached API reads. Reader must be the manager's direct API reader, never its informer cache. mutationlifecycle.MissingJobGrace relies on that read: a Job create is refused once another manager has retired its claim, not once a cache has caught up.
func (*Validator) Validate ¶
func (v *Validator) Validate(ctx context.Context, req admissionv1.AdmissionRequest) error
Validate verifies one admission request. It performs no mutation and treats dry-run requests exactly like requests that may be persisted.