Documentation ¶
Index ¶
- Variables
- type ApplyOption
- type ApplyOptions
- type Client
- type DeleteOption
- type DeleteOptions
- type FieldManager
- type GracePeriodSeconds
- type IgnoreNotFound
- type Manifest
- func (m Manifest) Append(mfs ...Manifest) Manifest
- func (m Manifest) Apply(opts ...ApplyOption) error
- func (m Manifest) Delete(opts ...DeleteOption) error
- func (m Manifest) DryRun() ([]MergePatch, error)
- func (m Manifest) Filter(preds ...Predicate) Manifest
- func (m Manifest) Resources() []unstructured.Unstructured
- func (m Manifest) Transform(fns ...Transformer) (Manifest, error)
- type Manifestival
- type MergePatch
- type Option
- type Overwrite
- type Owner
- type Path
- type Preconditions
- type Predicate
- func All(preds ...Predicate) Predicate
- func Any(preds ...Predicate) Predicate
- func ByAnnotation(annotation, value string) Predicate
- func ByGVK(gvk schema.GroupVersionKind) Predicate
- func ByKind(kind string) Predicate
- func ByLabel(label, value string) Predicate
- func ByLabels(labels map[string]string) Predicate
- func ByName(name string) Predicate
- func In(manifest Manifest) Predicate
- func Not(pred Predicate) Predicate
- type PropagationPolicy
- type Recursive
- type Slice
- type Source
- type Transformer
Constants ¶
This section is empty.
Variables ¶
var ( Everything = All() Nothing = Any() )
var CRDs = ByKind("CustomResourceDefinition")
CRDs returns only CustomResourceDefinitions
var DryRunAll = dryRunAll{}
Indicates that changes should not be persisted
var NoCRDs = Not(CRDs)
NoCRDs returns no CustomResourceDefinitions
Functions ¶
This section is empty.
Types ¶
type ApplyOption ¶ added in v0.2.0
type ApplyOption interface {
ApplyWith(*ApplyOptions)
}
Functional options pattern
type ApplyOptions ¶ added in v0.2.0
type ApplyOptions struct { ForCreate *metav1.CreateOptions ForUpdate *metav1.UpdateOptions Overwrite bool }
func ApplyWith ¶ added in v0.2.0
func ApplyWith(options []ApplyOption) *ApplyOptions
type Client ¶ added in v0.1.0
type Client interface { Create(obj *unstructured.Unstructured, options ...ApplyOption) error Update(obj *unstructured.Unstructured, options ...ApplyOption) error Delete(obj *unstructured.Unstructured, options ...DeleteOption) error Get(obj *unstructured.Unstructured) (*unstructured.Unstructured, error) }
Client includes the operations required by the Manifestival interface
type DeleteOption ¶ added in v0.2.0
type DeleteOption interface {
DeleteWith(*DeleteOptions)
}
type DeleteOptions ¶ added in v0.2.0
type DeleteOptions struct { ForDelete *metav1.DeleteOptions IgnoreNotFound bool // default to true in DeleteWith() }
func DeleteWith ¶ added in v0.2.0
func DeleteWith(options []DeleteOption) *DeleteOptions
type FieldManager ¶ added in v0.1.0
type FieldManager string
FieldManager is the name of the actor applying changes
func (FieldManager) ApplyWith ¶ added in v0.2.0
func (f FieldManager) ApplyWith(opts *ApplyOptions)
type GracePeriodSeconds ¶ added in v0.1.0
type GracePeriodSeconds int64
The duration in seconds before the object should be deleted
func (GracePeriodSeconds) DeleteWith ¶ added in v0.2.0
func (g GracePeriodSeconds) DeleteWith(opts *DeleteOptions)
type IgnoreNotFound ¶ added in v0.2.0
type IgnoreNotFound bool
Whether to error when deleting a non-existent resource [true]
func (IgnoreNotFound) DeleteWith ¶ added in v0.2.0
func (i IgnoreNotFound) DeleteWith(opts *DeleteOptions)
type Manifest ¶
type Manifest struct { Client Client // contains filtered or unexported fields }
Manifest tracks a set of concrete resources which should be managed as a group using a Kubernetes client
func ManifestFrom ¶ added in v0.2.0
ManifestFrom creates a Manifest from any Source implementation
func NewManifest ¶
NewManifest creates a Manifest from a comma-separated set of YAML files, directories, or URLs. It's equivalent to `ManifestFrom(Path(pathname))`
func (Manifest) Append ¶ added in v0.6.0
Append creates a new Manifest by appending the resources from other Manifests onto this one. No equality checking is done, so for any resources sharing the same GVK+name, the last one will "win".
func (Manifest) Apply ¶
func (m Manifest) Apply(opts ...ApplyOption) error
Apply updates or creates all resources in the manifest.
func (Manifest) Delete ¶
func (m Manifest) Delete(opts ...DeleteOption) error
Delete removes all resources in the Manifest
func (Manifest) DryRun ¶ added in v0.4.0
func (m Manifest) DryRun() ([]MergePatch, error)
DryRun returns a list of merge patches, either strategic or RFC-7386 for unregistered types, that show the effects of applying the manifest.
func (Manifest) Filter ¶ added in v0.2.0
Filter returns a Manifest containing only those resources for which *no* Predicate returns false. Any changes callers make to the resources passed to their Predicate[s] will only be reflected in the returned Manifest.
func (Manifest) Resources ¶
func (m Manifest) Resources() []unstructured.Unstructured
Resources returns a deep copy of the Manifest resources
type Manifestival ¶
type Manifestival interface { // Either updates or creates all resources in the manifest Apply(opts ...ApplyOption) error // Deletes all resources in the manifest Delete(opts ...DeleteOption) error // Transforms the resources within a Manifest Transform(fns ...Transformer) (Manifest, error) // Filters resources in a Manifest; Predicates are AND'd Filter(fns ...Predicate) Manifest // Append the resources from other Manifests to create a new one Append(mfs ...Manifest) Manifest // Show how applying the manifest would change the cluster DryRun() ([]MergePatch, error) }
Manifestival defines the operations allowed on a set of Kubernetes resources (typically, a set of YAML files, aka a manifest)
type MergePatch ¶ added in v0.4.0
type MergePatch map[string]interface{}
type Option ¶ added in v0.1.0
type Option func(*Manifest)
Option follows the "functional object" idiom
type Overwrite ¶ added in v0.5.0
type Overwrite bool
Resolve conflicts by using values from the manifest values
func (Overwrite) ApplyWith ¶ added in v0.5.0
func (i Overwrite) ApplyWith(opts *ApplyOptions)
type Owner ¶
type Owner interface { v1.Object schema.ObjectKind }
Owner is a partial Kubernetes metadata schema.
type Path ¶ added in v0.2.0
type Path string
Path is a Source represented as a comma-delimited list of files, directories, and URL's
func (Path) Parse ¶ added in v0.2.0
func (p Path) Parse() ([]unstructured.Unstructured, error)
type Preconditions ¶ added in v0.1.0
type Preconditions metav1.Preconditions
Must be fulfilled before a deletion is carried out
func (Preconditions) DeleteWith ¶ added in v0.2.0
func (p Preconditions) DeleteWith(opts *DeleteOptions)
type Predicate ¶ added in v0.2.0
type Predicate func(u *unstructured.Unstructured) bool
Predicate returns true if u should be included in result
func All ¶ added in v0.3.0
All returns a predicate that returns true unless any of its passed predicates return false.
func Any ¶ added in v0.3.0
Any returns a predicate that returns false unless any of its passed predicates return true.
func ByAnnotation ¶ added in v0.6.0
ByAnnotation returns resources that contain a particular annotation and value. A value of "" denotes *ANY* value
func ByGVK ¶ added in v0.2.0
func ByGVK(gvk schema.GroupVersionKind) Predicate
ByGVK returns resources of a particular GroupVersionKind
func ByLabel ¶ added in v0.2.0
ByLabel returns resources that contain a particular label and value. A value of "" denotes *ANY* value
type PropagationPolicy ¶ added in v0.1.0
type PropagationPolicy metav1.DeletionPropagation
Whether and how garbage collection will be performed.
func (PropagationPolicy) DeleteWith ¶ added in v0.2.0
func (p PropagationPolicy) DeleteWith(opts *DeleteOptions)
type Recursive ¶ added in v0.1.0
type Recursive string
Recursive is identical to Path, but dirs are searched recursively
func (Recursive) Parse ¶ added in v0.2.0
func (r Recursive) Parse() ([]unstructured.Unstructured, error)
type Slice ¶ added in v0.2.0
type Slice []unstructured.Unstructured
Slice is a Source comprised of existing objects
func (Slice) Parse ¶ added in v0.2.0
func (s Slice) Parse() ([]unstructured.Unstructured, error)
type Source ¶ added in v0.2.0
type Source interface {
Parse() ([]unstructured.Unstructured, error)
}
Source is the interface through which all Manifests are created.
type Transformer ¶
type Transformer func(u *unstructured.Unstructured) error
Transformer transforms a resource from the manifest in place.
func InjectNamespace ¶
func InjectNamespace(ns string) Transformer
InjectNamespace creates a Transformer which adds a namespace to existing resources if appropriate. We assume all resources in the manifest live in the same namespace.
func InjectOwner ¶
func InjectOwner(owner Owner) Transformer
InjectOwner creates a Transformer which adds an OwnerReference pointing to `owner`