Skip to content

Commit 51c8b5f

Browse files
authored
Merge pull request kyverno#2377 from realshuting/v1alpha1_policy_report
Add back V1alpha1 policy report resources
2 parents e6f1622 + fd7e473 commit 51c8b5f

22 files changed

+9139
-2322
lines changed

Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,10 @@ release-notes:
226226
true
227227

228228
kyverno-crd: controller-gen
229-
$(CONTROLLER_GEN) crd paths=./pkg/api/kyverno/v1alpha2 output:dir=./definitions/crds
230-
$(CONTROLLER_GEN) crd paths=./pkg/api/kyverno/v1 output:dir=./definitions/crds
229+
$(CONTROLLER_GEN) crd paths=./pkg/api/kyverno/... crd:crdVersions=v1 output:dir=./definitions/crds
231230

232231
report-crd: controller-gen
233-
$(CONTROLLER_GEN) crd paths=./pkg/api/policyreport/v1alpha2 output:dir=./definitions/crds
232+
$(CONTROLLER_GEN) crd paths=./pkg/api/policyreport/... crd:crdVersions=v1 output:dir=./definitions/crds
234233

235234
# install the right version of controller-gen
236235
install-controller-gen:

charts/kyverno-crds/templates/crds.yaml

+3,873-982
Large diffs are not rendered by default.

definitions/crds/kyverno.io_clusterreportchangerequests.yaml

+312
Large diffs are not rendered by default.

definitions/crds/kyverno.io_reportchangerequests.yaml

+312
Large diffs are not rendered by default.

definitions/crds/wgpolicyk8s.io_clusterpolicyreports.yaml

+312
Large diffs are not rendered by default.

definitions/crds/wgpolicyk8s.io_policyreports.yaml

+311
Large diffs are not rendered by default.

definitions/install.yaml

+1,738-886
Large diffs are not rendered by default.

definitions/install_debug.yaml

