1
0
Fork 0
mirror of https://github.com/kyverno/policy-reporter.git synced 2024-12-14 11:57:32 +00:00
policy-reporter/pkg/fixtures/target_results.go
Frank Jogeleit 78f24497fa
Policy Reporter v3 (#482)
Policy Reporter v3

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
2024-10-07 11:10:46 +02:00

127 lines
4.5 KiB
Go

package fixtures
import (
"time"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/kyverno/policy-reporter/pkg/crd/api/policyreport/v1alpha2"
)
var seconds = time.Date(2021, time.February, 23, 15, 10, 0, 0, time.UTC).Unix()
var CompleteTargetSendResult = v1alpha2.PolicyReportResult{
Message: "validation error: requests and limits required. Rule autogen-check-for-requests-and-limits failed at path /spec/template/spec/containers/0/resources/requests/",
Policy: "require-requests-and-limits-required",
Rule: "autogen-check-for-requests-and-limits",
Timestamp: v1.Timestamp{Seconds: seconds},
Result: v1alpha2.StatusFail,
Severity: v1alpha2.SeverityHigh,
Category: "resources",
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "v1",
Kind: "Deployment",
Name: "nginx",
Namespace: "default",
UID: "536ab69f-1b3c-4bd9-9ba4-274a56188409",
}},
Properties: map[string]string{"version": "1.2.0"},
}
var MinimalTargetSendResult = v1alpha2.PolicyReportResult{
Message: "validation error: label required. Rule app-label-required failed at path /spec/template/spec/containers/0/resources/requests/",
Policy: "app-label-requirement",
Result: v1alpha2.StatusFail,
Scored: true,
}
var EnforceTargetSendResult = v1alpha2.PolicyReportResult{
Message: "validation error: requests and limits required. Rule autogen-check-for-requests-and-limits failed at path /spec/template/spec/containers/0/resources/requests/",
Policy: "require-requests-and-limits-required",
Rule: "check-for-requests-and-limits",
Timestamp: v1.Timestamp{Seconds: seconds},
Result: v1alpha2.StatusFail,
Severity: v1alpha2.SeverityHigh,
Category: "resources",
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "",
Kind: "Pod",
Name: "nginx",
Namespace: "default",
UID: "",
}},
Properties: map[string]string{"version": "1.2.0"},
}
var MissingUIDSendResult = v1alpha2.PolicyReportResult{
Message: "validation error: requests and limits required. Rule autogen-check-for-requests-and-limits failed at path /spec/template/spec/containers/0/resources/requests/",
Policy: "require-requests-and-limits-required",
Rule: "check-for-requests-and-limits",
Timestamp: v1.Timestamp{Seconds: seconds},
Result: v1alpha2.StatusFail,
Severity: v1alpha2.SeverityHigh,
Category: "resources",
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "v1",
Kind: "Pod",
Name: "nginx",
Namespace: "default",
UID: "",
}},
Properties: map[string]string{"version": "1.2.0"},
}
var MissingAPIVersionSendResult = v1alpha2.PolicyReportResult{
Message: "validation error: requests and limits required. Rule autogen-check-for-requests-and-limits failed at path /spec/template/spec/containers/0/resources/requests/",
Policy: "require-requests-and-limits-required",
Rule: "check-for-requests-and-limits",
Timestamp: v1.Timestamp{Seconds: seconds},
Result: v1alpha2.StatusFail,
Severity: v1alpha2.SeverityHigh,
Category: "resources",
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "",
Kind: "Pod",
Name: "nginx",
Namespace: "default",
UID: "536ab69f-1b3c-4bd9-9ba4-274a56188409",
}},
Properties: map[string]string{"version": "1.2.0"},
}
var ErrorSendResult = v1alpha2.PolicyReportResult{
Message: "validation error: label required. Rule app-label-required failed at path /spec/template/spec/containers/0/resources/requests/",
Policy: "app-label-requirement",
Result: v1alpha2.StatusFail,
Scored: true,
}
var CritcalSendResult = v1alpha2.PolicyReportResult{
Message: "validation error: label required. Rule app-label-required failed at path /spec/template/spec/containers/0/resources/requests/",
Policy: "app-label-requirement",
Result: v1alpha2.StatusFail,
Scored: true,
}
var InfoSendResult = v1alpha2.PolicyReportResult{
Message: "validation error: label required. Rule app-label-required failed at path /spec/template/spec/containers/0/resources/requests/",
Policy: "app-label-requirement",
Result: v1alpha2.StatusFail,
Scored: true,
}
var DebugSendResult = v1alpha2.PolicyReportResult{
Message: "validation error: label required. Rule app-label-required failed at path /spec/template/spec/containers/0/resources/requests/",
Policy: "app-label-requirement",
Result: v1alpha2.StatusFail,
Scored: true,
}