Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteNullInJson(jsonBytes []byte) ([]byte, map[string]interface{}, error)
- type Annotator
- func (a *Annotator) GetModifiedConfiguration(obj runtime.Object, annotate bool) ([]byte, error)
- func (a *Annotator) GetOriginalConfiguration(obj runtime.Object) ([]byte, error)
- func (a *Annotator) SetLastAppliedAnnotation(obj runtime.Object) error
- func (a *Annotator) SetOriginalConfiguration(obj runtime.Object, original []byte) error
- type BaseJSONMergePatcher
- type CalculateOption
- type JSONMergePatcher
- type K8sStrategicMergePatcher
- func (p *K8sStrategicMergePatcher) CreateThreeWayMergePatch(original, modified, current []byte, dataStruct interface{}) ([]byte, error)
- func (p *K8sStrategicMergePatcher) CreateTwoWayMergePatch(original, modified []byte, dataStruct interface{}) ([]byte, error)
- func (p *K8sStrategicMergePatcher) StrategicMergePatch(original, patch []byte, dataStruct interface{}) ([]byte, error)
- type Maker
- type PatchMaker
- type PatchResult
- type StrategicMergePatcher
Constants ¶
View Source
const LastAppliedConfig = "banzaicloud.com/last-applied"
Variables ¶
View Source
var DefaultAnnotator = NewAnnotator(LastAppliedConfig)
View Source
var DefaultPatchMaker = NewPatchMaker(DefaultAnnotator, &K8sStrategicMergePatcher{}, &BaseJSONMergePatcher{})
Functions ¶
Types ¶
type Annotator ¶
type Annotator struct {
// contains filtered or unexported fields
}
func NewAnnotator ¶
func (*Annotator) GetModifiedConfiguration ¶
GetModifiedConfiguration retrieves the modified configuration of the object. If annotate is true, it embeds the result as an annotation in the modified configuration. If an object was read from the command input, it will use that version of the object. Otherwise, it will use the version from the server.
func (*Annotator) GetOriginalConfiguration ¶
GetOriginalConfiguration retrieves the original configuration of the object from the annotation, or nil if no annotation was found.
func (*Annotator) SetLastAppliedAnnotation ¶
SetLastAppliedAnnotation gets the modified configuration of the object, without embedding it again, and then sets it on the object as the annotation.
type BaseJSONMergePatcher ¶
type BaseJSONMergePatcher struct{}
func (*BaseJSONMergePatcher) CreateMergePatch ¶
func (p *BaseJSONMergePatcher) CreateMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error)
func (*BaseJSONMergePatcher) CreateThreeWayJSONMergePatch ¶
func (p *BaseJSONMergePatcher) CreateThreeWayJSONMergePatch(original, modified, current []byte) ([]byte, error)
func (*BaseJSONMergePatcher) MergePatch ¶
func (p *BaseJSONMergePatcher) MergePatch(docData, patchData []byte) ([]byte, error)
type CalculateOption ¶
func IgnoreField ¶
func IgnoreField(field string) CalculateOption
func IgnoreStatusFields ¶
func IgnoreStatusFields() CalculateOption
func IgnoreVolumeClaimTemplateTypeMetaAndStatus ¶
func IgnoreVolumeClaimTemplateTypeMetaAndStatus() CalculateOption
type JSONMergePatcher ¶
type K8sStrategicMergePatcher ¶
type K8sStrategicMergePatcher struct {
PreconditionFuncs []mergepatch.PreconditionFunc
}
func (*K8sStrategicMergePatcher) CreateThreeWayMergePatch ¶
func (p *K8sStrategicMergePatcher) CreateThreeWayMergePatch(original, modified, current []byte, dataStruct interface{}) ([]byte, error)
func (*K8sStrategicMergePatcher) CreateTwoWayMergePatch ¶
func (p *K8sStrategicMergePatcher) CreateTwoWayMergePatch(original, modified []byte, dataStruct interface{}) ([]byte, error)
func (*K8sStrategicMergePatcher) StrategicMergePatch ¶
func (p *K8sStrategicMergePatcher) StrategicMergePatch(original, patch []byte, dataStruct interface{}) ([]byte, error)
type Maker ¶
type Maker interface {
Calculate(currentObject, modifiedObject runtime.Object, opts ...CalculateOption) (*PatchResult, error)
}
func NewPatchMaker ¶
func NewPatchMaker(annotator *Annotator, strategicMergePatcher StrategicMergePatcher, jsonMergePatcher JSONMergePatcher) Maker
type PatchMaker ¶
type PatchMaker struct {
// contains filtered or unexported fields
}
func (*PatchMaker) Calculate ¶
func (p *PatchMaker) Calculate(currentObject, modifiedObject runtime.Object, opts ...CalculateOption) (*PatchResult, error)
type PatchResult ¶
func (*PatchResult) IsEmpty ¶
func (p *PatchResult) IsEmpty() bool
func (*PatchResult) String ¶
func (p *PatchResult) String() string
type StrategicMergePatcher ¶
type StrategicMergePatcher interface { StrategicMergePatch(original, patch []byte, dataStruct interface{}) ([]byte, error) CreateTwoWayMergePatch(original, modified []byte, dataStruct interface{}) ([]byte, error) CreateThreeWayMergePatch(original, modified, current []byte, dataStruct interface{}) ([]byte, error) }
Click to show internal directories.
Click to hide internal directories.