Documentation
¶
Index ¶
- Constants
- Variables
- type ApplyOption
- type ApplyOptionFunc
- type ApplyOptions
- type ApplyResult
- type Client
- type DeleteOption
- type DeleteOptions
- type FakeClient
- type GVKParser
- type GracePeriodSeconds
- type InNamespace
- type ListOption
- type ListOptions
- type MatchingFields
- type MatchingLabels
- type MatchingLabelsSelector
- type MergeFromOption
- type Object
- type ObjectKey
- type ObjectList
- type Options
- type Preconditions
- type PropagationPolicy
- type SubResourceClient
- func (*SubResourceClient) Create(_ context.Context, _, _ client.Object, _ ...client.SubResourceCreateOption) error
- func (c SubResourceClient) Delete(_ context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (SubResourceClient) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error
- func (*SubResourceClient) Get(_ context.Context, _, _ client.Object, _ ...client.SubResourceGetOption) error
- func (c SubResourceClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)
- func (c SubResourceClient) GroupVersionResourceFor(obj runtime.Object) (schema.GroupVersionResource, error)
- func (c SubResourceClient) IsObjectNamespaced(obj runtime.Object) (bool, error)
- func (c SubResourceClient) List(_ context.Context, obj client.ObjectList, opts ...client.ListOption) error
- func (c SubResourceClient) ListReactionFunc(action *testing.ListActionImpl) (bool, runtime.Object, error)
- func (c SubResourceClient) ObjectReaction() testing.ReactionFunc
- func (*SubResourceClient) Patch(_ context.Context, _ client.Object, _ client.Patch, ...) error
- func (c SubResourceClient) PatchReactionFunc(action *testing.PatchActionImpl) (bool, runtime.Object, error)
- func (c SubResourceClient) RESTMapper() meta.RESTMapper
- func (c SubResourceClient) Scheme() *runtime.Scheme
- func (c SubResourceClient) Status() client.SubResourceWriter
- func (c SubResourceClient) SubResource(sub string) client.SubResourceClient
- func (c *SubResourceClient) Update(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error
- func (c SubResourceClient) Watch(_ context.Context, obj client.ObjectList, opts ...client.ListOption) (watch.Interface, error)
Constants ¶
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/
const (
DefaultFieldManager = "tidb-operator"
)
Variables ¶
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)
}
type DeleteOption ¶
type DeleteOption = client.DeleteOption
type FakeClient ¶
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 MatchingFields ¶
type MatchingFields = client.MatchingFields
type MatchingLabels ¶
type MatchingLabels = client.MatchingLabels
type MatchingLabelsSelector ¶
type MatchingLabelsSelector = client.MatchingLabelsSelector
type ObjectList ¶
type ObjectList = client.ObjectList
Add alias of client.XXX to avoid import two client pkgs
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) Create(_ context.Context, _, _ client.Object, _ ...client.SubResourceCreateOption) error
func (SubResourceClient) DeleteAllOf ¶
func (SubResourceClient) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error
TODO(liubo02): impl it
func (*SubResourceClient) Get ¶
func (*SubResourceClient) Get(_ context.Context, _, _ client.Object, _ ...client.SubResourceGetOption) error
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 ¶
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 (SubResourceClient) ObjectReaction ¶
func (c SubResourceClient) ObjectReaction() testing.ReactionFunc
func (*SubResourceClient) Patch ¶
func (*SubResourceClient) Patch(_ context.Context, _ client.Object, _ client.Patch, _ ...client.SubResourcePatchOption) error
func (SubResourceClient) PatchReactionFunc ¶
func (SubResourceClient) RESTMapper ¶
func (c SubResourceClient) RESTMapper() meta.RESTMapper
func (SubResourceClient) Status ¶
func (c SubResourceClient) Status() client.SubResourceWriter
func (SubResourceClient) SubResource ¶
func (c SubResourceClient) SubResource(sub string) client.SubResourceClient
func (*SubResourceClient) Update ¶
func (c *SubResourceClient) Update(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error