pod

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelInstanceID is used to group all pods created by a single ruleset.
	LabelInstanceID = "compliance.gardener.cloud/instanceID"

	// LabelComplianceRoleKey is used to label pods related to compliance operations in the cluster.
	LabelComplianceRoleKey = "compliance.gardener.cloud/role"

	// LabelComplianceRolePrivPod is used as the label value for LabelComplianceRoleKey indicating privileged diki pods.
	LabelComplianceRolePrivPod = "diki-privileged-pod"
)

Variables

This section is empty.

Functions

func NewPrivilegedPod

func NewPrivilegedPod(name, namespace, image, nodeName string, additionalLabels map[string]string) func() *corev1.Pod

NewPrivilegedPod creates a new privileged Pod.

Types

type PodContext

type PodContext interface {
	Create(ctx context.Context, podConstructorFn func() *corev1.Pod) (PodExecutor, error)
	Delete(ctx context.Context, name, namespace string) error
}

PodContext creates and deletes Pods.

type PodExecutor

type PodExecutor interface {
	Execute(ctx context.Context, command string, commandArg string) (string, error)
}

PodExecutor executes commands inside a pod.

type SimplePodContext

type SimplePodContext struct {

	// IntervalWait is the time between wait API calls.
	IntervalWait time.Duration
	// TimeoutWait is the time waited for a pod to reach Running state or be deleted.
	TimeoutWait time.Duration
	// contains filtered or unexported fields
}

SimplePodContext can create and delete pods.

func NewSimplePodContext

func NewSimplePodContext(client client.Client, config *rest.Config) (*SimplePodContext, error)

NewSimplePodContext creates a new SimplePodContext.

func (*SimplePodContext) Create

func (spc *SimplePodContext) Create(ctx context.Context, podConstructorFn func() *corev1.Pod) (PodExecutor, error)

Create creates a Pod and waits for it to get in Running state.

func (*SimplePodContext) Delete

func (spc *SimplePodContext) Delete(ctx context.Context, name, namespace string) error

Delete deletes a specific pod and waits for it to be deleted.

type SimplePodExecutor

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

SimplePodExecutor can execute commands in a pod.

func NewPodExecutor

func NewPodExecutor(client client.Client, config *rest.Config, name, namespace string) (*SimplePodExecutor, error)

NewPodExecutor creates a new SimplePodExecutor.

func (*SimplePodExecutor) Execute

func (spe *SimplePodExecutor) Execute(ctx context.Context, command string, commandArg string) (string, error)

Execute runs a command is a pod.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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