controller

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImmutableAnnotation = "goharbor.io/immutable"
	WarningAnnotation   = "goharbor.io/warning"
	WarningValueTmpl    = "⚠️ This Resource is managed by *%s* ⚠️"
)
View Source
const (
	OperatorNameLabel    = "goharbor.io/operator-controller"
	OperatorVersionLabel = "goharbor.io/operator-version"
)
View Source
const DefaultClassName = ""

Variables

View Source
var ErrorOwnerNotFound = errors.New("owner not found")

Functions

func IsOptimisticLockError added in v1.0.1

func IsOptimisticLockError(err error) bool

Types

type Controller

type Controller struct {
	client.Client

	BaseController controllers.Controller
	Version        string
	GitCommit      string

	ConfigStore *configstore.Store

	Log    logr.Logger
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

func (*Controller) AddBasicResource

func (c *Controller) AddBasicResource(ctx context.Context, resource resources.Resource, dependencies ...graph.Resource) (*Resource, error)

func (*Controller) AddCertificateToManage

func (c *Controller) AddCertificateToManage(ctx context.Context, resource *certv1.Certificate, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddConfigMapToManage

func (c *Controller) AddConfigMapToManage(ctx context.Context, resource *corev1.ConfigMap, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddDeploymentToManage

func (c *Controller) AddDeploymentToManage(ctx context.Context, resource *appsv1.Deployment, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddExternalConfigMap added in v1.0.1

func (c *Controller) AddExternalConfigMap(ctx context.Context, configMap *corev1.ConfigMap, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddExternalResource

func (c *Controller) AddExternalResource(ctx context.Context, resource resources.Resource, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddExternalTypedSecret

func (c *Controller) AddExternalTypedSecret(ctx context.Context, secret *corev1.Secret, secretType corev1.SecretType, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddGVKToSpan

func (c *Controller) AddGVKToSpan(ctx context.Context, span opentracing.Span, resource runtime.Object) (gvk schema.GroupVersionKind)

func (*Controller) AddIngressToManage

func (c *Controller) AddIngressToManage(ctx context.Context, resource *netv1.Ingress, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddIssuerToManage

func (c *Controller) AddIssuerToManage(ctx context.Context, resource *certv1.Issuer, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddNetworkPolicyToManage added in v1.0.1

func (c *Controller) AddNetworkPolicyToManage(ctx context.Context, resource *netv1.NetworkPolicy, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddSecretToManage

func (c *Controller) AddSecretToManage(ctx context.Context, resource *corev1.Secret, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddServiceToManage

func (c *Controller) AddServiceToManage(ctx context.Context, resource *corev1.Service, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) AddUnsctructuredToManage

func (c *Controller) AddUnsctructuredToManage(ctx context.Context, resource *unstructured.Unstructured, dependencies ...graph.Resource) (graph.Resource, error)

func (*Controller) Apply

func (c *Controller) Apply(ctx context.Context, res *Resource) error

func (*Controller) AreNetworkPoliciesEnabled added in v1.0.1

func (c *Controller) AreNetworkPoliciesEnabled(ctx context.Context, resource resources.Resource) (bool, error)

func (*Controller) BoolConfig added in v1.0.1

func (c *Controller) BoolConfig(ctx context.Context, key string, defaultValue bool) (bool, error)

func (*Controller) Changed

func (c *Controller) Changed(ctx context.Context, depManager *checksum.Dependencies, resource resources.Resource) (bool, error)

func (*Controller) DeploymentMutateFn

func (c *Controller) DeploymentMutateFn(ctx context.Context, dependencies ...graph.Resource) (resources.Mutable, error)

func (*Controller) EnsureReady

func (c *Controller) EnsureReady(ctx context.Context, node graph.Resource) error

func (*Controller) EnsureSecretType

func (c *Controller) EnsureSecretType(ctx context.Context, node graph.Resource) error

func (*Controller) Funcs

func (*Controller) GetAndFilter

func (c *Controller) GetAndFilter(ctx context.Context, key client.ObjectKey, obj client.Object) (bool, error)

func (*Controller) GetClassName added in v1.0.1

func (c *Controller) GetClassName(ctx context.Context) (string, error)

func (*Controller) GetFQDN

func (c *Controller) GetFQDN() string

func (*Controller) GetGitCommit added in v1.0.1

func (c *Controller) GetGitCommit() string

func (*Controller) GetName

func (c *Controller) GetName() string

func (*Controller) GetTemplatedConfig

func (c *Controller) GetTemplatedConfig(ctx context.Context, templateConfig string, owner resources.Resource) ([]byte, error)

func (*Controller) GetVersion

func (c *Controller) GetVersion() string

func (*Controller) GlobalMutateFn

func (c *Controller) GlobalMutateFn(ctx context.Context) (resources.Mutable, error)

func (*Controller) HandleError

func (c *Controller) HandleError(ctx context.Context, resource client.Object, resultError error) (ctrl.Result, error)

func (*Controller) IntConfig added in v1.0.1

func (c *Controller) IntConfig(ctx context.Context, key string, defaultValue int) (int, error)

func (*Controller) Label

func (c *Controller) Label(suffix ...string) string

func (*Controller) LabelWithPrefix

func (c *Controller) LabelWithPrefix(prefix string, suffix ...string) string

func (*Controller) NormalizeName

func (c *Controller) NormalizeName(ctx context.Context, name string, suffixes ...string) string

func (*Controller) PopulateContext added in v1.1.0

func (c *Controller) PopulateContext(ctx context.Context, req ctrl.Request) context.Context

func (*Controller) PrepareStatus added in v1.0.1

func (c *Controller) PrepareStatus(ctx context.Context, owner resources.Resource) error

func (*Controller) ProcessFunc

func (c *Controller) ProcessFunc(ctx context.Context, resource runtime.Object, dependencies ...graph.Resource) func(context.Context, graph.Resource) error

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*Controller) Run

func (c *Controller) Run(ctx context.Context, owner resources.Resource) error

func (*Controller) SecretMutateFn added in v1.0.1

func (c *Controller) SecretMutateFn(ctx context.Context, immutable *bool) (resources.Mutable, error)

func (*Controller) SetControllerStatus

func (c *Controller) SetControllerStatus(ctx context.Context, data map[string]interface{}) error

func (*Controller) SetErrorConditions

func (c *Controller) SetErrorConditions(ctx context.Context, data map[string]interface{}, resultError error) error

func (*Controller) SetErrorStatus

func (c *Controller) SetErrorStatus(ctx context.Context, resource runtime.Object, resultError error) error

func (*Controller) SetSuccessConditions

func (c *Controller) SetSuccessConditions(ctx context.Context, data map[string]interface{}) error

func (*Controller) SetSuccessStatus

func (c *Controller) SetSuccessStatus(ctx context.Context, resource runtime.Object) error

func (*Controller) SetupWithManager

func (c *Controller) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

func (*Controller) StringConfig added in v1.0.1

func (c *Controller) StringConfig(ctx context.Context, key string, defaultValue string) (string, error)

type Reconciler

type Reconciler interface {
	reconcile.Reconciler

	NormalizeName(context.Context, string, ...string) string
	SetupWithManager(context.Context, manager.Manager) error
}

type Resource

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

func (*Resource) GetResource added in v1.0.1

func (res *Resource) GetResource() resources.Resource

type ResourceManager

type ResourceManager interface {
	AddResources(context.Context, resources.Resource) error
	NewEmpty(context.Context) resources.Resource
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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