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 ¶
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 { // AdditionalPodLabels are labels to be added to the created pods. If the a label key is already set by the pod constructor function it is not overwritten. AdditionalPodLabels map[string]string // WaitInterval is the time between wait API calls. WaitInterval time.Duration // WaitTimeout is the time waited for a pod to reach Running state or be deleted. WaitTimeout time.Duration // contains filtered or unexported fields }
SimplePodContext can create and delete pods.
func NewSimplePodContext ¶
func NewSimplePodContext(client client.Client, config *rest.Config, additionalPodLabels map[string]string) (*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.
type SimplePodExecutor ¶
type SimplePodExecutor struct { // WaitInterval is the time between retries of command runs. WaitInterval time.Duration // WaitTimeout is the max duration that a command can be retried before. WaitTimeout time.Duration // 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.
Click to show internal directories.
Click to hide internal directories.