controllers

package
v0.0.0-...-e8aa77b Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const FinalizerName = "diagnostic.ibm.com/finalizer"
View Source
const OperatorVersion = "0.247.20211115"
View Source
const ResultProcessing = "Processing..."
View Source
const UseLdLinuxDirect = true

Setting this to false doesn't work because of errors such as:

symbol lookup error: .../lib64/libc.so.6: undefined symbol: _dl_catch_error_ptr, version GLIBC_PRIVATE

This is because the ld-linux in the image may not match what the binaries need (e.g. specific glibc), So we need to use the ld-linux used by the containerdiagsmall image (see GetExecutionCommand). Thus we have to launch with an explicit call to ld-linux. See https://www.kernel.org/doc/man-pages/online/pages/man8/ld-linux.so.8.html

Variables

View Source
var StatusEnumNames = []string{
	"uninitialized",
	"processing",
	"success",
	"error",
	"mixed",
}

Functions

func AddDirectCallEnvars

func AddDirectCallEnvars(localFile *os.File, containerTmpFilesPrefix string)

func Cleanup

func Cleanup(logger *CustomLogger, localScratchSpaceDirectory string)

func CopyFile

func CopyFile(src string, dest string) error

func CurrentTimeAsString

func CurrentTimeAsString() string

func DoesFileExist

func DoesFileExist(path string) (bool, error)

func GetExecutionCommand

func GetExecutionCommand(containerTmpFilesPrefix string, command string, arguments string) string

func GetUniqueIdentifier

func GetUniqueIdentifier() string

func IsInitialStatus

func IsInitialStatus(containerDiagnostic *diagnosticv1.ContainerDiagnostic) bool
func ProcessSymlinks(check string, filesToTar map[string]bool, logger *CustomLogger)

func WriteExecutionLine

func WriteExecutionLine(fileWriter *os.File, containerTmpFilesPrefix string, command string, arguments string, redirectOutput bool, outputFile string, background bool)

Types

type ContainerDiagnosticReconciler

type ContainerDiagnosticReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	Config        *rest.Config
	EventRecorder record.EventRecorder
}

ContainerDiagnosticReconciler reconciles a ContainerDiagnostic object

func (*ContainerDiagnosticReconciler) CommandScript

func (r *ContainerDiagnosticReconciler) CommandScript(ctx context.Context, req ctrl.Request, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger) (ctrl.Result, error)

func (*ContainerDiagnosticReconciler) CommandVersion

func (r *ContainerDiagnosticReconciler) CommandVersion(ctx context.Context, req ctrl.Request, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger) (ctrl.Result, error)

func (*ContainerDiagnosticReconciler) EnsureDirectoriesOnContainer

func (r *ContainerDiagnosticReconciler) EnsureDirectoriesOnContainer(ctx context.Context, req ctrl.Request, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger, pod *corev1.Pod, container corev1.Container, contextTracker *ContextTracker, uuid string) (response string, ok bool)

func (*ContainerDiagnosticReconciler) ExecInContainer

func (r *ContainerDiagnosticReconciler) ExecInContainer(pod *corev1.Pod, container corev1.Container, command []string, stdout *bytes.Buffer, stderr *bytes.Buffer, stdin *bufio.Reader, stdoutWriter *bufio.Writer) error

func (*ContainerDiagnosticReconciler) ExecuteLocalCommand

func (r *ContainerDiagnosticReconciler) ExecuteLocalCommand(logger *CustomLogger, containerDiagnostic *diagnosticv1.ContainerDiagnostic, command string, arguments ...string) (output []byte, err error)

func (*ContainerDiagnosticReconciler) Finalize

func (r *ContainerDiagnosticReconciler) Finalize(logger *CustomLogger, containerDiagnostic *diagnosticv1.ContainerDiagnostic) error

func (*ContainerDiagnosticReconciler) FindSharedLibraries

func (r *ContainerDiagnosticReconciler) FindSharedLibraries(logger *CustomLogger, containerDiagnostic *diagnosticv1.ContainerDiagnostic, command string) ([]string, bool)

func (*ContainerDiagnosticReconciler) ProcessInstallCommand

func (r *ContainerDiagnosticReconciler) ProcessInstallCommand(fullCommand string, filesToTar map[string]bool, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger) bool

func (*ContainerDiagnosticReconciler) ProcessResult

func (r *ContainerDiagnosticReconciler) ProcessResult(result ctrl.Result, err error, ctx context.Context, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger) (ctrl.Result, error)

func (*ContainerDiagnosticReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. Compare the state specified by the ContainerDiagnostic object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*ContainerDiagnosticReconciler) RecordEventInfo

func (r *ContainerDiagnosticReconciler) RecordEventInfo(message string, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger)

func (*ContainerDiagnosticReconciler) RecordEventWarning

func (r *ContainerDiagnosticReconciler) RecordEventWarning(err error, message string, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger)

func (*ContainerDiagnosticReconciler) RunScriptOnContainer

func (r *ContainerDiagnosticReconciler) RunScriptOnContainer(ctx context.Context, req ctrl.Request, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger, pod *corev1.Pod, container corev1.Container, contextTracker *ContextTracker)

func (*ContainerDiagnosticReconciler) RunScriptOnPod

func (r *ContainerDiagnosticReconciler) RunScriptOnPod(ctx context.Context, req ctrl.Request, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger, pod *corev1.Pod, contextTracker *ContextTracker)

func (*ContainerDiagnosticReconciler) SetStatus

func (r *ContainerDiagnosticReconciler) SetStatus(status StatusEnum, message string, containerDiagnostic *diagnosticv1.ContainerDiagnostic, logger *CustomLogger)

func (*ContainerDiagnosticReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ContextTracker

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

type CustomLogger

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

func (*CustomLogger) AppendToLocalFile

func (l *CustomLogger) AppendToLocalFile(str string)

func (*CustomLogger) CloseLocalFile

func (l *CustomLogger) CloseLocalFile()

func (*CustomLogger) Debug1

func (l *CustomLogger) Debug1(str string)

func (*CustomLogger) Debug2

func (l *CustomLogger) Debug2(str string)

func (*CustomLogger) Debug3

func (l *CustomLogger) Debug3(str string)

func (*CustomLogger) Error

func (l *CustomLogger) Error(err error, str string)

func (*CustomLogger) Info

func (l *CustomLogger) Info(str string)

func (*CustomLogger) OpenLocalFile

func (l *CustomLogger) OpenLocalFile(fileName string) error

type StatusEnum

type StatusEnum int
const (
	StatusUninitialized StatusEnum = iota
	StatusProcessing
	StatusSuccess
	StatusError
	StatusMixed
)

func (StatusEnum) ToString

func (se StatusEnum) ToString() string

func (StatusEnum) Value

func (se StatusEnum) Value() int

Jump to

Keyboard shortcuts

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