Documentation ¶
Overview ¶
Package config holds the typed objects that define the schemas for ConfigMap objects that pertain to our API objects. This ConfigMap gets created by the Reconciler by combining all the ClusterImagePolicy CR into a single ConfigMap so that the AdmissionController only needs to deal with a single resource when validationg.
Index ¶
Constants ¶
const ( // ImagePoliciesConfigName is the name of ConfigMap created by the // reconciler and consumed by the admission webhook. ImagePoliciesConfigName = "config-image-policies" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
ImagePolicyConfig *ImagePolicyConfig
}
Config holds the collection of configurations that we attach to contexts. +k8s:deepcopy-gen=false
func FromContext ¶
FromContext extracts a Config from the provided context.
func FromContextOrDefaults ¶
FromContextOrDefaults is like FromContext, but when no Config is attached it returns a Config populated with the defaults for each of the Config fields.
type ImagePolicyConfig ¶
type ImagePolicyConfig struct { // This is the list of ImagePolicies that a admission controller uses // to make policy decisions. Policies map[string]webhookcip.ClusterImagePolicy }
func NewImagePoliciesConfigFromConfigMap ¶
func NewImagePoliciesConfigFromConfigMap(config *corev1.ConfigMap) (*ImagePolicyConfig, error)
NewImagePoliciesConfigFromConfigMap creates a Features from the supplied ConfigMap
func NewImagePoliciesConfigFromMap ¶
func NewImagePoliciesConfigFromMap(data map[string]string) (*ImagePolicyConfig, error)
NewImagePoliciesConfigFromMap creates an ImagePolicyConfig from the supplied Map
func (*ImagePolicyConfig) GetMatchingPolicies ¶
func (p *ImagePolicyConfig) GetMatchingPolicies(image string, kind, apiVersion string, labels map[string]string) (map[string]webhookcip.ClusterImagePolicy, error)
GetMatchingPolicies returns all matching Policies and their Authorities that need to be matched for the given kind, version and labels (if provided) to then match the Image. Returned map contains the name of the CIP as the key, and a normalized ClusterImagePolicy for it.
type Store ¶
type Store struct {
*configmap.UntypedStore
}
Store is a typed wrapper around configmap.Untyped store to handle our configmaps. +k8s:deepcopy-gen=false
func NewStore ¶
NewStore creates a new store of Configs and optionally calls functions when ConfigMaps are updated.