etcd

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package etcd implements data storage using etcd.

Key layout:

<prefix>/ ├── tokens/ │ └── <id>: core.BootstrapToken ├── clusters/ │ └── <id>: core.Cluster ├── roles/ │ └── <id>: core.Role ├── rolebindings/ │ └── <id>: core.RoleBinding ├── keyrings/ │ └── <cluster-id>/ │ └── <capability-id>: keyring.Keyring │── kv/ │ ├── <prefix1>/ │ │ └── ... │ └── <prefix2>/ │ └── ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EtcdStore

type EtcdStore struct {
	EtcdStoreOptions
	Logger *zap.SugaredLogger
	Client *clientv3.Client
}

EtcdStore implements TokenStore and TenantStore.

func NewEtcdStore

func NewEtcdStore(ctx context.Context, conf *v1beta1.EtcdStorageSpec, opts ...EtcdStoreOption) *EtcdStore

func (*EtcdStore) CreateCluster

func (e *EtcdStore) CreateCluster(ctx context.Context, cluster *corev1.Cluster) error

func (*EtcdStore) CreateRole

func (e *EtcdStore) CreateRole(ctx context.Context, role *corev1.Role) error

func (*EtcdStore) CreateRoleBinding

func (e *EtcdStore) CreateRoleBinding(ctx context.Context, roleBinding *corev1.RoleBinding) error

func (*EtcdStore) CreateToken

func (e *EtcdStore) CreateToken(ctx context.Context, ttl time.Duration, opts ...storage.TokenCreateOption) (*corev1.BootstrapToken, error)

func (*EtcdStore) DeleteCluster

func (e *EtcdStore) DeleteCluster(ctx context.Context, ref *corev1.Reference) error

func (*EtcdStore) DeleteRole

func (e *EtcdStore) DeleteRole(ctx context.Context, ref *corev1.Reference) error

func (*EtcdStore) DeleteRoleBinding

func (e *EtcdStore) DeleteRoleBinding(ctx context.Context, ref *corev1.Reference) error

func (*EtcdStore) DeleteToken

func (e *EtcdStore) DeleteToken(ctx context.Context, ref *corev1.Reference) error

func (*EtcdStore) GetCluster

func (e *EtcdStore) GetCluster(ctx context.Context, ref *corev1.Reference) (*corev1.Cluster, error)

func (*EtcdStore) GetRole

func (e *EtcdStore) GetRole(ctx context.Context, ref *corev1.Reference) (*corev1.Role, error)

func (*EtcdStore) GetRoleBinding

func (e *EtcdStore) GetRoleBinding(ctx context.Context, ref *corev1.Reference) (*corev1.RoleBinding, error)

func (*EtcdStore) GetToken

func (e *EtcdStore) GetToken(ctx context.Context, ref *corev1.Reference) (*corev1.BootstrapToken, error)

func (*EtcdStore) KeyValueStore

func (e *EtcdStore) KeyValueStore(prefix string) storage.KeyValueStore

func (*EtcdStore) KeyringStore

func (e *EtcdStore) KeyringStore(prefix string, ref *corev1.Reference) storage.KeyringStore

func (*EtcdStore) ListClusters

func (e *EtcdStore) ListClusters(
	ctx context.Context,
	matchLabels *corev1.LabelSelector,
	matchOptions corev1.MatchOptions,
) (*corev1.ClusterList, error)

func (*EtcdStore) ListRoleBindings

func (e *EtcdStore) ListRoleBindings(ctx context.Context) (*corev1.RoleBindingList, error)

func (*EtcdStore) ListRoles

func (e *EtcdStore) ListRoles(ctx context.Context) (*corev1.RoleList, error)

func (*EtcdStore) ListTokens

func (e *EtcdStore) ListTokens(ctx context.Context) ([]*corev1.BootstrapToken, error)

func (*EtcdStore) UpdateCluster

func (e *EtcdStore) UpdateCluster(
	ctx context.Context,
	ref *corev1.Reference,
	mutator storage.MutatorFunc[*corev1.Cluster],
) (*corev1.Cluster, error)

func (*EtcdStore) UpdateToken

func (*EtcdStore) WatchCluster added in v0.6.0

func (e *EtcdStore) WatchCluster(
	ctx context.Context,
	cluster *corev1.Cluster,
) (<-chan storage.WatchEvent[*corev1.Cluster], error)

func (*EtcdStore) WatchClusters added in v0.6.0

func (e *EtcdStore) WatchClusters(
	ctx context.Context,
	knownClusters []*corev1.Cluster,
) (<-chan storage.WatchEvent[*corev1.Cluster], error)

type EtcdStoreOption

type EtcdStoreOption func(*EtcdStoreOptions)

func WithPrefix

func WithPrefix(prefix string) EtcdStoreOption

type EtcdStoreOptions

type EtcdStoreOptions struct {
	Prefix string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL