handler

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright 2023 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// ENoExecEventErrorLabel is the label key used to mark an ENoExecEvent CR as having encountered an error during reconciliation
	ENoExecEventErrorLabel = "multiarch.openshift.io/enoexec-event-error"
	// Label values for error reasons (stored in ENoExecEventErrorLabel)
	ErrorReasonPodNotFound       = "pod-not-found"
	ErrorReasonNodeNotFound      = "node-not-found"
	ErrorReasonContainerNotFound = "container-not-found"
	ErrorReasonWrongNamespace    = "wrong-namespace"
	ErrorReasonReconciliation    = "reconciliation-error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ENoExecEvent added in v1.3.0

type ENoExecEvent struct {
	multiarchv1beta1.ENoExecEvent
	// contains filtered or unexported fields
}

ENoExecEvent wraps the multiarchv1beta1.ENoExecEvent with additional context and event recording capabilities

func NewENoExecEvent added in v1.3.0

func NewENoExecEvent(event *multiarchv1beta1.ENoExecEvent, ctx context.Context, recorder record.EventRecorder) *ENoExecEvent

NewENoExecEvent creates a new ENoExecEvent wrapper

func (*ENoExecEvent) Ctx added in v1.3.0

func (e *ENoExecEvent) Ctx() context.Context

Ctx returns the context associated with the ENoExecEvent

func (*ENoExecEvent) ENoExecEventObject added in v1.3.0

func (e *ENoExecEvent) ENoExecEventObject() *multiarchv1beta1.ENoExecEvent

ENoExecEventObject returns the underlying ENoExecEvent object

func (*ENoExecEvent) EnsureLabel added in v1.3.0

func (e *ENoExecEvent) EnsureLabel(label string, value string)

EnsureLabel ensures that the ENoExecEvent has the given label with the given value

func (*ENoExecEvent) EnsureNoLabel added in v1.3.0

func (e *ENoExecEvent) EnsureNoLabel(label string)

EnsureNoLabel ensures that the ENoExecEvent does not have the given label

func (*ENoExecEvent) HasErrorLabel added in v1.3.0

func (e *ENoExecEvent) HasErrorLabel() bool

HasErrorLabel returns true if the ENoExecEvent has the error label (regardless of value)

func (*ENoExecEvent) IsMarkedAsError added in v1.3.0

func (e *ENoExecEvent) IsMarkedAsError() bool

IsMarkedAsError returns true if the ENoExecEvent has been marked with an error label

func (*ENoExecEvent) MarkAsError added in v1.3.0

func (e *ENoExecEvent) MarkAsError()

MarkAsError marks the ENoExecEvent CR as having encountered a reconciliation error This allows the cleanup logic to identify and bypass errored CRs during plugin disable/uninstall

func (*ENoExecEvent) PublishEvent added in v1.3.0

func (e *ENoExecEvent) PublishEvent(eventType, reason, message string)

PublishEvent publishes a Kubernetes event for the ENoExecEvent CR

func (*ENoExecEvent) PublishEventOnPod added in v1.3.0

func (e *ENoExecEvent) PublishEventOnPod(pod *corev1.Pod, eventType, reason, message string)

PublishEventOnPod publishes a Kubernetes event on the source pod referenced by this ENoExecEvent This provides visibility of the reconciliation error in the pod's event log

func (*ENoExecEvent) Recorder added in v1.3.0

func (e *ENoExecEvent) Recorder() record.EventRecorder

Recorder returns the EventRecorder associated with the ENoExecEvent

type Reconciler

type Reconciler struct {
	client.Client

	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

Reconciler reconciles a ENoExecEvent object

func NewReconciler

func NewReconciler(client client.Client, clientSet *kubernetes.Clientset, scheme *runtime.Scheme, recorder record.EventRecorder) *Reconciler

func (*Reconciler) Reconcile

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

Reconcile will reconcile the ENoExecEvent resource. It will fetch the ENoExecEvent instance, retrieve the pod and node information, label the pod with the ENoExecEvent label, update the metrics, and publish an event. Finally, it will delete the ENoExecEvent resource if the reconciliation was successful or if the pod was not found.

func (*Reconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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