Documentation ¶
Index ¶
- Variables
- func IsNotExist(err error) bool
- type AuditLogStore
- type AuditingStore
- func (a AuditingStore) Create(ctx context.Context, manifest manifest.Manifest, minHealth int, ...) (fields.DaemonSet, error)
- func (a AuditingStore) Delete(ctx context.Context, id fields.ID, user string) error
- func (a AuditingStore) Disable(ctx context.Context, id fields.ID, user string) (fields.DaemonSet, error)
- func (a AuditingStore) Enable(ctx context.Context, id fields.ID, user string) (fields.DaemonSet, error)
- func (a AuditingStore) UpdateManifest(ctx context.Context, id fields.ID, manifest manifest.Manifest, user string) (fields.DaemonSet, error)
- func (a AuditingStore) UpdateMinHealth(ctx context.Context, id fields.ID, minHealth int, user string) (fields.DaemonSet, error)
- func (a AuditingStore) UpdateNodeSelector(ctx context.Context, id fields.ID, nodeSelector klabels.Selector, user string) (fields.DaemonSet, error)
- func (a AuditingStore) UpdateTimeout(ctx context.Context, id fields.ID, timeout time.Duration, user string) (fields.DaemonSet, error)
- type CASError
- type ConsulStore
- func (s *ConsulStore) Create(ctx context.Context, manifest manifest.Manifest, minHealth int, ...) (fields.DaemonSet, error)
- func (s *ConsulStore) Delete(id fields.ID) error
- func (s *ConsulStore) DeleteTxn(ctx context.Context, id fields.ID) error
- func (s *ConsulStore) Disable(id fields.ID) (fields.DaemonSet, error)
- func (s *ConsulStore) DisableTxn(ctx context.Context, id fields.ID) (fields.DaemonSet, error)
- func (s *ConsulStore) EnableTxn(ctx context.Context, id fields.ID) (fields.DaemonSet, error)
- func (s *ConsulStore) Get(id fields.ID) (fields.DaemonSet, *api.QueryMeta, error)
- func (s *ConsulStore) List() ([]fields.DaemonSet, error)
- func (s *ConsulStore) LockForOwnership(dsID fields.ID, session consul.Session) (consul.Unlocker, error)
- func (s *ConsulStore) LockForOwnershipTxn(lockCtx context.Context, dsID fields.ID, session consul.Session) (consul.TxnUnlocker, error)
- func (s *ConsulStore) MutateDS(id fields.ID, mutator func(fields.DaemonSet) (fields.DaemonSet, error)) (fields.DaemonSet, error)
- func (s *ConsulStore) MutateDSTxn(ctx context.Context, id fields.ID, ...) (fields.DaemonSet, error)
- func (s *ConsulStore) Watch(quitCh <-chan struct{}) <-chan WatchedDaemonSets
- func (s *ConsulStore) WatchAll(quitCh <-chan struct{}, pauseTime time.Duration) <-chan WatchedDaemonSetList
- type WatchedDaemonSetList
- type WatchedDaemonSets
Constants ¶
This section is empty.
Variables ¶
var NoDaemonSet error = errors.New("No daemon set found")
Functions ¶
func IsNotExist ¶
Types ¶
type AuditLogStore ¶
type AuditingStore ¶
type AuditingStore struct {
// contains filtered or unexported fields
}
AuditingStore is a wrapper around a ConsulStore that will produce audit logs for the actions taken.
func NewAuditingStore ¶
func NewAuditingStore(innerStore *ConsulStore, auditLogStore AuditLogStore) AuditingStore
func (AuditingStore) UpdateManifest ¶
func (AuditingStore) UpdateMinHealth ¶
func (AuditingStore) UpdateNodeSelector ¶
type ConsulStore ¶
type ConsulStore struct {
// contains filtered or unexported fields
}
store represents an interface for persisting daemon set to Consul, as well as restoring daemon set from Consul.
func NewConsul ¶
func NewConsul(client consulutil.ConsulClient, retries int, logger *logging.Logger) *ConsulStore
func (*ConsulStore) Create ¶
func (s *ConsulStore) Create( ctx context.Context, manifest manifest.Manifest, minHealth int, name fields.ClusterName, nodeSelector klabels.Selector, podID types.PodID, timeout time.Duration, ) (fields.DaemonSet, error)
Create creates a daemon set with the specified manifest and selectors. The node selector is used to determine what nodes the daemon set may schedule on. The pod label set is applied to every pod the daemon set schedules.
func (*ConsulStore) Delete ¶
func (s *ConsulStore) Delete(id fields.ID) error
Delete deletes a daemon set by ID. It does not return an error if no daemon set with the given ID exists.
func (*ConsulStore) DeleteTxn ¶
DeleteTxn adds a deletion operation to the passed transaction for the given daemon set ID. The operation will not error if the id does not exist TODO: replace all calls of Delete with DeleteTxn
func (*ConsulStore) DisableTxn ¶
DisableTxn adds an operation to the passed context to disable the daemon set
func (*ConsulStore) EnableTxn ¶
EnableTxn adds an operation to the passed context to enable the daemon set
func (*ConsulStore) Get ¶
Get retrieves a daemon set by ID. If it does not exist, it will produce an error
func (*ConsulStore) LockForOwnership ¶
func (s *ConsulStore) LockForOwnership(dsID fields.ID, session consul.Session) (consul.Unlocker, error)
LockForOwnership qcquires a lock on the DS that should be used by DS farm goroutines, whose job it is to carry out the intent of the DS.
func (*ConsulStore) LockForOwnershipTxn ¶
func (s *ConsulStore) LockForOwnershipTxn( lockCtx context.Context, dsID fields.ID, session consul.Session, ) (consul.TxnUnlocker, error)
LockForOwnershipTxn is should be called when taking "ownership" of a daemon set. Holding the ownership lock before taking action for a daemon set is used to guarantee that no two processes are doing the same work (and potentially conflicting). This function: 1) adds the necessary consul operations to LOCK the daemon set to the transaction context `lockCtx` 2) adds the necessary consul operations to UNLOCK the daemon set to `unlockCtx` 3) adds the necessary consul operations to CHECK that the lock is held to `checkLockedCtx`. It is good practice to branch any consul transactions that will write to consul off of this transaction to make sure that the lock is still held or othwerwise roll back the transaction
func (*ConsulStore) MutateDS ¶
func (s *ConsulStore) MutateDS( id fields.ID, mutator func(fields.DaemonSet) (fields.DaemonSet, error), ) (fields.DaemonSet, error)
MutateDS mutates the daemon set with the given id according to the passed mutator function. Any modifications to the daemon set done within the function will be applied if and only if the daemon set was not changed since the value was read (check-and-set operation used)
func (*ConsulStore) MutateDSTxn ¶
func (s *ConsulStore) MutateDSTxn( ctx context.Context, id fields.ID, mutator func(fields.DaemonSet) (fields.DaemonSet, error), ) (fields.DaemonSet, error)
MutateDSTxn adds a check-and-set operation to the passed transaction to perform the mutation requested via the mutator function. TODO: replace all calls of MutateDS with this
func (*ConsulStore) Watch ¶
func (s *ConsulStore) Watch(quitCh <-chan struct{}) <-chan WatchedDaemonSets
Watch watches dsTree for changes and returns a blocking channel where the client can read a WatchedDaemonSets object which contain changed daemon sets
func (*ConsulStore) WatchAll ¶
func (s *ConsulStore) WatchAll(quitCh <-chan struct{}, pauseTime time.Duration) <-chan WatchedDaemonSetList
WatchAll watches dsTree for all the daemon sets and returns a blocking channel where the client can read a WatchedDaemonSetsList object which contain all of the daemon sets currently on the tree