controllers

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

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

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNetworkAttachments       = "not all pods have interfaces with ips as configured in NetworkAttachments: %s"
	ErrReceivedUnexpectedAction = "unexpected action received"
	ErrConfirmLockOwnership     = "can not confirm ownership of %s lock"
)
View Source
const (
	InfoWaitingOnJob      = "Waiting on either job to finish or release of the lock."
	InfoTestingCompleted  = "Testing completed. All pods spawned by the test-operator finished."
	InfoCreatingFirstPod  = "Creating first test pod (workflow step %d)."
	InfoCreatingNextPod   = "Creating next test pod (workflow step %d)."
	InfoCanNotAcquireLock = "Can not acquire %s lock."
	InfoCanNotReleaseLock = "Can not release %s lock."
)
View Source
const (
	// Wait indicates that we should wait for the state of the OpenShift cluster
	// to change
	Wait = iota

	// CreateFirstJob indicates that the Reconcile loop should create the first job
	// either specified in the .Spec section or in the .Spec.Workflow section.
	CreateFirstJob

	// CreateNextJob indicates that the Reconcile loop should create a next job
	// specified in the .Spec.Workflow section (if .Spec.Workflow is defined)
	CreateNextJob

	// EndTesting indicates that all jobs have already finished. The Reconcile
	// loop should end the testing and release resources that are required to
	// be release (e.g., global lock)
	EndTesting

	// Failure indicates that an unexpected error was encountered
	Failure
)
View Source
const (
	// RequeueAfterValue tells how much time should we wait before calling Reconcile
	// loop again.
	RequeueAfterValue = time.Second * 60
)

Variables

This section is empty.

Functions

func EnsureCloudsConfigMapExists

func EnsureCloudsConfigMapExists(
	ctx context.Context,
	instance client.Object,
	helper *helper.Helper,
	labels map[string]string,
) (ctrl.Result, error)

Some frameworks like (e.g., Tobiko and Horizon) require password value to be present in clouds.yaml. This code ensures that we set a default value of 12345678 when password value is missing in the clouds.yaml

func GetCommonRbacRules

func GetCommonRbacRules(privileged bool) []rbacv1.PolicyRule

func GetCustomDataConfigMapName

func GetCustomDataConfigMapName(instance interface{}, workflowStepNum int) string

func GetEnvVarsConfigMapName

func GetEnvVarsConfigMapName(instance interface{}, workflowStepNum int) string

func GetStringHash

func GetStringHash(str string, hashLength int) string

Types

type AnsibleTestReconciler

type AnsibleTestReconciler struct {
	Reconciler
}

func (*AnsibleTestReconciler) GetLogger

func (r *AnsibleTestReconciler) GetLogger(ctx context.Context) logr.Logger

GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields

func (*AnsibleTestReconciler) PrepareAnsibleEnv

func (r *AnsibleTestReconciler) PrepareAnsibleEnv(
	instance *testv1beta1.AnsibleTest,
	step int,
) (map[string]env.Setter, map[string]string)

This function prepares env variables for a single workflow step.

func (*AnsibleTestReconciler) Reconcile

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

Reconcile - AnsibleTest

