Documentation
¶
Index ¶
- Variables
- func CloneReq(req *sdcpb.CreateDataStoreRequest) *sdcpb.CreateDataStoreRequest
- func ComputeCreateDSHash(req *sdcpb.CreateDataStoreRequest, ...) string
- func ConvertSdcpbDeviations2ConfigDeviations(ctx context.Context, devs []*sdcpb.WatchDeviationResponse) []configv1alpha1.ConfigDeviation
- func GetGVKNSN(obj client.Object) string
- func GetIntentUpdate(ctx context.Context, key storebackend.Key, config *config.Config, useSpec bool) ([]*sdcpb.Update, error)
- func NewTransactionError(err error, recoverable bool) error
- func RunDryRunTransaction(ctx context.Context, key types.NamespacedName, c *config.Config, ...) (runtime.Object, error)
- type Collector
- func (r *Collector) GetPort() uint
- func (r *Collector) IsRunning() bool
- func (r *Collector) NotifySubscriptionChanged()
- func (r *Collector) SetPort(port uint)
- func (r *Collector) Start(ctx context.Context, req *sdcpb.CreateDataStoreRequest) error
- func (r *Collector) Stop(ctx context.Context)
- func (r *Collector) StopSubscription(ctx context.Context)
- type DatastoreHandle
- type DeviationWatcher
- type LookupError
- type Path
- type PathSubscriptions
- type RuntimeStatus
- type Subscription
- type Subscriptions
- type TargetManager
- func (m *TargetManager) ApplyDesired(ctx context.Context, key storebackend.Key, req *sdcpb.CreateDataStoreRequest, ...)
- func (m *TargetManager) ApplySubscription(ctx context.Context, sub *invv1alpha1.Subscription) ([]string, error)
- func (m *TargetManager) ClearDesired(_ context.Context, key storebackend.Key)
- func (m *TargetManager) Delete(_ context.Context, key storebackend.Key)
- func (m *TargetManager) ForEachRuntime(fn func(runtimeview.TargetRuntimeView))
- func (m *TargetManager) GetClient(_ context.Context, key storebackend.Key) (dsclient.Client, RuntimeStatus, bool)
- func (m *TargetManager) GetDatastore(_ context.Context, key storebackend.Key) (*DatastoreHandle, bool)
- func (m *TargetManager) GetOrCreate(key storebackend.Key) *TargetRuntime
- func (m *TargetManager) GetRuntimeForTarget(_ context.Context, key storebackend.Key) *TargetRuntime
- func (m *TargetManager) RemoveSubscription(ctx context.Context, sub *invv1alpha1.Subscription) error
- type TargetPhase
- type TargetRuntime
- func (t *TargetRuntime) Cache() cache.Cache
- func (t *TargetRuntime) DeleteSubscription(ctx context.Context, sub *invv1alpha1.Subscription) error
- func (t *TargetRuntime) GetSchema() *configv1alpha1.ConfigStatusLastKnownGoodSchema
- func (t *TargetRuntime) Key() storebackend.Key
- func (t *TargetRuntime) PromLabels() []prompb.Label
- func (r *TargetRuntime) SetDesired(req *sdcpb.CreateDataStoreRequest, ...)
- func (r *TargetRuntime) Start(ctx context.Context)
- func (t *TargetRuntime) Status() RuntimeStatus
- func (r *TargetRuntime) Stop()
- func (t *TargetRuntime) UpsertSubscription(ctx context.Context, sub *invv1alpha1.Subscription) error
- type TransactionError
- type TransactionResult
- type Transactor
- func (r *Transactor) ListConfigsPerTarget(ctx context.Context, target *invv1alpha1.Target) (*config.ConfigList, error)
- func (r *Transactor) RecoverConfigs(ctx context.Context, target *invv1alpha1.Target, dsctx *DatastoreHandle) (*string, error)
- func (r *Transactor) SetConfigsTargetConditionForTarget(ctx context.Context, target *invv1alpha1.Target, ...) error
- func (r *Transactor) Transact(ctx context.Context, target *invv1alpha1.Target, dsctx *DatastoreHandle) (bool, error)
- func (r *Transactor) TransactionSet(ctx context.Context, dsctx *DatastoreHandle, req *sdcpb.TransactionSetRequest) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrLookup = errors.New("target lookup error")
Functions ¶
func CloneReq ¶
func CloneReq(req *sdcpb.CreateDataStoreRequest) *sdcpb.CreateDataStoreRequest
func ComputeCreateDSHash ¶
func ComputeCreateDSHash(req *sdcpb.CreateDataStoreRequest, refs *invv1alpha1.TargetStatusUsedReferences) string
func ConvertSdcpbDeviations2ConfigDeviations ¶
func ConvertSdcpbDeviations2ConfigDeviations(ctx context.Context, devs []*sdcpb.WatchDeviationResponse) []configv1alpha1.ConfigDeviation
func GetIntentUpdate ¶
func GetIntentUpdate(ctx context.Context, key storebackend.Key, config *config.Config, useSpec bool) ([]*sdcpb.Update, error)
useSpec indicates to use the spec as the confifSpec, typically set to true; when set to false it means we are recovering the config
func NewTransactionError ¶
NewTransactionError creates a new TransactionError
func RunDryRunTransaction ¶
func RunDryRunTransaction( ctx context.Context, key types.NamespacedName, c *config.Config, target *invv1alpha1.Target, intents []*sdcpb.TransactionIntent, dryrun bool, ) (runtime.Object, error)
runDryRunTransaction opens a short-lived data-server client, executes a TransactionSet dry-run with the provided intents, processes the result, and updates the Config status/conditions.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
func NewCollector ¶
func NewCollector(targetKey storebackend.Key, subscriptions *Subscriptions) *Collector
func (*Collector) NotifySubscriptionChanged ¶
func (r *Collector) NotifySubscriptionChanged()
func (*Collector) StopSubscription ¶
type DatastoreHandle ¶
type DatastoreHandle struct {
Key storebackend.Key
DatastoreName string
Client dsclient.Client
Schema *configv1alpha1.ConfigStatusLastKnownGoodSchema
MarkRecovered func(bool) // callback into runtime
Status RuntimeStatus
}
type DeviationWatcher ¶
type DeviationWatcher struct {
// contains filtered or unexported fields
}
func NewDeviationWatcher ¶
func NewDeviationWatcher( key storebackend.Key, client client.Client, dsclient dsclient.Client, ) *DeviationWatcher
func (*DeviationWatcher) Start ¶
func (r *DeviationWatcher) Start(ctx context.Context)
func (*DeviationWatcher) Stop ¶
func (r *DeviationWatcher) Stop(ctx context.Context)
type LookupError ¶
var TargetLookupErr *LookupError
func (*LookupError) Error ¶
func (e *LookupError) Error() string
func (*LookupError) Unwrap ¶
func (e *LookupError) Unwrap() error
type PathSubscriptions ¶
type PathSubscriptions struct {
Current *Subscription
// AllSubscriptions list all the subscriptions that are in the system, the key is name of the subscription CR
AllSubscriptions map[string]*Subscription
}
type RuntimeStatus ¶
type Subscription ¶
type Subscriptions ¶
type Subscriptions struct {
Paths store.Storer[*PathSubscriptions]
}
func NewSubscriptions ¶
func NewSubscriptions() *Subscriptions
func (*Subscriptions) AddSubscription ¶
func (r *Subscriptions) AddSubscription(subscription *invv1alpha1.Subscription) error
Add or update a subscription
func (*Subscriptions) DelSubscription ¶
func (r *Subscriptions) DelSubscription(subscription *invv1alpha1.Subscription) error
func (*Subscriptions) GetPaths ¶
func (r *Subscriptions) GetPaths() map[invv1alpha1.Encoding][]Path
func (*Subscriptions) HasSubscriptions ¶
func (r *Subscriptions) HasSubscriptions() bool
type TargetManager ¶
type TargetManager struct {
// contains filtered or unexported fields
}
func NewTargetManager ¶
func NewTargetManager(ds *dsmanager.DSConnManager, k8s client.Client) *TargetManager
func (*TargetManager) ApplyDesired ¶
func (m *TargetManager) ApplyDesired( ctx context.Context, key storebackend.Key, req *sdcpb.CreateDataStoreRequest, refs *invv1alpha1.TargetStatusUsedReferences, hash string, )
ApplyDesired is what your reconciler calls on each reconcile.
func (*TargetManager) ApplySubscription ¶
func (m *TargetManager) ApplySubscription(ctx context.Context, sub *invv1alpha1.Subscription) ([]string, error)
func (*TargetManager) ClearDesired ¶
func (m *TargetManager) ClearDesired(_ context.Context, key storebackend.Key)
ClearDesired is useful when the Target is being deleted or disabled.
func (*TargetManager) Delete ¶
func (m *TargetManager) Delete(_ context.Context, key storebackend.Key)
func (*TargetManager) ForEachRuntime ¶
func (m *TargetManager) ForEachRuntime(fn func(runtimeview.TargetRuntimeView))
func (*TargetManager) GetClient ¶
func (m *TargetManager) GetClient(_ context.Context, key storebackend.Key) (dsclient.Client, RuntimeStatus, bool)
GetClient returns a datastore-scoped DS client for this target, only if DS is ready AND datastore is ready.
func (*TargetManager) GetDatastore ¶
func (m *TargetManager) GetDatastore(_ context.Context, key storebackend.Key) (*DatastoreHandle, bool)
func (*TargetManager) GetOrCreate ¶
func (m *TargetManager) GetOrCreate(key storebackend.Key) *TargetRuntime
func (*TargetManager) GetRuntimeForTarget ¶
func (m *TargetManager) GetRuntimeForTarget(_ context.Context, key storebackend.Key) *TargetRuntime
GetRuntimeForTarget returns the runtime if it exists (does NOT create one).
func (*TargetManager) RemoveSubscription ¶
func (m *TargetManager) RemoveSubscription(ctx context.Context, sub *invv1alpha1.Subscription) error
type TargetPhase ¶
type TargetPhase string
const ( PhasePending TargetPhase = "Pending" PhaseWaitingForDS TargetPhase = "WaitingForDS" PhaseEnsuringDatastore TargetPhase = "EnsuringDatastore" PhaseRunning TargetPhase = "Running" PhaseDegraded TargetPhase = "Degraded" PhaseDeleting TargetPhase = "Deleting" )
type TargetRuntime ¶
type TargetRuntime struct {
// contains filtered or unexported fields
}
func NewTargetRuntime ¶
func NewTargetRuntime(key storebackend.Key, ds *dsmanager.DSConnManager, k8s client.Client) *TargetRuntime
func (*TargetRuntime) Cache ¶
func (t *TargetRuntime) Cache() cache.Cache
func (*TargetRuntime) DeleteSubscription ¶
func (t *TargetRuntime) DeleteSubscription(ctx context.Context, sub *invv1alpha1.Subscription) error
func (*TargetRuntime) GetSchema ¶
func (t *TargetRuntime) GetSchema() *configv1alpha1.ConfigStatusLastKnownGoodSchema
func (*TargetRuntime) Key ¶
func (t *TargetRuntime) Key() storebackend.Key
func (*TargetRuntime) PromLabels ¶
func (t *TargetRuntime) PromLabels() []prompb.Label
func (*TargetRuntime) SetDesired ¶
func (r *TargetRuntime) SetDesired(req *sdcpb.CreateDataStoreRequest, refs *invv1alpha1.TargetStatusUsedReferences, hash string)
func (*TargetRuntime) Start ¶
func (r *TargetRuntime) Start(ctx context.Context)
func (*TargetRuntime) Status ¶
func (t *TargetRuntime) Status() RuntimeStatus
func (*TargetRuntime) Stop ¶
func (r *TargetRuntime) Stop()
func (*TargetRuntime) UpsertSubscription ¶
func (t *TargetRuntime) UpsertSubscription(ctx context.Context, sub *invv1alpha1.Subscription) error
type TransactionError ¶
TransactionError represents an error with recoverability classification
func (*TransactionError) Error ¶
func (e *TransactionError) Error() string
type TransactionResult ¶
type Transactor ¶
type Transactor struct {
// contains filtered or unexported fields
}
func NewTransactor ¶
func NewTransactor(client client.Client, fieldManager string) *Transactor
func (*Transactor) ListConfigsPerTarget ¶
func (r *Transactor) ListConfigsPerTarget(ctx context.Context, target *invv1alpha1.Target) (*config.ConfigList, error)
func (*Transactor) RecoverConfigs ¶
func (r *Transactor) RecoverConfigs(ctx context.Context, target *invv1alpha1.Target, dsctx *DatastoreHandle) (*string, error)
func (*Transactor) SetConfigsTargetConditionForTarget ¶
func (r *Transactor) SetConfigsTargetConditionForTarget( ctx context.Context, target *invv1alpha1.Target, targetCond condv1alpha1.Condition, ) error
func (*Transactor) Transact ¶
func (r *Transactor) Transact(ctx context.Context, target *invv1alpha1.Target, dsctx *DatastoreHandle) (bool, error)
func (*Transactor) TransactionSet ¶
func (r *Transactor) TransactionSet( ctx context.Context, dsctx *DatastoreHandle, req *sdcpb.TransactionSetRequest, ) (string, error)