config

package
v0.9.0 Latest Latest
Warning

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

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

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

View Source
const (
	// ImagePoliciesConfigName is the name of ConfigMap created by the
	// reconciler and consumed by the admission webhook.
	ImagePoliciesConfigName = "config-image-policies"
)
View Source
const (
	// SigstoreKeysConfigName is the name of ConfigMap created by the
	// reconciler and consumed by the admission webhook for determining
	// which Keys/Certificates are trusted for things like Fulcio/Rekor, etc.
	SigstoreKeysConfigName = "config-sigstore-keys"
)

Variables

This section is empty.

Functions

func ConvertCertificateAuthority added in v0.6.0

func ConvertCertificateAuthority(source v1alpha1.CertificateAuthority) (*pbtrustroot.CertificateAuthority, error)

ConvertCertificateAuthority converts public into private CertificateAuthority

func ConvertTransparencyLogInstance added in v0.6.0

func ConvertTransparencyLogInstance(source v1alpha1.TransparencyLogInstance) (*pbtrustroot.TransparencyLogInstance, error)

ConvertTransparencyLogInstance converts public into private TransparencyLogInstance.

func DeserializeCertChain added in v0.9.0

func DeserializeCertChain(chain []byte) (*pbcommon.X509CertificateChain, error)

func DeserializePublicKey added in v0.9.0

func DeserializePublicKey(publicKey []byte) (*pbcommon.PublicKey, crypto.PublicKey, error)

func HashStringToHashAlgorithm added in v0.9.0

func HashStringToHashAlgorithm(hash string) pbcommon.HashAlgorithm

func SerializeCertChain added in v0.9.0

func SerializeCertChain(certChain *pbcommon.X509CertificateChain) []byte

func SerializePublicKey added in v0.9.0

func SerializePublicKey(publicKey *pbcommon.PublicKey) []byte

func ToContext

func ToContext(ctx context.Context, c *Config) context.Context

ToContext attaches the provided Config to the provided context, returning the new context with the Config attached.

Types

type CertificateAuthority added in v0.6.0

type CertificateAuthority = pbtrustroot.CertificateAuthority

type Config

type Config struct {
	ImagePolicyConfig  *ImagePolicyConfig
	SigstoreKeysConfig *SigstoreKeysMap
}

Config holds the collection of configurations that we attach to contexts. +k8s:deepcopy-gen=false

func FromContext

func FromContext(ctx context.Context) *Config

FromContext extracts a Config from the provided context.

func FromContextOrDefaults

func FromContextOrDefaults(ctx context.Context) *Config

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 DistinguishedName added in v0.6.0

type DistinguishedName = pbcommon.DistinguishedName

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 LogID added in v0.9.0

type LogID = pbcommon.LogId

type SigstoreKeys added in v0.6.0

type SigstoreKeys = pbtrustroot.TrustedRoot

SigstoreKeys contains all the necessary Keys and Certificates for validating against a specific instance of Sigstore.

func ConvertSigstoreKeys added in v0.9.0

func ConvertSigstoreKeys(_ context.Context, source *v1alpha1.SigstoreKeys) (sk *SigstoreKeys, err error)

ConvertSigstoreKeys takes a source and converts into a SigstoreKeys suitable for serialization into a ConfigMap entry.

type SigstoreKeysMap added in v0.6.0

type SigstoreKeysMap struct {
	SigstoreKeys map[string]*SigstoreKeys
}

func NewSigstoreKeysFromConfigMap added in v0.6.0

func NewSigstoreKeysFromConfigMap(config *corev1.ConfigMap) (*SigstoreKeysMap, error)

NewImagePoliciesConfigFromConfigMap creates a Features from the supplied ConfigMap

func NewSigstoreKeysFromMap added in v0.6.0

func NewSigstoreKeysFromMap(data map[string]string) (*SigstoreKeysMap, error)

NewSigstoreKeysFromMap creates a map of SigstoreKeys to use for validation.

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

func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value interface{})) *Store

NewStore creates a new store of Configs and optionally calls functions when ConfigMaps are updated.

func (*Store) Load

func (s *Store) Load() *Config

Load creates a Config from the current config state of the Store.

func (*Store) ToContext

func (s *Store) ToContext(ctx context.Context) context.Context

ToContext attaches the current Config state to the provided context.

type TimeRange added in v0.9.0

type TimeRange = pbcommon.TimeRange

type Timestamp added in v0.9.0

type Timestamp = timestamppb.Timestamp

type TransparencyLogInstance added in v0.6.0

type TransparencyLogInstance = pbtrustroot.TransparencyLogInstance

Jump to

Keyboard shortcuts

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