controllers

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reconcile

func Reconcile(
	cfg crdv1.HarborSync,
	harbor harbor.API,
	store reconciler.CredentialStore,
	rotationInterval time.Duration,
	mappingFunc func(
		crdv1.ProjectMapping,
		crdv1.HarborSync,
		harbor.Project,
		*crdv1.RobotAccountCredential,
		string),
) error

Reconcile is a Kubernetes-agnostic function that matches the projects, reconciles the robot accounts and calls mappingFunc if specified.

Types

type Adapter

type Adapter struct {
	client.Client
	Input []<-chan struct{}
}

Adapter waits for events on an input channel and emits SyncConfig change Events using a GenericEvent on a different channel

func NewAdapter

func NewAdapter(c client.Client, input []<-chan struct{}) Adapter

NewAdapter creates a new adapter instance

func (Adapter) Run

func (a Adapter) Run() <-chan event.GenericEvent

Run starts a goroutine which reads from the input channel and writes SyncConfig change events to the returned channel

type HarborSyncConfigReconciler

type HarborSyncConfigReconciler struct {
	client.Client
	RotationInterval time.Duration
	CredCache        reconciler.CredentialStore
	Harbor           harbor.API
}

HarborSyncConfigReconciler reconciles a HarborSyncConfig object

func (*HarborSyncConfigReconciler) Reconcile

func (r *HarborSyncConfigReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)

Reconcile reconciles the desired state in the cluster

func (*HarborSyncConfigReconciler) SetupWithManager

func (r *HarborSyncConfigReconciler) SetupWithManager(mgr ctrl.Manager, input <-chan event.GenericEvent) error

SetupWithManager setup the controller with the manager and the event input channel the input chan is used to trigger recon based on external events (harbor API resources changed, forced sync)

Jump to

Keyboard shortcuts

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