v1alpha1

package
v0.1.13 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupEffectClaimWebhookWithManager added in v0.1.4

func SetupEffectClaimWebhookWithManager(mgr ctrl.Manager) error

SetupEffectClaimWebhookWithManager registers the webhook for EffectClaim in the manager.

func SetupStoryTriggerWebhookWithManager added in v0.1.4

func SetupStoryTriggerWebhookWithManager(mgr ctrl.Manager) error

SetupStoryTriggerWebhookWithManager registers the webhook for StoryTrigger in the manager.

Types

type EffectClaimCustomValidator added in v0.1.4

type EffectClaimCustomValidator struct {
	Client        ctrlclient.Reader
	Config        *config.ControllerConfig
	ConfigManager *config.OperatorConfigManager
}

EffectClaimCustomValidator validates EffectClaim create and update operations.

func (*EffectClaimCustomValidator) ValidateCreate added in v0.1.4

func (*EffectClaimCustomValidator) ValidateDelete added in v0.1.4

func (*EffectClaimCustomValidator) ValidateUpdate added in v0.1.4

func (v *EffectClaimCustomValidator) ValidateUpdate(ctx context.Context, oldObj, newObj *runsv1alpha1.EffectClaim) (admission.Warnings, error)

type EffectClaimWebhook added in v0.1.4

type EffectClaimWebhook struct {
	Config        *config.ControllerConfig
	ConfigManager *config.OperatorConfigManager
}

EffectClaimWebhook wires the EffectClaim validator into the manager.

func (*EffectClaimWebhook) SetupWebhookWithManager added in v0.1.4

func (wh *EffectClaimWebhook) SetupWebhookWithManager(mgr ctrl.Manager) error

SetupWebhookWithManager registers the EffectClaim validating webhook with the manager.

type StepRunCustomDefaulter added in v0.1.3

type StepRunCustomDefaulter struct {
	Config        *config.ControllerConfig
	ConfigManager *config.OperatorConfigManager
}

func (*StepRunCustomDefaulter) Default added in v0.1.3

Default implements admission.Defaulter for StepRun resources.

Behavior:

  • Resolves the RetryPolicy using controller configuration defaults.
  • Sets MaxRetries, Delay, and Backoff if not specified.

Arguments:

  • ctx context.Context: forwarded for parity (unused today).
  • steprun *runsv1alpha1.StepRun: the StepRun to default.

Returns:

  • nil on success.

type StepRunCustomValidator

type StepRunCustomValidator struct {
	// Client is used for Engram existence checks and ReferenceGrant lookups.
	// It must be a non-cached reader (mgr.GetAPIReader()) so admission decisions reflect
	// the current API server state rather than a potentially stale informer cache.
	// ISSUE-4 fix: typed as client.Reader (read-only) rather than client.Client to
	// prevent accidental writes from within the validator.
	Client        client.Reader
	Config        *config.ControllerConfig
	ConfigManager *config.OperatorConfigManager
}

StepRunCustomValidator struct is responsible for validating the StepRun resource when it is created, updated, or deleted.

NOTE: The +kubebuilder:object:generate=false marker prevents controller-gen from generating DeepCopy methods, as this struct is used only for temporary operations and does not need to be deeply copied.

func (*StepRunCustomValidator) ValidateCreate

func (v *StepRunCustomValidator) ValidateCreate(ctx context.Context, steprun *runsv1alpha1.StepRun) (admission.Warnings, error)

ValidateCreate implements admission.Validator for StepRun creation.

Behavior:

  • Validates storyRunRef.name and stepId are set.
  • Validates input/output sizes and total resource size.
  • Validates status.needs doesn't contain self-references.

Arguments:

  • ctx context.Context: unused but required by interface.
  • steprun *runsv1alpha1.StepRun: the StepRun to validate.

Returns:

  • nil, nil if validation passes.
  • nil, error if validation errors exist.

func (*StepRunCustomValidator) ValidateDelete

ValidateDelete implements admission.Validator for StepRun deletion.

Behavior:

  • Always allows deletion (no-op validation).
  • Exists as scaffold placeholder; delete verb not enabled in annotation.

Arguments:

  • ctx context.Context: unused.
  • steprun *runsv1alpha1.StepRun: the StepRun being deleted.

Returns:

  • nil, nil (deletion always allowed).

func (*StepRunCustomValidator) ValidateUpdate

func (v *StepRunCustomValidator) ValidateUpdate(ctx context.Context, oldSteprun, steprun *runsv1alpha1.StepRun) (admission.Warnings, error)

ValidateUpdate implements admission.Validator for StepRun updates.

Behavior:

  • Skips validation if resource is being deleted (DeletionTimestamp set).
  • Rejects updates that decrease observedGeneration.
  • Validates status.needs on every update.
  • Skips spec validation if spec is semantically unchanged (status-only update), using equality.Semantic.DeepEqual to handle *runtime.RawExtension correctly.

Arguments:

  • ctx context.Context: unused but required by interface.
  • oldSteprun *runsv1alpha1.StepRun: previous StepRun state.
  • steprun *runsv1alpha1.StepRun: proposed StepRun state.

Returns:

  • nil, nil if validation passes or is skipped.
  • nil, error if validation errors exist.

type StepRunWebhook

type StepRunWebhook struct {
	Config        *config.ControllerConfig
	ConfigManager *config.OperatorConfigManager
}

StepRunWebhook registers the StepRun defaulting and validating webhooks. ISSUE-5 fix: removed the dead Client field that was set in SetupWebhookWithManager but never read after that point.

