Documentation ¶
Index ¶
- Constants
- Variables
- func ConflictError(name string) error
- func ExistsError(name string) error
- func NotFoundError(name string) error
- type ClusterLock
- type ClusterLockClient
- type ConsulClusterLockClient
- type KubeClusterLockClient
- type Options
- type TestClusterLocker
- func NewClusterLocker(ctx context.Context, idPrefix string, client ClusterLockClient) (*TestClusterLocker, error)
- func NewConsulClusterLocker(ctx context.Context, idPrefix string, consul *api.Client) (*TestClusterLocker, error)
- func NewKubeClusterLocker(clientset kubernetes.Interface, options Options) (*TestClusterLocker, error)
- func NewTestClusterLocker(clientset kubernetes.Interface, options Options) (*TestClusterLocker, error)deprecated
Constants ¶
View Source
const ( // default namespace to install LockDefaultNamespace = "default" // name of kubernetes service holding the lock LockResourceName = "test-lock" // name of the annotation containing the lock LockAnnotationKey = "test.lock" // name of the annotation containing the timeout LockTimeoutAnnotationKey = "test.lock.timeout" // Default timeout for lock to be held DefaultLockTimeout = time.Second * 30 DefaultTimeFormat = time.RFC3339Nano // heartbeat settings DefaultHeartbeatTime = time.Second * 10 )
Variables ¶
Functions ¶
func ConflictError ¶ added in v0.9.19
func ExistsError ¶ added in v0.9.19
func NotFoundError ¶ added in v0.9.19
Types ¶
type ClusterLock ¶ added in v0.9.19
type ClusterLock struct { Name string OwnerID string Timeout string // either a kube resource version or consul modify index ResourceVersion string }
a ClusterLock is only ever composed of either a kubernetes configmap, or a consul key
func CLFromConfigMap ¶ added in v0.9.19
func CLFromConfigMap(cm *v1.ConfigMap) *ClusterLock
func CLFromKVPair ¶ added in v0.9.19
func CLFromKVPair(keyPrefix string, kvp *api.KVPair) *ClusterLock
func (*ClusterLock) Clear ¶ added in v0.9.19
func (l *ClusterLock) Clear()
func (ClusterLock) ConfigMap ¶ added in v0.9.19
func (l ClusterLock) ConfigMap(namespace string) *v1.ConfigMap
func (*ClusterLock) Empty ¶ added in v0.9.19
func (l *ClusterLock) Empty() bool
func (ClusterLock) KVPair ¶ added in v0.9.19
func (l ClusterLock) KVPair(keyPrefix string) *api.KVPair
func (*ClusterLock) Set ¶ added in v0.9.19
func (l *ClusterLock) Set(ownerId, timeout string)
type ClusterLockClient ¶ added in v0.9.19
type ClusterLockClient interface { Create(cl *ClusterLock) (*ClusterLock, error) Update(cl *ClusterLock) (*ClusterLock, error) Get(name string) (*ClusterLock, error) Delete(name string) error }
type ConsulClusterLockClient ¶ added in v0.9.19
type ConsulClusterLockClient struct {
// contains filtered or unexported fields
}
func (*ConsulClusterLockClient) Create ¶ added in v0.9.19
func (c *ConsulClusterLockClient) Create(cl *ClusterLock) (*ClusterLock, error)
func (*ConsulClusterLockClient) Delete ¶ added in v0.9.19
func (c *ConsulClusterLockClient) Delete(name string) error
func (*ConsulClusterLockClient) Get ¶ added in v0.9.19
func (c *ConsulClusterLockClient) Get(name string) (*ClusterLock, error)
func (*ConsulClusterLockClient) Update ¶ added in v0.9.19
func (c *ConsulClusterLockClient) Update(cl *ClusterLock) (*ClusterLock, error)
type KubeClusterLockClient ¶ added in v0.9.19
type KubeClusterLockClient struct {
// contains filtered or unexported fields
}
func (*KubeClusterLockClient) Create ¶ added in v0.9.19
func (c *KubeClusterLockClient) Create(cl *ClusterLock) (*ClusterLock, error)
func (*KubeClusterLockClient) Delete ¶ added in v0.9.19
func (c *KubeClusterLockClient) Delete(name string) error
func (*KubeClusterLockClient) Get ¶ added in v0.9.19
func (c *KubeClusterLockClient) Get(name string) (*ClusterLock, error)
func (*KubeClusterLockClient) Update ¶ added in v0.9.19
func (c *KubeClusterLockClient) Update(cl *ClusterLock) (*ClusterLock, error)
type TestClusterLocker ¶
type TestClusterLocker struct {
// contains filtered or unexported fields
}
func NewClusterLocker ¶ added in v0.9.19
func NewClusterLocker(ctx context.Context, idPrefix string, client ClusterLockClient) (*TestClusterLocker, error)
func NewConsulClusterLocker ¶ added in v0.9.19
func NewKubeClusterLocker ¶ added in v0.9.19
func NewKubeClusterLocker(clientset kubernetes.Interface, options Options) (*TestClusterLocker, error)
func NewTestClusterLocker
deprecated
func NewTestClusterLocker(clientset kubernetes.Interface, options Options) (*TestClusterLocker, error)
Deprecated: use NewKubeClusterLocker
func (*TestClusterLocker) AcquireLock ¶
func (t *TestClusterLocker) AcquireLock(opts ...retry.Option) error
func (*TestClusterLocker) ReleaseLock ¶
func (t *TestClusterLocker) ReleaseLock() error
Click to show internal directories.
Click to hide internal directories.