func (*AnsibleTestReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type HorizonTestReconciler

type HorizonTestReconciler struct {
	Reconciler
}

HorizonTestReconciler reconciles a HorizonTest object

func (*HorizonTestReconciler) GetLogger

func (r *HorizonTestReconciler) GetLogger(ctx context.Context) logr.Logger

GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields

func (*HorizonTestReconciler) PrepareHorizonTestEnvVars

func (r *HorizonTestReconciler) PrepareHorizonTestEnvVars(
	instance *testv1beta1.HorizonTest,
) map[string]env.Setter

func (*HorizonTestReconciler) Reconcile

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

Reconcile - HorizonTest

func (*HorizonTestReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type NextAction

type NextAction int

NextAction holds an action that should be performed by the Reconcile loop.

type Reconciler

type Reconciler struct {
	Client  client.Client
	Kclient kubernetes.Interface
	Log     logr.Logger
	Scheme  *runtime.Scheme
}

func (*Reconciler) AcquireLock

func (r *Reconciler) AcquireLock(
	ctx context.Context,
	instance client.Object,
	h *helper.Helper,
	parallel bool,
) (bool, error)

func (*Reconciler) CheckSecretExists

func (r *Reconciler) CheckSecretExists(ctx context.Context, instance client.Object, secretName string) bool

func (*Reconciler) EnsureLogsPVCExists

func (r *Reconciler) EnsureLogsPVCExists(
	ctx context.Context,
	instance client.Object,
	helper *helper.Helper,
	labels map[string]string,
	StorageClassName string,
	workflowStepNum int,
) (ctrl.Result, error)

func (*Reconciler) GetClient

func (r *Reconciler) GetClient() client.Client

func (*Reconciler) GetContainerImage

func (r *Reconciler) GetContainerImage(
	ctx context.Context,
	containerImage string,
	instance interface{},
) (string, error)

func (*Reconciler) GetDefaultBool

func (r *Reconciler) GetDefaultBool(variable bool) string

func (*Reconciler) GetDefaultInt

func (r *Reconciler) GetDefaultInt(variable int64, defaultValue ...string) string

func (*Reconciler) GetJobName

func (r *Reconciler) GetJobName(instance interface{}, workflowStepNum int) string

func (*Reconciler) GetLastJob

func (r *Reconciler) GetLastJob(
	ctx context.Context,
	instance client.Object,
) (*batchv1.Job, error)

GetLastJob returns job associated with an instance which has the highest value stored in the workflowStep label

func (*Reconciler) GetLockInfo

func (r *Reconciler) GetLockInfo(ctx context.Context, instance client.Object) (*corev1.ConfigMap, error)

func (*Reconciler) GetLogger

func (r *Reconciler) GetLogger() logr.Logger

func (*Reconciler) GetPVCLogsName

func (r *Reconciler) GetPVCLogsName(instance client.Object, workflowStepNum int) string

func (*Reconciler) GetScheme

func (r *Reconciler) GetScheme() *runtime.Scheme

func (*Reconciler) GetWorkflowConfigMapName

func (r *Reconciler) GetWorkflowConfigMapName(instance client.Object) string

func (*Reconciler) JobExists

func (r *Reconciler) JobExists(ctx context.Context, instance client.Object, workflowStepNum int) bool

func (*Reconciler) NextAction

func (r *Reconciler) NextAction(
	ctx context.Context,
	instance client.Object,
	workflowLength int,
) (NextAction, int, error)

NextAction indicates what action needs to be performed by the Reconcile loop based on the current state of the OpenShift cluster.

func (*Reconciler) OverwriteAnsibleWithWorkflow

func (r *Reconciler) OverwriteAnsibleWithWorkflow(
	instance v1beta1.AnsibleTestSpec,
	sectionName string,
	workflowValueType string,
	workflowStepNum int,
) interface{}

func (*Reconciler) OverwriteValueWithWorkflow

func (r *Reconciler) OverwriteValueWithWorkflow(
	instance v1beta1.TobikoSpec,
	sectionName string,
	workflowValueType string,
	workflowStepNum int,
) interface{}

func (*Reconciler) ReleaseLock

func (r *Reconciler) ReleaseLock(ctx context.Context, instance client.Object) (bool, error)

type TempestReconciler

type TempestReconciler struct {
	Reconciler
}

func (*TempestReconciler) GetLogger

func (r *TempestReconciler) GetLogger(ctx context.Context) logr.Logger

GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields

func (*TempestReconciler) Reconcile

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

Reconcile - Tempest

func (*TempestReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type TobikoReconciler

type TobikoReconciler struct {
	Reconciler
}

TobikoReconciler reconciles a Tobiko object

func (*TobikoReconciler) GetLogger

func (r *TobikoReconciler) GetLogger(ctx context.Context) logr.Logger

GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields

func (*TobikoReconciler) PrepareTobikoEnvVars

func (r *TobikoReconciler) PrepareTobikoEnvVars(
	ctx context.Context,
	labels map[string]string,
	instance *testv1beta1.Tobiko,
	helper *helper.Helper,
	step int,
) map[string]env.Setter

This function prepares env variables for a single workflow step.

func (*TobikoReconciler) Reconcile

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

Reconcile - Tobiko

func (*TobikoReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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