Documentation
¶
Overview ¶
Package provisioning provides an abstraction layer for infrastructure provisioning through multiple backends.
Index ¶
- Constants
- func AAPExtraVarsFromContext(ctx context.Context) map[string]any
- func AddOnOperatorNameFromContext(ctx context.Context) string
- func AdminKubeconfigFromContext(ctx context.Context) string
- func AppendJob(jobs []v1alpha1.JobStatus, newJob v1alpha1.JobStatus, maxHistory int) []v1alpha1.JobStatus
- func CheckAPIServerForNonTerminalProvisionJob(ctx context.Context, apiReader client.Reader, key client.ObjectKey, ...) bool
- func CheckAPIServerForNonTerminalProvisionJobAndTarget(ctx context.Context, apiReader client.Reader, key client.ObjectKey, ...) bool
- func ComputeBackoffFromJobs(jobs []v1alpha1.JobStatus, configVersion string) time.Duration
- func ComputeDeprovisionBackoff(jobs []v1alpha1.JobStatus) time.Duration
- func ComputeDesiredConfigVersion(spec any) (string, error)
- func DeprovisionJobLaunchNeeded(jobs []v1alpha1.JobStatus, now time.Time) bool
- func FindJobByID(jobs []v1alpha1.JobStatus, jobID string) *v1alpha1.JobStatus
- func FindLatestJobByType(jobs []v1alpha1.JobStatus, jobType v1alpha1.JobType) *v1alpha1.JobStatus
- func FindLatestJobByTypeAndTarget(jobs []v1alpha1.JobStatus, jobType v1alpha1.JobType, target string) *v1alpha1.JobStatus
- func HandleBackoff(ctx context.Context, provState *State, latestJob *v1alpha1.JobStatus, ...) (ctrl.Result, error)
- func HasJobID(job *v1alpha1.JobStatus) bool
- func IsConfigApplied(jobs *[]v1alpha1.JobStatus, desiredConfigVersion string) bool
- func JobVars(ctx context.Context, resource client.Object) (map[string]any, error)
- func NeedsProvisionJob(latestJob *v1alpha1.JobStatus) bool
- func NetworkAttachmentMACsFromContext(ctx context.Context) map[string]string
- func PollDeprovisionJob(ctx context.Context, provider ProvisioningProvider, resource client.Object, ...) (ctrl.Result, bool, error)
- func PollJob(ctx context.Context, provider ProvisioningProvider, resource client.Object, ...) (ctrl.Result, error)
- func RunDeprovisioningLifecycle(ctx context.Context, provider ProvisioningProvider, resource client.Object, ...) (ctrl.Result, bool, error)
- func RunProvisioningLifecycle(ctx context.Context, provider ProvisioningProvider, resource client.Object, ...) (ctrl.Result, error)
- func StorageBackendConnectionsFromContext(ctx context.Context) map[string]BackendConnection
- func TenantStorageClassesFromContext(ctx context.Context) []v1alpha1.ResolvedStorageClass
- func TriggerDeprovisionJob(ctx context.Context, provider ProvisioningProvider, resource client.Object, ...) (ctrl.Result, error)
- func TriggerJob(ctx context.Context, provider ProvisioningProvider, resource client.Object, ...) (ctrl.Result, error)
- func UpdateJob(jobs []v1alpha1.JobStatus, updatedJob v1alpha1.JobStatus) bool
- func WithAAPExtraVars(ctx context.Context, extraVars map[string]any) context.Context
- func WithAddOnOperatorName(ctx context.Context, name string) context.Context
- func WithAdminKubeconfig(ctx context.Context, kubeconfig string) context.Context
- func WithNetworkAttachmentMACs(ctx context.Context, macs map[string]string) context.Context
- func WithStorageBackendConnections(ctx context.Context, conns map[string]BackendConnection) context.Context
- func WithStorageTierDefinitions(ctx context.Context, tiers []TierDefinition) context.Context
- func WithTenantStorageClasses(ctx context.Context, scs []v1alpha1.ResolvedStorageClass) context.Context
- type AAPClient
- type AAPProvider
- func (p *AAPProvider) CancelJob(ctx context.Context, jobID string) error
- func (p *AAPProvider) GetDeprovisionStatus(ctx context.Context, resource client.Object, jobID string) (ProvisionStatus, error)
- func (p *AAPProvider) GetDeprovisionStatusWithExtraVars(ctx context.Context, resource client.Object, jobID string) (ProvisionStatusWithExtraVars, error)
- func (p *AAPProvider) GetProvisionStatus(ctx context.Context, resource client.Object, jobID string) (ProvisionStatus, error)
- func (p *AAPProvider) GetProvisionStatusWithExtraVars(ctx context.Context, resource client.Object, jobID string) (ProvisionStatusWithExtraVars, error)
- func (p *AAPProvider) Name() string
- func (p *AAPProvider) TriggerDeprovision(ctx context.Context, resource client.Object, ...) (*DeprovisionResult, error)
- func (p *AAPProvider) TriggerProvision(ctx context.Context, resource client.Object) (*ProvisionResult, error)
- func (p *AAPProvider) TriggerProvisionWithExtraVars(ctx context.Context, resource client.Object, extraVars map[string]any) (*ProvisionResult, error)
- type Action
- type BackendConnection
- type DeprovisionAction
- type DeprovisionResult
- type JobsExtractor
- type PollCallbacks
- type ProviderConfig
- type ProvisionResult
- type ProvisionStatus
- type ProvisionStatusWithExtraVars
- type ProvisioningJobCanceler
- type ProvisioningProvider
- type ProvisioningProviderWithDeprovisionOutputs
- type ProvisioningProviderWithExtraVars
- type ProvisioningProviderWithProvisionOutputs
- type RateLimitError
- type State
- type TierDefinition
- type TierQosLimits
Constants ¶
const ( // DefaultStatusPollInterval is the default interval for polling provider status. DefaultStatusPollInterval = 30 * time.Second // DefaultMaxJobHistory is the default number of jobs to keep per job array. DefaultMaxJobHistory = 10 )
const ( BackoffBaseDelay = 2 * time.Minute BackoffMaxDelay = 30 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func AAPExtraVarsFromContext ¶ added in v0.0.29
AAPExtraVarsFromContext retrieves additional top-level AAP extra variables.
func AddOnOperatorNameFromContext ¶ added in v0.0.25
AddOnOperatorNameFromContext retrieves the operator role name for an add-on installation AAP job, or an empty string if it is not set.
func AdminKubeconfigFromContext ¶
AdminKubeconfigFromContext retrieves the admin kubeconfig from the context, or empty string if not set.
func AppendJob ¶
func AppendJob(jobs []v1alpha1.JobStatus, newJob v1alpha1.JobStatus, maxHistory int) []v1alpha1.JobStatus
AppendJob adds a new job to the jobs array and trims to maxHistory.
func CheckAPIServerForNonTerminalProvisionJob ¶
func CheckAPIServerForNonTerminalProvisionJob(ctx context.Context, apiReader client.Reader, key client.ObjectKey, fresh client.Object, extract JobsExtractor) bool
CheckAPIServerForNonTerminalProvisionJob reads the resource directly from the API server and returns true if a non-terminal provision job exists. The extract parameter (a JobsExtractor) determines which jobs array to check — each controller passes a typed extractor for its CRD.
func CheckAPIServerForNonTerminalProvisionJobAndTarget ¶
func CheckAPIServerForNonTerminalProvisionJobAndTarget(ctx context.Context, apiReader client.Reader, key client.ObjectKey, fresh client.Object, extract JobsExtractor, target string) bool
CheckAPIServerForNonTerminalProvisionJobAndTarget is CheckAPIServerForNonTerminalProvisionJob scoped to a single job target — required when populating JobTarget.CheckAPIServer for a non-"" target, since the untargeted form only ever checks untagged (target == "") job history.
func ComputeBackoffFromJobs ¶
ComputeBackoffFromJobs determines the next backoff duration based on the gap between the last two failed provision jobs with the same ConfigVersion.
func ComputeDeprovisionBackoff ¶
ComputeDeprovisionBackoff determines the next backoff duration for deprovision retries.
func ComputeDesiredConfigVersion ¶
ComputeDesiredConfigVersion computes a hash of the spec and returns it. The caller must pass the resource's Spec field (not the entire resource).
func DeprovisionJobLaunchNeeded ¶ added in v0.0.33
DeprovisionJobLaunchNeeded reports whether the lifecycle would launch a new deprovision job at the supplied time. Controllers use this before claiming a provider launch slot so ordinary status polling does not hold a launch claim across provider read failures.
func FindJobByID ¶
FindJobByID finds a job by its ID in the jobs array. Returns a pointer to the job if found, nil otherwise.
func FindLatestJobByType ¶
FindLatestJobByType finds the most recent job of the specified type by timestamp. Returns nil if no job of that type exists.
func FindLatestJobByTypeAndTarget ¶
func FindLatestJobByTypeAndTarget(jobs []v1alpha1.JobStatus, jobType v1alpha1.JobType, target string) *v1alpha1.JobStatus
FindLatestJobByTypeAndTarget finds the most recent job of the specified type and target by timestamp. Target distinguishes concurrent jobs of the same type for resources dispatching to multiple managers (e.g. Subnet's fabric and k8s jobs); pass "" for single-target resources. Returns nil if no matching job exists.
func HandleBackoff ¶
func HandleBackoff(ctx context.Context, provState *State, latestJob *v1alpha1.JobStatus, triggerFn func() (ctrl.Result, error)) (ctrl.Result, error)
HandleBackoff checks if the backoff period has elapsed since the last failed job. If elapsed, it calls triggerFn to retry. Otherwise, it returns a RequeueAfter with the remaining delay.
func IsConfigApplied ¶
IsConfigApplied returns true if the current spec has been successfully applied. Only the latest provision job is considered to avoid false positives when a spec reverts to a previously applied value (A-B-A problem). Also returns true for legacy provision jobs (empty ConfigVersion) that succeeded, to avoid re-triggering provisioning for resources provisioned before ConfigVersion tracking was introduced.
func JobVars ¶ added in v0.0.40
JobVars returns the osac_job_vars of a job for resource: the serialized resource plus the job inputs carried by ctx (tenant storage classes, storage tier definitions and backend connections). Controllers that launch their jobs through the network task engine use it to build the same input the AAP provider sends.
func NeedsProvisionJob ¶
NeedsProvisionJob determines if a new provision job should be triggered. Returns true if no job exists, or if the previous job failed (allowing retry). Used by controllers without config-version-based provisioning (SecurityGroup, Subnet, VirtualNetwork). Controllers with ConfigVersion support should use EvaluateAction instead, which adds backoff and spec-change detection.
func NetworkAttachmentMACsFromContext ¶
NetworkAttachmentMACsFromContext retrieves the network attachment MAC map, or nil when it was not set.
func PollDeprovisionJob ¶
func PollDeprovisionJob(ctx context.Context, provider ProvisioningProvider, resource client.Object, jobs *[]v1alpha1.JobStatus, latestDeprovisionJob *v1alpha1.JobStatus, maxHistory int, pollInterval time.Duration) (ctrl.Result, bool, error)
PollDeprovisionJob polls the status of an existing deprovision job. Returns (result, done, error) where done=true means the job reached terminal state and the controller can proceed with finalizer removal. When a deprovision job fails with BlockDeletionOnFailure, the function retries after exponential backoff rather than blocking forever.
func PollJob ¶
func PollJob(ctx context.Context, provider ProvisioningProvider, resource client.Object, provState *State, latestJob *v1alpha1.JobStatus, pollInterval time.Duration, callbacks *PollCallbacks) (ctrl.Result, error)
PollJob checks the status of an existing provision job and updates the jobs slice in place.
func RunDeprovisioningLifecycle ¶
func RunDeprovisioningLifecycle(ctx context.Context, provider ProvisioningProvider, resource client.Object, jobs *[]v1alpha1.JobStatus, maxHistory int, pollInterval time.Duration) (ctrl.Result, bool, error)
RunDeprovisioningLifecycle encapsulates the full deprovisioning flow: trigger if no job exists, poll/retry if one does. Controllers call this instead of duplicating the trigger-or-poll logic. Returns (result, done, error) where done=true means the controller can proceed with finalizer removal.
func RunProvisioningLifecycle ¶
func RunProvisioningLifecycle( ctx context.Context, provider ProvisioningProvider, resource client.Object, provState *State, maxHistory int, pollInterval time.Duration, callbacks *PollCallbacks, checkAPIServer func() bool, statusFlush func() error, ) (ctrl.Result, error)
RunProvisioningLifecycle encapsulates the full provisioning flow: evaluate action, trigger/poll/backoff as needed. Controllers call this instead of duplicating the switch statement. The callbacks customize behavior on success and failure.
statusFlush is called after a provision job is successfully triggered to persist the job status immediately, preventing duplicate jobs from concurrent reconciliations. Errors are logged but non-fatal — the end-of-reconcile status update serves as fallback.
func StorageBackendConnectionsFromContext ¶
func StorageBackendConnectionsFromContext(ctx context.Context) map[string]BackendConnection
StorageBackendConnectionsFromContext retrieves the storage backend connections from the context, or nil if not set.
func TenantStorageClassesFromContext ¶
func TenantStorageClassesFromContext(ctx context.Context) []v1alpha1.ResolvedStorageClass
TenantStorageClassesFromContext retrieves the tenant storage classes from the context, or nil if not set.
func TriggerDeprovisionJob ¶
func TriggerDeprovisionJob(ctx context.Context, provider ProvisioningProvider, resource client.Object, jobs *[]v1alpha1.JobStatus, maxHistory int, pollInterval time.Duration) (ctrl.Result, error)
TriggerDeprovisionJob triggers a deprovision job via the provider and handles the result. Updates the jobs slice in place. Returns the result for the controller to return.
func TriggerJob ¶
func TriggerJob(ctx context.Context, provider ProvisioningProvider, resource client.Object, provState *State, maxHistory int, pollInterval time.Duration) (ctrl.Result, error)
TriggerJob triggers a new provision job and updates the jobs slice in place via State.
func UpdateJob ¶
UpdateJob updates an existing job by ID with new values. Returns true if the job was found and updated, false otherwise.
func WithAAPExtraVars ¶ added in v0.0.29
WithAAPExtraVars returns a context carrying additional top-level AAP extra variables. The AAP provider merges these with its standard osac_job_vars.
func WithAddOnOperatorName ¶ added in v0.0.25
WithAddOnOperatorName returns a context carrying the operator role name for an add-on installation AAP job.
func WithAdminKubeconfig ¶
WithAdminKubeconfig returns a context carrying the admin kubeconfig for a CaaS cluster. The AAP provider reads this when building extra_vars.
func WithNetworkAttachmentMACs ¶
WithNetworkAttachmentMACs carries the subnet-ref to MAC-address map used by the bare-metal IP discovery provider when building AAP extra_vars.
func WithStorageBackendConnections ¶
func WithStorageBackendConnections(ctx context.Context, conns map[string]BackendConnection) context.Context
WithStorageBackendConnections returns a context carrying the resolved storage backend connection details, keyed by backend_id. The AAP provider reads this when building extra_vars.
func WithStorageTierDefinitions ¶
func WithStorageTierDefinitions(ctx context.Context, tiers []TierDefinition) context.Context
WithStorageTierDefinitions returns a context carrying the resolved storage tier definitions. The AAP provider reads this when building extra_vars.
func WithTenantStorageClasses ¶
func WithTenantStorageClasses(ctx context.Context, scs []v1alpha1.ResolvedStorageClass) context.Context
WithTenantStorageClasses returns a context carrying the tenant's resolved storage classes. The AAP provider reads this when building extra_vars.
Types ¶
type AAPClient ¶
type AAPClient interface {
GetTemplate(ctx context.Context, templateName string) (*aap.Template, error)
LaunchJobTemplate(ctx context.Context, req aap.LaunchJobTemplateRequest) (*aap.LaunchJobTemplateResponse, error)
LaunchWorkflowTemplate(ctx context.Context, req aap.LaunchWorkflowTemplateRequest) (*aap.LaunchWorkflowTemplateResponse, error)
GetJob(ctx context.Context, jobID string) (*aap.Job, error)
CancelJob(ctx context.Context, jobID string) error
}
AAPClient is the interface for AAP operations used by the provider.
type AAPProvider ¶
type AAPProvider struct {
// contains filtered or unexported fields
}
AAPProvider implements ProvisioningProvider using direct AAP REST API integration.
Template resolution supports two modes:
- Explicit: provisionTemplate and deprovisionTemplate are set directly
- Prefix-based: templatePrefix is set, and template names are derived from the resource Kind (e.g., prefix "osac" + Kind "VirtualNetwork" → "osac-create-virtual-network")
func NewAAPProvider ¶
func NewAAPProvider(client AAPClient, provisionTemplate, deprovisionTemplate string) *AAPProvider
NewAAPProvider creates a new AAP provider with explicit template names.
func NewAAPProviderWithPrefix ¶
func NewAAPProviderWithPrefix(client AAPClient, templatePrefix string) *AAPProvider
NewAAPProviderWithPrefix creates a new AAP provider that derives template names from the resource Kind using the given prefix. For example, with prefix "osac" and a VirtualNetwork resource, it resolves to "osac-create-virtual-network" and "osac-delete-virtual-network".
func (*AAPProvider) CancelJob ¶ added in v0.0.25
func (p *AAPProvider) CancelJob(ctx context.Context, jobID string) error
CancelJob cancels a running provisioning job during resource deletion.
func (*AAPProvider) GetDeprovisionStatus ¶
func (p *AAPProvider) GetDeprovisionStatus(ctx context.Context, resource client.Object, jobID string) (ProvisionStatus, error)
GetDeprovisionStatus checks deprovisioning job status via AAP API.
func (*AAPProvider) GetDeprovisionStatusWithExtraVars ¶ added in v0.0.33
func (p *AAPProvider) GetDeprovisionStatusWithExtraVars( ctx context.Context, resource client.Object, jobID string, ) (ProvisionStatusWithExtraVars, error)
GetDeprovisionStatusWithExtraVars returns status, submitted inputs, and artifacts from an AAP deprovisioning job.
func (*AAPProvider) GetProvisionStatus ¶
func (p *AAPProvider) GetProvisionStatus(ctx context.Context, resource client.Object, jobID string) (ProvisionStatus, error)
GetProvisionStatus checks provisioning job status via AAP API.
func (*AAPProvider) GetProvisionStatusWithExtraVars ¶ added in v0.0.19
func (p *AAPProvider) GetProvisionStatusWithExtraVars(ctx context.Context, resource client.Object, jobID string) (ProvisionStatusWithExtraVars, error)
GetProvisionStatusWithExtraVars checks provisioning job status and returns its submitted inputs and output artifacts from the same AAP job response.
func (*AAPProvider) Name ¶
func (p *AAPProvider) Name() string
Name returns the provider name for logging.
func (*AAPProvider) TriggerDeprovision ¶
func (p *AAPProvider) TriggerDeprovision(ctx context.Context, resource client.Object, provisionJobs []v1alpha1.JobStatus) (*DeprovisionResult, error)
TriggerDeprovision attempts to start deprovisioning for a resource. It checks whether a running provision job needs to be cancelled first.
func (*AAPProvider) TriggerProvision ¶
func (p *AAPProvider) TriggerProvision(ctx context.Context, resource client.Object) (*ProvisionResult, error)
TriggerProvision triggers provisioning via AAP API. Autodetects whether the template is a job_template or workflow_job_template.
func (*AAPProvider) TriggerProvisionWithExtraVars ¶ added in v0.0.19
func (p *AAPProvider) TriggerProvisionWithExtraVars(ctx context.Context, resource client.Object, extraVars map[string]any) (*ProvisionResult, error)
TriggerProvisionWithExtraVars triggers provisioning with additional variables.
type Action ¶
type Action int
Action represents the outcome of shouldTriggerProvision.
func EvaluateAction ¶
EvaluateAction determines the next provisioning action based on job history and config versions.
type BackendConnection ¶
BackendConnection carries one storage backend's management-endpoint connection details, resolved once per unique backend_id across all tiers so credential material is never duplicated in the extra_vars payload.
type DeprovisionAction ¶
type DeprovisionAction string
DeprovisionAction represents the action taken by a provider when attempting to deprovision.
const ( // DeprovisionTriggered means deprovisioning was started and controller should poll status DeprovisionTriggered DeprovisionAction = "triggered" // DeprovisionWaiting means provider is not ready yet and controller should requeue DeprovisionWaiting DeprovisionAction = "waiting" // DeprovisionSkipped means provider determined deprovisioning is not needed DeprovisionSkipped DeprovisionAction = "skipped" )
type DeprovisionResult ¶
type DeprovisionResult struct {
// Action indicates what the provider did
Action DeprovisionAction
// JobID is the tracking identifier when Action==DeprovisionTriggered
// Used by controller to poll status via GetDeprovisionStatus()
// Empty when Action==DeprovisionWaiting or Action==DeprovisionSkipped
JobID string
// BlockDeletionOnFailure indicates whether deletion should be blocked if deprovision fails
// Stored in CR status for crash recovery (controller restart)
// Providers set based on their cleanup guarantees
BlockDeletionOnFailure bool
// ProvisionJobStatus is the current status of the provision job (state and message)
// Populated when provision job is checked before deprovisioning
// This allows the controller to update the CR status to reflect job cancellation/termination
// Empty when no provision job exists
ProvisionJobStatus *ProvisionStatus
}
DeprovisionResult contains the result of attempting to trigger a deprovision operation.
type JobsExtractor ¶
JobsExtractor extracts a jobs array from a resource. Used by CheckAPIServerForNonTerminalProvisionJob to read jobs from a fresh API server copy of the resource. Each controller passes a typed extractor for its own CRD (e.g. func(obj) { return obj.(*Subnet).Status.ProvisioningJobs }).
type PollCallbacks ¶
type PollCallbacks struct {
// OnFailed is called when the job transitions to Failed state.
OnFailed func(message string)
// OnOutputError is called when a successful job's outputs cannot be processed.
OnOutputError func(message string)
// OnSuccess is called when the job succeeds.
OnSuccess func(status ProvisionStatus)
// OnSuccessWithExtraVars is called when the job succeeds and receives its output variables.
// When set, the provider's output-aware status method is used and this callback runs
// before OnSuccess. Errors without a confirmed successful status are retried; output
// errors accompanying a successful status are reported through OnOutputError.
OnSuccessWithExtraVars func(status ProvisionStatusWithExtraVars) error
}
PollCallbacks holds optional callbacks for provision job state transitions.
type ProviderConfig ¶
type ProviderConfig struct {
AAPClient AAPClient
ProvisionTemplate string
DeprovisionTemplate string
// FulfillmentEndpoint and FulfillmentIssuerURL are forwarded to AAP for
// tenant-cluster CSI provisioning. They are deployment configuration, not
// credentials.
FulfillmentEndpoint string
FulfillmentIssuerURL string
// TemplatePrefix enables convention-based template name resolution for AAP.
// When set, template names are derived from the resource Kind:
// {prefix}-create-{kind-kebab} and {prefix}-delete-{kind-kebab}
// Explicit ProvisionTemplate/DeprovisionTemplate take precedence when set.
TemplatePrefix string
}
ProviderConfig contains configuration for creating the AAP provisioning provider.
type ProvisionResult ¶
type ProvisionResult struct {
// JobID is the identifier for the triggered job
JobID string
// InitialState is the initial state of the job (typically Pending or Running)
InitialState v1alpha1.JobState
// Message is a human-readable status message
Message string
}
ProvisionResult contains the result of triggering a provision operation.
type ProvisionStatus ¶
type ProvisionStatus struct {
// JobID is the unique identifier for this job.
JobID string
// State indicates the current state of the job.
State v1alpha1.JobState
// Message provides a human-readable status message.
Message string
// Progress indicates completion percentage (0-100).
// Optional: providers that don't support progress tracking should leave this at 0.
Progress int
// StartTime is when the job started execution.
StartTime time.Time
// EndTime is when the job completed (succeeded or failed).
// Zero value indicates job is still running.
EndTime time.Time
// ReconciledVersion is the configuration version that was successfully applied.
// Only populated when State is JobStateSucceeded.
ReconciledVersion string
// ErrorDetails contains detailed error information when State is JobStateFailed.
ErrorDetails string
// Outputs contains structured artifacts returned by the provisioning job.
// Provider-specific controllers use these values to populate backend identifiers.
Outputs map[string]any
}
ProvisionStatus represents the current state of a provisioning or deprovisioning job.
func (*ProvisionStatus) MessageWithDetails ¶
func (s *ProvisionStatus) MessageWithDetails() string
MessageWithDetails returns the message with error details appended, if present.
type ProvisionStatusWithExtraVars ¶ added in v0.0.19
type ProvisionStatusWithExtraVars struct {
ProvisionStatus
// InputExtraVars contains the job's submitted extra_vars input.
InputExtraVars map[string]any
// ExtraVars contains the job's returned artifacts.
ExtraVars map[string]any
}
ProvisionStatusWithExtraVars contains the provisioning status, the inputs submitted to the job, and the output artifacts returned by the job.
type ProvisioningJobCanceler ¶ added in v0.0.25
ProvisioningJobCanceler can cancel a running provisioning job during resource deletion. Providers that cannot cancel jobs may omit this interface; callers must then wait for the job to reach a terminal state before continuing deletion.
type ProvisioningProvider ¶
type ProvisioningProvider interface {
// TriggerProvision starts provisioning for a resource.
// Returns a ProvisionResult with job details and initial state.
TriggerProvision(ctx context.Context, resource client.Object) (*ProvisionResult, error)
// GetProvisionStatus checks the status of a provisioning job.
// The resource parameter allows providers to check additional state if needed.
GetProvisionStatus(ctx context.Context, resource client.Object, jobID string) (ProvisionStatus, error)
// TriggerDeprovision attempts to deprovision a resource.
// The provider performs any prerequisite checks (e.g. cancelling a running provision job)
// and returns an action indicating whether deprovisioning was triggered, needs to wait,
// or should be skipped. provisionJobs is the current provision job history for the resource,
// used to find and cancel any running provision job before deprovisioning.
TriggerDeprovision(ctx context.Context, resource client.Object, provisionJobs []v1alpha1.JobStatus) (*DeprovisionResult, error)
// GetDeprovisionStatus checks the status of a deprovisioning job.
GetDeprovisionStatus(ctx context.Context, resource client.Object, jobID string) (ProvisionStatus, error)
// Name returns the provider name for logging and identification.
Name() string
}
ProvisioningProvider abstracts triggering infrastructure automation via AAP and retrieving job status.
func NewProvider ¶
func NewProvider(config ProviderConfig) (ProvisioningProvider, error)
NewProvider creates an AAP provisioning provider from the configuration.
type ProvisioningProviderWithDeprovisionOutputs ¶ added in v0.0.33
type ProvisioningProviderWithDeprovisionOutputs interface {
GetDeprovisionStatusWithExtraVars(ctx context.Context, resource client.Object, jobID string) (ProvisionStatusWithExtraVars, error)
}
ProvisioningProviderWithDeprovisionOutputs can retrieve deprovision job artifacts.
type ProvisioningProviderWithExtraVars ¶ added in v0.0.19
type ProvisioningProviderWithExtraVars interface {
TriggerProvisionWithExtraVars(ctx context.Context, resource client.Object, extraVars map[string]any) (*ProvisionResult, error)
}
ProvisioningProviderWithExtraVars can trigger provisioning with inherited automation variables.
type ProvisioningProviderWithProvisionOutputs ¶ added in v0.0.19
type ProvisioningProviderWithProvisionOutputs interface {
GetProvisionStatusWithExtraVars(ctx context.Context, resource client.Object, jobID string) (ProvisionStatusWithExtraVars, error)
}
ProvisioningProviderWithProvisionOutputs can retrieve output variables from a provisioning job.
type RateLimitError ¶
RateLimitError indicates a request was rate-limited and should be retried.
func AsRateLimitError ¶
func AsRateLimitError(err error) (*RateLimitError, bool)
AsRateLimitError checks if err is a RateLimitError and returns it.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type State ¶
State points into the resource's status fields used by the provisioning lifecycle. Jobs is a pointer so shared functions can modify the slice in place. DesiredConfigVersion is a value snapshot captured at construction time — it is not updated if the instance status changes afterward.
type TierDefinition ¶
type TierDefinition struct {
Name string
Protocol string
Provider string
// BackendID is the join key into a map of BackendConnection values keyed by
// backend_id — not the connection itself.
BackendID string
QosLimits TierQosLimits
}
TierDefinition is the flat, AAP-schema-shaped representation of a storage tier (mirrors osac-aap's storage_provider role argument_specs.yaml: name/protocol/ provider/qos_limits), resolved from the Tier and Backend APIs.
func StorageTierDefinitionsFromContext ¶
func StorageTierDefinitionsFromContext(ctx context.Context) []TierDefinition
StorageTierDefinitionsFromContext retrieves the storage tier definitions from the context, or nil if not set.
type TierQosLimits ¶
TierQosLimits carries the bandwidth limits for a TierDefinition's backend association.