common

package
v0.1.49 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OpenSCAPExitCodeCompliant defines a success coming from OpenSCAP
	OpenSCAPExitCodeCompliant string = "0"
	// OpenSCAPExitCodeNonCompliant defines a non-compliance error coming from OpenSCAP
	OpenSCAPExitCodeNonCompliant string = "2"
	// PodUnschedulableExitCode is a custom error that indicates that we couldn't schedule the pod
	PodUnschedulableExitCode string = "unschedulable"

	// taken from k8sutil
	ForceRunModeEnv             = "OSDK_FORCE_RUN_MODE"
	LocalRunMode    RunModeType = "local"
	ClusterRunMode  RunModeType = "cluster"
)

Variables

This section is empty.

Functions

func CallCustomHandler added in v0.1.10

func CallCustomHandler(err error) (reconcile.Result, error)

CallCustomHandler calls the custom handler for an error if it has one

func ContainsFinalizer added in v0.1.10

func ContainsFinalizer(slice []string, f string) bool

ContainsFinalizer checks if the given finalizer `f` is in the given list of finalizers

func GenerateEventForResult added in v0.1.17

func GenerateEventForResult(recorder record.EventRecorder, obj runtime.Object, objInfo metav1.Object, result compv1alpha1.ComplianceScanStatusResult)

func GetComplianceOperatorName added in v0.1.47

func GetComplianceOperatorName() string

GetComplianceOperatorName gets the name that the operator is currently running with.

func GetComplianceOperatorNamespace

func GetComplianceOperatorNamespace() string

GetComplianceOperatorNamespace gets the namespace that the operator is currently running on.

func HasCustomHandler added in v0.1.10

func HasCustomHandler(err error) bool

HasCustomHandler returns whether the error has a custom handler or not

func IsRetriable

func IsRetriable(err error) bool

IsRetriable returns whether the error is retriable or not using the NonRetriableCtrlError interface

func RemoveFinalizer added in v0.1.10

func RemoveFinalizer(slice []string, f string) (result []string)

RemoveFinalizer removes the given finalizer `f` from the given list of finalizers

func ReturnWithRetriableError

func ReturnWithRetriableError(log logr.Logger, err error) (reconcile.Result, error)

ReturnWithRetriableError will check if the error is retriable we return it. If it's not retriable, we return nil so the reconciler doesn't keep looping.

Types

type ErrorHandler added in v0.1.10

type ErrorHandler func() (reconcile.Result, error)

ErrorHandler defines a function that handles errors It can be used in a non retriable or a retriable error.

type NonRetriableCtrlError

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

NonRetriableCtrlError wraps errors with the addition of having the information for the error being non-retriable

func NewNonRetriableCtrlError added in v0.1.9

func NewNonRetriableCtrlError(errorFmt string, args ...interface{}) *NonRetriableCtrlError

NewNonRetriableCtrlError creates an error with the RetriableCtrlError interface

func NewRetriableCtrlErrorWithCustomHandler added in v0.1.10

func NewRetriableCtrlErrorWithCustomHandler(customHandler ErrorHandler, errorFmt string, args ...interface{}) *NonRetriableCtrlError

NewRetriableCtrlErrorWithCustomHandler creates an error with the RetriableCtrlError interface This error is retriable has a custom handler

func WrapNonRetriableCtrlError

func WrapNonRetriableCtrlError(err error) *NonRetriableCtrlError

WrapNonRetriableCtrlError wraps an error with the RetriableCtrlError interface

func (NonRetriableCtrlError) Error

func (cerr NonRetriableCtrlError) Error() string

func (NonRetriableCtrlError) HasCustomHandler added in v0.1.10

func (cerr NonRetriableCtrlError) HasCustomHandler() bool

HasCustomHandler checks whether an error has a custom handler

func (NonRetriableCtrlError) IsRetriable

func (cerr NonRetriableCtrlError) IsRetriable() bool

IsRetriable exposes if the error is retriable or not

type RunModeType added in v0.1.47

type RunModeType string

type SafeRecorder added in v0.1.10

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

func NewSafeRecorder added in v0.1.10

func NewSafeRecorder(name string, mgr manager.Manager) *SafeRecorder

func (*SafeRecorder) AnnotatedEventf added in v0.1.10

func (sr *SafeRecorder) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{})

AnnotatedEventf is just like eventf, but with annotations attached

func (*SafeRecorder) Event added in v0.1.10

func (sr *SafeRecorder) Event(object runtime.Object, eventtype, reason, message string)

func (*SafeRecorder) Eventf added in v0.1.10

func (sr *SafeRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{})

Eventf is just like Event, but with Sprintf for the message field.

Jump to

Keyboard shortcuts

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