Documentation ¶
Index ¶
- Constants
- func IsInvalidConfig(err error) bool
- func IsWrongTypeError(err error) bool
- type Config
- type Resource
- func (r *Resource) ApplyCreateChange(ctx context.Context, obj, createChange interface{}) error
- func (r *Resource) ApplyDeleteChange(ctx context.Context, obj, deleteChange interface{}) error
- func (r *Resource) ApplyUpdateChange(ctx context.Context, obj, updateChange interface{}) error
- func (r *Resource) GetCurrentState(ctx context.Context, obj interface{}) (interface{}, error)
- func (r *Resource) GetDesiredState(ctx context.Context, obj interface{}) (interface{}, error)
- func (r *Resource) Name() string
- func (r *Resource) NewDeletePatch(ctx context.Context, obj, currentState, desiredState interface{}) (*crud.Patch, error)
- func (r *Resource) NewUpdatePatch(ctx context.Context, obj, currentState, desiredState interface{}) (*crud.Patch, error)
Constants ¶
const ( // AESCBCKeyLength represent the 32bytes length for AES-CBC with PKCS#7 // padding encryption key. AESCBCKeyLength = 32 )
const (
// Name is the identifier of the resource.
Name = "encryptionkey"
)
Variables ¶
This section is empty.
Functions ¶
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
func IsWrongTypeError ¶
IsWrongTypeError asserts wrongTypeError.
Types ¶
type Config ¶
type Config struct { K8sClient kubernetes.Interface Logger micrologger.Logger ToClusterGuestConfigFunc func(obj interface{}) (v1alpha1.ClusterGuestConfig, error) ToClusterObjectMetaFunc func(obj interface{}) (apismetav1.ObjectMeta, error) }
Config represents the configuration used to create a new cloud config resource.
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource implements the cloud config resource.
func (*Resource) ApplyCreateChange ¶
ApplyCreateChange takes observed custom object and create portion of the Patch provided by NewUpdatePatch or NewDeletePatch. It creates k8s secret for encryption key if needed.
func (*Resource) ApplyDeleteChange ¶
ApplyDeleteChange takes observed custom object and delete portion of the Patch provided by NewUpdatePatch and NewDeletePatch. It deletes k8s secret for related encryption key if needed.
func (*Resource) ApplyUpdateChange ¶
ApplyUpdateChange takes observed custom object and update portion of the Patch provided by NewUpdatePatch or NewDeletePatch. This is currently a NOP for encryptionkey Resource.
func (*Resource) GetCurrentState ¶
GetCurrentState takes observed custom object as an input and based on that information looks for current state of cluster encryption key secret and returns it. Return value is of type *v1.Secret.
func (*Resource) GetDesiredState ¶
GetDesiredState takes observed (during create, delete and update events) custom object as an input and returns computed desired state for it.
func (*Resource) NewDeletePatch ¶
func (r *Resource) NewDeletePatch(ctx context.Context, obj, currentState, desiredState interface{}) (*crud.Patch, error)
NewDeletePatch is called upon observed custom object deletion. It receives the deleted custom object, the current state as provided by GetCurrentState and the desired state as provided by GetDesiredState. NewDeletePatch analyses the current and desired state and returns the patch to be applied by Create, Delete, and Update functions.