Documentation ¶
Index ¶
- Constants
- Variables
- func CreatePodAnnotations(req CapsuleRequest) map[string]string
- func EnvSources(refs []v1alpha2.EnvReference) []v1.EnvFromSource
- func FileToVolume(f v1alpha2.File) (v1.Volume, v1.VolumeMount)
- func FilesToVolumes(files []v1alpha2.File) ([]v1.Volume, []v1.VolumeMount)
- func IsOwnedBy(owner metav1.Object, obj metav1.Object) bool
- func ListConvert[T client.Object](objects []client.Object) ([]T, error)
- func ListExisting[T client.Object](r Request, obj T) ([]T, error)
- func ListNew[T client.Object](r Request, obj T) ([]T, error)
- func ObjectsEquals(o1, o2 client.Object, scheme *runtime.Scheme) (bool, error)
- type CapsulePipeline
- func (p *CapsulePipeline) AddStep(step Step[CapsuleRequest])
- func (p *CapsulePipeline) ComputeConfig(ctx context.Context, capsule *v1alpha2.Capsule, client client.Client) (PluginConfigResult, error)
- func (p *CapsulePipeline) DeleteCapsule(ctx context.Context, capsule *v1alpha2.Capsule, client client.Client, ...) (*Result, error)
- func (p *CapsulePipeline) RunCapsule(ctx context.Context, capsule *v1alpha2.Capsule, client client.Client, ...) (*Result, error)
- func (p *CapsulePipeline) Steps() []Step[CapsuleRequest]
- type CapsuleRequest
- type CapsuleRequestOption
- type Change
- type ExecutableRequest
- type Object
- type ObjectKey
- type ObjectStatusCallback
- type Options
- type OutputObject
- type PluginConfig
- type PluginConfigResult
- type ProjectEnvironmentRequest
- type Request
- type RequestBase
- func (r *RequestBase) Commit(ctx context.Context) (map[ObjectKey]*Change, error)
- func (r *RequestBase) Delete(gvk schema.GroupVersionKind, name string) error
- func (r *RequestBase) GetExisting(gvk schema.GroupVersionKind, name string) (client.Object, error)
- func (r *RequestBase) GetExistingInto(obj client.Object) error
- func (r *RequestBase) GetNew(gvk schema.GroupVersionKind, name string) (client.Object, error)
- func (r *RequestBase) GetNewInto(obj client.Object) error
- func (r *RequestBase) ListExisting(gvk schema.GroupVersionKind) ([]client.Object, error)
- func (r *RequestBase) ListNew(gvk schema.GroupVersionKind) ([]client.Object, error)
- func (r *RequestBase) PrepareRequest() *Result
- func (r *RequestBase) Reader() client.Reader
- func (r *RequestBase) Scheme() *runtime.Scheme
- func (r *RequestBase) Set(obj client.Object) error
- type RequestDeps
- type RequestState
- type RequestStrategies
- type ResourceState
- type Result
- type Step
- type StepConfigResult
Constants ¶
View Source
const ( LabelOwnedByCapsule = "rig.dev/owned-by-capsule" AnnotationOverrideOwnership = "rig.dev/override-ownership" AnnotationPullSecret = "rig.dev/pull-secret" LabelCapsule = "rig.dev/capsule" LabelCron = "batch.kubernets.io/cronjob" RigDevRolloutLabel = "rig.dev/rollout" RigDevInterfaceLabel = "rig.dev/interface" AnnotationChecksumFiles = "rig.dev/config-checksum-files" AnnotationChecksumAutoEnv = "rig.dev/config-checksum-auto-env" AnnotationChecksumEnv = "rig.dev/config-checksum-env" )
View Source
const (
LabelOwnedByProject = "rig.dev/owned-by-project"
)
Variables ¶
View Source
var AppsDeploymentGVK = appsv1.SchemeGroupVersion.WithKind("Deployment")
Functions ¶
func CreatePodAnnotations ¶
func CreatePodAnnotations(req CapsuleRequest) map[string]string
func EnvSources ¶
func EnvSources(refs []v1alpha2.EnvReference) []v1.EnvFromSource
func FileToVolume ¶
func FilesToVolumes ¶
Types ¶
type CapsulePipeline ¶
type CapsulePipeline struct {
// contains filtered or unexported fields
}
func NewCapsulePipeline ¶
func NewCapsulePipeline( config *configv1alpha1.OperatorConfig, scheme *runtime.Scheme, vm scheme.VersionMapper, logger logr.Logger, ) *CapsulePipeline
func (*CapsulePipeline) AddStep ¶
func (p *CapsulePipeline) AddStep(step Step[CapsuleRequest])
func (*CapsulePipeline) ComputeConfig ¶ added in v1.12.0
func (p *CapsulePipeline) ComputeConfig( ctx context.Context, capsule *v1alpha2.Capsule, client client.Client, ) (PluginConfigResult, error)
func (*CapsulePipeline) DeleteCapsule ¶
func (p *CapsulePipeline) DeleteCapsule( ctx context.Context, capsule *v1alpha2.Capsule, client client.Client, opts ...CapsuleRequestOption, ) (*Result, error)
func (*CapsulePipeline) RunCapsule ¶
func (p *CapsulePipeline) RunCapsule( ctx context.Context, capsule *v1alpha2.Capsule, client client.Client, opts ...CapsuleRequestOption, ) (*Result, error)
func (*CapsulePipeline) Steps ¶
func (p *CapsulePipeline) Steps() []Step[CapsuleRequest]
type CapsuleRequest ¶
type CapsuleRequest interface { Request // Capsule returns a deepcopy of the capsule object being reconciled. Capsule() *v1alpha2.Capsule // MarkUsedObject marks the object as used by the Capsule which will be present in the Capsule's Status MarkUsedObject(res v1alpha2.UsedResource) error }
CapsuleRequest contains a single reconcile request for a given capsule. It contains both the set of existing kubernetes objects owned by the capsule and the set of objects recorded to be applied after all steps in the pipeline has been executed (called 'new' objects). The set of existing objects cannot be modified (as the interface does not allow for writing to Kubernetes) but there are both read and write access to the set of new objects.
func NewCapsuleRequest ¶
func NewCapsuleRequest( p *CapsulePipeline, capsule *v1alpha2.Capsule, client client.Client, opts ...CapsuleRequestOption, ) CapsuleRequest
type CapsuleRequestOption ¶
type CapsuleRequestOption interface {
// contains filtered or unexported methods
}
func WithAdditionalResources ¶
func WithAdditionalResources(resources []*pipeline.Object) CapsuleRequestOption
func WithDryRun ¶
func WithDryRun() CapsuleRequestOption
func WithForce ¶
func WithForce() CapsuleRequestOption
type ExecutableRequest ¶
type ExecutableRequest[T Request] interface { GetRequest() T GetBase() *RequestBase }
TODO This ExecuteableRequest type construction is a bit messy Find a better abstraction
func NewProjectEnvironmentRequest ¶
func NewProjectEnvironmentRequest( c client.Client, reader client.Reader, vm scheme.VersionMapper, config *configv1alpha1.OperatorConfig, scheme *runtime.Scheme, logger logr.Logger, projectEnv *v1alpha2.ProjectEnvironment, ) ExecutableRequest[ProjectEnvironmentRequest]
type ObjectKey ¶
type ObjectKey struct { client.ObjectKey schema.GroupVersionKind }
func ObjectKeyFromObject ¶ added in v1.10.5
func (ObjectKey) MarshalLog ¶
type ObjectStatusCallback ¶
type OutputObject ¶
type OutputObject struct { ObjectKey ObjectKey Object client.Object State ResourceState }
type PluginConfig ¶ added in v1.12.0
type PluginConfigResult ¶ added in v1.12.0
type PluginConfigResult struct {
Steps []StepConfigResult
}
type ProjectEnvironmentRequest ¶
type ProjectEnvironmentRequest interface { Request // ProjectEnvironment returns a deepcopy of the capsule object being reconciled. ProjectEnvironment() *v1alpha2.ProjectEnvironment }
type Request ¶
type Request interface { // Scheme returns the serialization scheme used by the rig operator. // It contains all the types used by a Capsule. Scheme() *runtime.Scheme // Reader is a Kubernetes reader with access to the cluster the rig operator is running in. Reader() client.Reader // GetExisting populates 'obj' with a copy of the corresponding object owned by the capsule currently present in the cluster. // If the name of 'obj' isn't set, it defaults to the Capsule name. GetExisting(gvk schema.GroupVersionKind, name string) (client.Object, error) GetExistingInto(obj client.Object) error // GetNew populates 'obj' with a copy of the corresponding object owned by the capsule about to be applied. // If the name of 'obj' isn't set, it defaults to the Capsule name. GetNew(gvk schema.GroupVersionKind, name string) (client.Object, error) GetNewInto(obj client.Object) error // Set updates the object recorded to be applied. // If the name of 'obj' isn't set, it defaults to the Capsule name. Set(obj client.Object) error // Delete records the given object to be deleted. // The behavior is such that that calling req.Delete(obj) and then req.GetNew(obj) // returns a not-found error from GetNew. // If an object of the given type and name is present in the cluster, calling req.GetExisting(obj) succeeds // as calls to Delete (or Set) will only be applied to the cluster at the very end of the reconcilliation. // If the name of 'obj' isn't set, it defaults to the Capsule name. Delete(gvk schema.GroupVersionKind, name string) error // ListExisting returns a list with a copy of the objects of the corresponding type owned by the capsule and currently present in the cluster. // If you want a slice of typed objects, use the generic free-standing ListExisting function. ListExisting(gvk schema.GroupVersionKind) ([]client.Object, error) // ListNew returns a list with a copy of the objects of the corresponding type owned by the capsule and about to be applied. // If you want a slice of typed objects, use the generic free-standing ListNew function. ListNew(gvk schema.GroupVersionKind) ([]client.Object, error) }
type RequestBase ¶
type RequestBase struct { RequestDeps RequestState Strategies RequestStrategies }
func NewRequestBase ¶
func NewRequestBase( c client.Client, reader client.Reader, vm scheme.VersionMapper, config *configv1alpha1.OperatorConfig, scheme *runtime.Scheme, logger logr.Logger, strategies RequestStrategies, object client.Object, ) RequestBase
func (*RequestBase) Delete ¶
func (r *RequestBase) Delete(gvk schema.GroupVersionKind, name string) error
func (*RequestBase) GetExisting ¶
func (r *RequestBase) GetExisting(gvk schema.GroupVersionKind, name string) (client.Object, error)
func (*RequestBase) GetExistingInto ¶ added in v1.9.1
func (r *RequestBase) GetExistingInto(obj client.Object) error
func (*RequestBase) GetNew ¶
func (r *RequestBase) GetNew(gvk schema.GroupVersionKind, name string) (client.Object, error)
func (*RequestBase) GetNewInto ¶ added in v1.9.1
func (r *RequestBase) GetNewInto(obj client.Object) error
func (*RequestBase) ListExisting ¶
func (r *RequestBase) ListExisting(gvk schema.GroupVersionKind) ([]client.Object, error)
func (*RequestBase) ListNew ¶
func (r *RequestBase) ListNew(gvk schema.GroupVersionKind) ([]client.Object, error)
func (*RequestBase) PrepareRequest ¶
func (r *RequestBase) PrepareRequest() *Result
func (*RequestBase) Reader ¶
func (r *RequestBase) Reader() client.Reader
func (*RequestBase) Scheme ¶
func (r *RequestBase) Scheme() *runtime.Scheme
type RequestDeps ¶
type RequestDeps struct {
// contains filtered or unexported fields
}
type RequestState ¶
type RequestState struct {
// contains filtered or unexported fields
}
TODO Make generic over object?
type RequestStrategies ¶
type RequestStrategies interface { // Status updating strategies UpdateStatusWithChanges(ctx context.Context, changes map[ObjectKey]*Change, generation int64) error UpdateStatusWithError(ctx context.Context, err error) error // Execution loop strategies LoadExistingObjects(ctx context.Context) error Prepare() OwnedLabel() string GetKey(gvk schema.GroupVersionKind, name string) (ObjectKey, error) }
type ResourceState ¶
type ResourceState string
const ( ResourceStateDeleted ResourceState = "deleted" ResourceStateUpdated ResourceState = "updated" ResourceStateUnchanged ResourceState = "unchanged" ResourceStateCreated ResourceState = "created" ResourceStateFailed ResourceState = "failed" ResourceStateAlreadyExists ResourceState = "alreadyExists" ResourceStateChangePending ResourceState = "changePending" )
type Result ¶
type Result struct { InputObjects []client.Object OutputObjects []OutputObject }
type StepConfigResult ¶ added in v1.12.0
type StepConfigResult struct { Name string Plugins []PluginConfig }
Click to show internal directories.
Click to hide internal directories.