Documentation
¶
Index ¶
- func ApplyPatches(ctx context.Context, c client.Client, obj client.Object, patches []JSONPatch, ...) (err error)
- func CreateOrUpdate(ctx context.Context, c client.Client, obj *unstructured.Unstructured, ...) error
- func EscapeJSONPointer(s string) string
- func JSONPatchesToJSONPatchOperation(patches []JSONPatch) []jsonpatch.JsonPatchOperation
- func JSONPatchesToRawPatch(patches []JSONPatch) (patch []byte, err error)
- func JsonPointerDelete(obj map[string]any, p string) error
- func JsonPointerGet(obj map[string]any, p string) (any, bool)
- func JsonPointerSet(obj map[string]any, p string, val any) error
- func LastApplyTimeForManager(obj *unstructured.Unstructured, manager string) *metav1.Time
- func MatchIgnorePaths(rules []IgnoreRule, obj *unstructured.Unstructured) []string
- func PatchApply(ctx context.Context, c client.Client, obj client.Object, fieldOwner string, ...) error
- func PreserveIgnoredPaths(desired, live map[string]any, ptrs []string)
- type IgnoreRule
- type JSONPatch
- func AddAnnotationsPatch(annotations map[string]string, keys map[string]string) []JSONPatch
- func AddLabelsPatch(labels map[string]string, keys map[string]string) []JSONPatch
- func AddOwnerReferencePatch(ownerrefs []metav1.OwnerReference, ownerreference *metav1.OwnerReference) []JSONPatch
- func PatchRemoveAnnotations(annotations map[string]string, keys []string) []JSONPatch
- func PatchRemoveLabels(labels map[string]string, keys []string) []JSONPatch
- func RemoveOwnerReferencePatch(ownerRefs []metav1.OwnerReference, toRemove *metav1.OwnerReference) []JSONPatch
- type JSONPatchOperation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyPatches ¶
func CreateOrUpdate ¶
func CreateOrUpdate( ctx context.Context, c client.Client, obj *unstructured.Unstructured, labels, annotations map[string]string, ignore []IgnoreRule, ) error
CreateOrUpdate Implementation with optional IgnoreRules.
func EscapeJSONPointer ¶
func JSONPatchesToJSONPatchOperation ¶
func JSONPatchesToJSONPatchOperation( patches []JSONPatch, ) []jsonpatch.JsonPatchOperation
func JSONPatchesToRawPatch ¶
func JsonPointerGet ¶
jsonPointerGet returns (value, true) if JSON pointer p exists.
func LastApplyTimeForManager ¶
func LastApplyTimeForManager(obj *unstructured.Unstructured, manager string) *metav1.Time
Returns timestamp of last apply for a manager.
func MatchIgnorePaths ¶
func MatchIgnorePaths(rules []IgnoreRule, obj *unstructured.Unstructured) []string
func PatchApply ¶
func PreserveIgnoredPaths ¶
Types ¶
type IgnoreRule ¶
type IgnoreRule struct {
// Paths is a list of JSON Pointer (RFC 6901) paths to be excluded from
// consideration in a Kubernetes object.
// +required
Paths []string `json:"paths"`
// Target is a selector for specifying Kubernetes objects to which this
// rule applies.
// If Target is not set, the Paths will be ignored for all Kubernetes
// objects within the manifest of the Helm release.
// +optional
Target *kustomize.Selector `json:"target,omitempty"`
}
+kubebuilder:object:generate=true
func (*IgnoreRule) DeepCopy ¶
func (in *IgnoreRule) DeepCopy() *IgnoreRule
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IgnoreRule.
func (*IgnoreRule) DeepCopyInto ¶
func (in *IgnoreRule) DeepCopyInto(out *IgnoreRule)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*IgnoreRule) Matches ¶
func (i *IgnoreRule) Matches(obj *unstructured.Unstructured) bool
type JSONPatch ¶
type JSONPatch struct {
Operation JSONPatchOperation `json:"op"`
Path string `json:"path"`
Value any `json:"value,omitempty"`
}
func AddAnnotationsPatch ¶
func AddLabelsPatch ¶
func AddOwnerReferencePatch ¶
func AddOwnerReferencePatch( ownerrefs []metav1.OwnerReference, ownerreference *metav1.OwnerReference, ) []JSONPatch
func PatchRemoveAnnotations ¶
PatchRemoveAnnotations returns a JSONPatch array for removing annotations with matching keys.
func PatchRemoveLabels ¶
PatchRemoveLabels returns a JSONPatch array for removing labels with matching keys.
func RemoveOwnerReferencePatch ¶
func RemoveOwnerReferencePatch( ownerRefs []metav1.OwnerReference, toRemove *metav1.OwnerReference, ) []JSONPatch
type JSONPatchOperation ¶
type JSONPatchOperation string
const ( JSONPatchAdd JSONPatchOperation = "add" JSONPatchReplace JSONPatchOperation = "replace" JSONPatchRemove JSONPatchOperation = "remove" )
func (JSONPatchOperation) String ¶
func (j JSONPatchOperation) String() string
Click to show internal directories.
Click to hide internal directories.