configmapresource

package
v7.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsWrongTypeError

func IsWrongTypeError(err error) bool

IsWrongTypeError asserts wrongTypeError.

Types

type Config

type Config struct {
	K8sClient   kubernetes.Interface
	Logger      micrologger.Logger
	StateGetter StateGetter

	AllowedLabels []string
	Name          string
}

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Resource, error)

func (*Resource) ApplyCreateChange

func (r *Resource) ApplyCreateChange(ctx context.Context, obj, createChange interface{}) error

ApplyCreateChange ensures the ConfigMap is created in the k8s api.

func (*Resource) ApplyDeleteChange

func (r *Resource) ApplyDeleteChange(ctx context.Context, obj, deleteChange interface{}) error

func (*Resource) ApplyUpdateChange

func (r *Resource) ApplyUpdateChange(ctx context.Context, obj, updateChange interface{}) error

func (*Resource) GetCurrentState

func (r *Resource) GetCurrentState(ctx context.Context, obj interface{}) (interface{}, error)

func (*Resource) GetDesiredState

func (r *Resource) GetDesiredState(ctx context.Context, obj interface{}) (interface{}, error)

func (*Resource) Name

func (r *Resource) Name() string

func (*Resource) NewDeletePatch

func (r *Resource) NewDeletePatch(ctx context.Context, obj, currentState, desiredState interface{}) (*crud.Patch, error)

func (*Resource) NewUpdatePatch

func (r *Resource) NewUpdatePatch(ctx context.Context, obj, currentState, desiredState interface{}) (*crud.Patch, error)

type StateGetter

type StateGetter interface {
	// GetCurrentState returns a current state of the system for the given
	// incarnation of the observed Kubernetes object. The state consists of
	// multiple objects but it is fine to return a slice of single object
	// if only one object is managed by this resource.
	GetCurrentState(ctx context.Context, obj interface{}) ([]*corev1.ConfigMap, error)
	// GetDesiredState returns a desired state of the system for the given
	// incarnation of the observed Kubernetes object. The state consists of
	// multiple objects but it is fine to return a slice of single object
	// if only one object is managed by this resource.
	//
	// NOTE: This state may be different if the observed object is
	// created/updated or deleted. Deletion timestamp can be checked to
	// figure if the object is scheduled for deletion.
	GetDesiredState(ctx context.Context, obj interface{}) ([]*corev1.ConfigMap, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL