rules

package
v0.2.159 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPodOwner

func ExtractPodOwner(pod *corev1.Pod, clientset kubernetes.Interface) (string, string, string, string)

ExtractPodOwner returns the kind, name, namespace, and UID of the controller that owns the pod. The UID is captured from OwnerReferences or during resolution to avoid duplicate API calls.

func GetContainerID added in v0.2.128

func GetContainerID(pod *corev1.Pod, containerName string) string

GetContainerID returns the container ID for the given container name from the pod status. It checks regular containers, init containers, and ephemeral containers. When containerName is empty, falls back to the first container (matching Kubernetes default behavior). Returns an empty string if the container is not found or pod is nil.

func GetContainerImage added in v0.2.131

func GetContainerImage(pod *corev1.Pod, containerName string) string

GetContainerImage returns the container image name for the given container name from the pod spec. When containerName is empty, falls back to the first container (matching Kubernetes default behavior).

func GetContainerImageDigest added in v0.2.131

func GetContainerImageDigest(pod *corev1.Pod, containerName string) string

GetContainerImageDigest returns the image digest (from ImageID) for the given container name from the pod status. The "docker-pullable://" prefix is stripped so the result is a clean registry digest reference. When containerName is empty, falls back to the first container (matching Kubernetes default behavior).

func GetContainerNameFromExecToPodEvent

func GetContainerNameFromExecToPodEvent(event admission.Attributes) (string, error)

GetContainerNameFromExecToPodEvent returns the container name from the admission event for exec operations.

func GetControllerDetails

func GetControllerDetails(event admission.Attributes, clientset kubernetes.Interface) (*corev1.Pod, string, string, string, string, string, error)

GetControllerDetails returns the pod and controller details (pod, kind, name, namespace, uid, and node name). The workload UID is captured during owner resolution to avoid duplicate API calls.

func GetPodDetails

func GetPodDetails(clientset kubernetes.Interface, podName, namespace string) (*corev1.Pod, error)

GetPodDetails returns the pod details from the Kubernetes API server.

Types

type GenericRuleFailure

type GenericRuleFailure struct {
	BaseRuntimeAlert       apitypes.BaseRuntimeAlert
	RuntimeProcessDetails  apitypes.ProcessTree
	RuleAlert              apitypes.RuleAlert
	AdmissionAlert         apitypes.AdmissionAlert
	RuntimeAlertK8sDetails apitypes.RuntimeAlertK8sDetails
	RuleID                 string
}

func (*GenericRuleFailure) GetAdmissionsAlert

func (rule *GenericRuleFailure) GetAdmissionsAlert() apitypes.AdmissionAlert

func (*GenericRuleFailure) GetBaseRuntimeAlert

func (rule *GenericRuleFailure) GetBaseRuntimeAlert() apitypes.BaseRuntimeAlert

func (*GenericRuleFailure) GetRuleAlert

func (rule *GenericRuleFailure) GetRuleAlert() apitypes.RuleAlert

func (*GenericRuleFailure) GetRuleId

func (rule *GenericRuleFailure) GetRuleId() string

func (*GenericRuleFailure) GetRuntimeAlertK8sDetails

func (rule *GenericRuleFailure) GetRuntimeAlertK8sDetails() apitypes.RuntimeAlertK8sDetails

func (*GenericRuleFailure) GetRuntimeProcessDetails

func (rule *GenericRuleFailure) GetRuntimeProcessDetails() apitypes.ProcessTree

func (*GenericRuleFailure) SetAdmissionsAlert

func (rule *GenericRuleFailure) SetAdmissionsAlert(admissionsAlert apitypes.AdmissionAlert)

func (*GenericRuleFailure) SetBaseRuntimeAlert

func (rule *GenericRuleFailure) SetBaseRuntimeAlert(baseRuntimeAlert apitypes.BaseRuntimeAlert)

func (*GenericRuleFailure) SetRuleAlert

func (rule *GenericRuleFailure) SetRuleAlert(ruleAlert apitypes.RuleAlert)

func (*GenericRuleFailure) SetRuntimeAlertK8sDetails

func (rule *GenericRuleFailure) SetRuntimeAlertK8sDetails(runtimeAlertK8sDetails apitypes.RuntimeAlertK8sDetails)

func (*GenericRuleFailure) SetRuntimeProcessDetails

func (rule *GenericRuleFailure) SetRuntimeProcessDetails(runtimeProcessDetails apitypes.ProcessTree)

func (*GenericRuleFailure) SetWorkloadDetails

func (rule *GenericRuleFailure) SetWorkloadDetails(workloadDetails string)

Jump to

Keyboard shortcuts

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