func (*StepRunWebhook) SetupWebhookWithManager

func (wh *StepRunWebhook) SetupWebhookWithManager(mgr ctrl.Manager) error

SetupWebhookWithManager registers the StepRun defaulting and validating webhooks.

Behavior:

  • Creates both defaulter and validator webhooks for StepRun resources.
  • Uses mgr.GetAPIReader() for the validator so lookups bypass the cache and reflect the authoritative API server state at admission time.
  • Injects Config and ConfigManager into both handlers.

Arguments:

  • mgr ctrl.Manager: the controller-runtime manager.

Returns:

  • nil on success.
  • Error if webhook registration fails.

type StoryRunCustomValidator

type StoryRunCustomValidator struct {
	Client        client.Reader
	Config        *config.ControllerConfig
	ConfigManager *config.OperatorConfigManager
}

StoryRunCustomValidator struct is responsible for validating the StoryRun resource when it is created, updated, or deleted.

NOTE: The +kubebuilder:object:generate=false marker prevents controller-gen from generating DeepCopy methods, as this struct is used only for temporary operations and does not need to be deeply copied.

func (*StoryRunCustomValidator) ValidateCreate

ValidateCreate implements admission.Validator for StoryRun creation.

Behavior:

  • Validates storyRef.name is set and Story exists.
  • Validates inputs shape, size, and schema against Story.

Arguments:

  • ctx context.Context: for Story lookup.
  • sr *runsv1alpha1.StoryRun: the StoryRun being created.

Returns:

  • nil, nil if validation passes.
  • nil, error if validation errors exist.

func (*StoryRunCustomValidator) ValidateDelete

ValidateDelete implements webhook.CustomValidator for StoryRun deletion.

Behavior:

  • Always allows deletion (no-op validation).
  • Exists as scaffold placeholder; delete verb not enabled in annotation.

Arguments:

  • ctx context.Context: unused.
  • obj runtime.Object: expected to be *runsv1alpha1.StoryRun.

Returns:

  • nil, nil (deletion always allowed).

func (*StoryRunCustomValidator) ValidateUpdate

func (v *StoryRunCustomValidator) ValidateUpdate(ctx context.Context, oldSr, newSr *runsv1alpha1.StoryRun) (admission.Warnings, error)

ValidateUpdate implements webhook.CustomValidator for StoryRun updates.

Behavior:

  • Skips validation if resource is being deleted (DeletionTimestamp set).
  • Rejects updates that decrease observedGeneration.
  • Skips validation if spec is unchanged (metadata-only update).
  • Allows a graceful cancel request when only spec.cancelRequested changes from nil/false to true.

Arguments:

  • ctx context.Context: for Story lookup.
  • oldObj runtime.Object: previous StoryRun state.
  • newObj runtime.Object: proposed StoryRun state.

Returns:

  • nil, nil if validation passes or is skipped.
  • nil, error if type assertion fails or validation errors exist.

type StoryRunWebhook

type StoryRunWebhook struct {
	Config        *config.ControllerConfig
	ConfigManager *config.OperatorConfigManager
}

func (*StoryRunWebhook) SetupWebhookWithManager

func (wh *StoryRunWebhook) SetupWebhookWithManager(mgr ctrl.Manager) error

SetupWebhookWithManager registers the StoryRun validating webhook with the manager.

Behavior:

  • Creates a validating webhook for StoryRun resources.
  • Uses mgr.GetAPIReader() so admission checks read authoritative API state.
  • Injects Config and ConfigManager into the validator.

Arguments:

  • mgr ctrl.Manager: the controller-runtime manager.

Returns:

  • nil on success.
  • Error if webhook registration fails.

type StoryTriggerCustomValidator added in v0.1.4

type StoryTriggerCustomValidator struct {
	Client        ctrlclient.Reader
	Config        *config.ControllerConfig
	ConfigManager *config.OperatorConfigManager
}

StoryTriggerCustomValidator struct is responsible for validating the StoryTrigger resource when it is created, updated, or deleted.

NOTE: The +kubebuilder:object:generate=false marker prevents controller-gen from generating DeepCopy methods, as this struct is used only for temporary operations and does not need to be deeply copied.

func (*StoryTriggerCustomValidator) ValidateCreate added in v0.1.4

ValidateCreate implements webhook.CustomValidator so a webhook will be registered for the type StoryTrigger.

func (*StoryTriggerCustomValidator) ValidateDelete added in v0.1.4

ValidateDelete implements webhook.CustomValidator so a webhook will be registered for the type StoryTrigger.

func (*StoryTriggerCustomValidator) ValidateUpdate added in v0.1.4

func (v *StoryTriggerCustomValidator) ValidateUpdate(ctx context.Context, oldObj, newObj *runsv1alpha1.StoryTrigger) (admission.Warnings, error)

ValidateUpdate implements webhook.CustomValidator so a webhook will be registered for the type StoryTrigger.

type StoryTriggerWebhook added in v0.1.4

type StoryTriggerWebhook struct {
	Config        *config.ControllerConfig
	ConfigManager *config.OperatorConfigManager
}

StoryTriggerWebhook wires the StoryTrigger validator into the manager.

func (*StoryTriggerWebhook) SetupWebhookWithManager added in v0.1.4

func (wh *StoryTriggerWebhook) SetupWebhookWithManager(mgr ctrl.Manager) error

SetupWebhookWithManager registers the StoryTrigger validating webhook with the manager.

Jump to

Keyboard shortcuts

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