internalrequest

package
v0.0.0-...-0b31d94 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter holds the objects needed to reconcile an InternalRequest.

func NewAdapter

func NewAdapter(ctx context.Context, client, internalClient client.Client, internalRequest *v1alpha1.InternalRequest, loader loader.ObjectLoader, logger logr.Logger) *Adapter

NewAdapter creates and returns an Adapter instance.

func (*Adapter) EnsureConfigIsLoaded

func (a *Adapter) EnsureConfigIsLoaded() (controller.OperationResult, error)

EnsureConfigIsLoaded is an operation that will load the service InternalServicesConfig from the manager namespace. If not found, a new InternalServicesConfig resource will be generated and attached to the adapter.

Note: This operation sets values in the adapter to be used by other operations, so it should be always enabled.

func (*Adapter) EnsurePipelineExists

func (a *Adapter) EnsurePipelineExists() (controller.OperationResult, error)

EnsurePipelineExists is an operation that will ensure the Pipeline referenced by the InternalRequest exists and add it to the adapter, so it can be used in other operations. If the Pipeline doesn't exist, the InternalRequest will be marked as failed.

Note: This operation sets values in the adapter to be used by other operations, so it should be always enabled.

func (*Adapter) EnsurePipelineRunIsCreated

func (a *Adapter) EnsurePipelineRunIsCreated() (controller.OperationResult, error)

EnsurePipelineRunIsCreated is an operation that will ensure that the InternalRequest is handled by creating a new PipelineRun for the Pipeline referenced in the Request field.

func (*Adapter) EnsurePipelineRunIsDeleted

func (a *Adapter) EnsurePipelineRunIsDeleted() (controller.OperationResult, error)

EnsurePipelineRunIsDeleted is an operation that will ensure that the PipelineRun created to handle the InternalRequest is deleted once it finishes.

func (*Adapter) EnsureRequestINotCompleted

func (a *Adapter) EnsureRequestINotCompleted() (controller.OperationResult, error)

EnsureRequestINotCompleted is an operation that will stop processing a request if it was completed already.

func (*Adapter) EnsureRequestIsAllowed

func (a *Adapter) EnsureRequestIsAllowed() (controller.OperationResult, error)

EnsureRequestIsAllowed is an operation that will ensure that the request is coming from a namespace allowed to execute InternalRequests. If the InternalServicesConfig spec.allowList is empty, any request will be allowed regardless of the remote namespace.

func (*Adapter) EnsureStatusIsTracked

func (a *Adapter) EnsureStatusIsTracked() (controller.OperationResult, error)

EnsureStatusIsTracked is an operation that will ensure that the InternalRequest PipelineRun status is tracked in the InternalRequest being processed.

type Reconciler

type Reconciler struct {
	Client         client.Client
	Log            logr.Logger
	InternalClient client.Client
	Scheme         *runtime.Scheme
}

Reconciler reconciles an InternalRequest object

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

func (*Reconciler) Register

func (r *Reconciler) Register(mgr ctrl.Manager, log *logr.Logger, remoteCluster cluster.Cluster) error

Register registers the controller with the passed manager and log. This controller monitors new InternalRequests and filters out status updates. It also watches for PipelineRuns created by this controller and owned by the InternalRequests so the owner gets reconciled on PipelineRun changes.

Jump to

Keyboard shortcuts

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