Documentation
¶
Overview ¶
Package synk contains functionality to synchronize a batch of resources with a cluster while correctly handling CRDs and deletions.
Index ¶
Constants ¶
const ( StatusSuccess = "success" StatusFailure = "failure" )
const AnnotationIgnore = "synk.cloudrobotics.com/ignore"
Annotation to opt-out of resource synchronization. If set to "true" on a resource in the cluster, Synk will not overwrite it with the chart version, but will still update its owner references so it does not get pruned.
Variables ¶
This section is empty.
Functions ¶
func IsTransientErr ¶
IsTransientErr returns true if the error may resolve by retrying the operation. It must not be called with a nil error.
Types ¶
type ApplyOptions ¶
type ApplyOptions struct {
// Namespace that's set for all namespaced resources that have no
// other namespace set yet.
Namespace string
// EnforceNamespace causes apply to fail if a resource has a namespace set
// that's different from Namespace.
EnforceNamespace bool
// Log functions to report progress and failures while applying resources.
Log func(r *unstructured.Unstructured, a apps.ResourceAction, status, msg string)
// contains filtered or unexported fields
}
TODO(freinartz): determine options that allow us to be semantically compatible with vanilla kubectl apply.
type Interface ¶
type Interface interface {
Init(ctx context.Context) error
Delete(ctx context.Context, name string) error
Apply(ctx context.Context, name string, opts *ApplyOptions, resources ...*unstructured.Unstructured) (*apps.ResourceSet, error)
}
type Synk ¶
type Synk struct {
// contains filtered or unexported fields
}
Synk allows to synchronize sets of resources with a fixed cluster.
func New ¶
func New(client dynamic.Interface, discovery discovery.CachedDiscoveryInterface) *Synk
New returns a new Synk object that acts against the cluster for the given configuration.
func (*Synk) Apply ¶
func (s *Synk) Apply( ctx context.Context, name string, opts *ApplyOptions, resources ...*unstructured.Unstructured, ) (*apps.ResourceSet, error)
Apply installs or updates the ResourceSet specified by 'name'.
func (*Synk) Delete ¶
Delete removes the resources that are part of the ResourceSet specified by 'name'. It uses so-called "foreground cascading deletion", which means that:
- it returns after marking the ResourceSet for deletion, but before the
resources have been deleted
- the ResourceSet will not be deleted until all resources have been deleted
This ensures that if a new ResourceSet is created before all resources have been deleted, it will have a higher version number.