client

package
v2.1.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const AnnoKeyIgnoreDiff = "pingcap.com/ignore-diff"

AnnoKeyIgnoreDiff defines the fields list to ignore difference which may be produced by mutating webhook. Fields are separated by comma. Example: "spec.xxx,spec.yyy" It may be deprecated after mutating admission policy is enabled by default. We can easily create a mutating admission policy to fix mutating webhooks which don't handle the "server-side apply" properly. See https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/

View Source
const (
	DefaultFieldManager = "tidb-operator"
)

Variables

View Source
var (
	ObjectKeyFromObject = client.ObjectKeyFromObject
	IgnoreNotFound      = client.IgnoreNotFound
	RawPatch            = client.RawPatch
	WithSubResourceBody = client.WithSubResourceBody
	MergeFrom           = client.MergeFrom
)

Functions

This section is empty.

Types

type ApplyOption

type ApplyOption interface {
	With(opts *ApplyOptions)
}

func Immutable

func Immutable(fields ...string) ApplyOption

type ApplyOptionFunc

type ApplyOptionFunc func(opts *ApplyOptions)

func (ApplyOptionFunc) With

func (f ApplyOptionFunc) With(opts *ApplyOptions)

type ApplyOptions

type ApplyOptions struct {
	// Immutable defines fields which is immutable
	// It's only for some fields which cannot be changed but actually maybe changed.
	// For example,
	// - Storage class ref can be changed in instance CR to modify volumes
	//   if feature VolumeAttributesClass is not enabled(just like v1).
	//   However, it's immutable in PVC. When VolumeAttributesClass is enabled,
	//   storage class should not be applied to PVC.
	// - The immutable field is changed when creation by the webhook.
	// NOTE: now slice/array is not supported
	Immutable [][]string
}

func NewApplyOptions

func NewApplyOptions(obj client.Object) *ApplyOptions

type ApplyResult

type ApplyResult int
const (
	ApplyResultUpdated ApplyResult = iota
	ApplyResultUnchanged
	ApplyResultCreated
)

func (ApplyResult) String

func (r ApplyResult) String() string

type Client

type Client interface {
	client.WithWatch
	Apply(ctx context.Context, obj client.Object, opts ...ApplyOption) error
	ApplyWithResult(ctx context.Context, obj client.Object, opts ...ApplyOption) (ApplyResult, error)
}

func New

func New(cfg *rest.Config, opts client.Options) (Client, error)

type DeleteOption

type DeleteOption = client.DeleteOption

type DeleteOptions

type DeleteOptions = client.DeleteOptions

DeleteOptions from client

type FakeClient

type FakeClient interface {
	Client
	WithError(verb, resource string, err error)
}

func NewFakeClient

func NewFakeClient(objs ...client.Object) FakeClient

type GVKParser

type GVKParser interface {
	Type(gvk schema.GroupVersionKind) *typed.ParseableType
}

func NewGVKParser

func NewGVKParser(gvs []schema.GroupVersion, paths map[string]openapi.GroupVersion) (GVKParser, error)

type GracePeriodSeconds

type GracePeriodSeconds = client.GracePeriodSeconds

type InNamespace

type InNamespace = client.InNamespace

type ListOption

type ListOption = client.ListOption

type ListOptions

type ListOptions = client.ListOptions

ListOptions from client

type MatchingFields

type MatchingFields = client.MatchingFields

type MatchingLabels

type MatchingLabels = client.MatchingLabels

type MatchingLabelsSelector

type MatchingLabelsSelector = client.MatchingLabelsSelector

type MergeFromOption

type MergeFromOption = client.MergeFromOption

MergeFromOption from client

type Object

type Object = client.Object

Add alias of client.XXX to avoid import two client pkgs

type ObjectKey

type ObjectKey = client.ObjectKey

Add alias of client.XXX to avoid import two client pkgs

type ObjectList

type ObjectList = client.ObjectList

Add alias of client.XXX to avoid import two client pkgs

type Options

type Options = client.Options

type Preconditions

type Preconditions = client.Preconditions

type PropagationPolicy

type PropagationPolicy = client.PropagationPolicy

type SubResourceClient

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

func (*SubResourceClient) Create

func (SubResourceClient) Delete

func (c SubResourceClient) Delete(_ context.Context, obj client.Object, opts ...client.DeleteOption) error

func (SubResourceClient) DeleteAllOf

func (SubResourceClient) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error

TODO(liubo02): impl it

func (*SubResourceClient) Get

func (SubResourceClient) GroupVersionKindFor

func (c SubResourceClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)

GroupVersionKindFor returns the GroupVersionKind for the given object.

func (SubResourceClient) GroupVersionResourceFor

func (c SubResourceClient) GroupVersionResourceFor(obj runtime.Object) (schema.GroupVersionResource, error)

func (SubResourceClient) IsObjectNamespaced

func (c SubResourceClient) IsObjectNamespaced(obj runtime.Object) (bool, error)

IsObjectNamespaced returns true if the GroupVersionKind of the object is namespaced.

func (SubResourceClient) List

func (c SubResourceClient) List(_ context.Context, obj client.ObjectList, opts ...client.ListOption) error

func (SubResourceClient) ListReactionFunc

func (c SubResourceClient) ListReactionFunc(action *testing.ListActionImpl) (bool, runtime.Object, error)

func (SubResourceClient) ObjectReaction

func (c SubResourceClient) ObjectReaction() testing.ReactionFunc

func (*SubResourceClient) Patch

func (SubResourceClient) PatchReactionFunc

func (c SubResourceClient) PatchReactionFunc(action *testing.PatchActionImpl) (bool, runtime.Object, error)

func (SubResourceClient) RESTMapper

func (c SubResourceClient) RESTMapper() meta.RESTMapper

func (SubResourceClient) Scheme

func (c SubResourceClient) Scheme() *runtime.Scheme

func (SubResourceClient) Status

func (c SubResourceClient) Status() client.SubResourceWriter

func (SubResourceClient) SubResource

func (c SubResourceClient) SubResource(sub string) client.SubResourceClient

func (*SubResourceClient) Update

func (SubResourceClient) Watch

func (c SubResourceClient) Watch(_ context.Context, obj client.ObjectList, opts ...client.ListOption) (watch.Interface, error)

Jump to

Keyboard shortcuts

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