Skip to content

Commit

Permalink
Merge pull request #221 from fabriziosestito/chore/change-visibility-…
Browse files Browse the repository at this point in the history
…report-constants

chore(report): constants should be private
  • Loading branch information
flavio authored Mar 11, 2024
2 parents 7e56394 + deb824d commit 62f4a1a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions internal/report/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package report
const (
policyReportSource = "kubewarden"
propertyPolicyResourceVersion = "policy-resource-version"
PropertyPolicyUID = "policy-uid"
propertyPolicyUID = "policy-uid"
)

const (
Expand Down Expand Up @@ -34,5 +34,5 @@ const (

const (
labelAppManagedBy = "app.kubernetes.io/managed-by"
LabelApp = "kubewarden"
labelApp = "kubewarden"
)
6 changes: 3 additions & 3 deletions internal/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func NewPolicyReport(resource unstructured.Unstructured) *wgpolicy.PolicyReport
Name: string(resource.GetUID()),
Namespace: resource.GetNamespace(),
Labels: map[string]string{
labelAppManagedBy: LabelApp,
labelAppManagedBy: labelApp,
},
OwnerReferences: []metav1.OwnerReference{
{
Expand Down Expand Up @@ -75,7 +75,7 @@ func NewClusterPolicyReport(resource unstructured.Unstructured) *wgpolicy.Cluste
ObjectMeta: metav1.ObjectMeta{
Name: string(resource.GetUID()),
Labels: map[string]string{
labelAppManagedBy: LabelApp,
labelAppManagedBy: labelApp,
},
OwnerReferences: []metav1.OwnerReference{
{
Expand Down Expand Up @@ -194,7 +194,7 @@ func computeProperties(policy policiesv1.Policy) map[string]string {
// same result can be reused in the next scan
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
properties[propertyPolicyResourceVersion] = policy.GetResourceVersion()
properties[PropertyPolicyUID] = string(policy.GetUID())
properties[propertyPolicyUID] = string(policy.GetUID())

return properties
}
6 changes: 3 additions & 3 deletions internal/report/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestNewPolicyReportResult(t *testing.T) {
SubjectSelector: &metav1.LabelSelector{},
Description: "",
Properties: map[string]string{
PropertyPolicyUID: "policy-uid",
propertyPolicyUID: "policy-uid",
propertyPolicyResourceVersion: "1",
typeValidating: valueTypeTrue,
},
Expand Down Expand Up @@ -192,7 +192,7 @@ func TestNewPolicyReportResult(t *testing.T) {
SubjectSelector: &metav1.LabelSelector{},
Description: "The request was rejected",
Properties: map[string]string{
PropertyPolicyUID: "policy-uid",
propertyPolicyUID: "policy-uid",
propertyPolicyResourceVersion: "1",
typeMutating: valueTypeTrue,
},
Expand Down Expand Up @@ -229,7 +229,7 @@ func TestNewPolicyReportResult(t *testing.T) {
SubjectSelector: &metav1.LabelSelector{},
Description: "",
Properties: map[string]string{
PropertyPolicyUID: "policy-uid",
propertyPolicyUID: "policy-uid",
propertyPolicyResourceVersion: "1",
typeValidating: valueTypeTrue,
},
Expand Down

0 comments on commit 62f4a1a

Please sign in to comment.