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
- func (c *ConsulClusterLockClient) Create(ctx context.Context, cl *ClusterLock) (*ClusterLock, error)
- func (c *ConsulClusterLockClient) Delete(_ context.Context, name string) error
- func (c *ConsulClusterLockClient) Get(_ context.Context, name string) (*ClusterLock, error)
- func (c *ConsulClusterLockClient) Update(ctx context.Context, cl *ClusterLock) (*ClusterLock, error)
- type KubeClusterLockClient
- func (c *KubeClusterLockClient) Create(ctx context.Context, cl *ClusterLock) (*ClusterLock, error)
- func (c *KubeClusterLockClient) Delete(ctx context.Context, name string) error
- func (c *KubeClusterLockClient) Get(ctx context.Context, name string) (*ClusterLock, error)
- func (c *KubeClusterLockClient) Update(ctx context.Context, cl *ClusterLock) (*ClusterLock, error)
- 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 ¶
View Source
var (
IsEmptyLockReleaseError = func(e error) bool {
return e == emptyLockReleaseError
}
IsNotLockOwnerError = func(e error) bool {
return e == notLockOwnerError
}
IsLockIsUseError = func(e error) bool {
return e == lockInUseError
}
)
Functions ¶
func ConflictError ¶ added in v0.9.19
func ConflictError(name string) error
func ExistsError ¶ added in v0.9.19
func ExistsError(name string) error
func NotFoundError ¶ added in v0.9.19
func NotFoundError(name string) error
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) ConfigMap ¶ added in v0.9.19
func (l ClusterLock) ConfigMap(namespace string) *v1.ConfigMap
type ClusterLockClient ¶ added in v0.9.19
type ClusterLockClient interface {
Create(ctx context.Context, cl *ClusterLock) (*ClusterLock, error)
Update(ctx context.Context, cl *ClusterLock) (*ClusterLock, error)
Get(ctx context.Context, name string) (*ClusterLock, error)
Delete(ctx context.Context, 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(ctx context.Context, cl *ClusterLock) (*ClusterLock, error)
func (*ConsulClusterLockClient) Delete ¶ added in v0.9.19
func (c *ConsulClusterLockClient) Delete(_ context.Context, name string) 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(ctx context.Context, cl *ClusterLock) (*ClusterLock, error)
func (*KubeClusterLockClient) Delete ¶ added in v0.9.19
func (c *KubeClusterLockClient) Delete(ctx context.Context, name string) 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 NewConsulClusterLocker(ctx context.Context, idPrefix string, consul *api.Client) (*TestClusterLocker, error)
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.