controllers

package
v0.0.0-...-1c438a8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ManagedBy = "compass-manager"

	AnnotationIDForMigration = "compass-runtime-id-for-migration"

	Finalizer             = "kyma-project.io/cm-protection"
	LabelBrokerInstanceID = "kyma-project.io/instance-id"
	LabelBrokerPlanID     = "kyma-project.io/broker-plan-id"
	LabelBrokerPlanName   = "kyma-project.io/broker-plan-name"
	LabelCompassID        = "kyma-project.io/compass-runtime-id"
	LabelGlobalAccountID  = "kyma-project.io/global-account-id"
	LabelKymaName         = "operator.kyma-project.io/kyma-name"
	LabelManagedBy        = "operator.kyma-project.io/managed-by"
	LabelShootName        = "kyma-project.io/shoot-name"
	LabelSubaccountID     = "kyma-project.io/subaccount-id"
	LabelDryRun           = "kyma-project.io/cm-dry-run"

	ApplicationConnectorModuleName = "application-connector"
	// KubeconfigKey is the name of the key in the secret storing cluster credentials.
	// The secret is created by KEB: https://github.com/kyma-project/control-plane/blob/main/components/kyma-environment-broker/internal/process/steps/lifecycle_manager_kubeconfig.go
	KubeconfigKey = "config"
)
View Source
const (
	AgentConfigurationSecretName = "compass-agent-configuration"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
	Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
	Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
	List(ctx context.Context, obj client.ObjectList, opts ...client.ListOption) error
	Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
	Status() client.SubResourceWriter
}

type CompassManagerReconciler

type CompassManagerReconciler struct {
	Client       Client
	Scheme       *runtime.Scheme
	Log          *log.Logger
	Configurator Configurator
	Registrator  Registrator
	// contains filtered or unexported fields
}

CompassManagerReconciler reconciles a CompassManager object

func NewCompassManagerReconciler

func NewCompassManagerReconciler(
	mgr manager.Manager,
	log *log.Logger,
	c Configurator,
	r Registrator,
	requeueTime time.Duration,
	requeueTimeForKubeconfig time.Duration,
	enabledRegistration bool,
	dryRun bool,
	metrics metrics.Metrics,
) *CompassManagerReconciler

func (*CompassManagerReconciler) CreateFunc

func (cm *CompassManagerReconciler) CreateFunc(obj runtime.Object) bool

func (*CompassManagerReconciler) DeleteFunc

func (cm *CompassManagerReconciler) DeleteFunc(obj runtime.Object) bool

func (*CompassManagerReconciler) Reconcile

func (cm *CompassManagerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*CompassManagerReconciler) SetupWithManager

func (cm *CompassManagerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*CompassManagerReconciler) UpdateFunc

func (cm *CompassManagerReconciler) UpdateFunc(oldObj, newObj runtime.Object) bool

type CompassRegistrator

type CompassRegistrator struct {
	Client director.Client
	Log    *logrus.Logger
}

func NewCompassRegistrator

func NewCompassRegistrator(directorClient director.Client, log *logrus.Logger) *CompassRegistrator

func (*CompassRegistrator) DeregisterFromCompass

func (r *CompassRegistrator) DeregisterFromCompass(compassID, globalAccount string) error

func (*CompassRegistrator) RefreshCompassToken

func (r *CompassRegistrator) RefreshCompassToken(compassID, globalAccount string) (graphql.OneTimeTokenForRuntimeExt, error)

func (*CompassRegistrator) RegisterInCompass

func (r *CompassRegistrator) RegisterInCompass(compassRuntimeLabels map[string]interface{}) (string, error)

type Configurator

type Configurator interface {
	// ConfigureCompassRuntimeAgent creates a secret in the Runtime that is used by the Compass Runtime Agent. It must be idempotent.
	ConfigureCompassRuntimeAgent(kubeconfig []byte, compassRuntimeID, globalAccount string) error
}

type ControlPlaneInterface

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

func NewControlPlaneInterface

func NewControlPlaneInterface(kubectl Client, log *log.Logger, dryRun bool) *ControlPlaneInterface

func (*ControlPlaneInterface) CreateCompassMapping

func (c *ControlPlaneInterface) CreateCompassMapping(name types.NamespacedName, compassRuntimeID string) error

func (*ControlPlaneInterface) DeleteCompassMapping

func (c *ControlPlaneInterface) DeleteCompassMapping(name types.NamespacedName) error

func (*ControlPlaneInterface) GetCompassMapping

func (*ControlPlaneInterface) GetCompassRuntimeID

func (c *ControlPlaneInterface) GetCompassRuntimeID(name types.NamespacedName) (string, error)

GetCompassRuntimeID returns `errNotFound` if the mapping exists, but doesn't have the label

func (*ControlPlaneInterface) GetKubeconfig

func (c *ControlPlaneInterface) GetKubeconfig(name types.NamespacedName) ([]byte, error)

func (*ControlPlaneInterface) GetKyma

func (*ControlPlaneInterface) RemoveCMFinalizer

func (c *ControlPlaneInterface) RemoveCMFinalizer(name types.NamespacedName) error

func (*ControlPlaneInterface) SetCompassMappingStatus

func (c *ControlPlaneInterface) SetCompassMappingStatus(name types.NamespacedName, status s.Status) error

SetCompassMappingStatus sets the registered and configured on an existing CompassManagerMapping If error occurs - logs it and returns

func (*ControlPlaneInterface) UpsertCompassMapping

func (c *ControlPlaneInterface) UpsertCompassMapping(name types.NamespacedName, compassRuntimeID string) error

type DirectorError

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

func (*DirectorError) Error

func (e *DirectorError) Error() string

type DryRunner

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

func NewDryRunner

func NewDryRunner(log *logrus.Logger) *DryRunner

func (DryRunner) ConfigureCompassRuntimeAgent

func (dr DryRunner) ConfigureCompassRuntimeAgent(_ []byte, compassRuntimeID, globalAccount string) error

func (DryRunner) DeregisterFromCompass

func (dr DryRunner) DeregisterFromCompass(compassID, globalAccount string) error

func (DryRunner) RegisterInCompass

func (dr DryRunner) RegisterInCompass(compassRuntimeLabels map[string]interface{}) (string, error)

type Registrator

type Registrator interface {
	// RegisterInCompass creates Runtime in the Compass system. It must be idempotent.
	RegisterInCompass(compassRuntimeLabels map[string]interface{}) (string, error)
	// DeregisterFromCompass deletes Runtime from Compass system
	DeregisterFromCompass(compassID, globalAccount string) error
}

type RuntimeAgentConfigurator

type RuntimeAgentConfigurator struct {
	Client director.Client
	Log    *logrus.Logger
}

func NewRuntimeAgentConfigurator

func NewRuntimeAgentConfigurator(directorClient director.Client, log *logrus.Logger) *RuntimeAgentConfigurator

func (*RuntimeAgentConfigurator) ConfigureCompassRuntimeAgent

func (r *RuntimeAgentConfigurator) ConfigureCompassRuntimeAgent(kubeconfig []byte, compassRuntimeID, globalAccount string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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