Documentation ¶
Index ¶
- Constants
- Variables
- func AddDirectCallEnvars(localFile *os.File, containerTmpFilesPrefix string)
- func Cleanup(logger *CustomLogger, localScratchSpaceDirectory string)
- func CopyFile(src string, dest string) error
- func CurrentTimeAsString() string
- func DoesFileExist(path string) (bool, error)
- func GetExecutionCommand(containerTmpFilesPrefix string, command string, arguments string) string
- func GetUniqueIdentifier() string
- func IsInitialStatus(containerDiagnostic *diagnosticv1.ContainerDiagnostic) bool
- func ProcessSymlinks(check string, filesToTar map[string]bool, logger *CustomLogger)
- func WriteExecutionLine(fileWriter *os.File, containerTmpFilesPrefix string, command string, ...)
- type ContainerDiagnosticReconciler
- func (r *ContainerDiagnosticReconciler) CommandScript(ctx context.Context, req ctrl.Request, ...) (ctrl.Result, error)
- func (r *ContainerDiagnosticReconciler) CommandVersion(ctx context.Context, req ctrl.Request, ...) (ctrl.Result, error)
- func (r *ContainerDiagnosticReconciler) EnsureDirectoriesOnContainer(ctx context.Context, req ctrl.Request, ...) (response string, ok bool)
- func (r *ContainerDiagnosticReconciler) ExecInContainer(pod *corev1.Pod, container corev1.Container, command []string, ...) error
- func (r *ContainerDiagnosticReconciler) ExecuteLocalCommand(logger *CustomLogger, containerDiagnostic *diagnosticv1.ContainerDiagnostic, ...) (output []byte, err error)
- func (r *ContainerDiagnosticReconciler) Finalize(logger *CustomLogger, containerDiagnostic *diagnosticv1.ContainerDiagnostic) error
- func (r *ContainerDiagnosticReconciler) FindSharedLibraries(logger *CustomLogger, containerDiagnostic *diagnosticv1.ContainerDiagnostic, ...) ([]string, bool)
- func (r *ContainerDiagnosticReconciler) ProcessInstallCommand(fullCommand string, filesToTar map[string]bool, ...) bool
- func (r *ContainerDiagnosticReconciler) ProcessResult(result ctrl.Result, err error, ctx context.Context, ...) (ctrl.Result, error)
- func (r *ContainerDiagnosticReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *ContainerDiagnosticReconciler) RecordEventInfo(message string, containerDiagnostic *diagnosticv1.ContainerDiagnostic, ...)
- func (r *ContainerDiagnosticReconciler) RecordEventWarning(err error, message string, ...)
- func (r *ContainerDiagnosticReconciler) RunScriptOnContainer(ctx context.Context, req ctrl.Request, ...)
- func (r *ContainerDiagnosticReconciler) RunScriptOnPod(ctx context.Context, req ctrl.Request, ...)
- func (r *ContainerDiagnosticReconciler) SetStatus(status StatusEnum, message string, ...)
- func (r *ContainerDiagnosticReconciler) SetupWithManager(mgr ctrl.Manager) error
- type ContextTracker
- type CustomLogger
- func (l *CustomLogger) AppendToLocalFile(str string)
- func (l *CustomLogger) CloseLocalFile()
- func (l *CustomLogger) Debug1(str string)
- func (l *CustomLogger) Debug2(str string)
- func (l *CustomLogger) Debug3(str string)
- func (l *CustomLogger) Error(err error, str string)
- func (l *CustomLogger) Info(str string)
- func (l *CustomLogger) OpenLocalFile(fileName string) error
- type StatusEnum
Constants ¶
const FinalizerName = "diagnostic.ibm.com/finalizer"
const OperatorVersion = "0.247.20211115"
const ResultProcessing = "Processing..."
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 ¶
var StatusEnumNames = []string{
"uninitialized",
"processing",
"success",
"error",
"mixed",
}
Functions ¶
func AddDirectCallEnvars ¶
func Cleanup ¶
func Cleanup(logger *CustomLogger, localScratchSpaceDirectory string)
func CurrentTimeAsString ¶
func CurrentTimeAsString() string
func DoesFileExist ¶
func GetExecutionCommand ¶
func GetUniqueIdentifier ¶
func GetUniqueIdentifier() string
func IsInitialStatus ¶
func IsInitialStatus(containerDiagnostic *diagnosticv1.ContainerDiagnostic) bool
func ProcessSymlinks ¶
func ProcessSymlinks(check string, filesToTar map[string]bool, logger *CustomLogger)
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 (*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 ¶
func (r *ContainerDiagnosticReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
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