mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-10 18:06:55 +00:00
* feat: add interface for image verify cache Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: add basic client for cache Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: add ttl to client Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: add flags and flag setup Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: added a default image verify cache Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: add propogation of cache to image verifier Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: add useCache to image verification types Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * bug: add ivcache to image verifier Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: add logger to cache Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * typo: DisabledImageVerfiyCache Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * typo: DisabledImageVerfiyCache Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * Update cmd/internal/flag.go Signed-off-by: shuting <shutting06@gmail.com> * feat: add use cache to v2beta1 crd Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * bug: change public attribute TTL to private Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * fix: replace nil in test with disabled cache Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * fix: convert ttl time to time.Duration Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: update opts to use time.Duration Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat:add policy version and remove delete functions by adding policy version, old entries will automatically become outdated and we will not have to remove them manually Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: remove clear and update get and set to take interface as input Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * style: fix lint issue Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> --------- Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> Signed-off-by: shuting <shutting06@gmail.com> Co-authored-by: shuting <shutting06@gmail.com> Co-authored-by: shuting <shuting@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
211 lines
11 KiB
Go
211 lines
11 KiB
Go
/*
|
|
Copyright The Kubernetes Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
|
|
|
package v1
|
|
|
|
import (
|
|
v1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
|
)
|
|
|
|
// ImageVerificationApplyConfiguration represents an declarative configuration of the ImageVerification type for use
|
|
// with apply.
|
|
type ImageVerificationApplyConfiguration struct {
|
|
Type *v1.ImageVerificationType `json:"type,omitempty"`
|
|
Image *string `json:"image,omitempty"`
|
|
ImageReferences []string `json:"imageReferences,omitempty"`
|
|
Key *string `json:"key,omitempty"`
|
|
Roots *string `json:"roots,omitempty"`
|
|
Subject *string `json:"subject,omitempty"`
|
|
Issuer *string `json:"issuer,omitempty"`
|
|
AdditionalExtensions map[string]string `json:"additionalExtensions,omitempty"`
|
|
Attestors []AttestorSetApplyConfiguration `json:"attestors,omitempty"`
|
|
Attestations []AttestationApplyConfiguration `json:"attestations,omitempty"`
|
|
Annotations map[string]string `json:"annotations,omitempty"`
|
|
Repository *string `json:"repository,omitempty"`
|
|
MutateDigest *bool `json:"mutateDigest,omitempty"`
|
|
VerifyDigest *bool `json:"verifyDigest,omitempty"`
|
|
Required *bool `json:"required,omitempty"`
|
|
ImageRegistryCredentials *ImageRegistryCredentialsApplyConfiguration `json:"imageRegistryCredentials,omitempty"`
|
|
UseCache *bool `json:"useCache,omitempty"`
|
|
}
|
|
|
|
// ImageVerificationApplyConfiguration constructs an declarative configuration of the ImageVerification type for use with
|
|
// apply.
|
|
func ImageVerification() *ImageVerificationApplyConfiguration {
|
|
return &ImageVerificationApplyConfiguration{}
|
|
}
|
|
|
|
// WithType sets the Type field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Type field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithType(value v1.ImageVerificationType) *ImageVerificationApplyConfiguration {
|
|
b.Type = &value
|
|
return b
|
|
}
|
|
|
|
// WithImage sets the Image field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Image field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithImage(value string) *ImageVerificationApplyConfiguration {
|
|
b.Image = &value
|
|
return b
|
|
}
|
|
|
|
// WithImageReferences adds the given value to the ImageReferences field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the ImageReferences field.
|
|
func (b *ImageVerificationApplyConfiguration) WithImageReferences(values ...string) *ImageVerificationApplyConfiguration {
|
|
for i := range values {
|
|
b.ImageReferences = append(b.ImageReferences, values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithKey sets the Key field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Key field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithKey(value string) *ImageVerificationApplyConfiguration {
|
|
b.Key = &value
|
|
return b
|
|
}
|
|
|
|
// WithRoots sets the Roots field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Roots field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithRoots(value string) *ImageVerificationApplyConfiguration {
|
|
b.Roots = &value
|
|
return b
|
|
}
|
|
|
|
// WithSubject sets the Subject field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Subject field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithSubject(value string) *ImageVerificationApplyConfiguration {
|
|
b.Subject = &value
|
|
return b
|
|
}
|
|
|
|
// WithIssuer sets the Issuer field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Issuer field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithIssuer(value string) *ImageVerificationApplyConfiguration {
|
|
b.Issuer = &value
|
|
return b
|
|
}
|
|
|
|
// WithAdditionalExtensions puts the entries into the AdditionalExtensions field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, the entries provided by each call will be put on the AdditionalExtensions field,
|
|
// overwriting an existing map entries in AdditionalExtensions field with the same key.
|
|
func (b *ImageVerificationApplyConfiguration) WithAdditionalExtensions(entries map[string]string) *ImageVerificationApplyConfiguration {
|
|
if b.AdditionalExtensions == nil && len(entries) > 0 {
|
|
b.AdditionalExtensions = make(map[string]string, len(entries))
|
|
}
|
|
for k, v := range entries {
|
|
b.AdditionalExtensions[k] = v
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithAttestors adds the given value to the Attestors field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the Attestors field.
|
|
func (b *ImageVerificationApplyConfiguration) WithAttestors(values ...*AttestorSetApplyConfiguration) *ImageVerificationApplyConfiguration {
|
|
for i := range values {
|
|
if values[i] == nil {
|
|
panic("nil value passed to WithAttestors")
|
|
}
|
|
b.Attestors = append(b.Attestors, *values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithAttestations adds the given value to the Attestations field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, values provided by each call will be appended to the Attestations field.
|
|
func (b *ImageVerificationApplyConfiguration) WithAttestations(values ...*AttestationApplyConfiguration) *ImageVerificationApplyConfiguration {
|
|
for i := range values {
|
|
if values[i] == nil {
|
|
panic("nil value passed to WithAttestations")
|
|
}
|
|
b.Attestations = append(b.Attestations, *values[i])
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
|
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
|
// overwriting an existing map entries in Annotations field with the same key.
|
|
func (b *ImageVerificationApplyConfiguration) WithAnnotations(entries map[string]string) *ImageVerificationApplyConfiguration {
|
|
if b.Annotations == nil && len(entries) > 0 {
|
|
b.Annotations = make(map[string]string, len(entries))
|
|
}
|
|
for k, v := range entries {
|
|
b.Annotations[k] = v
|
|
}
|
|
return b
|
|
}
|
|
|
|
// WithRepository sets the Repository field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Repository field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithRepository(value string) *ImageVerificationApplyConfiguration {
|
|
b.Repository = &value
|
|
return b
|
|
}
|
|
|
|
// WithMutateDigest sets the MutateDigest field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the MutateDigest field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithMutateDigest(value bool) *ImageVerificationApplyConfiguration {
|
|
b.MutateDigest = &value
|
|
return b
|
|
}
|
|
|
|
// WithVerifyDigest sets the VerifyDigest field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the VerifyDigest field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithVerifyDigest(value bool) *ImageVerificationApplyConfiguration {
|
|
b.VerifyDigest = &value
|
|
return b
|
|
}
|
|
|
|
// WithRequired sets the Required field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the Required field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithRequired(value bool) *ImageVerificationApplyConfiguration {
|
|
b.Required = &value
|
|
return b
|
|
}
|
|
|
|
// WithImageRegistryCredentials sets the ImageRegistryCredentials field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the ImageRegistryCredentials field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithImageRegistryCredentials(value *ImageRegistryCredentialsApplyConfiguration) *ImageVerificationApplyConfiguration {
|
|
b.ImageRegistryCredentials = value
|
|
return b
|
|
}
|
|
|
|
// WithUseCache sets the UseCache field in the declarative configuration to the given value
|
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
|
// If called multiple times, the UseCache field is set to the value of the last call.
|
|
func (b *ImageVerificationApplyConfiguration) WithUseCache(value bool) *ImageVerificationApplyConfiguration {
|
|
b.UseCache = &value
|
|
return b
|
|
}
|