Documentation
¶
Index ¶
- func DeleteAnnotation(o Object, key string)
- func GetAnnotation(o Object, key string) (string, bool)
- func IsInvalidConfig(err error) bool
- func ObjectKey(o Object) client.ObjectKey
- func SetAnnotation(o Object, key, val string)
- type Config
- type Object
- type Service
- func (s *Service) EnsureCreated(ctx context.Context, hashAnnotation string, desired Object) error
- func (s *Service) EnsureDeleted(ctx context.Context, obj Object) error
- func (s *Service) GroupVersionKind(o Object) (schema.GroupVersionKind, error)
- func (s *Service) Kind(o Object) string
- func (s *Service) Modify(ctx context.Context, key client.ObjectKey, obj Object, modifyFunc func() error, ...) error
- func (s *Service) ModifyStatus(ctx context.Context, key client.ObjectKey, obj Object, modifyFunc func() error, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteAnnotation ¶
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
func SetAnnotation ¶
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) EnsureCreated ¶
func (*Service) EnsureDeleted ¶ added in v0.2.4
func (*Service) GroupVersionKind ¶
func (s *Service) GroupVersionKind(o Object) (schema.GroupVersionKind, error)
func (*Service) Kind ¶ added in v0.2.4
Kind is a best effort approach to extract object kind. It should serve only logging purposes.
func (*Service) Modify ¶
func (s *Service) Modify(ctx context.Context, key client.ObjectKey, obj Object, modifyFunc func() error, backOff backoff.BackOff) error
Modify gets the object for the given key. It sets the most recent version of the object to provided obj pointer and calls modifyFunc which is supposed to apply changes to the pointer.
- The modifyFunc is called on every try.
- The obj variable is reset and populated before every try.
- There are no retries if the object defined by the key does not exist.
Example usage:
key := client.ObjectKey{Namespace: "giantswarm", Name: "my-operator"} current := &v1alpha1.App{} modifyFunc := func() error { current.Spec.Version = "2.0.0" return nil } err := h.resource.Modify(ctx, key, current, modifyFunc, nil) if err != nil { ... }
Click to show internal directories.
Click to hide internal directories.