autogen

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PodControllerCronJob represent CronJob string
	PodControllerCronJob = "CronJob"
	// PodControllers stores the list of Pod-controllers in csv string
	PodControllers = "DaemonSet,Deployment,Job,StatefulSet,ReplicaSet,ReplicationController,CronJob"
)

Variables

This section is empty.

Functions

func CanAutoGen

func CanAutoGen(spec *kyvernov1.Spec) (applyAutoGen bool, controllers 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) []kyvernov1.Rule

func GenerateRulePatches

func GenerateRulePatches(spec *kyvernov1.Spec, controllers string) (rulePatches [][]byte, errs []error)

GenerateRulePatches generates rule for podControllers based on scenario A and C

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) []string

GetRequestedControllers returns the requested autogen controllers based on object annotations.

func GetSupportedControllers

func GetSupportedControllers(spec *kyvernov1.Spec) []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