Documentation ¶
Index ¶
- Constants
- Variables
- func IsOwnedBy(owner metav1.Object, obj metav1.Object) bool
- func LookupGVK(gk schema.GroupKind) (schema.GroupVersionKind, error)
- func ObjectsEquals(o1, o2 client.Object) bool
- type CapsulePipeline
- type CapsuleRequest
- type CapsuleRequestOption
- type Change
- type ExecutableRequest
- type Object
- type ObjectKey
- type ObjectsEqual
- type OutputObject
- type ProjectRequest
- type Request
- type RequestBase
- func (r *RequestBase) Commit(ctx context.Context) (map[ObjectKey]*Change, error)
- func (r *RequestBase) Delete(obj client.Object) error
- func (r *RequestBase) GetExisting(obj client.Object) error
- func (r *RequestBase) GetNew(obj 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
Constants ¶
View Source
const (
LabelOwnedByCapsule = "rig.dev/owned-by-capsule"
)
View Source
const (
LabelOwnedByProject = "rig.dev/owned-by-project"
)
Variables ¶
View Source
var ( AppsDeploymentGVK = appsv1.SchemeGroupVersion.WithKind("Deployment") CoreServiceGVK = corev1.SchemeGroupVersion.WithKind("Service") CoreNamespace = corev1.SchemeGroupVersion.WithKind("Namespace") CMCertificateGVK = cmv1.SchemeGroupVersion.WithKind(cmv1.CertificateKind) NetIngressGVK = netv1.SchemeGroupVersion.WithKind("Ingress") AutoscalingvHorizontalPodAutoscalerGVK = autoscalingv2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler") BatchCronJobGVK = batchv1.SchemeGroupVersion.WithKind("CronJob") MonitoringServiceMonitorGVK = monitorv1.SchemeGroupVersion.WithKind(monitorv1.ServiceMonitorsKind) VPAVerticalPodAutoscalerGVK = vpav1.SchemeGroupVersion.WithKind("VerticalPodAutoscaler") CoreServiceAccount = corev1.SchemeGroupVersion.WithKind("ServiceAccount") )
Functions ¶
func ObjectsEquals ¶
Types ¶
type CapsulePipeline ¶ added in v1.8.1
type CapsulePipeline struct {
// contains filtered or unexported fields
}
func NewCapsulePipeline ¶ added in v1.8.1
func NewCapsulePipeline( cc client.Client, cr client.Reader, config *configv1alpha1.OperatorConfig, scheme *runtime.Scheme, logger logr.Logger, ) *CapsulePipeline
func (*CapsulePipeline) AddStep ¶ added in v1.8.1
func (p *CapsulePipeline) AddStep(step Step[CapsuleRequest])
func (*CapsulePipeline) RunCapsule ¶ added in v1.8.1
func (p *CapsulePipeline) RunCapsule( ctx context.Context, capsule *v1alpha2.Capsule, opts ...CapsuleRequestOption, ) (*Result, error)
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, opts ...CapsuleRequestOption) CapsuleRequest
type CapsuleRequestOption ¶
type CapsuleRequestOption interface {
// contains filtered or unexported methods
}
func WithAdditionalResources ¶ added in v1.7.4
func WithAdditionalResources(resources []*pipeline.Object) CapsuleRequestOption
func WithDryRun ¶
func WithDryRun() CapsuleRequestOption
func WithForce ¶
func WithForce() CapsuleRequestOption
type ExecutableRequest ¶ added in v1.8.2
type ExecutableRequest[T Request] interface { GetRequest() T GetBase() *RequestBase }
TODO This ExecuteableRequest type construction is a bit messy Find a better abstraction
func NewProjectRequest ¶ added in v1.8.2
func NewProjectRequest( c client.Client, reader client.Reader, config *configv1alpha1.OperatorConfig, scheme *runtime.Scheme, logger logr.Logger, project *v1alpha2.Project, ) ExecutableRequest[ProjectRequest]
type ObjectKey ¶ added in v1.8.1
type ObjectKey struct { client.ObjectKey schema.GroupVersionKind }
func (ObjectKey) MarshalLog ¶ added in v1.8.1
func (ok ObjectKey) MarshalLog() interface{}
type ObjectsEqual ¶
type OutputObject ¶
type OutputObject struct { ObjectKey ObjectKey Object client.Object State ResourceState }
type ProjectRequest ¶ added in v1.8.2
type Request ¶ added in v1.8.1
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(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(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 behaviour 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) succeds // 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(obj client.Object) error }
type RequestBase ¶ added in v1.8.1
type RequestBase struct { RequestDeps RequestState Strategies RequestStrategies }
func NewRequestBase ¶ added in v1.8.1
func NewRequestBase( c client.Client, reader client.Reader, config *configv1alpha1.OperatorConfig, scheme *runtime.Scheme, logger logr.Logger, strategies RequestStrategies, object client.Object, ) RequestBase
func (*RequestBase) GetExisting ¶ added in v1.8.1
func (r *RequestBase) GetExisting(obj client.Object) error
func (*RequestBase) PrepareRequest ¶ added in v1.8.1
func (r *RequestBase) PrepareRequest() *Result
func (*RequestBase) Reader ¶ added in v1.8.1
func (r *RequestBase) Reader() client.Reader
func (*RequestBase) Scheme ¶ added in v1.8.1
func (r *RequestBase) Scheme() *runtime.Scheme
type RequestDeps ¶ added in v1.8.1
type RequestDeps struct {
// contains filtered or unexported fields
}
type RequestState ¶ added in v1.8.1
type RequestState struct {
// contains filtered or unexported fields
}
TODO Make generic over object?
type RequestStrategies ¶ added in v1.8.1
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(obj client.Object) (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 }
func ExecuteRequest ¶ added in v1.8.1
Click to show internal directories.
Click to hide internal directories.