Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Applier ¶
type Applier struct {
Kind Kind
Parent *Applier
ApplyDefaults ApplyDefaults
ErrorPolicy string
ResourceApplyOptions []client.PatchOption
ResourceDeleteOptions []client.DeleteOption
Resource *unstructured.Unstructured
Group []Applier
}
Applier represents a deeply nested structure of resources to apply or delete. Best used by unmarshalling from JSON.
applier := applygroup.Applier{
ApplyDefaults: applygroup.ApplyDefaults{FieldManagerFallback: "applier"},
}
err := json.Unmarshal([]byte(rendered), &applier)
func (*Applier) Apply ¶
Apply applies or deletes the resource(s) represented by this Applier using the given client. It returns an error if any operation fails. For groups, it respects the errorPolicy: "Abort" stops on the first error, "Continue" collects all errors.
func (*Applier) UnmarshalJSONFrom ¶
UnmarshalJSONFrom implements jsonv2.UnmarshalerFrom. It unmarshals a deeply nested structure of resources to apply or delete. The JSON can be: - null: represents a NoopKind - an object: represents a resource to apply or delete - an array: represents a group of resources to apply or delete
If the object is of kind ApplyGroupConfig, it is treated as a configuration for the group. It must not be the root element. If the array contains an ApplyGroupConfig, it must be the first element in the array. The errorPolicy is inherited by child groups and defaults to "Continue".
If the object has the special deletion options, it is treated as a resource to delete. Otherwise, it is treated as a resource to apply.
Example JSON:
[
null,
[
{
"apiVersion": "internal.espejote.io/v1",
"kind": "ApplyGroupConfig",
"spec": {
"errorPolicy": "Abort"
}
},
{
"apiVersion": "v1",
"kind": "ConfigMap"
},
{
"apiVersion": "v1",
"kind": "ConfigMap"
}
],
{
"apiVersion": "apps/v1",
"kind": "Deployment"
}
]
type ApplyDefaults ¶
type ApplyDefaults struct {
espejotev1alpha1.ApplyOptions
// FieldManagerFallback is the field manager to use if none is specified for the object.
FieldManagerFallback string
}
ApplyDefaults holds the default options for applying resources.