...

Package storage

import "k8s.io/apiextensions-apiserver/test/integration/storage"
Overview
Index

Overview ▾

func GetEtcdClients

func GetEtcdClients(config storagebackend.TransportConfig) (*clientv3.Client, clientv3.KV, error)

GetEtcdClients returns an initialized clientv3.Client and clientv3.KV.

type EtcdObjectReader

EtcdObjectReader provides direct access to custom resource objects stored in etcd.

type EtcdObjectReader struct {
    // contains filtered or unexported fields
}

func NewEtcdObjectReader

func NewEtcdObjectReader(etcdClient *clientv3.Client, restOptions *generic.RESTOptions, crd *apiextensionsv1.CustomResourceDefinition) *EtcdObjectReader

NewEtcdObjectReader creates a reader for accessing custom resource objects directly from etcd.

func (*EtcdObjectReader) GetStoredCustomResource

func (s *EtcdObjectReader) GetStoredCustomResource(ns, name string) (*unstructured.Unstructured, error)

GetStoredCustomResource gets the storage representation of a custom resource from etcd.

func (*EtcdObjectReader) SetStoredCustomResource

func (s *EtcdObjectReader) SetStoredCustomResource(ns, name string, obj *unstructured.Unstructured) error

SetStoredCustomResource writes the storage representation of a custom resource to etcd.

func (*EtcdObjectReader) WaitForStorageVersion

func (s *EtcdObjectReader) WaitForStorageVersion(version string, ns, name string, timeout time.Duration, updateObjFn func()) error

WaitForStorageVersion calls the updateObjFn periodically and waits for the version of the custom resource stored in etcd to be set to the provided version. Typically updateObjFn should perform a noop update to the object so that when stored version of a CRD changes, the object is written at the updated storage version. If the timeout is exceeded a error is returned. This is useful when updating the stored version of an existing CRD because the update does not take effect immediately.