+1,307-451
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
Copyright 2020 The Kubernetes authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
21+
corev1 "k8s.io/api/core/v1"
22+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23+
)
24+
25+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
26+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
27+
28+
// ClusterReportChangeRequest is the Schema for the ClusterReportChangeRequests API
29+
// +genclient
30+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
31+
// +genclient:nonNamespaced
32+
// +kubebuilder:object:root=true
33+
// +kubebuilder:resource:path=clusterreportchangerequests,scope="Cluster",shortName=crcr
34+
// +kubebuilder:printcolumn:name="Kind",type=string,JSONPath=`.scope.kind`,priority=1
35+
// +kubebuilder:printcolumn:name="Name",type=string,JSONPath=`.scope.name`,priority=1
36+
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.pass`
37+
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.fail`
38+
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.warn`
39+
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.error`
40+
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.skip`
41+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
42+
type ClusterReportChangeRequest struct {
43+
metav1.TypeMeta `json:",inline"`
44+
metav1.ObjectMeta `json:"metadata,omitempty"`
45+
46+
// Scope is an optional reference to the report scope (e.g. a Deployment, Namespace, or Node)
47+
// +optional
48+
Scope *corev1.ObjectReference `json:"scope,omitempty"`
49+
50+
// ScopeSelector is an optional selector for multiple scopes (e.g. Pods).
51+
// Either one of, or none of, but not both of, Scope or ScopeSelector should be specified.
52+
// +optional
53+
ScopeSelector *metav1.LabelSelector `json:"scopeSelector,omitempty"`
54+
55+
// PolicyReportSummary provides a summary of results
56+
// +optional
57+
Summary report.PolicyReportSummary `json:"summary,omitempty"`
58+
59+
// PolicyReportResult provides result details
60+
// +optional
61+
Results []*report.PolicyReportResult `json:"results,omitempty"`
62+
}
63+
64+
// ClusterReportChangeRequestList contains a list of ClusterReportChangeRequest
65+
// +kubebuilder:object:root=true
66+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
67+
type ClusterReportChangeRequestList struct {
68+
metav1.TypeMeta `json:",inline"`
69+
metav1.ListMeta `json:"metadata,omitempty"`
70+
Items []ClusterReportChangeRequest `json:"items"`
71+
}
72+
73+
func init() {
74+
SchemeBuilder.Register(&ClusterReportChangeRequest{}, &ClusterReportChangeRequestList{})
75+
}

pkg/api/kyverno/v1alpha1/doc.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2020 The Kubernetes authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1alpha1 contains API Schema definitions for the policy v1alpha1 API group
18+
// +k8s:deepcopy-gen=package
19+
// +kubebuilder:object:generate=true
20+
// +groupName=kyverno.io
21+
package v1alpha1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Copyright 2020 The Kubernetes authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1alpha1 contains API Schema definitions for the policy v1alpha1 API group
18+
// +kubebuilder:object:generate=true
19+
// +groupName=kyverno.io
20+
package v1alpha1
21+
22+
import (
23+
"k8s.io/apimachinery/pkg/runtime/schema"
24+
"sigs.k8s.io/controller-runtime/pkg/scheme"
25+
)
26+
27+
// Package v1alpha1 contains API Schema definitions for the policy v1alpha1 API group
28+
// +kubebuilder:object:generate=true
29+
// +groupName=kyverno.io
30+
var (
31+
// SchemeGroupVersion is group version used to register these objects
32+
SchemeGroupVersion = schema.GroupVersion{Group: "kyverno.io", Version: "v1alpha1"}
33+
34+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
35+
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
36+
37+
// AddToScheme adds the types in this group-version to the given scheme.
38+
AddToScheme = SchemeBuilder.AddToScheme
39+
)
40+
41+
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
42+
func Kind(kind string) schema.GroupKind {
43+
return SchemeGroupVersion.WithKind(kind).GroupKind()
44+
}
45+
46+
// Resource takes an unqualified resource and returns a Group qualified GroupResource
47+
func Resource(resource string) schema.GroupResource {
48+
return SchemeGroupVersion.WithResource(resource).GroupResource()
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
Copyright 2020 The Kubernetes authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
report "github.com/kyverno/kyverno/pkg/api/policyreport/v1alpha1"
21+
corev1 "k8s.io/api/core/v1"
22+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23+
)
24+
25+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
26+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
27+
28+
// ReportChangeRequest is the Schema for the ReportChangeRequests API
29+
// +genclient
30+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
31+
// +kubebuilder:object:root=true
32+
// +kubebuilder:printcolumn:name="Kind",type=string,JSONPath=`.scope.kind`,priority=1
33+
// +kubebuilder:printcolumn:name="Name",type=string,JSONPath=`.scope.name`,priority=1
34+
// +kubebuilder:printcolumn:name="Pass",type=integer,JSONPath=`.summary.pass`
35+
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.summary.fail`
36+
// +kubebuilder:printcolumn:name="Warn",type=integer,JSONPath=`.summary.warn`
37+
// +kubebuilder:printcolumn:name="Error",type=integer,JSONPath=`.summary.error`
38+
// +kubebuilder:printcolumn:name="Skip",type=integer,JSONPath=`.summary.skip`
39+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
40+
// +kubebuilder:resource:shortName=rcr
41+
type ReportChangeRequest struct {
42+
metav1.TypeMeta `json:",inline"`
43+
metav1.ObjectMeta `json:"metadata,omitempty"`
44+
45+
// Scope is an optional reference to the report scope (e.g. a Deployment, Namespace, or Node)
46+
// +optional
47+
Scope *corev1.ObjectReference `json:"scope,omitempty"`
48+
49+
// ScopeSelector is an optional selector for multiple scopes (e.g. Pods).
50+
// Either one of, or none of, but not both of, Scope or ScopeSelector should be specified.
51+
// +optional
52+
ScopeSelector *metav1.LabelSelector `json:"scopeSelector,omitempty"`
53+
54+
// PolicyReportSummary provides a summary of results
55+
// +optional
56+
Summary report.PolicyReportSummary `json:"summary,omitempty"`
57+
58+
// PolicyReportResult provides result details
59+
// +optional
60+
Results []*report.PolicyReportResult `json:"results,omitempty"`
61+
}
62+
63+
// ReportChangeRequestList contains a list of ReportChangeRequest
64+
// +kubebuilder:object:root=true
65+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
66+
type ReportChangeRequestList struct {
67+
metav1.TypeMeta `json:",inline"`
68+
metav1.ListMeta `json:"metadata,omitempty"`
69+
Items []ReportChangeRequest `json:"items"`
70+
}
71+
72+
func init() {
73+
SchemeBuilder.Register(&ReportChangeRequest{}, &ReportChangeRequestList{})
74+
}

0 commit comments

Comments
 (0)