mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
chore: bump k8s libs to 0.30 (#10285)
* chore: bump k8s libs to 0.30 Signed-off-by: ShutingZhao <shuting@nirmata.com> * chore: update crds Signed-off-by: ShutingZhao <shuting@nirmata.com> * chore: bump kubectl-validate Signed-off-by: ShutingZhao <shuting@nirmata.com> * chore: fix tests Signed-off-by: ShutingZhao <shuting@nirmata.com> * chore: fix panic Signed-off-by: ShutingZhao <shuting@nirmata.com> * chore: fix linter Signed-off-by: ShutingZhao <shuting@nirmata.com> * chore: bump k8s Signed-off-by: ShutingZhao <shuting@nirmata.com> * fix sum Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * codegen Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: indent Signed-off-by: ShutingZhao <shuting@nirmata.com> * chore: bump deps Signed-off-by: ShutingZhao <shuting@nirmata.com> --------- Signed-off-by: ShutingZhao <shuting@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
7fac1620cb
commit
5260b4f7bc
26 changed files with 2769 additions and 205 deletions
|
@ -239,6 +239,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
@ -298,6 +299,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
@ -619,6 +621,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
@ -678,6 +681,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ cleanupJobs:
|
||||||
|
|
||||||
# -- Node affinity constraints.
|
# -- Node affinity constraints.
|
||||||
nodeAffinity: {}
|
nodeAffinity: {}
|
||||||
|
|
||||||
clusterEphemeralReports:
|
clusterEphemeralReports:
|
||||||
|
|
||||||
# -- Enable cleanup cronjob
|
# -- Enable cleanup cronjob
|
||||||
|
|
|
@ -5,11 +5,11 @@ import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const CrdsFolder = "crds"
|
const crdsFolder = "crds"
|
||||||
|
|
||||||
//go:embed crds
|
//go:embed crds
|
||||||
var crdsFs embed.FS
|
var crdsFs embed.FS
|
||||||
|
|
||||||
func Crds() fs.FS {
|
func Crds() (fs.FS, error) {
|
||||||
return crdsFs
|
return fs.Sub(crdsFs, crdsFolder)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
factory, _ = resourceloader.New(openapiclient.NewComposite(openapiclient.NewLocalCRDFiles(data.Crds(), data.CrdsFolder)))
|
|
||||||
exceptionV2alpha1 = schema.GroupVersion(kyvernov2alpha1.GroupVersion).WithKind("PolicyException")
|
exceptionV2alpha1 = schema.GroupVersion(kyvernov2alpha1.GroupVersion).WithKind("PolicyException")
|
||||||
exceptionV2beta1 = schema.GroupVersion(kyvernov2beta1.GroupVersion).WithKind("PolicyException")
|
exceptionV2beta1 = schema.GroupVersion(kyvernov2beta1.GroupVersion).WithKind("PolicyException")
|
||||||
exceptionV2 = schema.GroupVersion(kyvernov2.GroupVersion).WithKind("PolicyException")
|
exceptionV2 = schema.GroupVersion(kyvernov2.GroupVersion).WithKind("PolicyException")
|
||||||
|
@ -45,6 +44,16 @@ func load(content []byte) ([]*kyvernov2beta1.PolicyException, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var exceptions []*kyvernov2beta1.PolicyException
|
var exceptions []*kyvernov2beta1.PolicyException
|
||||||
|
crds, err := data.Crds()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
factory, err := resourceloader.New(openapiclient.NewComposite(openapiclient.NewLocalCRDFiles(crds)))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
for _, document := range documents {
|
for _, document := range documents {
|
||||||
gvk, untyped, err := factory.Load(document)
|
gvk, untyped, err := factory.Load(document)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -28,10 +28,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
factory, _ = resourceloader.New(openapiclient.NewComposite(
|
|
||||||
openapiclient.NewHardcodedBuiltins("1.28"),
|
|
||||||
openapiclient.NewLocalCRDFiles(data.Crds(), data.CrdsFolder),
|
|
||||||
))
|
|
||||||
policyV1 = schema.GroupVersion(kyvernov1.GroupVersion).WithKind("Policy")
|
policyV1 = schema.GroupVersion(kyvernov1.GroupVersion).WithKind("Policy")
|
||||||
policyV2 = schema.GroupVersion(kyvernov2beta1.GroupVersion).WithKind("Policy")
|
policyV2 = schema.GroupVersion(kyvernov2beta1.GroupVersion).WithKind("Policy")
|
||||||
clusterPolicyV1 = schema.GroupVersion(kyvernov1.GroupVersion).WithKind("ClusterPolicy")
|
clusterPolicyV1 = schema.GroupVersion(kyvernov1.GroupVersion).WithKind("ClusterPolicy")
|
||||||
|
@ -125,6 +121,20 @@ func kubectlValidateLoader(path string, content []byte) (*LoaderResults, error)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
results := &LoaderResults{}
|
results := &LoaderResults{}
|
||||||
|
|
||||||
|
crds, err := data.Crds()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
factory, err := resourceloader.New(openapiclient.NewComposite(
|
||||||
|
openapiclient.NewHardcodedBuiltins("1.30"),
|
||||||
|
openapiclient.NewLocalCRDFiles(crds),
|
||||||
|
))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
for _, document := range documents {
|
for _, document := range documents {
|
||||||
gvk, untyped, err := factory.Load(document)
|
gvk, untyped, err := factory.Load(document)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -233,6 +233,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
@ -292,6 +293,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
@ -613,6 +615,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
@ -672,6 +675,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
|
|
@ -46378,6 +46378,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
@ -46437,6 +46438,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
@ -46758,6 +46760,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
@ -46817,6 +46820,7 @@ spec:
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
uid:
|
uid:
|
||||||
description: |-
|
description: |-
|
||||||
A unique value that identifies this user across time. If this user is
|
A unique value that identifies this user across time. If this user is
|
||||||
|
|
|
@ -33,18 +33,14 @@ func TestNew(t *testing.T) {
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
}, {
|
}, {
|
||||||
name: "builtin",
|
name: "builtin",
|
||||||
client: openapiclient.NewHardcodedBuiltins("1.27"),
|
client: openapiclient.NewHardcodedBuiltins("1.30"),
|
||||||
want: func() Loader {
|
want: func() Loader {
|
||||||
validator, err := validator.New(openapiclient.NewHardcodedBuiltins("1.27"))
|
validator, err := validator.New(openapiclient.NewHardcodedBuiltins("1.30"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
return &loader{
|
return &loader{
|
||||||
validator: validator,
|
validator: validator,
|
||||||
}
|
}
|
||||||
}(),
|
}(),
|
||||||
}, {
|
|
||||||
name: "invalid local",
|
|
||||||
client: openapiclient.NewLocalCRDFiles(data.Crds(), "blam"),
|
|
||||||
wantErr: true,
|
|
||||||
}, {
|
}, {
|
||||||
name: "composite - no clients",
|
name: "composite - no clients",
|
||||||
client: openapiclient.NewComposite(),
|
client: openapiclient.NewComposite(),
|
||||||
|
@ -61,22 +57,18 @@ func TestNew(t *testing.T) {
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
}, {
|
}, {
|
||||||
name: "composite - with err client",
|
name: "composite - with err client",
|
||||||
client: openapiclient.NewComposite(openapiclient.NewHardcodedBuiltins("1.27"), errClient{}),
|
client: openapiclient.NewComposite(openapiclient.NewHardcodedBuiltins("1.30"), errClient{}),
|
||||||
wantErr: true,
|
|
||||||
}, {
|
|
||||||
name: "composite - invalid local",
|
|
||||||
client: openapiclient.NewComposite(openapiclient.NewLocalCRDFiles(data.Crds(), "blam")),
|
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
}}
|
}}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
got, err := New(tt.client)
|
got, err := New(tt.client)
|
||||||
if (err != nil) != tt.wantErr {
|
if (err != nil) != tt.wantErr {
|
||||||
t.Errorf("New() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("%v failed, New() error = %v, wantErr %v", tt.name, err, tt.wantErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(got, tt.want) {
|
if !reflect.DeepEqual(got, tt.want) {
|
||||||
t.Errorf("New() = %v, want %v", got, tt.want)
|
t.Errorf("%v failed, New() = %v, want %v", tt.name, got, tt.want)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -110,30 +102,48 @@ func Test_loader_Load(t *testing.T) {
|
||||||
want unstructured.Unstructured
|
want unstructured.Unstructured
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{{
|
}{{
|
||||||
name: "nil",
|
name: "nil",
|
||||||
loader: newLoader(openapiclient.NewLocalCRDFiles(data.Crds(), "crds")),
|
loader: newLoader(func() openapi.Client {
|
||||||
|
file, _ := data.Crds()
|
||||||
|
return openapiclient.NewLocalCRDFiles(file)
|
||||||
|
}(),
|
||||||
|
),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
}, {
|
}, {
|
||||||
name: "empty GVK",
|
name: "empty GVK",
|
||||||
loader: newLoader(openapiclient.NewLocalCRDFiles(data.Crds(), "crds")),
|
loader: newLoader(func() openapi.Client {
|
||||||
|
file, _ := data.Crds()
|
||||||
|
return openapiclient.NewLocalCRDFiles(file)
|
||||||
|
}(),
|
||||||
|
),
|
||||||
document: []byte(`foo: bar`),
|
document: []byte(`foo: bar`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
}, {
|
}, {
|
||||||
name: "not yaml",
|
name: "not yaml",
|
||||||
loader: newLoader(openapiclient.NewLocalCRDFiles(data.Crds(), "crds")),
|
loader: newLoader(
|
||||||
|
func() openapi.Client {
|
||||||
|
file, _ := data.Crds()
|
||||||
|
return openapiclient.NewLocalCRDFiles(file)
|
||||||
|
}(),
|
||||||
|
),
|
||||||
document: []byte(`
|
document: []byte(`
|
||||||
foo
|
foo
|
||||||
bar
|
bar
|
||||||
- baz`),
|
- baz`),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
}, {
|
}, {
|
||||||
name: "unknown GVK",
|
name: "unknown GVK",
|
||||||
loader: newLoader(openapiclient.NewLocalCRDFiles(data.Crds(), "crds")),
|
loader: newLoader(
|
||||||
|
func() openapi.Client {
|
||||||
|
file, _ := data.Crds()
|
||||||
|
return openapiclient.NewLocalCRDFiles(file)
|
||||||
|
}(),
|
||||||
|
),
|
||||||
document: loadFile("../../../cmd/cli/kubectl-kyverno/_testdata/resources/namespace.yaml"),
|
document: loadFile("../../../cmd/cli/kubectl-kyverno/_testdata/resources/namespace.yaml"),
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
}, {
|
}, {
|
||||||
name: "bad schema",
|
name: "bad schema",
|
||||||
loader: newLoader(openapiclient.NewHardcodedBuiltins("1.27")),
|
loader: newLoader(openapiclient.NewHardcodedBuiltins("1.30")),
|
||||||
document: []byte(`
|
document: []byte(`
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Namespace
|
kind: Namespace
|
||||||
|
@ -145,7 +155,7 @@ func Test_loader_Load(t *testing.T) {
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
}, {
|
}, {
|
||||||
name: "ok",
|
name: "ok",
|
||||||
loader: newLoader(openapiclient.NewHardcodedBuiltins("1.27")),
|
loader: newLoader(openapiclient.NewHardcodedBuiltins("1.30")),
|
||||||
document: loadFile("../../../cmd/cli/kubectl-kyverno/_testdata/resources/namespace.yaml"),
|
document: loadFile("../../../cmd/cli/kubectl-kyverno/_testdata/resources/namespace.yaml"),
|
||||||
want: toUnstructured(loadFile("../../../cmd/cli/kubectl-kyverno/_testdata/resources/namespace.yaml")),
|
want: toUnstructured(loadFile("../../../cmd/cli/kubectl-kyverno/_testdata/resources/namespace.yaml")),
|
||||||
}}
|
}}
|
||||||
|
|
43
go.mod
43
go.mod
|
@ -32,7 +32,7 @@ require (
|
||||||
github.com/julienschmidt/httprouter v1.3.0
|
github.com/julienschmidt/httprouter v1.3.0
|
||||||
github.com/kataras/tablewriter v0.0.0-20180708051242-e063d29b7c23
|
github.com/kataras/tablewriter v0.0.0-20180708051242-e063d29b7c23
|
||||||
github.com/kyverno/go-jmespath v0.4.1-0.20231124160150-95e59c162877
|
github.com/kyverno/go-jmespath v0.4.1-0.20231124160150-95e59c162877
|
||||||
github.com/kyverno/kyverno-json v0.0.3-0.20240401145725-a17ecb70f39e
|
github.com/kyverno/kyverno-json v0.0.3-alpha.2.0.20240530232232-5c38b4fee0b1
|
||||||
github.com/lensesio/tableprinter v0.0.0-20201125135848-89e81fc956e7
|
github.com/lensesio/tableprinter v0.0.0-20201125135848-89e81fc956e7
|
||||||
github.com/notaryproject/notation-core-go v1.0.3
|
github.com/notaryproject/notation-core-go v1.0.3
|
||||||
github.com/notaryproject/notation-go v1.1.1
|
github.com/notaryproject/notation-go v1.1.1
|
||||||
|
@ -41,7 +41,7 @@ require (
|
||||||
github.com/opencontainers/go-digest v1.0.0
|
github.com/opencontainers/go-digest v1.0.0
|
||||||
github.com/opencontainers/image-spec v1.1.0
|
github.com/opencontainers/image-spec v1.1.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/prometheus/client_golang v1.18.0
|
github.com/prometheus/client_golang v1.19.0
|
||||||
github.com/robfig/cron v1.2.0
|
github.com/robfig/cron v1.2.0
|
||||||
github.com/sigstore/cosign/v2 v2.2.4
|
github.com/sigstore/cosign/v2 v2.2.4
|
||||||
github.com/sigstore/k8s-manifest-sigstore v0.5.4
|
github.com/sigstore/k8s-manifest-sigstore v0.5.4
|
||||||
|
@ -74,18 +74,18 @@ require (
|
||||||
gopkg.in/inf.v0 v0.9.1
|
gopkg.in/inf.v0 v0.9.1
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
gotest.tools v2.2.0+incompatible
|
gotest.tools v2.2.0+incompatible
|
||||||
k8s.io/api v0.29.4
|
k8s.io/api v0.30.1
|
||||||
k8s.io/apiextensions-apiserver v0.29.3
|
k8s.io/apiextensions-apiserver v0.30.1
|
||||||
k8s.io/apimachinery v0.30.0
|
k8s.io/apimachinery v0.30.1
|
||||||
k8s.io/apiserver v0.29.3
|
k8s.io/apiserver v0.30.1
|
||||||
k8s.io/cli-runtime v0.29.4
|
k8s.io/cli-runtime v0.30.1
|
||||||
k8s.io/client-go v0.29.4
|
k8s.io/client-go v0.30.1
|
||||||
k8s.io/klog/v2 v2.120.1
|
k8s.io/klog/v2 v2.120.1
|
||||||
k8s.io/kube-aggregator v0.29.3
|
k8s.io/kube-aggregator v0.30.1
|
||||||
k8s.io/pod-security-admission v0.29.2
|
k8s.io/pod-security-admission v0.30.1
|
||||||
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0
|
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0
|
||||||
sigs.k8s.io/controller-runtime v0.17.3
|
sigs.k8s.io/controller-runtime v0.17.3
|
||||||
sigs.k8s.io/kubectl-validate v0.0.3
|
sigs.k8s.io/kubectl-validate v0.0.4
|
||||||
sigs.k8s.io/kustomize/api v0.17.2
|
sigs.k8s.io/kustomize/api v0.17.2
|
||||||
sigs.k8s.io/kustomize/kyaml v0.17.1
|
sigs.k8s.io/kustomize/kyaml v0.17.1
|
||||||
sigs.k8s.io/release-utils v0.8.2
|
sigs.k8s.io/release-utils v0.8.2
|
||||||
|
@ -230,13 +230,12 @@ require (
|
||||||
github.com/golang/protobuf v1.5.4 // indirect
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/btree v1.1.2 // indirect
|
github.com/google/btree v1.1.2 // indirect
|
||||||
github.com/google/cel-go v0.17.7 // indirect
|
github.com/google/cel-go v0.20.1 // indirect
|
||||||
github.com/google/certificate-transparency-go v1.1.7 // indirect
|
github.com/google/certificate-transparency-go v1.1.7 // indirect
|
||||||
github.com/google/go-cmp v0.6.0 // indirect
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
github.com/google/go-github/v55 v55.0.0 // indirect
|
github.com/google/go-github/v55 v55.0.0 // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
github.com/google/gofuzz v1.2.0 // indirect
|
github.com/google/gofuzz v1.2.0 // indirect
|
||||||
github.com/google/gxui v0.0.0-20151028112939-f85e0a97b3a4 // indirect
|
|
||||||
github.com/google/s2a-go v0.1.7 // indirect
|
github.com/google/s2a-go v0.1.7 // indirect
|
||||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
|
@ -270,6 +269,7 @@ require (
|
||||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||||
github.com/klauspost/compress v1.17.8 // indirect
|
github.com/klauspost/compress v1.17.8 // indirect
|
||||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||||
|
github.com/kyverno/pkg/ext v0.0.0-20240418121121-df8add26c55c // indirect
|
||||||
github.com/letsencrypt/boulder v0.0.0-20240127020530-97a19b18d21e // indirect
|
github.com/letsencrypt/boulder v0.0.0-20240127020530-97a19b18d21e // indirect
|
||||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
|
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
|
||||||
github.com/magiconair/properties v1.8.7 // indirect
|
github.com/magiconair/properties v1.8.7 // indirect
|
||||||
|
@ -277,6 +277,7 @@ require (
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||||
github.com/miekg/pkcs11 v1.1.1 // indirect
|
github.com/miekg/pkcs11 v1.1.1 // indirect
|
||||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||||
|
@ -304,7 +305,7 @@ require (
|
||||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||||
github.com/prometheus/client_model v0.6.0 // indirect
|
github.com/prometheus/client_model v0.6.0 // indirect
|
||||||
github.com/prometheus/common v0.47.0 // indirect
|
github.com/prometheus/common v0.48.0 // indirect
|
||||||
github.com/prometheus/procfs v0.12.0 // indirect
|
github.com/prometheus/procfs v0.12.0 // indirect
|
||||||
github.com/protocolbuffers/txtpbfmt v0.0.0-20240116145035-ef3ab179eed6 // indirect
|
github.com/protocolbuffers/txtpbfmt v0.0.0-20240116145035-ef3ab179eed6 // indirect
|
||||||
github.com/r3labs/diff v1.1.0 // indirect
|
github.com/r3labs/diff v1.1.0 // indirect
|
||||||
|
@ -326,7 +327,6 @@ require (
|
||||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||||
github.com/skeema/knownhosts v1.2.2 // indirect
|
github.com/skeema/knownhosts v1.2.2 // indirect
|
||||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
|
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
|
||||||
github.com/smarty/assertions v1.16.0 // indirect
|
|
||||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||||
github.com/spf13/afero v1.11.0 // indirect
|
github.com/spf13/afero v1.11.0 // indirect
|
||||||
github.com/spf13/cast v1.6.0 // indirect
|
github.com/spf13/cast v1.6.0 // indirect
|
||||||
|
@ -353,9 +353,9 @@ require (
|
||||||
github.com/xlab/treeprint v1.2.0 // indirect
|
github.com/xlab/treeprint v1.2.0 // indirect
|
||||||
github.com/yashtewari/glob-intersection v0.2.0 // indirect
|
github.com/yashtewari/glob-intersection v0.2.0 // indirect
|
||||||
github.com/zeebo/errs v1.3.0 // indirect
|
github.com/zeebo/errs v1.3.0 // indirect
|
||||||
go.etcd.io/etcd/api/v3 v3.5.12 // indirect
|
go.etcd.io/etcd/api/v3 v3.5.13 // indirect
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect
|
go.etcd.io/etcd/client/pkg/v3 v3.5.13 // indirect
|
||||||
go.etcd.io/etcd/client/v3 v3.5.12 // indirect
|
go.etcd.io/etcd/client/v3 v3.5.13 // indirect
|
||||||
go.mongodb.org/mongo-driver v1.14.0 // indirect
|
go.mongodb.org/mongo-driver v1.14.0 // indirect
|
||||||
go.opencensus.io v0.24.0 // indirect
|
go.opencensus.io v0.24.0 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
|
||||||
|
@ -382,7 +382,7 @@ require (
|
||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
k8s.io/component-base v0.29.3 // indirect
|
k8s.io/component-base v0.30.1 // indirect
|
||||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340
|
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340
|
||||||
k8s.io/kubectl v0.29.2 // indirect
|
k8s.io/kubectl v0.29.2 // indirect
|
||||||
oras.land/oras-go/v2 v2.5.0 // indirect
|
oras.land/oras-go/v2 v2.5.0 // indirect
|
||||||
|
@ -391,6 +391,9 @@ require (
|
||||||
)
|
)
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
|
github.com/google/cel-go v0.20.1 => github.com/google/cel-go v0.17.8
|
||||||
|
github.com/prometheus/client_golang v1.19.0 => github.com/prometheus/client_golang v1.18.0
|
||||||
|
github.com/prometheus/common v0.48.0 => github.com/prometheus/common v0.44.0
|
||||||
github.com/sigstore/cosign/v2 v2.2.4 => github.com/kyverno/cosign/v2 v2.2.4-deps-fix
|
github.com/sigstore/cosign/v2 v2.2.4 => github.com/kyverno/cosign/v2 v2.2.4-deps-fix
|
||||||
k8s.io/pod-security-admission v0.29.2 => github.com/YTGhost/pod-security-admission v0.22.0-beta.0.0.20240304113848-33168815d7c7
|
k8s.io/pod-security-admission v0.30.1 => github.com/YTGhost/pod-security-admission v0.22.0-beta.0.0.20240603173423-11663473ae49
|
||||||
)
|
)
|
||||||
|
|
79
go.sum
79
go.sum
|
@ -89,8 +89,8 @@ github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0k
|
||||||
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
|
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
|
||||||
github.com/ThalesIgnite/crypto11 v1.2.5 h1:1IiIIEqYmBvUYFeMnHqRft4bwf/O36jryEUpY+9ef8E=
|
github.com/ThalesIgnite/crypto11 v1.2.5 h1:1IiIIEqYmBvUYFeMnHqRft4bwf/O36jryEUpY+9ef8E=
|
||||||
github.com/ThalesIgnite/crypto11 v1.2.5/go.mod h1:ILDKtnCKiQ7zRoNxcp36Y1ZR8LBPmR2E23+wTQe/MlE=
|
github.com/ThalesIgnite/crypto11 v1.2.5/go.mod h1:ILDKtnCKiQ7zRoNxcp36Y1ZR8LBPmR2E23+wTQe/MlE=
|
||||||
github.com/YTGhost/pod-security-admission v0.22.0-beta.0.0.20240304113848-33168815d7c7 h1:UxexVr0r4aF4YpgQEEC18Y9h0lVzJ8VflXrLDpFVFfo=
|
github.com/YTGhost/pod-security-admission v0.22.0-beta.0.0.20240603173423-11663473ae49 h1:dwYC6vA5cR+2YFeEasNoJGVj/NrsXCSIWww3qQxeQFY=
|
||||||
github.com/YTGhost/pod-security-admission v0.22.0-beta.0.0.20240304113848-33168815d7c7/go.mod h1:rBAI9Kn+bV1UGQqDqZSgFo/+fm8S/3fFOsU42Z8SVkc=
|
github.com/YTGhost/pod-security-admission v0.22.0-beta.0.0.20240603173423-11663473ae49/go.mod h1:wJpTzOGwDdTbVbIqwBuAX7io1eDQIuW/UfMaK5/Xzn0=
|
||||||
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
|
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
|
||||||
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
|
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
|
||||||
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
|
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
|
||||||
|
@ -295,6 +295,8 @@ github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRK
|
||||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||||
|
github.com/dustinkirkland/golang-petname v0.0.0-20231002161417-6a283f1aaaf2 h1:S6Dco8FtAhEI/qkg/00H6RdEGC+MCy5GPiQ+xweNRFE=
|
||||||
|
github.com/dustinkirkland/golang-petname v0.0.0-20231002161417-6a283f1aaaf2/go.mod h1:8AuBTZBRSFqEYBPYULd+NN474/zZBLP+6WeT5S9xlAc=
|
||||||
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU=
|
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU=
|
||||||
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
|
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
|
||||||
github.com/emicklei/go-restful/v3 v3.11.2 h1:1onLa9DcsMYO9P+CXaL0dStDqQ2EHHXLiz+BtnqkLAU=
|
github.com/emicklei/go-restful/v3 v3.11.2 h1:1onLa9DcsMYO9P+CXaL0dStDqQ2EHHXLiz+BtnqkLAU=
|
||||||
|
@ -435,8 +437,8 @@ github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
|
github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
|
||||||
github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
|
github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
|
||||||
github.com/google/cel-go v0.17.7 h1:6ebJFzu1xO2n7TLtN+UBqShGBhlD85bhvglh5DpcfqQ=
|
github.com/google/cel-go v0.17.8 h1:j9m730pMZt1Fc4oKhCLUHfjj6527LuhYcYw0Rl8gqto=
|
||||||
github.com/google/cel-go v0.17.7/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY=
|
github.com/google/cel-go v0.17.8/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY=
|
||||||
github.com/google/certificate-transparency-go v1.1.7 h1:IASD+NtgSTJLPdzkthwvAG1ZVbF2WtFg4IvoA68XGSw=
|
github.com/google/certificate-transparency-go v1.1.7 h1:IASD+NtgSTJLPdzkthwvAG1ZVbF2WtFg4IvoA68XGSw=
|
||||||
github.com/google/certificate-transparency-go v1.1.7/go.mod h1:FSSBo8fyMVgqptbfF6j5p/XNdgQftAhSmXcIxV9iphE=
|
github.com/google/certificate-transparency-go v1.1.7/go.mod h1:FSSBo8fyMVgqptbfF6j5p/XNdgQftAhSmXcIxV9iphE=
|
||||||
github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM=
|
github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM=
|
||||||
|
@ -610,8 +612,10 @@ github.com/kyverno/go-jmespath v0.4.1-0.20231124160150-95e59c162877 h1:XOLJNGX/q
|
||||||
github.com/kyverno/go-jmespath v0.4.1-0.20231124160150-95e59c162877/go.mod h1:yzDHaKovQy16rjN4kFnjF+IdNoN4p1ndw+va6+B8zUU=
|
github.com/kyverno/go-jmespath v0.4.1-0.20231124160150-95e59c162877/go.mod h1:yzDHaKovQy16rjN4kFnjF+IdNoN4p1ndw+va6+B8zUU=
|
||||||
github.com/kyverno/go-jmespath/internal/testify v1.5.2-0.20230630133209-945021c749d9 h1:lL311dF3a2aeNibJj8v+uhFU3XkvRHZmCtAdSPOrQYY=
|
github.com/kyverno/go-jmespath/internal/testify v1.5.2-0.20230630133209-945021c749d9 h1:lL311dF3a2aeNibJj8v+uhFU3XkvRHZmCtAdSPOrQYY=
|
||||||
github.com/kyverno/go-jmespath/internal/testify v1.5.2-0.20230630133209-945021c749d9/go.mod h1:XRxUGHIiCy1WYma1CdfdO1WOhIe8dLPTENaZr5D1ex4=
|
github.com/kyverno/go-jmespath/internal/testify v1.5.2-0.20230630133209-945021c749d9/go.mod h1:XRxUGHIiCy1WYma1CdfdO1WOhIe8dLPTENaZr5D1ex4=
|
||||||
github.com/kyverno/kyverno-json v0.0.3-0.20240401145725-a17ecb70f39e h1:FlI6ePgIsyoC/qgK/fciSo8t4dIAIuBPRHgof2bGF1M=
|
github.com/kyverno/kyverno-json v0.0.3-alpha.2.0.20240530232232-5c38b4fee0b1 h1:iXY2qj4ExPQkwUv0idlwzzSaN3Y5wl7qvM+BV9azwH8=
|
||||||
github.com/kyverno/kyverno-json v0.0.3-0.20240401145725-a17ecb70f39e/go.mod h1:sCLxnovJt6sSjRre76K0k5f50B5UPY2wRUTlPV6jTfM=
|
github.com/kyverno/kyverno-json v0.0.3-alpha.2.0.20240530232232-5c38b4fee0b1/go.mod h1:jno6MqBZQalUVI+CfKDkzf1uCGODWKwWJiW/FEplong=
|
||||||
|
github.com/kyverno/pkg/ext v0.0.0-20240418121121-df8add26c55c h1:lAolpR9H8BwM5lRRvgCQ8JowswyxZRH+fgtIQzHFVCk=
|
||||||
|
github.com/kyverno/pkg/ext v0.0.0-20240418121121-df8add26c55c/go.mod h1:02vxM0GNXz9+B/i6+rMfWAIwibUuAH+qFsd73IFskgQ=
|
||||||
github.com/lensesio/tableprinter v0.0.0-20201125135848-89e81fc956e7 h1:k/1ku0yehLCPqERCHkIHMDqDg1R02AcCScRuHbamU3s=
|
github.com/lensesio/tableprinter v0.0.0-20201125135848-89e81fc956e7 h1:k/1ku0yehLCPqERCHkIHMDqDg1R02AcCScRuHbamU3s=
|
||||||
github.com/lensesio/tableprinter v0.0.0-20201125135848-89e81fc956e7/go.mod h1:YR/zYthNdWfO8+0IOyHDcIDBBBS2JMnYUIwSsnwmRqU=
|
github.com/lensesio/tableprinter v0.0.0-20201125135848-89e81fc956e7/go.mod h1:YR/zYthNdWfO8+0IOyHDcIDBBBS2JMnYUIwSsnwmRqU=
|
||||||
github.com/letsencrypt/boulder v0.0.0-20240127020530-97a19b18d21e h1:7QjzPboPE+0pVMsZP1sz1mN26m6vew78YmcIZz1FMrg=
|
github.com/letsencrypt/boulder v0.0.0-20240127020530-97a19b18d21e h1:7QjzPboPE+0pVMsZP1sz1mN26m6vew78YmcIZz1FMrg=
|
||||||
|
@ -632,6 +636,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
|
||||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||||
github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo=
|
github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo=
|
||||||
github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY=
|
github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY=
|
||||||
github.com/miekg/pkcs11 v1.0.3-0.20190429190417-a667d056470f/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
|
github.com/miekg/pkcs11 v1.0.3-0.20190429190417-a667d056470f/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
|
||||||
|
@ -734,8 +740,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
|
||||||
github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos=
|
github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos=
|
||||||
github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8=
|
github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8=
|
||||||
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||||
github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k=
|
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
|
||||||
github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc=
|
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
|
||||||
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
|
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
|
||||||
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
|
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
|
||||||
|
@ -802,8 +808,8 @@ github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EE
|
||||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
|
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
|
||||||
github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 h1:unQFBIznI+VYD1/1fApl1A+9VcBk+9dcqGfnePY87LY=
|
github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 h1:unQFBIznI+VYD1/1fApl1A+9VcBk+9dcqGfnePY87LY=
|
||||||
github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262/go.mod h1:MyOHs9Po2fbM1LHej6sBUT8ozbxmMOFG+E+rx/GSGuc=
|
github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262/go.mod h1:MyOHs9Po2fbM1LHej6sBUT8ozbxmMOFG+E+rx/GSGuc=
|
||||||
github.com/smarty/assertions v1.16.0 h1:EvHNkdRA4QHMrn75NZSoUQ/mAUXAYWfatfB01yTCzfY=
|
github.com/smarty/assertions v1.15.1 h1:812oFiXI+G55vxsFf+8bIZ1ux30qtkdqzKbEFwyX3Tk=
|
||||||
github.com/smarty/assertions v1.16.0/go.mod h1:duaaFdCS0K9dnoM50iyek/eYINOZ64gbh1Xlf6LG7AI=
|
github.com/smarty/assertions v1.15.1/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
||||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
|
@ -911,14 +917,14 @@ github.com/zeebo/errs v1.3.0 h1:hmiaKqgYZzcVgRL1Vkc1Mn2914BbzB0IBxs+ebeutGs=
|
||||||
github.com/zeebo/errs v1.3.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
|
github.com/zeebo/errs v1.3.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
|
||||||
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
|
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
|
||||||
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
|
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
|
||||||
go.etcd.io/etcd/api/v3 v3.5.12 h1:W4sw5ZoU2Juc9gBWuLk5U6fHfNVyY1WC5g9uiXZio/c=
|
go.etcd.io/etcd/api/v3 v3.5.13 h1:8WXU2/NBge6AUF1K1gOexB6e07NgsN1hXK0rSTtgSp4=
|
||||||
go.etcd.io/etcd/api/v3 v3.5.12/go.mod h1:Ot+o0SWSyT6uHhA56al1oCED0JImsRiU9Dc26+C2a+4=
|
go.etcd.io/etcd/api/v3 v3.5.13/go.mod h1:gBqlqkcMMZMVTMm4NDZloEVJzxQOQIls8splbqBDa0c=
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.12 h1:EYDL6pWwyOsylrQyLp2w+HkQ46ATiOvoEdMarindU2A=
|
go.etcd.io/etcd/client/pkg/v3 v3.5.13 h1:RVZSAnWWWiI5IrYAXjQorajncORbS0zI48LQlE2kQWg=
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.12/go.mod h1:seTzl2d9APP8R5Y2hFL3NVlD6qC/dOT+3kvrqPyTas4=
|
go.etcd.io/etcd/client/pkg/v3 v3.5.13/go.mod h1:XxHT4u1qU12E2+po+UVPrEeL94Um6zL58ppuJWXSAB8=
|
||||||
go.etcd.io/etcd/client/v2 v2.305.10 h1:MrmRktzv/XF8CvtQt+P6wLUlURaNpSDJHFZhe//2QE4=
|
go.etcd.io/etcd/client/v2 v2.305.10 h1:MrmRktzv/XF8CvtQt+P6wLUlURaNpSDJHFZhe//2QE4=
|
||||||
go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA=
|
go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA=
|
||||||
go.etcd.io/etcd/client/v3 v3.5.12 h1:v5lCPXn1pf1Uu3M4laUE2hp/geOTc5uPcYYsNe1lDxg=
|
go.etcd.io/etcd/client/v3 v3.5.13 h1:o0fHTNJLeO0MyVbc7I3fsCf6nrOqn5d+diSarKnB2js=
|
||||||
go.etcd.io/etcd/client/v3 v3.5.12/go.mod h1:tSbBCakoWmmddL+BKVAJHa9km+O/E+bumDe9mSbPiqw=
|
go.etcd.io/etcd/client/v3 v3.5.13/go.mod h1:cqiAeY8b5DEEcpxvgWKsbLIWNM/8Wy2xJSDMtioMcoI=
|
||||||
go.etcd.io/etcd/pkg/v3 v3.5.10 h1:WPR8K0e9kWl1gAhB5A7gEa5ZBTNkT9NdNWrR8Qpo1CM=
|
go.etcd.io/etcd/pkg/v3 v3.5.10 h1:WPR8K0e9kWl1gAhB5A7gEa5ZBTNkT9NdNWrR8Qpo1CM=
|
||||||
go.etcd.io/etcd/pkg/v3 v3.5.10/go.mod h1:TKTuCKKcF1zxmfKWDkfz5qqYaE3JncKKZPFf8c1nFUs=
|
go.etcd.io/etcd/pkg/v3 v3.5.10/go.mod h1:TKTuCKKcF1zxmfKWDkfz5qqYaE3JncKKZPFf8c1nFUs=
|
||||||
go.etcd.io/etcd/raft/v3 v3.5.10 h1:cgNAYe7xrsrn/5kXMSaH8kM/Ky8mAdMqGOxyYwpP0LA=
|
go.etcd.io/etcd/raft/v3 v3.5.10 h1:cgNAYe7xrsrn/5kXMSaH8kM/Ky8mAdMqGOxyYwpP0LA=
|
||||||
|
@ -1034,6 +1040,7 @@ golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
|
||||||
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
@ -1203,26 +1210,26 @@ gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
|
||||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
k8s.io/api v0.29.4 h1:WEnF/XdxuCxdG3ayHNRR8yH3cI1B/llkWBma6bq4R3w=
|
k8s.io/api v0.30.1 h1:kCm/6mADMdbAxmIh0LBjS54nQBE+U4KmbCfIkF5CpJY=
|
||||||
k8s.io/api v0.29.4/go.mod h1:DetSv0t4FBTcEpfA84NJV3g9a7+rSzlUHk5ADAYHUv0=
|
k8s.io/api v0.30.1/go.mod h1:ddbN2C0+0DIiPntan/bye3SW3PdwLa11/0yqwvuRrJM=
|
||||||
k8s.io/apiextensions-apiserver v0.29.3 h1:9HF+EtZaVpFjStakF4yVufnXGPRppWFEQ87qnO91YeI=
|
k8s.io/apiextensions-apiserver v0.30.1 h1:4fAJZ9985BmpJG6PkoxVRpXv9vmPUOVzl614xarePws=
|
||||||
k8s.io/apiextensions-apiserver v0.29.3/go.mod h1:po0XiY5scnpJfFizNGo6puNU6Fq6D70UJY2Cb2KwAVc=
|
k8s.io/apiextensions-apiserver v0.30.1/go.mod h1:R4GuSrlhgq43oRY9sF2IToFh7PVlF1JjfWdoG3pixk4=
|
||||||
k8s.io/apimachinery v0.30.0 h1:qxVPsyDM5XS96NIh9Oj6LavoVFYff/Pon9cZeDIkHHA=
|
k8s.io/apimachinery v0.30.1 h1:ZQStsEfo4n65yAdlGTfP/uSHMQSoYzU/oeEbkmF7P2U=
|
||||||
k8s.io/apimachinery v0.30.0/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
|
k8s.io/apimachinery v0.30.1/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
|
||||||
k8s.io/apiserver v0.29.3 h1:xR7ELlJ/BZSr2n4CnD3lfA4gzFivh0wwfNfz9L0WZcE=
|
k8s.io/apiserver v0.30.1 h1:BEWEe8bzS12nMtDKXzCF5Q5ovp6LjjYkSp8qOPk8LZ8=
|
||||||
k8s.io/apiserver v0.29.3/go.mod h1:hrvXlwfRulbMbBgmWRQlFru2b/JySDpmzvQwwk4GUOs=
|
k8s.io/apiserver v0.30.1/go.mod h1:i87ZnQ+/PGAmSbD/iEKM68bm1D5reX8fO4Ito4B01mo=
|
||||||
k8s.io/cli-runtime v0.29.4 h1:QvUrddBxVX6XFJ6z64cGpEk7e4bQduKweqbqq+qBd9g=
|
k8s.io/cli-runtime v0.30.1 h1:kSBBpfrJGS6lllc24KeniI9JN7ckOOJKnmFYH1RpTOw=
|
||||||
k8s.io/cli-runtime v0.29.4/go.mod h1:NmklYuZ4DLfOr2XEIT8Nzl883KMZUCv7KMj3wMHayCA=
|
k8s.io/cli-runtime v0.30.1/go.mod h1:zhHgbqI4J00pxb6gM3gJPVf2ysDjhQmQtnTxnMScab8=
|
||||||
k8s.io/client-go v0.29.4 h1:79ytIedxVfyXV8rpH3jCBW0u+un0fxHDwX5F9K8dPR8=
|
k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q=
|
||||||
k8s.io/client-go v0.29.4/go.mod h1:kC1thZQ4zQWYwldsfI088BbK6RkxK+aF5ebV8y9Q4tk=
|
k8s.io/client-go v0.30.1/go.mod h1:wrAqLNs2trwiCH/wxxmT/x3hKVH9PuV0GGW0oDoHVqc=
|
||||||
k8s.io/component-base v0.29.3 h1:Oq9/nddUxlnrCuuR2K/jp6aflVvc0uDvxMzAWxnGzAo=
|
k8s.io/component-base v0.30.1 h1:bvAtlPh1UrdaZL20D9+sWxsJljMi0QZ3Lmw+kmZAaxQ=
|
||||||
k8s.io/component-base v0.29.3/go.mod h1:Yuj33XXjuOk2BAaHsIGHhCKZQAgYKhqIxIjIr2UXYio=
|
k8s.io/component-base v0.30.1/go.mod h1:e/X9kDiOebwlI41AvBHuWdqFriSRrX50CdwA9TFaHLI=
|
||||||
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
|
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
|
||||||
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||||
k8s.io/kms v0.29.3 h1:ReljsAUhYlm2spdT4yXmY+9a8x8dc/OT4mXvwQPPteQ=
|
k8s.io/kms v0.30.1 h1:gEIbEeCbFiaN2tNfp/EUhFdGr5/CSj8Eyq6Mkr7cCiY=
|
||||||
k8s.io/kms v0.29.3/go.mod h1:TBGbJKpRUMk59neTMDMddjIDL+D4HuFUbpuiuzmOPg0=
|
k8s.io/kms v0.30.1/go.mod h1:GrMurD0qk3G4yNgGcsCEmepqf9KyyIrTXYR2lyUOJC4=
|
||||||
k8s.io/kube-aggregator v0.29.3 h1:5KvTyFN8sQq2imq8tMAHWEKoE64Zg9WSMaGX78KV6ps=
|
k8s.io/kube-aggregator v0.30.1 h1:ymR2BsxDacTKwzKTuNhGZttuk009c+oZbSeD+IPX5q4=
|
||||||
k8s.io/kube-aggregator v0.29.3/go.mod h1:xGJqV/SJJ1fbwTGfQLAZfwgqX1EMoaqfotDTkDrqqSk=
|
k8s.io/kube-aggregator v0.30.1/go.mod h1:SFbqWsM6ea8dHd3mPLsZFzJHbjBOS5ykIgJh4znZ5iQ=
|
||||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=
|
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=
|
||||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
|
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
|
||||||
k8s.io/kubectl v0.29.2 h1:uaDYaBhumvkwz0S2XHt36fK0v5IdNgL7HyUniwb2IUo=
|
k8s.io/kubectl v0.29.2 h1:uaDYaBhumvkwz0S2XHt36fK0v5IdNgL7HyUniwb2IUo=
|
||||||
|
@ -1237,8 +1244,8 @@ sigs.k8s.io/controller-runtime v0.17.3 h1:65QmN7r3FWgTxDMz9fvGnO1kbf2nu+acg9p2R9
|
||||||
sigs.k8s.io/controller-runtime v0.17.3/go.mod h1:N0jpP5Lo7lMTF9aL56Z/B2oWBJjey6StQM0jRbKQXtY=
|
sigs.k8s.io/controller-runtime v0.17.3/go.mod h1:N0jpP5Lo7lMTF9aL56Z/B2oWBJjey6StQM0jRbKQXtY=
|
||||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||||
sigs.k8s.io/kubectl-validate v0.0.3 h1:wcbx6dPXF7BWoWSyih295mEOLBbzZA6CaEHoCufutUo=
|
sigs.k8s.io/kubectl-validate v0.0.4 h1:tGKuv0awYHn11Cb6KPsZKxUmHgavF46K3NvVH0Nse9U=
|
||||||
sigs.k8s.io/kubectl-validate v0.0.3/go.mod h1:Y67xSi06L5XSl+jSGFamNoa117yq6SnN4yXIzWHWxU8=
|
sigs.k8s.io/kubectl-validate v0.0.4/go.mod h1:JTm3G+JZLPISqABh73uV7s/sW28q2zZqnTghOzahEKA=
|
||||||
sigs.k8s.io/kustomize/api v0.17.2 h1:E7/Fjk7V5fboiuijoZHgs4aHuexi5Y2loXlVOAVAG5g=
|
sigs.k8s.io/kustomize/api v0.17.2 h1:E7/Fjk7V5fboiuijoZHgs4aHuexi5Y2loXlVOAVAG5g=
|
||||||
sigs.k8s.io/kustomize/api v0.17.2/go.mod h1:UWTz9Ct+MvoeQsHcJ5e+vziRRkwimm3HytpZgIYqye0=
|
sigs.k8s.io/kustomize/api v0.17.2/go.mod h1:UWTz9Ct+MvoeQsHcJ5e+vziRRkwimm3HytpZgIYqye0=
|
||||||
sigs.k8s.io/kustomize/kyaml v0.17.1 h1:TnxYQxFXzbmNG6gOINgGWQt09GghzgTP6mIurOgrLCQ=
|
sigs.k8s.io/kustomize/kyaml v0.17.1 h1:TnxYQxFXzbmNG6gOINgGWQt09GghzgTP6mIurOgrLCQ=
|
||||||
|
|
|
@ -3,6 +3,8 @@ package client
|
||||||
import (
|
import (
|
||||||
"github.com/go-logr/logr"
|
"github.com/go-logr/logr"
|
||||||
mutatingwebhookconfigurations "github.com/kyverno/kyverno/pkg/clients/kube/admissionregistrationv1/mutatingwebhookconfigurations"
|
mutatingwebhookconfigurations "github.com/kyverno/kyverno/pkg/clients/kube/admissionregistrationv1/mutatingwebhookconfigurations"
|
||||||
|
validatingadmissionpolicies "github.com/kyverno/kyverno/pkg/clients/kube/admissionregistrationv1/validatingadmissionpolicies"
|
||||||
|
validatingadmissionpolicybindings "github.com/kyverno/kyverno/pkg/clients/kube/admissionregistrationv1/validatingadmissionpolicybindings"
|
||||||
validatingwebhookconfigurations "github.com/kyverno/kyverno/pkg/clients/kube/admissionregistrationv1/validatingwebhookconfigurations"
|
validatingwebhookconfigurations "github.com/kyverno/kyverno/pkg/clients/kube/admissionregistrationv1/validatingwebhookconfigurations"
|
||||||
"github.com/kyverno/kyverno/pkg/metrics"
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
k8s_io_client_go_kubernetes_typed_admissionregistration_v1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
|
k8s_io_client_go_kubernetes_typed_admissionregistration_v1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
|
||||||
|
@ -34,6 +36,14 @@ func (c *withMetrics) MutatingWebhookConfigurations() k8s_io_client_go_kubernete
|
||||||
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "MutatingWebhookConfiguration", c.clientType)
|
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "MutatingWebhookConfiguration", c.clientType)
|
||||||
return mutatingwebhookconfigurations.WithMetrics(c.inner.MutatingWebhookConfigurations(), recorder)
|
return mutatingwebhookconfigurations.WithMetrics(c.inner.MutatingWebhookConfigurations(), recorder)
|
||||||
}
|
}
|
||||||
|
func (c *withMetrics) ValidatingAdmissionPolicies() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface {
|
||||||
|
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ValidatingAdmissionPolicy", c.clientType)
|
||||||
|
return validatingadmissionpolicies.WithMetrics(c.inner.ValidatingAdmissionPolicies(), recorder)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) ValidatingAdmissionPolicyBindings() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface {
|
||||||
|
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ValidatingAdmissionPolicyBinding", c.clientType)
|
||||||
|
return validatingadmissionpolicybindings.WithMetrics(c.inner.ValidatingAdmissionPolicyBindings(), recorder)
|
||||||
|
}
|
||||||
func (c *withMetrics) ValidatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingWebhookConfigurationInterface {
|
func (c *withMetrics) ValidatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingWebhookConfigurationInterface {
|
||||||
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ValidatingWebhookConfiguration", c.clientType)
|
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ValidatingWebhookConfiguration", c.clientType)
|
||||||
return validatingwebhookconfigurations.WithMetrics(c.inner.ValidatingWebhookConfigurations(), recorder)
|
return validatingwebhookconfigurations.WithMetrics(c.inner.ValidatingWebhookConfigurations(), recorder)
|
||||||
|
@ -50,6 +60,12 @@ func (c *withTracing) RESTClient() rest.Interface {
|
||||||
func (c *withTracing) MutatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.MutatingWebhookConfigurationInterface {
|
func (c *withTracing) MutatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.MutatingWebhookConfigurationInterface {
|
||||||
return mutatingwebhookconfigurations.WithTracing(c.inner.MutatingWebhookConfigurations(), c.client, "MutatingWebhookConfiguration")
|
return mutatingwebhookconfigurations.WithTracing(c.inner.MutatingWebhookConfigurations(), c.client, "MutatingWebhookConfiguration")
|
||||||
}
|
}
|
||||||
|
func (c *withTracing) ValidatingAdmissionPolicies() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface {
|
||||||
|
return validatingadmissionpolicies.WithTracing(c.inner.ValidatingAdmissionPolicies(), c.client, "ValidatingAdmissionPolicy")
|
||||||
|
}
|
||||||
|
func (c *withTracing) ValidatingAdmissionPolicyBindings() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface {
|
||||||
|
return validatingadmissionpolicybindings.WithTracing(c.inner.ValidatingAdmissionPolicyBindings(), c.client, "ValidatingAdmissionPolicyBinding")
|
||||||
|
}
|
||||||
func (c *withTracing) ValidatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingWebhookConfigurationInterface {
|
func (c *withTracing) ValidatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingWebhookConfigurationInterface {
|
||||||
return validatingwebhookconfigurations.WithTracing(c.inner.ValidatingWebhookConfigurations(), c.client, "ValidatingWebhookConfiguration")
|
return validatingwebhookconfigurations.WithTracing(c.inner.ValidatingWebhookConfigurations(), c.client, "ValidatingWebhookConfiguration")
|
||||||
}
|
}
|
||||||
|
@ -65,6 +81,12 @@ func (c *withLogging) RESTClient() rest.Interface {
|
||||||
func (c *withLogging) MutatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.MutatingWebhookConfigurationInterface {
|
func (c *withLogging) MutatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.MutatingWebhookConfigurationInterface {
|
||||||
return mutatingwebhookconfigurations.WithLogging(c.inner.MutatingWebhookConfigurations(), c.logger.WithValues("resource", "MutatingWebhookConfigurations"))
|
return mutatingwebhookconfigurations.WithLogging(c.inner.MutatingWebhookConfigurations(), c.logger.WithValues("resource", "MutatingWebhookConfigurations"))
|
||||||
}
|
}
|
||||||
|
func (c *withLogging) ValidatingAdmissionPolicies() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface {
|
||||||
|
return validatingadmissionpolicies.WithLogging(c.inner.ValidatingAdmissionPolicies(), c.logger.WithValues("resource", "ValidatingAdmissionPolicies"))
|
||||||
|
}
|
||||||
|
func (c *withLogging) ValidatingAdmissionPolicyBindings() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface {
|
||||||
|
return validatingadmissionpolicybindings.WithLogging(c.inner.ValidatingAdmissionPolicyBindings(), c.logger.WithValues("resource", "ValidatingAdmissionPolicyBindings"))
|
||||||
|
}
|
||||||
func (c *withLogging) ValidatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingWebhookConfigurationInterface {
|
func (c *withLogging) ValidatingWebhookConfigurations() k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingWebhookConfigurationInterface {
|
||||||
return validatingwebhookconfigurations.WithLogging(c.inner.ValidatingWebhookConfigurations(), c.logger.WithValues("resource", "ValidatingWebhookConfigurations"))
|
return validatingwebhookconfigurations.WithLogging(c.inner.ValidatingWebhookConfigurations(), c.logger.WithValues("resource", "ValidatingWebhookConfigurations"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,446 @@
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
"github.com/kyverno/kyverno/pkg/tracing"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
"go.uber.org/multierr"
|
||||||
|
k8s_io_api_admissionregistration_v1 "k8s.io/api/admissionregistration/v1"
|
||||||
|
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||||
|
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
k8s_io_client_go_applyconfigurations_admissionregistration_v1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
|
||||||
|
k8s_io_client_go_kubernetes_typed_admissionregistration_v1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithLogging(inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface, logger logr.Logger) k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithMetrics(inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface, recorder metrics.Recorder) k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface {
|
||||||
|
return &withMetrics{inner, recorder}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface, client, kind string) k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface {
|
||||||
|
return &withTracing{inner, client, kind}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingAdmissionPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Apply")
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Apply failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Apply done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingAdmissionPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "ApplyStatus")
|
||||||
|
ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "ApplyStatus failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("ApplyStatus done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Create")
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Create done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Delete")
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Delete done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Get")
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Get done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyList, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "List")
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("List done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Patch")
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Patch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Update")
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Update done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "UpdateStatus")
|
||||||
|
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "UpdateStatus failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("UpdateStatus done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Watch")
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Watch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface
|
||||||
|
recorder metrics.Recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingAdmissionPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "apply")
|
||||||
|
return c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingAdmissionPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "apply_status")
|
||||||
|
return c.inner.ApplyStatus(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "create")
|
||||||
|
return c.inner.Create(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||||
|
return c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||||
|
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "get")
|
||||||
|
return c.inner.Get(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyList, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "list")
|
||||||
|
return c.inner.List(arg0, arg1)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||||
|
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update")
|
||||||
|
return c.inner.Update(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update_status")
|
||||||
|
return c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||||
|
return c.inner.Watch(arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyInterface
|
||||||
|
client string
|
||||||
|
kind string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingAdmissionPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Apply"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingAdmissionPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("ApplyStatus"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Create"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Delete"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Get"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyList, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("List"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Patch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Update"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicy, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("UpdateStatus"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Watch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
|
@ -0,0 +1,374 @@
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
"github.com/kyverno/kyverno/pkg/tracing"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
"go.uber.org/multierr"
|
||||||
|
k8s_io_api_admissionregistration_v1 "k8s.io/api/admissionregistration/v1"
|
||||||
|
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||||
|
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
k8s_io_client_go_applyconfigurations_admissionregistration_v1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
|
||||||
|
k8s_io_client_go_kubernetes_typed_admissionregistration_v1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithLogging(inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface, logger logr.Logger) k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithMetrics(inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface, recorder metrics.Recorder) k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface {
|
||||||
|
return &withMetrics{inner, recorder}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface, client, kind string) k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface {
|
||||||
|
return &withTracing{inner, client, kind}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingAdmissionPolicyBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Apply")
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Apply failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Apply done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Create")
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Create done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Delete")
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Delete done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Get")
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Get done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBindingList, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "List")
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("List done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Patch")
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Patch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Update")
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Update done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Watch")
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Watch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface
|
||||||
|
recorder metrics.Recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingAdmissionPolicyBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "apply")
|
||||||
|
return c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "create")
|
||||||
|
return c.inner.Create(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||||
|
return c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||||
|
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "get")
|
||||||
|
return c.inner.Get(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBindingList, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "list")
|
||||||
|
return c.inner.List(arg0, arg1)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||||
|
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update")
|
||||||
|
return c.inner.Update(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||||
|
return c.inner.Watch(arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_admissionregistration_v1.ValidatingAdmissionPolicyBindingInterface
|
||||||
|
client string
|
||||||
|
kind string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingAdmissionPolicyBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Apply"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Create"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Delete"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Get"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBindingList, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("List"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Patch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingAdmissionPolicyBinding, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Update"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Watch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
|
@ -51,6 +51,7 @@ import (
|
||||||
schedulingv1 "github.com/kyverno/kyverno/pkg/clients/kube/schedulingv1"
|
schedulingv1 "github.com/kyverno/kyverno/pkg/clients/kube/schedulingv1"
|
||||||
schedulingv1alpha1 "github.com/kyverno/kyverno/pkg/clients/kube/schedulingv1alpha1"
|
schedulingv1alpha1 "github.com/kyverno/kyverno/pkg/clients/kube/schedulingv1alpha1"
|
||||||
schedulingv1beta1 "github.com/kyverno/kyverno/pkg/clients/kube/schedulingv1beta1"
|
schedulingv1beta1 "github.com/kyverno/kyverno/pkg/clients/kube/schedulingv1beta1"
|
||||||
|
storagemigrationv1alpha1 "github.com/kyverno/kyverno/pkg/clients/kube/storagemigrationv1alpha1"
|
||||||
storagev1 "github.com/kyverno/kyverno/pkg/clients/kube/storagev1"
|
storagev1 "github.com/kyverno/kyverno/pkg/clients/kube/storagev1"
|
||||||
storagev1alpha1 "github.com/kyverno/kyverno/pkg/clients/kube/storagev1alpha1"
|
storagev1alpha1 "github.com/kyverno/kyverno/pkg/clients/kube/storagev1alpha1"
|
||||||
storagev1beta1 "github.com/kyverno/kyverno/pkg/clients/kube/storagev1beta1"
|
storagev1beta1 "github.com/kyverno/kyverno/pkg/clients/kube/storagev1beta1"
|
||||||
|
@ -108,6 +109,7 @@ import (
|
||||||
k8s_io_client_go_kubernetes_typed_storage_v1 "k8s.io/client-go/kubernetes/typed/storage/v1"
|
k8s_io_client_go_kubernetes_typed_storage_v1 "k8s.io/client-go/kubernetes/typed/storage/v1"
|
||||||
k8s_io_client_go_kubernetes_typed_storage_v1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
|
k8s_io_client_go_kubernetes_typed_storage_v1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
|
||||||
k8s_io_client_go_kubernetes_typed_storage_v1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
|
k8s_io_client_go_kubernetes_typed_storage_v1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
|
||||||
|
k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1alpha1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type clientset struct {
|
type clientset struct {
|
||||||
|
@ -163,6 +165,7 @@ type clientset struct {
|
||||||
storagev1 k8s_io_client_go_kubernetes_typed_storage_v1.StorageV1Interface
|
storagev1 k8s_io_client_go_kubernetes_typed_storage_v1.StorageV1Interface
|
||||||
storagev1alpha1 k8s_io_client_go_kubernetes_typed_storage_v1alpha1.StorageV1alpha1Interface
|
storagev1alpha1 k8s_io_client_go_kubernetes_typed_storage_v1alpha1.StorageV1alpha1Interface
|
||||||
storagev1beta1 k8s_io_client_go_kubernetes_typed_storage_v1beta1.StorageV1beta1Interface
|
storagev1beta1 k8s_io_client_go_kubernetes_typed_storage_v1beta1.StorageV1beta1Interface
|
||||||
|
storagemigrationv1alpha1 k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientset) Discovery() k8s_io_client_go_discovery.DiscoveryInterface {
|
func (c *clientset) Discovery() k8s_io_client_go_discovery.DiscoveryInterface {
|
||||||
|
@ -321,6 +324,9 @@ func (c *clientset) StorageV1alpha1() k8s_io_client_go_kubernetes_typed_storage_
|
||||||
func (c *clientset) StorageV1beta1() k8s_io_client_go_kubernetes_typed_storage_v1beta1.StorageV1beta1Interface {
|
func (c *clientset) StorageV1beta1() k8s_io_client_go_kubernetes_typed_storage_v1beta1.StorageV1beta1Interface {
|
||||||
return c.storagev1beta1
|
return c.storagev1beta1
|
||||||
}
|
}
|
||||||
|
func (c *clientset) StoragemigrationV1alpha1() k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface {
|
||||||
|
return c.storagemigrationv1alpha1
|
||||||
|
}
|
||||||
|
|
||||||
func WrapWithMetrics(inner k8s_io_client_go_kubernetes.Interface, m metrics.MetricsConfigManager, clientType metrics.ClientType) k8s_io_client_go_kubernetes.Interface {
|
func WrapWithMetrics(inner k8s_io_client_go_kubernetes.Interface, m metrics.MetricsConfigManager, clientType metrics.ClientType) k8s_io_client_go_kubernetes.Interface {
|
||||||
return &clientset{
|
return &clientset{
|
||||||
|
@ -376,6 +382,7 @@ func WrapWithMetrics(inner k8s_io_client_go_kubernetes.Interface, m metrics.Metr
|
||||||
storagev1: storagev1.WithMetrics(inner.StorageV1(), m, clientType),
|
storagev1: storagev1.WithMetrics(inner.StorageV1(), m, clientType),
|
||||||
storagev1alpha1: storagev1alpha1.WithMetrics(inner.StorageV1alpha1(), m, clientType),
|
storagev1alpha1: storagev1alpha1.WithMetrics(inner.StorageV1alpha1(), m, clientType),
|
||||||
storagev1beta1: storagev1beta1.WithMetrics(inner.StorageV1beta1(), m, clientType),
|
storagev1beta1: storagev1beta1.WithMetrics(inner.StorageV1beta1(), m, clientType),
|
||||||
|
storagemigrationv1alpha1: storagemigrationv1alpha1.WithMetrics(inner.StoragemigrationV1alpha1(), m, clientType),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,6 +440,7 @@ func WrapWithTracing(inner k8s_io_client_go_kubernetes.Interface) k8s_io_client_
|
||||||
storagev1: storagev1.WithTracing(inner.StorageV1(), "StorageV1"),
|
storagev1: storagev1.WithTracing(inner.StorageV1(), "StorageV1"),
|
||||||
storagev1alpha1: storagev1alpha1.WithTracing(inner.StorageV1alpha1(), "StorageV1alpha1"),
|
storagev1alpha1: storagev1alpha1.WithTracing(inner.StorageV1alpha1(), "StorageV1alpha1"),
|
||||||
storagev1beta1: storagev1beta1.WithTracing(inner.StorageV1beta1(), "StorageV1beta1"),
|
storagev1beta1: storagev1beta1.WithTracing(inner.StorageV1beta1(), "StorageV1beta1"),
|
||||||
|
storagemigrationv1alpha1: storagemigrationv1alpha1.WithTracing(inner.StoragemigrationV1alpha1(), "StoragemigrationV1alpha1"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,5 +498,6 @@ func WrapWithLogging(inner k8s_io_client_go_kubernetes.Interface, logger logr.Lo
|
||||||
storagev1: storagev1.WithLogging(inner.StorageV1(), logger.WithValues("group", "StorageV1")),
|
storagev1: storagev1.WithLogging(inner.StorageV1(), logger.WithValues("group", "StorageV1")),
|
||||||
storagev1alpha1: storagev1alpha1.WithLogging(inner.StorageV1alpha1(), logger.WithValues("group", "StorageV1alpha1")),
|
storagev1alpha1: storagev1alpha1.WithLogging(inner.StorageV1alpha1(), logger.WithValues("group", "StorageV1alpha1")),
|
||||||
storagev1beta1: storagev1beta1.WithLogging(inner.StorageV1beta1(), logger.WithValues("group", "StorageV1beta1")),
|
storagev1beta1: storagev1beta1.WithLogging(inner.StorageV1beta1(), logger.WithValues("group", "StorageV1beta1")),
|
||||||
|
storagemigrationv1alpha1: storagemigrationv1alpha1.WithLogging(inner.StoragemigrationV1alpha1(), logger.WithValues("group", "StoragemigrationV1alpha1")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,12 @@ package client
|
||||||
import (
|
import (
|
||||||
"github.com/go-logr/logr"
|
"github.com/go-logr/logr"
|
||||||
podschedulingcontexts "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/podschedulingcontexts"
|
podschedulingcontexts "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/podschedulingcontexts"
|
||||||
|
resourceclaimparameters "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/resourceclaimparameters"
|
||||||
resourceclaims "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/resourceclaims"
|
resourceclaims "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/resourceclaims"
|
||||||
resourceclaimtemplates "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/resourceclaimtemplates"
|
resourceclaimtemplates "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/resourceclaimtemplates"
|
||||||
resourceclasses "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/resourceclasses"
|
resourceclasses "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/resourceclasses"
|
||||||
|
resourceclassparameters "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/resourceclassparameters"
|
||||||
|
resourceslices "github.com/kyverno/kyverno/pkg/clients/kube/resourcev1alpha2/resourceslices"
|
||||||
"github.com/kyverno/kyverno/pkg/metrics"
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
k8s_io_client_go_kubernetes_typed_resource_v1alpha2 "k8s.io/client-go/kubernetes/typed/resource/v1alpha2"
|
k8s_io_client_go_kubernetes_typed_resource_v1alpha2 "k8s.io/client-go/kubernetes/typed/resource/v1alpha2"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
|
@ -36,6 +39,10 @@ func (c *withMetrics) PodSchedulingContexts(namespace string) k8s_io_client_go_k
|
||||||
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "PodSchedulingContext", c.clientType)
|
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "PodSchedulingContext", c.clientType)
|
||||||
return podschedulingcontexts.WithMetrics(c.inner.PodSchedulingContexts(namespace), recorder)
|
return podschedulingcontexts.WithMetrics(c.inner.PodSchedulingContexts(namespace), recorder)
|
||||||
}
|
}
|
||||||
|
func (c *withMetrics) ResourceClaimParameters(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface {
|
||||||
|
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "ResourceClaimParameters", c.clientType)
|
||||||
|
return resourceclaimparameters.WithMetrics(c.inner.ResourceClaimParameters(namespace), recorder)
|
||||||
|
}
|
||||||
func (c *withMetrics) ResourceClaimTemplates(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimTemplateInterface {
|
func (c *withMetrics) ResourceClaimTemplates(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimTemplateInterface {
|
||||||
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "ResourceClaimTemplate", c.clientType)
|
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "ResourceClaimTemplate", c.clientType)
|
||||||
return resourceclaimtemplates.WithMetrics(c.inner.ResourceClaimTemplates(namespace), recorder)
|
return resourceclaimtemplates.WithMetrics(c.inner.ResourceClaimTemplates(namespace), recorder)
|
||||||
|
@ -44,10 +51,18 @@ func (c *withMetrics) ResourceClaims(namespace string) k8s_io_client_go_kubernet
|
||||||
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "ResourceClaim", c.clientType)
|
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "ResourceClaim", c.clientType)
|
||||||
return resourceclaims.WithMetrics(c.inner.ResourceClaims(namespace), recorder)
|
return resourceclaims.WithMetrics(c.inner.ResourceClaims(namespace), recorder)
|
||||||
}
|
}
|
||||||
|
func (c *withMetrics) ResourceClassParameters(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface {
|
||||||
|
recorder := metrics.NamespacedClientQueryRecorder(c.metrics, namespace, "ResourceClassParameters", c.clientType)
|
||||||
|
return resourceclassparameters.WithMetrics(c.inner.ResourceClassParameters(namespace), recorder)
|
||||||
|
}
|
||||||
func (c *withMetrics) ResourceClasses() k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassInterface {
|
func (c *withMetrics) ResourceClasses() k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassInterface {
|
||||||
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ResourceClass", c.clientType)
|
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ResourceClass", c.clientType)
|
||||||
return resourceclasses.WithMetrics(c.inner.ResourceClasses(), recorder)
|
return resourceclasses.WithMetrics(c.inner.ResourceClasses(), recorder)
|
||||||
}
|
}
|
||||||
|
func (c *withMetrics) ResourceSlices() k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface {
|
||||||
|
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "ResourceSlice", c.clientType)
|
||||||
|
return resourceslices.WithMetrics(c.inner.ResourceSlices(), recorder)
|
||||||
|
}
|
||||||
|
|
||||||
type withTracing struct {
|
type withTracing struct {
|
||||||
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceV1alpha2Interface
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceV1alpha2Interface
|
||||||
|
@ -60,15 +75,24 @@ func (c *withTracing) RESTClient() rest.Interface {
|
||||||
func (c *withTracing) PodSchedulingContexts(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.PodSchedulingContextInterface {
|
func (c *withTracing) PodSchedulingContexts(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.PodSchedulingContextInterface {
|
||||||
return podschedulingcontexts.WithTracing(c.inner.PodSchedulingContexts(namespace), c.client, "PodSchedulingContext")
|
return podschedulingcontexts.WithTracing(c.inner.PodSchedulingContexts(namespace), c.client, "PodSchedulingContext")
|
||||||
}
|
}
|
||||||
|
func (c *withTracing) ResourceClaimParameters(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface {
|
||||||
|
return resourceclaimparameters.WithTracing(c.inner.ResourceClaimParameters(namespace), c.client, "ResourceClaimParameters")
|
||||||
|
}
|
||||||
func (c *withTracing) ResourceClaimTemplates(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimTemplateInterface {
|
func (c *withTracing) ResourceClaimTemplates(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimTemplateInterface {
|
||||||
return resourceclaimtemplates.WithTracing(c.inner.ResourceClaimTemplates(namespace), c.client, "ResourceClaimTemplate")
|
return resourceclaimtemplates.WithTracing(c.inner.ResourceClaimTemplates(namespace), c.client, "ResourceClaimTemplate")
|
||||||
}
|
}
|
||||||
func (c *withTracing) ResourceClaims(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimInterface {
|
func (c *withTracing) ResourceClaims(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimInterface {
|
||||||
return resourceclaims.WithTracing(c.inner.ResourceClaims(namespace), c.client, "ResourceClaim")
|
return resourceclaims.WithTracing(c.inner.ResourceClaims(namespace), c.client, "ResourceClaim")
|
||||||
}
|
}
|
||||||
|
func (c *withTracing) ResourceClassParameters(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface {
|
||||||
|
return resourceclassparameters.WithTracing(c.inner.ResourceClassParameters(namespace), c.client, "ResourceClassParameters")
|
||||||
|
}
|
||||||
func (c *withTracing) ResourceClasses() k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassInterface {
|
func (c *withTracing) ResourceClasses() k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassInterface {
|
||||||
return resourceclasses.WithTracing(c.inner.ResourceClasses(), c.client, "ResourceClass")
|
return resourceclasses.WithTracing(c.inner.ResourceClasses(), c.client, "ResourceClass")
|
||||||
}
|
}
|
||||||
|
func (c *withTracing) ResourceSlices() k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface {
|
||||||
|
return resourceslices.WithTracing(c.inner.ResourceSlices(), c.client, "ResourceSlice")
|
||||||
|
}
|
||||||
|
|
||||||
type withLogging struct {
|
type withLogging struct {
|
||||||
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceV1alpha2Interface
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceV1alpha2Interface
|
||||||
|
@ -81,12 +105,21 @@ func (c *withLogging) RESTClient() rest.Interface {
|
||||||
func (c *withLogging) PodSchedulingContexts(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.PodSchedulingContextInterface {
|
func (c *withLogging) PodSchedulingContexts(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.PodSchedulingContextInterface {
|
||||||
return podschedulingcontexts.WithLogging(c.inner.PodSchedulingContexts(namespace), c.logger.WithValues("resource", "PodSchedulingContexts").WithValues("namespace", namespace))
|
return podschedulingcontexts.WithLogging(c.inner.PodSchedulingContexts(namespace), c.logger.WithValues("resource", "PodSchedulingContexts").WithValues("namespace", namespace))
|
||||||
}
|
}
|
||||||
|
func (c *withLogging) ResourceClaimParameters(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface {
|
||||||
|
return resourceclaimparameters.WithLogging(c.inner.ResourceClaimParameters(namespace), c.logger.WithValues("resource", "ResourceClaimParameters").WithValues("namespace", namespace))
|
||||||
|
}
|
||||||
func (c *withLogging) ResourceClaimTemplates(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimTemplateInterface {
|
func (c *withLogging) ResourceClaimTemplates(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimTemplateInterface {
|
||||||
return resourceclaimtemplates.WithLogging(c.inner.ResourceClaimTemplates(namespace), c.logger.WithValues("resource", "ResourceClaimTemplates").WithValues("namespace", namespace))
|
return resourceclaimtemplates.WithLogging(c.inner.ResourceClaimTemplates(namespace), c.logger.WithValues("resource", "ResourceClaimTemplates").WithValues("namespace", namespace))
|
||||||
}
|
}
|
||||||
func (c *withLogging) ResourceClaims(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimInterface {
|
func (c *withLogging) ResourceClaims(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimInterface {
|
||||||
return resourceclaims.WithLogging(c.inner.ResourceClaims(namespace), c.logger.WithValues("resource", "ResourceClaims").WithValues("namespace", namespace))
|
return resourceclaims.WithLogging(c.inner.ResourceClaims(namespace), c.logger.WithValues("resource", "ResourceClaims").WithValues("namespace", namespace))
|
||||||
}
|
}
|
||||||
|
func (c *withLogging) ResourceClassParameters(namespace string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface {
|
||||||
|
return resourceclassparameters.WithLogging(c.inner.ResourceClassParameters(namespace), c.logger.WithValues("resource", "ResourceClassParameters").WithValues("namespace", namespace))
|
||||||
|
}
|
||||||
func (c *withLogging) ResourceClasses() k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassInterface {
|
func (c *withLogging) ResourceClasses() k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassInterface {
|
||||||
return resourceclasses.WithLogging(c.inner.ResourceClasses(), c.logger.WithValues("resource", "ResourceClasses"))
|
return resourceclasses.WithLogging(c.inner.ResourceClasses(), c.logger.WithValues("resource", "ResourceClasses"))
|
||||||
}
|
}
|
||||||
|
func (c *withLogging) ResourceSlices() k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface {
|
||||||
|
return resourceslices.WithLogging(c.inner.ResourceSlices(), c.logger.WithValues("resource", "ResourceSlices"))
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,374 @@
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
"github.com/kyverno/kyverno/pkg/tracing"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
"go.uber.org/multierr"
|
||||||
|
k8s_io_api_resource_v1alpha2 "k8s.io/api/resource/v1alpha2"
|
||||||
|
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||||
|
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
k8s_io_client_go_applyconfigurations_resource_v1alpha2 "k8s.io/client-go/applyconfigurations/resource/v1alpha2"
|
||||||
|
k8s_io_client_go_kubernetes_typed_resource_v1alpha2 "k8s.io/client-go/kubernetes/typed/resource/v1alpha2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithLogging(inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface, logger logr.Logger) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithMetrics(inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface, recorder metrics.Recorder) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface {
|
||||||
|
return &withMetrics{inner, recorder}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface, client, kind string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface {
|
||||||
|
return &withTracing{inner, client, kind}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_resource_v1alpha2.ResourceClaimParametersApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Apply")
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Apply failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Apply done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Create(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClaimParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Create")
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Create done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Delete")
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Delete done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Get")
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Get done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParametersList, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "List")
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("List done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Patch")
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Patch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Update(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClaimParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Update")
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Update done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Watch")
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Watch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface
|
||||||
|
recorder metrics.Recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_resource_v1alpha2.ResourceClaimParametersApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "apply")
|
||||||
|
return c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClaimParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "create")
|
||||||
|
return c.inner.Create(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||||
|
return c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||||
|
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "get")
|
||||||
|
return c.inner.Get(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParametersList, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "list")
|
||||||
|
return c.inner.List(arg0, arg1)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||||
|
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClaimParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update")
|
||||||
|
return c.inner.Update(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||||
|
return c.inner.Watch(arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClaimParametersInterface
|
||||||
|
client string
|
||||||
|
kind string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_resource_v1alpha2.ResourceClaimParametersApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Apply"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClaimParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Create"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Delete"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Get"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParametersList, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("List"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Patch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClaimParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClaimParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Update"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Watch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
|
@ -0,0 +1,374 @@
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
"github.com/kyverno/kyverno/pkg/tracing"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
"go.uber.org/multierr"
|
||||||
|
k8s_io_api_resource_v1alpha2 "k8s.io/api/resource/v1alpha2"
|
||||||
|
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||||
|
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
k8s_io_client_go_applyconfigurations_resource_v1alpha2 "k8s.io/client-go/applyconfigurations/resource/v1alpha2"
|
||||||
|
k8s_io_client_go_kubernetes_typed_resource_v1alpha2 "k8s.io/client-go/kubernetes/typed/resource/v1alpha2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithLogging(inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface, logger logr.Logger) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithMetrics(inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface, recorder metrics.Recorder) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface {
|
||||||
|
return &withMetrics{inner, recorder}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface, client, kind string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface {
|
||||||
|
return &withTracing{inner, client, kind}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_resource_v1alpha2.ResourceClassParametersApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Apply")
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Apply failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Apply done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Create(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClassParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Create")
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Create done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Delete")
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Delete done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Get")
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Get done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParametersList, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "List")
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("List done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Patch")
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Patch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Update(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClassParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Update")
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Update done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Watch")
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Watch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface
|
||||||
|
recorder metrics.Recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_resource_v1alpha2.ResourceClassParametersApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "apply")
|
||||||
|
return c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClassParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "create")
|
||||||
|
return c.inner.Create(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||||
|
return c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||||
|
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "get")
|
||||||
|
return c.inner.Get(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParametersList, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "list")
|
||||||
|
return c.inner.List(arg0, arg1)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||||
|
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClassParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update")
|
||||||
|
return c.inner.Update(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||||
|
return c.inner.Watch(arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceClassParametersInterface
|
||||||
|
client string
|
||||||
|
kind string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_resource_v1alpha2.ResourceClassParametersApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Apply"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClassParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Create"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Delete"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Get"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParametersList, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("List"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Patch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceClassParameters, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_resource_v1alpha2.ResourceClassParameters, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Update"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Watch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
|
@ -0,0 +1,374 @@
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
"github.com/kyverno/kyverno/pkg/tracing"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
"go.uber.org/multierr"
|
||||||
|
k8s_io_api_resource_v1alpha2 "k8s.io/api/resource/v1alpha2"
|
||||||
|
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||||
|
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
k8s_io_client_go_applyconfigurations_resource_v1alpha2 "k8s.io/client-go/applyconfigurations/resource/v1alpha2"
|
||||||
|
k8s_io_client_go_kubernetes_typed_resource_v1alpha2 "k8s.io/client-go/kubernetes/typed/resource/v1alpha2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithLogging(inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface, logger logr.Logger) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithMetrics(inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface, recorder metrics.Recorder) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface {
|
||||||
|
return &withMetrics{inner, recorder}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface, client, kind string) k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface {
|
||||||
|
return &withTracing{inner, client, kind}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_resource_v1alpha2.ResourceSliceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Apply")
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Apply failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Apply done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Create(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Create")
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Create done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Delete")
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Delete done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Get")
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Get done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_resource_v1alpha2.ResourceSliceList, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "List")
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("List done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Patch")
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Patch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Update(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Update")
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Update done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Watch")
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Watch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface
|
||||||
|
recorder metrics.Recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_resource_v1alpha2.ResourceSliceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "apply")
|
||||||
|
return c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "create")
|
||||||
|
return c.inner.Create(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||||
|
return c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||||
|
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "get")
|
||||||
|
return c.inner.Get(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_resource_v1alpha2.ResourceSliceList, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "list")
|
||||||
|
return c.inner.List(arg0, arg1)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||||
|
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update")
|
||||||
|
return c.inner.Update(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||||
|
return c.inner.Watch(arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_resource_v1alpha2.ResourceSliceInterface
|
||||||
|
client string
|
||||||
|
kind string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_resource_v1alpha2.ResourceSliceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Apply"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Create"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Delete"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Get"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_resource_v1alpha2.ResourceSliceList, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("List"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Patch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_resource_v1alpha2.ResourceSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_resource_v1alpha2.ResourceSlice, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Update"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Watch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
storageversionmigrations "github.com/kyverno/kyverno/pkg/clients/kube/storagemigrationv1alpha1/storageversionmigrations"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1alpha1"
|
||||||
|
"k8s.io/client-go/rest"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithMetrics(inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface, metrics metrics.MetricsConfigManager, clientType metrics.ClientType) k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface {
|
||||||
|
return &withMetrics{inner, metrics, clientType}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface, client string) k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface {
|
||||||
|
return &withTracing{inner, client}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithLogging(inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface, logger logr.Logger) k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface
|
||||||
|
metrics metrics.MetricsConfigManager
|
||||||
|
clientType metrics.ClientType
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) RESTClient() rest.Interface {
|
||||||
|
return c.inner.RESTClient()
|
||||||
|
}
|
||||||
|
func (c *withMetrics) StorageVersionMigrations() k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface {
|
||||||
|
recorder := metrics.ClusteredClientQueryRecorder(c.metrics, "StorageVersionMigration", c.clientType)
|
||||||
|
return storageversionmigrations.WithMetrics(c.inner.StorageVersionMigrations(), recorder)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface
|
||||||
|
client string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) RESTClient() rest.Interface {
|
||||||
|
return c.inner.RESTClient()
|
||||||
|
}
|
||||||
|
func (c *withTracing) StorageVersionMigrations() k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface {
|
||||||
|
return storageversionmigrations.WithTracing(c.inner.StorageVersionMigrations(), c.client, "StorageVersionMigration")
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StoragemigrationV1alpha1Interface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) RESTClient() rest.Interface {
|
||||||
|
return c.inner.RESTClient()
|
||||||
|
}
|
||||||
|
func (c *withLogging) StorageVersionMigrations() k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface {
|
||||||
|
return storageversionmigrations.WithLogging(c.inner.StorageVersionMigrations(), c.logger.WithValues("resource", "StorageVersionMigrations"))
|
||||||
|
}
|
|
@ -0,0 +1,446 @@
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-logr/logr"
|
||||||
|
"github.com/kyverno/kyverno/pkg/metrics"
|
||||||
|
"github.com/kyverno/kyverno/pkg/tracing"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
"go.uber.org/multierr"
|
||||||
|
k8s_io_api_storagemigration_v1alpha1 "k8s.io/api/storagemigration/v1alpha1"
|
||||||
|
k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types"
|
||||||
|
k8s_io_apimachinery_pkg_watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
k8s_io_client_go_applyconfigurations_storagemigration_v1alpha1 "k8s.io/client-go/applyconfigurations/storagemigration/v1alpha1"
|
||||||
|
k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1 "k8s.io/client-go/kubernetes/typed/storagemigration/v1alpha1"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WithLogging(inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface, logger logr.Logger) k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface {
|
||||||
|
return &withLogging{inner, logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithMetrics(inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface, recorder metrics.Recorder) k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface {
|
||||||
|
return &withMetrics{inner, recorder}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTracing(inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface, client, kind string) k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface {
|
||||||
|
return &withTracing{inner, client, kind}
|
||||||
|
}
|
||||||
|
|
||||||
|
type withLogging struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface
|
||||||
|
logger logr.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withLogging) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storagemigration_v1alpha1.StorageVersionMigrationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Apply")
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Apply failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Apply done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storagemigration_v1alpha1.StorageVersionMigrationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "ApplyStatus")
|
||||||
|
ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "ApplyStatus failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("ApplyStatus done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Create(arg0 context.Context, arg1 *k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Create")
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Create failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Create done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Delete")
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "Delete failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Delete done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "DeleteCollection")
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret0); err != nil {
|
||||||
|
logger.Error(err, "DeleteCollection failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("DeleteCollection done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withLogging) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Get")
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Get failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Get done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigrationList, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "List")
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "List failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("List done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Patch")
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Patch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Patch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Update(arg0 context.Context, arg1 *k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Update")
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Update failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Update done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "UpdateStatus")
|
||||||
|
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "UpdateStatus failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("UpdateStatus done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withLogging) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
start := time.Now()
|
||||||
|
logger := c.logger.WithValues("operation", "Watch")
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if err := multierr.Combine(ret1); err != nil {
|
||||||
|
logger.Error(err, "Watch failed", "duration", time.Since(start))
|
||||||
|
} else {
|
||||||
|
logger.Info("Watch done", "duration", time.Since(start))
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
type withMetrics struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface
|
||||||
|
recorder metrics.Recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storagemigration_v1alpha1.StorageVersionMigrationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "apply")
|
||||||
|
return c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storagemigration_v1alpha1.StorageVersionMigrationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "apply_status")
|
||||||
|
return c.inner.ApplyStatus(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "create")
|
||||||
|
return c.inner.Create(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete")
|
||||||
|
return c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "delete_collection")
|
||||||
|
return c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "get")
|
||||||
|
return c.inner.Get(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigrationList, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "list")
|
||||||
|
return c.inner.List(arg0, arg1)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "patch")
|
||||||
|
return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update")
|
||||||
|
return c.inner.Update(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "update_status")
|
||||||
|
return c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
defer c.recorder.RecordWithContext(arg0, "watch")
|
||||||
|
return c.inner.Watch(arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
type withTracing struct {
|
||||||
|
inner k8s_io_client_go_kubernetes_typed_storagemigration_v1alpha1.StorageVersionMigrationInterface
|
||||||
|
client string
|
||||||
|
kind string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storagemigration_v1alpha1.StorageVersionMigrationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Apply"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Apply(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storagemigration_v1alpha1.StorageVersionMigrationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("ApplyStatus"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Create"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Create(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Delete"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.Delete(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("DeleteCollection"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0 := c.inner.DeleteCollection(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret0)
|
||||||
|
}
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Get"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Get(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigrationList, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("List"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.List(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Patch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Update"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Update(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storagemigration_v1alpha1.StorageVersionMigration, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("UpdateStatus"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) {
|
||||||
|
var span trace.Span
|
||||||
|
if tracing.IsInSpan(arg0) {
|
||||||
|
arg0, span = tracing.StartChildSpan(
|
||||||
|
arg0,
|
||||||
|
"",
|
||||||
|
fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"),
|
||||||
|
trace.WithAttributes(
|
||||||
|
tracing.KubeClientGroupKey.String(c.client),
|
||||||
|
tracing.KubeClientKindKey.String(c.kind),
|
||||||
|
tracing.KubeClientOperationKey.String("Watch"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
}
|
||||||
|
ret0, ret1 := c.inner.Watch(arg0, arg1)
|
||||||
|
if span != nil {
|
||||||
|
tracing.SetSpanStatus(span, ret1)
|
||||||
|
}
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apiserver/pkg/admission"
|
"k8s.io/apiserver/pkg/admission"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/cel"
|
"k8s.io/apiserver/pkg/admission/plugin/cel"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/validatingadmissionpolicy"
|
"k8s.io/apiserver/pkg/admission/plugin/policy/validating"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions"
|
"k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions"
|
||||||
celconfig "k8s.io/apiserver/pkg/apis/cel"
|
celconfig "k8s.io/apiserver/pkg/apis/cel"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
|
@ -123,7 +123,7 @@ func (h validateCELHandler) Process(
|
||||||
// newMatcher will be used to check if the incoming resource matches the CEL preconditions
|
// newMatcher will be used to check if the incoming resource matches the CEL preconditions
|
||||||
newMatcher := matchconditions.NewMatcher(matchConditionFilter, nil, policyKind, "", policyName)
|
newMatcher := matchconditions.NewMatcher(matchConditionFilter, nil, policyKind, "", policyName)
|
||||||
// newValidator will be used to validate CEL expressions against the incoming object
|
// newValidator will be used to validate CEL expressions against the incoming object
|
||||||
validator := validatingadmissionpolicy.NewValidator(filter, newMatcher, auditAnnotationFilter, messageExpressionfilter, nil)
|
validator := validating.NewValidator(filter, newMatcher, auditAnnotationFilter, messageExpressionfilter, nil)
|
||||||
|
|
||||||
var namespace *corev1.Namespace
|
var namespace *corev1.Namespace
|
||||||
// Special case, the namespace object has the namespace of itself.
|
// Special case, the namespace object has the namespace of itself.
|
||||||
|
@ -154,7 +154,7 @@ func (h validateCELHandler) Process(
|
||||||
versionedAttr, _ := admission.NewVersionedAttributes(admissionAttributes, admissionAttributes.GetKind(), nil)
|
versionedAttr, _ := admission.NewVersionedAttributes(admissionAttributes, admissionAttributes.GetKind(), nil)
|
||||||
authorizer := internal.NewAuthorizer(h.client, resourceKind)
|
authorizer := internal.NewAuthorizer(h.client, resourceKind)
|
||||||
// validate the incoming object against the rule
|
// validate the incoming object against the rule
|
||||||
var validationResults []validatingadmissionpolicy.ValidateResult
|
var validationResults []validating.ValidateResult
|
||||||
if hasParam {
|
if hasParam {
|
||||||
paramKind := rule.Validation.CEL.ParamKind
|
paramKind := rule.Validation.CEL.ParamKind
|
||||||
paramRef := rule.Validation.CEL.ParamRef
|
paramRef := rule.Validation.CEL.ParamRef
|
||||||
|
@ -175,7 +175,7 @@ func (h validateCELHandler) Process(
|
||||||
|
|
||||||
for _, validationResult := range validationResults {
|
for _, validationResult := range validationResults {
|
||||||
// no validations are returned if preconditions aren't met
|
// no validations are returned if preconditions aren't met
|
||||||
if datautils.DeepEqual(validationResult, validatingadmissionpolicy.ValidateResult{}) {
|
if datautils.DeepEqual(validationResult, validating.ValidateResult{}) {
|
||||||
return resource, handlers.WithResponses(
|
return resource, handlers.WithResponses(
|
||||||
engineapi.RuleSkip(rule.Name, engineapi.Validation, "cel preconditions not met"),
|
engineapi.RuleSkip(rule.Name, engineapi.Validation, "cel preconditions not met"),
|
||||||
)
|
)
|
||||||
|
@ -183,13 +183,13 @@ func (h validateCELHandler) Process(
|
||||||
|
|
||||||
for _, decision := range validationResult.Decisions {
|
for _, decision := range validationResult.Decisions {
|
||||||
switch decision.Action {
|
switch decision.Action {
|
||||||
case validatingadmissionpolicy.ActionAdmit:
|
case validating.ActionAdmit:
|
||||||
if decision.Evaluation == validatingadmissionpolicy.EvalError {
|
if decision.Evaluation == validating.EvalError {
|
||||||
return resource, handlers.WithResponses(
|
return resource, handlers.WithResponses(
|
||||||
engineapi.RuleError(rule.Name, engineapi.Validation, decision.Message, nil),
|
engineapi.RuleError(rule.Name, engineapi.Validation, decision.Message, nil),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
case validatingadmissionpolicy.ActionDeny:
|
case validating.ActionDeny:
|
||||||
return resource, handlers.WithResponses(
|
return resource, handlers.WithResponses(
|
||||||
engineapi.RuleFail(rule.Name, engineapi.Validation, decision.Message),
|
engineapi.RuleFail(rule.Name, engineapi.Validation, decision.Message),
|
||||||
)
|
)
|
||||||
|
|
|
@ -79,65 +79,67 @@ func exemptExclusions(defaultCheckResults, excludeCheckResults []pssutils.PSSChe
|
||||||
for _, excludeResult := range excludeCheckResults {
|
for _, excludeResult := range excludeCheckResults {
|
||||||
for _, checkID := range pssutils.PSS_control_name_to_ids[exclude.ControlName] {
|
for _, checkID := range pssutils.PSS_control_name_to_ids[exclude.ControlName] {
|
||||||
if excludeResult.ID == checkID {
|
if excludeResult.ID == checkID {
|
||||||
for _, excludeFieldErr := range *excludeResult.CheckResult.ErrList {
|
if excludeResult.CheckResult.ErrList != nil {
|
||||||
var excludeField, excludeContainerType string
|
for _, excludeFieldErr := range *excludeResult.CheckResult.ErrList {
|
||||||
var excludeIndexes []int
|
var excludeField, excludeContainerType string
|
||||||
var isContainerLevelField bool = false
|
var excludeIndexes []int
|
||||||
var excludeContainer corev1.Container
|
var isContainerLevelField bool = false
|
||||||
|
var excludeContainer corev1.Container
|
||||||
|
|
||||||
if isContainerLevelExclusion {
|
if isContainerLevelExclusion {
|
||||||
excludeField, excludeIndexes, excludeContainerType, isContainerLevelField = parseField(excludeFieldErr.Field)
|
excludeField, excludeIndexes, excludeContainerType, isContainerLevelField = parseField(excludeFieldErr.Field)
|
||||||
} else {
|
} else {
|
||||||
excludeField = regexIndex.ReplaceAllString(excludeFieldErr.Field, "*")
|
excludeField = regexIndex.ReplaceAllString(excludeFieldErr.Field, "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
if isContainerLevelField {
|
if isContainerLevelField {
|
||||||
excludeContainer = getContainerInfo(matching, excludeIndexes[0], excludeContainerType)
|
excludeContainer = getContainerInfo(matching, excludeIndexes[0], excludeContainerType)
|
||||||
}
|
}
|
||||||
excludeBadValues := extractBadValues(excludeFieldErr)
|
excludeBadValues := extractBadValues(excludeFieldErr)
|
||||||
|
|
||||||
if excludeField == exclude.RestrictedField || len(exclude.RestrictedField) == 0 {
|
if excludeField == exclude.RestrictedField || len(exclude.RestrictedField) == 0 {
|
||||||
flag := true
|
flag := true
|
||||||
if len(exclude.Values) != 0 {
|
if len(exclude.Values) != 0 {
|
||||||
for _, badValue := range excludeBadValues {
|
for _, badValue := range excludeBadValues {
|
||||||
if !wildcard.CheckPatterns(exclude.Values, badValue) {
|
if !wildcard.CheckPatterns(exclude.Values, badValue) {
|
||||||
flag = false
|
flag = false
|
||||||
break
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if flag {
|
||||||
if flag {
|
defaultCheckResult := defaultCheckResultsMap[checkID]
|
||||||
defaultCheckResult := defaultCheckResultsMap[checkID]
|
if defaultCheckResult.CheckResult.ErrList != nil {
|
||||||
if defaultCheckResult.CheckResult.ErrList != nil {
|
for idx, defaultFieldErr := range *defaultCheckResult.CheckResult.ErrList {
|
||||||
for idx, defaultFieldErr := range *defaultCheckResult.CheckResult.ErrList {
|
var defaultField, defaultContainerType string
|
||||||
var defaultField, defaultContainerType string
|
var defaultIndexes []int
|
||||||
var defaultIndexes []int
|
var isContainerLevelField bool = false
|
||||||
var isContainerLevelField bool = false
|
var defaultContainer corev1.Container
|
||||||
var defaultContainer corev1.Container
|
|
||||||
|
|
||||||
if isContainerLevelExclusion {
|
if isContainerLevelExclusion {
|
||||||
defaultField, defaultIndexes, defaultContainerType, isContainerLevelField = parseField(defaultFieldErr.Field)
|
defaultField, defaultIndexes, defaultContainerType, isContainerLevelField = parseField(defaultFieldErr.Field)
|
||||||
} else {
|
} else {
|
||||||
defaultField = regexIndex.ReplaceAllString(defaultFieldErr.Field, "*")
|
defaultField = regexIndex.ReplaceAllString(defaultFieldErr.Field, "*")
|
||||||
}
|
|
||||||
|
|
||||||
if isContainerLevelField {
|
|
||||||
defaultContainer = getContainerInfo(pod, defaultIndexes[0], defaultContainerType)
|
|
||||||
if excludeField == defaultField && excludeContainer.Name == defaultContainer.Name {
|
|
||||||
remove(defaultCheckResult.CheckResult.ErrList, idx)
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if excludeField == defaultField {
|
if isContainerLevelField {
|
||||||
remove(defaultCheckResult.CheckResult.ErrList, idx)
|
defaultContainer = getContainerInfo(pod, defaultIndexes[0], defaultContainerType)
|
||||||
break
|
if excludeField == defaultField && excludeContainer.Name == defaultContainer.Name {
|
||||||
|
remove(defaultCheckResult.CheckResult.ErrList, idx)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if excludeField == defaultField {
|
||||||
|
remove(defaultCheckResult.CheckResult.ErrList, idx)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if len(*defaultCheckResult.CheckResult.ErrList) == 0 {
|
||||||
if len(*defaultCheckResult.CheckResult.ErrList) == 0 {
|
delete(defaultCheckResultsMap, checkID)
|
||||||
delete(defaultCheckResultsMap, checkID)
|
} else {
|
||||||
} else {
|
defaultCheckResultsMap[checkID] = defaultCheckResult
|
||||||
defaultCheckResultsMap[checkID] = defaultCheckResult
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
|
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
|
||||||
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/cel"
|
"k8s.io/apiserver/pkg/admission/plugin/cel"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/validatingadmissionpolicy"
|
"k8s.io/apiserver/pkg/admission/plugin/policy/validating"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions"
|
"k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions"
|
||||||
"k8s.io/apiserver/pkg/cel/environment"
|
"k8s.io/apiserver/pkg/cel/environment"
|
||||||
)
|
)
|
||||||
|
@ -80,7 +80,7 @@ func (c Compiler) CompileMatchExpressions(optionalVars cel.OptionalVariableDecla
|
||||||
func (c Compiler) convertValidations() []cel.ExpressionAccessor {
|
func (c Compiler) convertValidations() []cel.ExpressionAccessor {
|
||||||
celExpressionAccessor := make([]cel.ExpressionAccessor, len(c.validateExpressions))
|
celExpressionAccessor := make([]cel.ExpressionAccessor, len(c.validateExpressions))
|
||||||
for i, validation := range c.validateExpressions {
|
for i, validation := range c.validateExpressions {
|
||||||
validation := validatingadmissionpolicy.ValidationCondition{
|
validation := validating.ValidationCondition{
|
||||||
Expression: validation.Expression,
|
Expression: validation.Expression,
|
||||||
Message: validation.Message,
|
Message: validation.Message,
|
||||||
Reason: validation.Reason,
|
Reason: validation.Reason,
|
||||||
|
@ -94,7 +94,7 @@ func (c Compiler) convertMessageExpressions() []cel.ExpressionAccessor {
|
||||||
celExpressionAccessor := make([]cel.ExpressionAccessor, len(c.validateExpressions))
|
celExpressionAccessor := make([]cel.ExpressionAccessor, len(c.validateExpressions))
|
||||||
for i, validation := range c.validateExpressions {
|
for i, validation := range c.validateExpressions {
|
||||||
if validation.MessageExpression != "" {
|
if validation.MessageExpression != "" {
|
||||||
condition := validatingadmissionpolicy.MessageExpressionCondition{
|
condition := validating.MessageExpressionCondition{
|
||||||
MessageExpression: validation.MessageExpression,
|
MessageExpression: validation.MessageExpression,
|
||||||
}
|
}
|
||||||
celExpressionAccessor[i] = &condition
|
celExpressionAccessor[i] = &condition
|
||||||
|
@ -106,7 +106,7 @@ func (c Compiler) convertMessageExpressions() []cel.ExpressionAccessor {
|
||||||
func (c Compiler) convertAuditAnnotations() []cel.ExpressionAccessor {
|
func (c Compiler) convertAuditAnnotations() []cel.ExpressionAccessor {
|
||||||
celExpressionAccessor := make([]cel.ExpressionAccessor, len(c.auditAnnotationExpressions))
|
celExpressionAccessor := make([]cel.ExpressionAccessor, len(c.auditAnnotationExpressions))
|
||||||
for i, validation := range c.auditAnnotationExpressions {
|
for i, validation := range c.auditAnnotationExpressions {
|
||||||
validation := validatingadmissionpolicy.AuditAnnotationCondition{
|
validation := validating.AuditAnnotationCondition{
|
||||||
Key: validation.Key,
|
Key: validation.Key,
|
||||||
ValueExpression: validation.ValueExpression,
|
ValueExpression: validation.ValueExpression,
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ func (c Compiler) convertMatchExpressions() []cel.ExpressionAccessor {
|
||||||
func (c Compiler) convertVariables() []cel.NamedExpressionAccessor {
|
func (c Compiler) convertVariables() []cel.NamedExpressionAccessor {
|
||||||
namedExpressions := make([]cel.NamedExpressionAccessor, len(c.variables))
|
namedExpressions := make([]cel.NamedExpressionAccessor, len(c.variables))
|
||||||
for i, variable := range c.variables {
|
for i, variable := range c.variables {
|
||||||
namedExpressions[i] = &validatingadmissionpolicy.Variable{
|
namedExpressions[i] = &validating.Variable{
|
||||||
Name: variable.Name,
|
Name: variable.Name,
|
||||||
Expression: variable.Expression,
|
Expression: variable.Expression,
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,9 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apiserver/pkg/admission"
|
"k8s.io/apiserver/pkg/admission"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/cel"
|
"k8s.io/apiserver/pkg/admission/plugin/cel"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/validatingadmissionpolicy"
|
"k8s.io/apiserver/pkg/admission/plugin/policy/generic"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/validatingadmissionpolicy/matching"
|
"k8s.io/apiserver/pkg/admission/plugin/policy/matching"
|
||||||
|
"k8s.io/apiserver/pkg/admission/plugin/policy/validating"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions"
|
"k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions"
|
||||||
celconfig "k8s.io/apiserver/pkg/apis/cel"
|
celconfig "k8s.io/apiserver/pkg/apis/cel"
|
||||||
)
|
)
|
||||||
|
@ -117,10 +118,10 @@ func Validate(
|
||||||
|
|
||||||
if client != nil {
|
if client != nil {
|
||||||
nsLister := NewCustomNamespaceLister(client)
|
nsLister := NewCustomNamespaceLister(client)
|
||||||
matcher := validatingadmissionpolicy.NewMatcher(matching.NewMatcher(nsLister, client.GetKubeClient()))
|
matcher := generic.NewPolicyMatcher(matching.NewMatcher(nsLister, client.GetKubeClient()))
|
||||||
|
|
||||||
// convert policy from v1alpha1 to v1beta1
|
// convert policy from v1alpha1 to v1
|
||||||
v1beta1policy := ConvertValidatingAdmissionPolicy(policy)
|
v1policy := ConvertValidatingAdmissionPolicy(policy)
|
||||||
|
|
||||||
// construct admission attributes
|
// construct admission attributes
|
||||||
gvr, err := client.Discovery().GetGVRFromGVK(gvk)
|
gvr, err := client.Discovery().GetGVRFromGVK(gvk)
|
||||||
|
@ -131,7 +132,7 @@ func Validate(
|
||||||
|
|
||||||
// check if policy matches the incoming resource
|
// check if policy matches the incoming resource
|
||||||
o := admission.NewObjectInterfacesFromScheme(runtime.NewScheme())
|
o := admission.NewObjectInterfacesFromScheme(runtime.NewScheme())
|
||||||
isMatch, _, _, err := matcher.DefinitionMatches(a, o, &v1beta1policy)
|
isMatch, _, _, err := matcher.DefinitionMatches(a, o, validating.NewValidatingAdmissionPolicyAccessor(&v1policy))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return engineResponse, err
|
return engineResponse, err
|
||||||
}
|
}
|
||||||
|
@ -147,9 +148,9 @@ func Validate(
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, binding := range bindings {
|
for i, binding := range bindings {
|
||||||
// convert policy binding from v1alpha1 to v1beta1
|
// convert policy binding from v1alpha1 to v1
|
||||||
v1beta1binding := ConvertValidatingAdmissionPolicyBinding(binding)
|
v1binding := ConvertValidatingAdmissionPolicyBinding(binding)
|
||||||
isMatch, err := matcher.BindingMatches(a, o, &v1beta1binding)
|
isMatch, err := matcher.BindingMatches(a, o, validating.NewValidatingAdmissionPolicyBindingAccessor(&v1binding))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return engineResponse, err
|
return engineResponse, err
|
||||||
}
|
}
|
||||||
|
@ -215,7 +216,7 @@ func validateResource(
|
||||||
}
|
}
|
||||||
|
|
||||||
newMatcher := matchconditions.NewMatcher(compiler.CompileMatchExpressions(optionalVars), &failPolicy, "", string(matchPolicy), "")
|
newMatcher := matchconditions.NewMatcher(compiler.CompileMatchExpressions(optionalVars), &failPolicy, "", string(matchPolicy), "")
|
||||||
validator := validatingadmissionpolicy.NewValidator(
|
validator := validating.NewValidator(
|
||||||
compiler.CompileValidateExpressions(optionalVars),
|
compiler.CompileValidateExpressions(optionalVars),
|
||||||
newMatcher,
|
newMatcher,
|
||||||
compiler.CompileAuditAnnotationsExpressions(optionalVars),
|
compiler.CompileAuditAnnotationsExpressions(optionalVars),
|
||||||
|
@ -226,16 +227,16 @@ func validateResource(
|
||||||
validateResult := validator.Validate(context.TODO(), a.GetResource(), versionedAttr, nil, &namespace, celconfig.RuntimeCELCostBudget, nil)
|
validateResult := validator.Validate(context.TODO(), a.GetResource(), versionedAttr, nil, &namespace, celconfig.RuntimeCELCostBudget, nil)
|
||||||
|
|
||||||
// no validations are returned if match conditions aren't met
|
// no validations are returned if match conditions aren't met
|
||||||
if datautils.DeepEqual(validateResult, validatingadmissionpolicy.ValidateResult{}) {
|
if datautils.DeepEqual(validateResult, validating.ValidateResult{}) {
|
||||||
ruleResp = engineapi.RuleSkip(policy.GetName(), engineapi.Validation, "match conditions aren't met")
|
ruleResp = engineapi.RuleSkip(policy.GetName(), engineapi.Validation, "match conditions aren't met")
|
||||||
} else {
|
} else {
|
||||||
isPass := true
|
isPass := true
|
||||||
for _, policyDecision := range validateResult.Decisions {
|
for _, policyDecision := range validateResult.Decisions {
|
||||||
if policyDecision.Evaluation == validatingadmissionpolicy.EvalError {
|
if policyDecision.Evaluation == validating.EvalError {
|
||||||
isPass = false
|
isPass = false
|
||||||
ruleResp = engineapi.RuleError(policy.GetName(), engineapi.Validation, policyDecision.Message, nil)
|
ruleResp = engineapi.RuleError(policy.GetName(), engineapi.Validation, policyDecision.Message, nil)
|
||||||
break
|
break
|
||||||
} else if policyDecision.Action == validatingadmissionpolicy.ActionDeny {
|
} else if policyDecision.Action == validating.ActionDeny {
|
||||||
isPass = false
|
isPass = false
|
||||||
ruleResp = engineapi.RuleFail(policy.GetName(), engineapi.Validation, policyDecision.Message)
|
ruleResp = engineapi.RuleFail(policy.GetName(), engineapi.Validation, policyDecision.Message)
|
||||||
break
|
break
|
||||||
|
|
|
@ -2,13 +2,12 @@ package validatingadmissionpolicy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
|
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
|
||||||
"k8s.io/api/admissionregistration/v1alpha1"
|
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
||||||
"k8s.io/api/admissionregistration/v1beta1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConvertValidatingAdmissionPolicy is used to convert v1alpha1 of ValidatingAdmissionPolicy to v1beta1
|
// ConvertValidatingAdmissionPolicy is used to convert v1alpha1 of ValidatingAdmissionPolicy to v1
|
||||||
func ConvertValidatingAdmissionPolicy(v1alpha1policy v1alpha1.ValidatingAdmissionPolicy) v1beta1.ValidatingAdmissionPolicy {
|
func ConvertValidatingAdmissionPolicy(v1alpha1policy admissionregistrationv1alpha1.ValidatingAdmissionPolicy) admissionregistrationv1.ValidatingAdmissionPolicy {
|
||||||
var namespaceSelector, objectSelector metav1.LabelSelector
|
var namespaceSelector, objectSelector metav1.LabelSelector
|
||||||
if v1alpha1policy.Spec.MatchConstraints.NamespaceSelector != nil {
|
if v1alpha1policy.Spec.MatchConstraints.NamespaceSelector != nil {
|
||||||
namespaceSelector = *v1alpha1policy.Spec.MatchConstraints.NamespaceSelector
|
namespaceSelector = *v1alpha1policy.Spec.MatchConstraints.NamespaceSelector
|
||||||
|
@ -16,16 +15,16 @@ func ConvertValidatingAdmissionPolicy(v1alpha1policy v1alpha1.ValidatingAdmissio
|
||||||
if v1alpha1policy.Spec.MatchConstraints.ObjectSelector != nil {
|
if v1alpha1policy.Spec.MatchConstraints.ObjectSelector != nil {
|
||||||
objectSelector = *v1alpha1policy.Spec.MatchConstraints.ObjectSelector
|
objectSelector = *v1alpha1policy.Spec.MatchConstraints.ObjectSelector
|
||||||
}
|
}
|
||||||
v1beta1policy := v1beta1.ValidatingAdmissionPolicy{
|
v1beta1policy := admissionregistrationv1.ValidatingAdmissionPolicy{
|
||||||
Spec: v1beta1.ValidatingAdmissionPolicySpec{
|
Spec: admissionregistrationv1.ValidatingAdmissionPolicySpec{
|
||||||
FailurePolicy: (*v1beta1.FailurePolicyType)(v1alpha1policy.Spec.FailurePolicy),
|
FailurePolicy: (*admissionregistrationv1.FailurePolicyType)(v1alpha1policy.Spec.FailurePolicy),
|
||||||
ParamKind: (*v1beta1.ParamKind)(v1alpha1policy.Spec.ParamKind),
|
ParamKind: (*admissionregistrationv1.ParamKind)(v1alpha1policy.Spec.ParamKind),
|
||||||
MatchConstraints: &v1beta1.MatchResources{
|
MatchConstraints: &admissionregistrationv1.MatchResources{
|
||||||
NamespaceSelector: &namespaceSelector,
|
NamespaceSelector: &namespaceSelector,
|
||||||
ObjectSelector: &objectSelector,
|
ObjectSelector: &objectSelector,
|
||||||
ResourceRules: convertRules(v1alpha1policy.Spec.MatchConstraints.ResourceRules),
|
ResourceRules: convertRules(v1alpha1policy.Spec.MatchConstraints.ResourceRules),
|
||||||
ExcludeResourceRules: convertRules(v1alpha1policy.Spec.MatchConstraints.ExcludeResourceRules),
|
ExcludeResourceRules: convertRules(v1alpha1policy.Spec.MatchConstraints.ExcludeResourceRules),
|
||||||
MatchPolicy: (*v1beta1.MatchPolicyType)(v1alpha1policy.Spec.MatchConstraints.MatchPolicy),
|
MatchPolicy: (*admissionregistrationv1.MatchPolicyType)(v1alpha1policy.Spec.MatchConstraints.MatchPolicy),
|
||||||
},
|
},
|
||||||
Validations: convertValidations(v1alpha1policy.Spec.Validations),
|
Validations: convertValidations(v1alpha1policy.Spec.Validations),
|
||||||
AuditAnnotations: convertAuditAnnotations(v1alpha1policy.Spec.AuditAnnotations),
|
AuditAnnotations: convertAuditAnnotations(v1alpha1policy.Spec.AuditAnnotations),
|
||||||
|
@ -37,10 +36,10 @@ func ConvertValidatingAdmissionPolicy(v1alpha1policy v1alpha1.ValidatingAdmissio
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertValidatingAdmissionPolicyBinding is used to convert v1alpha1 of ValidatingAdmissionPolicyBinding to v1beta1
|
// ConvertValidatingAdmissionPolicyBinding is used to convert v1alpha1 of ValidatingAdmissionPolicyBinding to v1beta1
|
||||||
func ConvertValidatingAdmissionPolicyBinding(v1alpha1binding v1alpha1.ValidatingAdmissionPolicyBinding) v1beta1.ValidatingAdmissionPolicyBinding {
|
func ConvertValidatingAdmissionPolicyBinding(v1alpha1binding admissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding) admissionregistrationv1.ValidatingAdmissionPolicyBinding {
|
||||||
var namespaceSelector, objectSelector, paramSelector metav1.LabelSelector
|
var namespaceSelector, objectSelector, paramSelector metav1.LabelSelector
|
||||||
var resourceRules, excludeResourceRules []v1alpha1.NamedRuleWithOperations
|
var resourceRules, excludeResourceRules []admissionregistrationv1alpha1.NamedRuleWithOperations
|
||||||
var matchPolicy *v1alpha1.MatchPolicyType
|
var matchPolicy *admissionregistrationv1alpha1.MatchPolicyType
|
||||||
if v1alpha1binding.Spec.MatchResources != nil {
|
if v1alpha1binding.Spec.MatchResources != nil {
|
||||||
if v1alpha1binding.Spec.MatchResources.NamespaceSelector != nil {
|
if v1alpha1binding.Spec.MatchResources.NamespaceSelector != nil {
|
||||||
namespaceSelector = *v1alpha1binding.Spec.MatchResources.NamespaceSelector
|
namespaceSelector = *v1alpha1binding.Spec.MatchResources.NamespaceSelector
|
||||||
|
@ -53,7 +52,7 @@ func ConvertValidatingAdmissionPolicyBinding(v1alpha1binding v1alpha1.Validating
|
||||||
matchPolicy = v1alpha1binding.Spec.MatchResources.MatchPolicy
|
matchPolicy = v1alpha1binding.Spec.MatchResources.MatchPolicy
|
||||||
}
|
}
|
||||||
|
|
||||||
var paramRef v1beta1.ParamRef
|
var paramRef admissionregistrationv1.ParamRef
|
||||||
if v1alpha1binding.Spec.ParamRef != nil {
|
if v1alpha1binding.Spec.ParamRef != nil {
|
||||||
paramRef.Name = v1alpha1binding.Spec.ParamRef.Name
|
paramRef.Name = v1alpha1binding.Spec.ParamRef.Name
|
||||||
paramRef.Namespace = v1alpha1binding.Spec.ParamRef.Namespace
|
paramRef.Namespace = v1alpha1binding.Spec.ParamRef.Namespace
|
||||||
|
@ -62,19 +61,19 @@ func ConvertValidatingAdmissionPolicyBinding(v1alpha1binding v1alpha1.Validating
|
||||||
} else {
|
} else {
|
||||||
paramRef.Selector = ¶mSelector
|
paramRef.Selector = ¶mSelector
|
||||||
}
|
}
|
||||||
paramRef.ParameterNotFoundAction = (*v1beta1.ParameterNotFoundActionType)(v1alpha1binding.Spec.ParamRef.ParameterNotFoundAction)
|
paramRef.ParameterNotFoundAction = (*admissionregistrationv1.ParameterNotFoundActionType)(v1alpha1binding.Spec.ParamRef.ParameterNotFoundAction)
|
||||||
}
|
}
|
||||||
|
|
||||||
v1beta1binding := v1beta1.ValidatingAdmissionPolicyBinding{
|
v1beta1binding := admissionregistrationv1.ValidatingAdmissionPolicyBinding{
|
||||||
Spec: v1beta1.ValidatingAdmissionPolicyBindingSpec{
|
Spec: admissionregistrationv1.ValidatingAdmissionPolicyBindingSpec{
|
||||||
PolicyName: v1alpha1binding.Spec.PolicyName,
|
PolicyName: v1alpha1binding.Spec.PolicyName,
|
||||||
ParamRef: ¶mRef,
|
ParamRef: ¶mRef,
|
||||||
MatchResources: &v1beta1.MatchResources{
|
MatchResources: &admissionregistrationv1.MatchResources{
|
||||||
NamespaceSelector: &namespaceSelector,
|
NamespaceSelector: &namespaceSelector,
|
||||||
ObjectSelector: &objectSelector,
|
ObjectSelector: &objectSelector,
|
||||||
ResourceRules: convertRules(resourceRules),
|
ResourceRules: convertRules(resourceRules),
|
||||||
ExcludeResourceRules: convertRules(excludeResourceRules),
|
ExcludeResourceRules: convertRules(excludeResourceRules),
|
||||||
MatchPolicy: (*v1beta1.MatchPolicyType)(matchPolicy),
|
MatchPolicy: (*admissionregistrationv1.MatchPolicyType)(matchPolicy),
|
||||||
},
|
},
|
||||||
ValidationActions: convertValidationActions(v1alpha1binding.Spec.ValidationActions),
|
ValidationActions: convertValidationActions(v1alpha1binding.Spec.ValidationActions),
|
||||||
},
|
},
|
||||||
|
@ -82,55 +81,55 @@ func ConvertValidatingAdmissionPolicyBinding(v1alpha1binding v1alpha1.Validating
|
||||||
return v1beta1binding
|
return v1beta1binding
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertRules(v1alpha1rules []v1alpha1.NamedRuleWithOperations) []v1beta1.NamedRuleWithOperations {
|
func convertRules(v1alpha1rules []admissionregistrationv1alpha1.NamedRuleWithOperations) []admissionregistrationv1.NamedRuleWithOperations {
|
||||||
v1beta1rules := make([]v1beta1.NamedRuleWithOperations, 0, len(v1alpha1rules))
|
v1beta1rules := make([]admissionregistrationv1.NamedRuleWithOperations, 0, len(v1alpha1rules))
|
||||||
for _, r := range v1alpha1rules {
|
for _, r := range v1alpha1rules {
|
||||||
v1beta1rules = append(v1beta1rules, v1beta1.NamedRuleWithOperations(r))
|
v1beta1rules = append(v1beta1rules, admissionregistrationv1.NamedRuleWithOperations(r))
|
||||||
}
|
}
|
||||||
return v1beta1rules
|
return v1beta1rules
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertValidations(v1alpha1validations []v1alpha1.Validation) []v1beta1.Validation {
|
func convertValidations(v1alpha1validations []admissionregistrationv1alpha1.Validation) []admissionregistrationv1.Validation {
|
||||||
v1beta1validations := make([]v1beta1.Validation, 0, len(v1alpha1validations))
|
v1beta1validations := make([]admissionregistrationv1.Validation, 0, len(v1alpha1validations))
|
||||||
for _, v := range v1alpha1validations {
|
for _, v := range v1alpha1validations {
|
||||||
v1beta1validations = append(v1beta1validations, v1beta1.Validation(v))
|
v1beta1validations = append(v1beta1validations, admissionregistrationv1.Validation(v))
|
||||||
}
|
}
|
||||||
return v1beta1validations
|
return v1beta1validations
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertAuditAnnotations(v1alpha1auditanns []v1alpha1.AuditAnnotation) []v1beta1.AuditAnnotation {
|
func convertAuditAnnotations(v1alpha1auditanns []admissionregistrationv1alpha1.AuditAnnotation) []admissionregistrationv1.AuditAnnotation {
|
||||||
v1beta1auditanns := make([]v1beta1.AuditAnnotation, 0, len(v1alpha1auditanns))
|
v1beta1auditanns := make([]admissionregistrationv1.AuditAnnotation, 0, len(v1alpha1auditanns))
|
||||||
for _, a := range v1alpha1auditanns {
|
for _, a := range v1alpha1auditanns {
|
||||||
v1beta1auditanns = append(v1beta1auditanns, v1beta1.AuditAnnotation(a))
|
v1beta1auditanns = append(v1beta1auditanns, admissionregistrationv1.AuditAnnotation(a))
|
||||||
}
|
}
|
||||||
return v1beta1auditanns
|
return v1beta1auditanns
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertMatchConditions(v1alpha1conditions []v1alpha1.MatchCondition) []v1beta1.MatchCondition {
|
func convertMatchConditions(v1alpha1conditions []admissionregistrationv1alpha1.MatchCondition) []admissionregistrationv1.MatchCondition {
|
||||||
v1beta1conditions := make([]v1beta1.MatchCondition, 0, len(v1alpha1conditions))
|
v1beta1conditions := make([]admissionregistrationv1.MatchCondition, 0, len(v1alpha1conditions))
|
||||||
for _, m := range v1alpha1conditions {
|
for _, m := range v1alpha1conditions {
|
||||||
v1beta1conditions = append(v1beta1conditions, v1beta1.MatchCondition(m))
|
v1beta1conditions = append(v1beta1conditions, admissionregistrationv1.MatchCondition(m))
|
||||||
}
|
}
|
||||||
return v1beta1conditions
|
return v1beta1conditions
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertVariables(v1alpha1variables []v1alpha1.Variable) []v1beta1.Variable {
|
func convertVariables(v1alpha1variables []admissionregistrationv1alpha1.Variable) []admissionregistrationv1.Variable {
|
||||||
v1beta1variables := make([]v1beta1.Variable, 0, len(v1alpha1variables))
|
v1beta1variables := make([]admissionregistrationv1.Variable, 0, len(v1alpha1variables))
|
||||||
for _, v := range v1alpha1variables {
|
for _, v := range v1alpha1variables {
|
||||||
v1beta1variables = append(v1beta1variables, v1beta1.Variable(v))
|
v1beta1variables = append(v1beta1variables, admissionregistrationv1.Variable(v))
|
||||||
}
|
}
|
||||||
return v1beta1variables
|
return v1beta1variables
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertValidationActions(v1alpha1actions []v1alpha1.ValidationAction) []v1beta1.ValidationAction {
|
func convertValidationActions(v1alpha1actions []admissionregistrationv1alpha1.ValidationAction) []admissionregistrationv1.ValidationAction {
|
||||||
v1beta1actions := make([]v1beta1.ValidationAction, 0, len(v1alpha1actions))
|
v1beta1actions := make([]admissionregistrationv1.ValidationAction, 0, len(v1alpha1actions))
|
||||||
for _, a := range v1alpha1actions {
|
for _, a := range v1alpha1actions {
|
||||||
v1beta1actions = append(v1beta1actions, v1beta1.ValidationAction(a))
|
v1beta1actions = append(v1beta1actions, admissionregistrationv1.ValidationAction(a))
|
||||||
}
|
}
|
||||||
return v1beta1actions
|
return v1beta1actions
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConvertMatchConditionsV1(v1alpha1conditions []v1alpha1.MatchCondition) []admissionregistrationv1.MatchCondition {
|
func ConvertMatchConditionsV1(v1alpha1conditions []admissionregistrationv1alpha1.MatchCondition) []admissionregistrationv1.MatchCondition {
|
||||||
v1conditions := make([]admissionregistrationv1.MatchCondition, 0, len(v1alpha1conditions))
|
v1conditions := make([]admissionregistrationv1.MatchCondition, 0, len(v1alpha1conditions))
|
||||||
for _, m := range v1alpha1conditions {
|
for _, m := range v1alpha1conditions {
|
||||||
v1conditions = append(v1conditions, admissionregistrationv1.MatchCondition(m))
|
v1conditions = append(v1conditions, admissionregistrationv1.MatchCondition(m))
|
||||||
|
|
|
@ -37,7 +37,7 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||||
"k8s.io/apimachinery/pkg/util/yaml"
|
"k8s.io/apimachinery/pkg/util/yaml"
|
||||||
"k8s.io/apiserver/pkg/admission/plugin/validatingadmissionpolicy"
|
"k8s.io/apiserver/pkg/admission/plugin/policy/validating"
|
||||||
"k8s.io/apiserver/pkg/cel/openapi/resolver"
|
"k8s.io/apiserver/pkg/cel/openapi/resolver"
|
||||||
"k8s.io/client-go/discovery"
|
"k8s.io/client-go/discovery"
|
||||||
"k8s.io/client-go/restmapper"
|
"k8s.io/client-go/restmapper"
|
||||||
|
@ -438,7 +438,7 @@ func Validate(policy, oldPolicy kyvernov1.PolicyInterface, client dclient.Interf
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mapper := restmapper.NewDiscoveryRESTMapper(groupResources)
|
mapper := restmapper.NewDiscoveryRESTMapper(groupResources)
|
||||||
checker := &validatingadmissionpolicy.TypeChecker{
|
checker := &validating.TypeChecker{
|
||||||
SchemaResolver: resolver,
|
SchemaResolver: resolver,
|
||||||
RestMapper: mapper,
|
RestMapper: mapper,
|
||||||
}
|
}
|
||||||
|
@ -453,10 +453,10 @@ func Validate(policy, oldPolicy kyvernov1.PolicyInterface, client dclient.Interf
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
v1beta1vap := vaputils.ConvertValidatingAdmissionPolicy(*vap)
|
v1vap := vaputils.ConvertValidatingAdmissionPolicy(*vap)
|
||||||
|
|
||||||
// check cel expression warnings
|
// check cel expression warnings
|
||||||
ctx := checker.CreateContext(&v1beta1vap)
|
ctx := checker.CreateContext(&v1vap)
|
||||||
fieldRef := field.NewPath("spec", "rules[0]", "validate", "cel", "expressions")
|
fieldRef := field.NewPath("spec", "rules[0]", "validate", "cel", "expressions")
|
||||||
for i, e := range spec.Rules[0].Validation.CEL.Expressions {
|
for i, e := range spec.Rules[0].Validation.CEL.Expressions {
|
||||||
results := checker.CheckExpression(ctx, e.Expression)
|
results := checker.CheckExpression(ctx, e.Expression)
|
||||||
|
|
Loading…
Reference in a new issue