k8s

package
v0.0.0-...-31c609f Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentContext

func GetCurrentContext() (string, string, error)

GetCurrentContext returns the current Kubernetes context and cluster name

func RunKubectlCommand

func RunKubectlCommand(args ...string) ([]byte, error)

RunKubectlCommand executes a kubectl command and returns the output

Types

type CommandExecutor

type CommandExecutor interface {
	Run(args ...string) ([]byte, error)
}

CommandExecutor defines how we run commands

var Executor CommandExecutor = RealExecutor{}

Executor is the variable we use to run commands.

type RealExecutor

type RealExecutor struct{}

RealExecutor runs actual kubectl commands

func (RealExecutor) Run

func (r RealExecutor) Run(args ...string) ([]byte, error)

type SimplePolicy

type SimplePolicy struct {
	Name                    string
	ValidationFailureAction string
	Rules                   []SimpleRule
}

SimplePolicy matches the interface expected by the cmd package

func GetAllPolicies

func GetAllPolicies() ([]SimplePolicy, error)

GetAllPolicies retrieves all Kyverno policies using kubectl

func GetPolicy

func GetPolicy(name string) (*SimplePolicy, error)

GetPolicy retrieves a specific Kyverno policy by name using kubectl

type SimplePolicyReport

type SimplePolicyReport struct {
	Policy    string
	Namespace string
	Resource  string
	Status    string
	Message   string
}

SimplePolicyReport for CLI output

func GetAllPolicyReports

func GetAllPolicyReports(filter string) ([]SimplePolicyReport, error)

GetAllPolicyReports retrieves all policy reports from the cluster

func GetPolicyResources

func GetPolicyResources(policyName string) ([]SimplePolicyReport, error)

GetPolicyResources retrieves all resources affected by a specific policy

type SimpleRule

type SimpleRule struct {
	Name string
}

Jump to

Keyboard shortcuts

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