instctrl

package
v0.0.0-...-2e8aeb9 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package instctrl groups the functionalities related to the Instance controller.

Index

Constants

View Source
const (
	// WebdavSecretUsernameKey -> the key of the webdav secret containing the username.
	WebdavSecretUsernameKey = "username"
	// WebdavSecretPasswordKey -> The key of the webdav secret containing the password.
	WebdavSecretPasswordKey = "password"

	// UserDataKey -> the key of the created secret containing the cloud-init userdata content.
	UserDataKey = "userdata"
)
View Source
const (
	// EvTmplNotFound -> the event key corresponding to a not found template.
	EvTmplNotFound = "TemplateNotFound"
	// EvTmplNotFoundMsg -> the event message corresponding to a not found template.
	EvTmplNotFoundMsg = "Template %v/%v not found"

	// EvTntNotFound -> the event key corresponding to a not found tenant.
	EvTntNotFound = "TenantNotFound"
	// EvTntNotFoundMsg -> the event message corresponding to a not found tenant.
	EvTntNotFoundMsg = "Tenant %v not found"

	// EvEnvironmentErr -> the event key corresponding to a failed environment enforcement.
	EvEnvironmentErr = "EnvironmentEnforcementFailed"
	// EvEnvironmentErrMsg -> the event message corresponding to a failed environment enforcement.
	EvEnvironmentErrMsg = "Failed to enforce environment %v"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type InstanceReconciler

type InstanceReconciler struct {
	client.Client
	Scheme             *runtime.Scheme
	EventsRecorder     record.EventRecorder
	NamespaceWhitelist metav1.LabelSelector
	ServiceUrls        ServiceUrls
	ContainerEnvOpts   forge.ContainerEnvOpts

	// This function, if configured, is deferred at the beginning of the Reconcile.
	// Specifically, it is meant to be set to GinkgoRecover during the tests,
	// in order to lead to a controlled failure in case the Reconcile panics.
	ReconcileDeferHook func()
}

InstanceReconciler reconciles a Instance object.

func (*InstanceReconciler) EnforceCloudInitSecret

func (r *InstanceReconciler) EnforceCloudInitSecret(ctx context.Context) error

EnforceCloudInitSecret enforces the creation/update of a secret containing the cloud-init configuration, based on the information retrieved for the tenant object and its associated WebDav credentials.

func (*InstanceReconciler) EnforceContainerEnvironment

func (r *InstanceReconciler) EnforceContainerEnvironment(ctx context.Context) error

EnforceContainerEnvironment implements the logic to create all the different Kubernetes resources required to start a containerized CrownLabs environment.

func (*InstanceReconciler) EnforceInstanceExposition

func (r *InstanceReconciler) EnforceInstanceExposition(ctx context.Context) error

EnforceInstanceExposition ensures the presence/absence of the objects required to expose an environment (i.e. service, ingress), depending on whether the instance is running or not.

func (*InstanceReconciler) EnforceVMEnvironment

func (r *InstanceReconciler) EnforceVMEnvironment(ctx context.Context) error

EnforceVMEnvironment implements the logic to create all the different Kubernetes resources required to start a CrownLabs environment.

func (*InstanceReconciler) GetNFSSpecs

func (r *InstanceReconciler) GetNFSSpecs(ctx context.Context) (nfsServerName, nfsPath string, err error)

GetNFSSpecs extracts the NFS server name and path for the user's personal NFS volume, required to mount the MyDrive disk of a given tenant from the associated secret.

func (*InstanceReconciler) GetPublicKeys

func (r *InstanceReconciler) GetPublicKeys(ctx context.Context) ([]string, error)

GetPublicKeys extracts and returns the set of public keys associated with a given tenant, along with the ones of the tenants having Manager role in the corresponding workspace.

func (*InstanceReconciler) Reconcile

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

Reconcile reconciles the state of an Instance resource.

func (*InstanceReconciler) RetrievePhaseFromDeployment

func (r *InstanceReconciler) RetrievePhaseFromDeployment(deployment *appsv1.Deployment) clv1alpha2.EnvironmentPhase

RetrievePhaseFromDeployment converts the Deployment phase to the corresponding one of the instance.

func (*InstanceReconciler) RetrievePhaseFromVM

RetrievePhaseFromVM converts the VM phase to the corresponding one of the instance.

func (*InstanceReconciler) RetrievePhaseFromVMI

RetrievePhaseFromVMI converts the VMI phase to the corresponding one of the instance.

func (*InstanceReconciler) SetupWithManager

func (r *InstanceReconciler) SetupWithManager(mgr ctrl.Manager, concurrency int) error

SetupWithManager registers a new controller for Instance resources.

type ServiceUrls

type ServiceUrls struct {
	WebsiteBaseURL   string
	InstancesAuthURL string
}

ServiceUrls holds URL parameters for the instance reconciler.

Jump to

Keyboard shortcuts

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