Documentation ¶
Overview ¶
Deprecated: Use github.com/stolostron/applier/pkg/applier project
Index ¶
- type Applier
- func (a *Applier) Create(u *unstructured.Unstructured) error
- func (a *Applier) CreateInPath(path string, excluded []string, recursive bool, values interface{}) error
- func (a *Applier) CreateOrUpdate(u *unstructured.Unstructured) error
- func (a *Applier) CreateOrUpdateInPath(path string, excluded []string, recursive bool, values interface{}) error
- func (a *Applier) CreateOrUpdateResource(assetName string, values interface{}) error
- func (a *Applier) CreateOrUpdateResources(assetNames []string, values interface{}) error
- func (a *Applier) CreateOrUpdates(us []*unstructured.Unstructured) error
- func (a *Applier) CreateResource(assetName string, values interface{}) error
- func (a *Applier) CreateResources(assetNames []string, values interface{}) error
- func (a *Applier) Creates(us []*unstructured.Unstructured) error
- func (a *Applier) Delete(u *unstructured.Unstructured) error
- func (a *Applier) DeleteInPath(path string, excluded []string, recursive bool, values interface{}) error
- func (a *Applier) DeleteResource(assetName string, values interface{}) error
- func (a *Applier) DeleteResources(assetNames []string, values interface{}) error
- func (a *Applier) Deletes(us []*unstructured.Unstructured) error
- func (a *Applier) Update(u *unstructured.Unstructured) error
- func (a *Applier) UpdateInPath(path string, excluded []string, recursive bool, values interface{}) error
- func (a *Applier) UpdateResource(assetName string, values interface{}) error
- func (a *Applier) UpdateResources(assetNames []string, values interface{}) error
- func (a *Applier) Updates(us []*unstructured.Unstructured) error
- type Merger
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Applier ¶
type Applier struct {
// contains filtered or unexported fields
}
Applier structure to access kubernetes through the applier
func NewApplier ¶
func NewApplier( templateReader templateprocessor.TemplateReader, templateProcessorOptions *templateprocessor.Options, client client.Client, owner metav1.Object, scheme *runtime.Scheme, merger Merger, applierOptions *Options, ) (*Applier, error)
NewApplier creates a new client to access kubernetes through the applier. applier: An applier client: The client-go client to use when applying the resources. owner: The object owner for the setControllerReference, the reference is not if nil. scheme: The object scheme for the setControllerReference, the reference is not if nil. merger: The function implementing the way how the resources must be merged
func (*Applier) Create ¶
func (a *Applier) Create( u *unstructured.Unstructured, ) error
Create creates an unstructured object.
func (*Applier) CreateInPath ¶
func (a *Applier) CreateInPath( path string, excluded []string, recursive bool, values interface{}, ) error
CreateInPath creates the assets found in the path and subpath if recursive is set to true. path: The path were the yaml to apply is located excludes: The list of yamls to exclude recursive: If true all yamls in the path directory and sub-directories will be applied it excludes the assets named in the excluded array it sets the Controller reference if owner and scheme are not nil
func (*Applier) CreateOrUpdate ¶
func (a *Applier) CreateOrUpdate( u *unstructured.Unstructured, ) error
CreateOrUpdate creates or updates an unstructured object. It will returns an error if it failed and also if it needs to update the object and the applier.Merger is not defined.
func (*Applier) CreateOrUpdateInPath ¶
func (a *Applier) CreateOrUpdateInPath( path string, excluded []string, recursive bool, values interface{}, ) error
CreateOrUpdateInPath creates or updates the assets found in the path and subpath if recursive is set to true. path: The path were the yaml to apply is located excludes: The list of yamls to exclude recursive: If true all yamls in the path directory and sub-directories will be applied it excludes the assets named in the excluded array it sets the Controller reference if owner and scheme are not nil
func (*Applier) CreateOrUpdateResource ¶
CreateorUpdateAsset create or updates an asset
func (*Applier) CreateOrUpdateResources ¶
CreateOrUpdateResources creates or update resources given an array of resources name
func (*Applier) CreateOrUpdates ¶
func (a *Applier) CreateOrUpdates( us []*unstructured.Unstructured, ) error
CreateOrUpdates an array of unstructured.Unstructured
func (*Applier) CreateResource ¶
CreateResource create an asset
func (*Applier) CreateResources ¶
CreateResources creates resources given an array of resources name
func (*Applier) Creates ¶
func (a *Applier) Creates( us []*unstructured.Unstructured, ) error
Creates create resources from an array of unstructured.Unstructured
func (*Applier) Delete ¶
func (a *Applier) Delete( u *unstructured.Unstructured, ) error
Delete deletes an unstructured object.
func (*Applier) DeleteInPath ¶
func (a *Applier) DeleteInPath( path string, excluded []string, recursive bool, values interface{}, ) error
DeleteInPath delete the assets found in the path and subpath if recursive is set to true. path: The path were the yaml to apply is located excludes: The list of yamls to exclude recursive: If true all yamls in the path directory and sub-directories will be applied it excludes the assets named in the excluded array it sets the Controller reference if owner and scheme are not nil
func (*Applier) DeleteResource ¶
DeleteResource delete an resource
func (*Applier) DeleteResources ¶
DeleteResources deletes resources given an array of resources name
func (*Applier) Deletes ¶
func (a *Applier) Deletes( us []*unstructured.Unstructured, ) error
Delete deletes resources from an array of unstructured.Unstructured
func (*Applier) Update ¶
func (a *Applier) Update( u *unstructured.Unstructured, ) error
Update updates an unstructured object. It will returns an error if it failed and also if it needs to update the object and the applier.Merger is not defined.
func (*Applier) UpdateInPath ¶
func (a *Applier) UpdateInPath( path string, excluded []string, recursive bool, values interface{}, ) error
UpdateInPath creates or updates the assets found in the path and subpath if recursive is set to true. path: The path were the yaml to apply is located excludes: The list of yamls to exclude recursive: If true all yamls in the path directory and sub-directories will be applied it excludes the assets named in the excluded array it sets the Controller reference if owner and scheme are not nil
func (*Applier) UpdateResource ¶
UpdateResource updates an asset
func (*Applier) UpdateResources ¶
UpdateResources update resources given an array of resources name
func (*Applier) Updates ¶
func (a *Applier) Updates( us []*unstructured.Unstructured, ) error
Updates updates resources from an array of unstructured.Unstructured
type Merger ¶
type Merger func(current, new *unstructured.Unstructured, ) ( future *unstructured.Unstructured, update bool, )
Merger merges the `current` and the `want` resources into one resource which will be use for to update. If `update` is true than the update will be executed.
var DefaultKubernetesMerger Merger = func(current, new *unstructured.Unstructured, ) ( future *unstructured.Unstructured, update bool, ) { for _, r := range rootAttributes { if newValue, ok := new.Object[r]; ok { if !reflect.DeepEqual(newValue, current.Object[r]) { update = true current.Object[r] = newValue } } else { if _, ok := current.Object[r]; ok { current.Object[r] = nil } } } return current, update }
DefaultKubernetesMerger merges kubernetes runtime.Object It merges the spec, rules, roleRef, subjects root attribute of a runtime.Object For example a CLusterRoleBinding has a subjects and roleRef fields and so the old subjects and roleRef fields from the ClusterRoleBinding will be replaced by the new values.
type Options ¶
type Options struct { //The option used when a resource is created ClientCreateOption []client.CreateOption //The option used when a resource is updated ClientUpdateOption []client.UpdateOption //The option used when a resource is deleted ClientDeleteOption []client.DeleteOption //Defines the parameters for retrying a transaction if it fails. Backoff *wait.Backoff //If true, the client will be set for dryrun DryRun bool //If true, the finalizers will be removed after deletion. ForceDelete bool }
Options defines for the available options for the applier