Documentation
¶
Overview ¶
Package etcd provides a method for operators the data in etcd.
Index ¶
- Constants
- Variables
- func AddToScheme(scheme *runtime.Scheme)
- func Convert(inMediaType, outMediaType string, in []byte) (*runtime.TypeMeta, []byte, error)
- func DetectMediaType(in []byte) (string, error)
- func MediaTypeFromGVR(gvr schema.GroupVersionResource) (mediaType string, err error)
- func PatchMetaFromStruct(gvk schema.GroupVersionKind) (strategicpatch.LookupPatchMeta, error)
- func PrefixFromGVR(gvr schema.GroupVersionResource) (prefix string, err error)
- type Client
- type ClientConfig
- type KeyValue
- type LoadConfig
- type Loader
- type Op
- type OpOption
- type SaveConfig
- type Saver
Constants ¶
const ( StorageBinaryMediaType = "application/vnd.kubernetes.storagebinary" ProtobufMediaType = "application/vnd.kubernetes.protobuf" YAMLMediaType = "application/yaml" JSONMediaType = "application/json" )
Variables ¶
var ( Scheme = runtime.NewScheme() Codecs = serializer.NewCodecFactory(Scheme) )
var IgnoreKeys = map[string]struct{}{
"/ranges/serviceips": {},
"/ranges/servicenodeports": {},
"/masterleases/": {},
"/peerserverleases/": {},
}
var SpecialDefaultMediaTypes = map[string]struct{}{
"apiextensions.k8s.io": {},
"apiregistration.k8s.io": {},
}
var SpecialDefaultResourcePrefixes = map[schema.GroupResource]string{
{Group: "", Resource: "replicationcontrollers"}: "controllers",
{Group: "", Resource: "endpoints"}: "services/endpoints",
{Group: "", Resource: "services"}: "services/specs",
{Group: "", Resource: "nodes"}: "minions",
{Group: "extensions", Resource: "ingresses"}: "ingress",
{Group: "networking.k8s.io", Resource: "ingresses"}: "ingress",
}
SpecialDefaultResourcePrefixes are prefixes compiled into Kubernetes. see k8s.io/kubernetes/pkg/kubeapiserver/default_storage_factory_builder.go
Functions ¶
func AddToScheme ¶
AddToScheme adds all types of this clientset into the given scheme.
func DetectMediaType ¶
DetectMediaType detects the media type of the given data.
func MediaTypeFromGVR ¶
func MediaTypeFromGVR(gvr schema.GroupVersionResource) (mediaType string, err error)
MediaTypeFromGVR returns the media type of the given GroupVersionResource.
func PatchMetaFromStruct ¶
func PatchMetaFromStruct(gvk schema.GroupVersionKind) (strategicpatch.LookupPatchMeta, error)
PatchMetaFromStruct is a PatchMetaFromStruct implementation that uses strategicpatch.
func PrefixFromGVR ¶
func PrefixFromGVR(gvr schema.GroupVersionResource) (prefix string, err error)
PrefixFromGVR returns the prefix of the given GroupVersionResource.
Types ¶
type Client ¶
type Client interface { // Get is a method that retrieves a key-value pair from the etcd server. // It returns the revision of the key-value pair Get(ctx context.Context, prefix string, opOpts ...OpOption) (rev int64, err error) // Watch is a method that watches for changes to a key-value pair on the etcd server. Watch(ctx context.Context, prefix string, opOpts ...OpOption) error // Delete is a method that deletes a key-value pair from the etcd server. Delete(ctx context.Context, prefix string, opOpts ...OpOption) error // Put is a method that sets a key-value pair on the etcd server. Put(ctx context.Context, prefix string, value []byte, opOpts ...OpOption) error }
Client is an interface that defines the operations that can be performed on an etcd client.
func NewClient ¶
func NewClient(conf ClientConfig) (Client, error)
NewClient creates a new etcd client.
type ClientConfig ¶
type ClientConfig struct { // Endpoints is a list of URLs. Endpoints []string // TLS holds the client secure credentials, if any. TLS *tls.Config // Username is a user name for authentication. Username string // Password is a password for authentication. Password string }
ClientConfig is the etcd client config.
type LoadConfig ¶
LoadConfig is the combination of the impersonation config
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads the resources to cluster This way does not delete existing resources in the cluster, which will Handle the ownerReference so that the resources remain relative to each other
func NewLoader ¶
func NewLoader(loadConfig LoadConfig) (*Loader, error)
NewLoader creates a new snapshot Loader.
func (*Loader) AllowHandle ¶
func (l *Loader) AllowHandle(ctx context.Context) context.CancelFunc
AllowHandle allows the handle to be used
type Op ¶
type Op struct {
// contains filtered or unexported fields
}
Op is the option for the operation.
type OpOption ¶
type OpOption func(*Op)
OpOption is the option for the operation.
func WithGVR ¶
func WithGVR(gvr schema.GroupVersionResource) OpOption
WithGVR sets the gvr for the target.
func WithPageLimit ¶
WithPageLimit sets the page limit for the target.
func WithResponse ¶
WithResponse sets the response callback for the target.
func WithRevision ¶
WithRevision sets the revision for the target.
type SaveConfig ¶
SaveConfig is the combination of the impersonation config and the PagerConfig.