common

package
v1.13.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeneratePolicyLabel          = "generate.kyverno.io/policy-name"
	GeneratePolicyNamespaceLabel = "generate.kyverno.io/policy-namespace"
	GenerateRuleLabel            = "generate.kyverno.io/rule-name"
	GenerateTriggerNameLabel     = "generate.kyverno.io/trigger-name"
	GenerateTriggerUIDLabel      = "generate.kyverno.io/trigger-uid"
	GenerateTriggerNSLabel       = "generate.kyverno.io/trigger-namespace"
	GenerateTriggerKindLabel     = "generate.kyverno.io/trigger-kind"
	GenerateTriggerVersionLabel  = "generate.kyverno.io/trigger-version"
	GenerateTriggerGroupLabel    = "generate.kyverno.io/trigger-group"
	GenerateSourceNameLabel      = "generate.kyverno.io/source-name"
	GenerateSourceUIDLabel       = "generate.kyverno.io/source-uid"
	GenerateSourceNSLabel        = "generate.kyverno.io/source-namespace"
	GenerateSourceKindLabel      = "generate.kyverno.io/source-kind"
	GenerateSourceVersionLabel   = "generate.kyverno.io/source-version"
	GenerateSourceGroupLabel     = "generate.kyverno.io/source-group"
	GenerateTypeCloneSourceLabel = "generate.kyverno.io/clone-source"
)

Variables

This section is empty.

Functions

func FindDownstream added in v1.11.0

func FindDownstream(client dclient.Interface, apiVersion, kind string, labels map[string]string) (*unstructured.UnstructuredList, error)

func GenerateLabelsSet

func GenerateLabelsSet(policyKey string) pkglabels.Set

func GetResource

func GetResource(client dclient.Interface, resourceSpec kyvernov1.ResourceSpec, urSpec kyvernov2.UpdateRequestSpec, log logr.Logger) (resource *unstructured.Unstructured, err error)

func ManageLabels

func ManageLabels(unstr *unstructured.Unstructured, triggerResource unstructured.Unstructured, policy kyvernov1.PolicyInterface, ruleName string)

func MutateLabelsSet

func MutateLabelsSet(policyKey string, trigger Object) pkglabels.Set

func NewBackgroundContext

func NewBackgroundContext(
	logger logr.Logger,
	dclient dclient.Interface,
	urContext kyvernov2.UpdateRequestSpecContext,
	policy kyvernov1.PolicyInterface,
	trigger *unstructured.Unstructured,
	cfg config.Configuration,
	jp jmespath.Interface,
	namespaceLabels map[string]string,
) (*engine.PolicyContext, error)

func PolicyInfo added in v1.10.0

func PolicyInfo(labels map[string]string, policy kyvernov1.PolicyInterface, ruleName string)

func PolicyKey added in v1.10.0

func PolicyKey(namespace, name string) string

func ResourceSpecFromUnstructured added in v1.10.0

func ResourceSpecFromUnstructured(obj unstructured.Unstructured) kyvernov1.ResourceSpec

func TagSource added in v1.10.1

func TagSource(labels map[string]string, obj Object)

func TriggerInfo added in v1.10.0

func TriggerInfo(labels map[string]string, obj unstructured.Unstructured)

Types

type Object

type Object interface {
	GetName() string
	GetNamespace() string
	GetKind() string
	GetAPIVersion() string
	GetUID() types.UID
}

type StatusControlInterface

type StatusControlInterface interface {
	Failed(name string, message string, genResources []kyvernov1.ResourceSpec) (*kyvernov2.UpdateRequest, error)
	Success(name string, genResources []kyvernov1.ResourceSpec) (*kyvernov2.UpdateRequest, error)
	Skip(name string, genResources []kyvernov1.ResourceSpec) (*kyvernov2.UpdateRequest, error)
}

StatusControlInterface provides interface to update status subresource

Jump to

Keyboard shortcuts

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