tenant_controller

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: 32 Imported by: 0

Documentation

Overview

Package tenant_controller groups the functionalities related to the Tenant controller.

Package tenant_controller groups the functionalities related to the Tenant controller.

Index

Constants

View Source
const (
	// NoWorkspacesLabel -> label to be set (to true) when no workspaces are associated to the tenant.
	NoWorkspacesLabel = "crownlabs.polito.it/no-workspaces"
	// NFSSecretName -> NFS secret name.
	NFSSecretName = "mydrive-info"
	// NFSSecretServerNameKey -> NFS Server key in NFS secret.
	NFSSecretServerNameKey = "server-name"
	// NFSSecretPathKey -> NFS path key in NFS secret.
	NFSSecretPathKey = "path"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KcActor

type KcActor struct {
	Client gocloak.GoCloak

	TargetRealm           string
	TargetClientID        string
	UserRequiredActions   []string
	EmailActionsLifeSpanS int
	// contains filtered or unexported fields
}

KcActor contains the needed objects and infos to use keycloak functionalities.

func NewKcActor

func NewKcActor(kcURL, kcUser, kcPsw, targetRealmName, targetClient, loginRealm string) (*KcActor, error)

NewKcActor sets up a keycloak client with the specified parameters and performs the first login.

func (*KcActor) GetAccessToken

func (kcA *KcActor) GetAccessToken() string

GetAccessToken thread-safely returns the access token stored into the Token field.

func (*KcActor) SetToken

func (kcA *KcActor) SetToken(newToken *gocloak.JWT)

SetToken thread-safely stores a new JWT inside the KcActor struct.

type TenantReconciler

type TenantReconciler struct {
	client.Client
	Scheme                      *runtime.Scheme
	KcA                         *KcActor
	TargetLabelKey              string
	TargetLabelValue            string
	SandboxClusterRole          string
	Concurrency                 int
	MyDrivePVCsSize             resource.Quantity
	MyDrivePVCsStorageClassName string
	MyDrivePVCsNamespace        string
	RequeueTimeMinimum          time.Duration
	RequeueTimeMaximum          time.Duration
	TenantNSKeepAlive           time.Duration
	BaseWorkspaces              []string

	// 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()
}

TenantReconciler reconciles a Tenant object.

func (*TenantReconciler) EnforceSandboxResources

func (r *TenantReconciler) EnforceSandboxResources(ctx context.Context, tenant *clv1alpha2.Tenant) error

EnforceSandboxResources ensures the presence/absence of a sandbox.

func (*TenantReconciler) Reconcile

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

Reconcile reconciles the state of a tenant resource.

func (*TenantReconciler) SetupWithManager

func (r *TenantReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers a new controller for Tenant resources.

type WorkspaceReconciler

type WorkspaceReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	KcA              *KcActor
	TargetLabelKey   string
	TargetLabelValue string

	RequeueTimeMinimum time.Duration
	RequeueTimeMaximum time.Duration

	// 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()
}

WorkspaceReconciler reconciles a Workspace object.

func (*WorkspaceReconciler) Reconcile

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

Reconcile reconciles the state of a workspace resource.

func (*WorkspaceReconciler) SetupWithManager

func (r *WorkspaceReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers a new controller for Workspace resources.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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