autogen

package
v1.12.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// PodControllerCronJob represent CronJob string
	PodControllerCronJob = "CronJob"
)

Variables

View Source
var (
	PodControllers = sets.New("DaemonSet", "Deployment", "Job", "StatefulSet", "ReplicaSet", "ReplicationController", "CronJob")
)

Functions

func CanAutoGen

func CanAutoGen(spec *kyvernov1.Spec) (applyAutoGen bool, controllers sets.Set[string])

CanAutoGen checks whether the rule(s) (in policy) can be applied to Pod controllers returns controllers as: - "" if:

  • name or selector is defined
  • mixed kinds (Pod + pod controller) is defined
  • Pod and PodControllers are not defined
  • mutate.Patches/mutate.PatchesJSON6902/validate.deny/generate rule is defined

- otherwise it returns all pod controllers

func ComputeRules

func ComputeRules(p kyvernov1.PolicyInterface, kind string) []kyvernov1.Rule

func GetControllers

func GetControllers(meta *metav1.ObjectMeta, spec *kyvernov1.Spec) ([]string, []string, []string)

GetControllers computes the autogen controllers that should be applied to a policy. It returns the requested, supported and effective controllers (intersection of requested and supported ones).

func GetRequestedControllers

func GetRequestedControllers(meta *metav1.ObjectMeta) sets.Set[string]

GetRequestedControllers returns the requested autogen controllers based on object annotations.

func GetSupportedControllers

func GetSupportedControllers(spec *kyvernov1.Spec) sets.Set[string]

GetSupportedControllers returns the supported autogen controllers for a given spec.

Types

This section is empty.

Jump to

Keyboard shortcuts

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