Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
Types ¶
type Config ¶
type Config struct {
// ClientFunc is a function that takes a namespace and returns a Kubernetes
// client for resources of the specific kind in that namespace.
ClientFunc func(string) Interface
// Logger to use for logging.
Logger micrologger.Logger
// Name of the resource handler.
// Note this is not the same thing as name of the resource.
Name string
// GetObjectMeta is a function that takes a resource object, casts it to
// appropriate type and returns the metadata of that object, i.e. its
// metav1.ObjectMeta part (name, namespace, labels, annotations, etc.).
GetObjectMeta func(interface{}) (metav1.ObjectMeta, error)
// GetDesiredObject is a function that takes a resource object and returns the
// object populated with the desired state.
GetDesiredObject func(interface{}) (metav1.Object, error)
// HasChangedFunc is a function that takes two copies of an object - first
// with existing state in the cluster and second with the desired state for
// the given resource and returns true if there is a difference between
// them and therefore state needs to be reconciled to match the desired.
HasChangedFunc func(metav1.Object, metav1.Object) bool
}
Config contains dependencies for Resource struct.
type Interface ¶
type Interface interface {
Create(ctx context.Context, object metav1.Object, options metav1.CreateOptions) (metav1.Object, error)
Update(ctx context.Context, object metav1.Object, options metav1.UpdateOptions) (metav1.Object, error)
Get(ctx context.Context, name string, options metav1.GetOptions) (metav1.Object, error)
Delete(ctx context.Context, name string, options *metav1.DeleteOptions) error
}
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func (*Resource) EnsureCreated ¶
func (*Resource) EnsureDeleted ¶
Click to show internal directories.
Click to hide internal directories.