1
0
Fork 0
mirror of https://github.com/kyverno/policy-reporter.git synced 2024-12-15 17:50:58 +00:00
policy-reporter/pkg/fixtures/policy_results.go
Frank Jogeleit 6c2330495c
Reduce mapping (#256)
* replace internal structs

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
2023-02-07 11:21:48 +01:00

154 lines
5.1 KiB
Go

package fixtures
import (
"github.com/kyverno/policy-reporter/pkg/crd/api/policyreport/v1alpha2"
corev1 "k8s.io/api/core/v1"
)
var PassResult = v1alpha2.PolicyReportResult{
ID: "123",
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",
Priority: v1alpha2.WarningPriority,
Result: v1alpha2.StatusPass,
Severity: v1alpha2.SeverityHigh,
Category: "resources",
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "v1",
Kind: "Deployment",
Name: "nginx",
Namespace: "test",
UID: "536ab69f-1b3c-4bd9-9ba4-274a56188409",
}},
}
var PassPodResult = v1alpha2.PolicyReportResult{
ID: "124",
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",
Priority: v1alpha2.WarningPriority,
Result: v1alpha2.StatusPass,
Category: "Best Practices",
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "v1",
Kind: "Pod",
Name: "nginx",
Namespace: "test",
UID: "536ab69f-1b3c-4bd9-9ba4-274a56188419",
}},
}
var FailResult = v1alpha2.PolicyReportResult{
ID: "123",
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",
Priority: v1alpha2.WarningPriority,
Result: v1alpha2.StatusFail,
Severity: v1alpha2.SeverityHigh,
Category: "resources",
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "v1",
Kind: "Deployment",
Name: "nginx",
Namespace: "test",
UID: "536ab69f-1b3c-4bd9-9ba4-274a56188409",
}},
}
var FailDisallowRuleResult = v1alpha2.PolicyReportResult{
ID: "123",
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: "disallow-policy",
Rule: "disallow-policy",
Priority: v1alpha2.WarningPriority,
Result: v1alpha2.StatusFail,
Severity: v1alpha2.SeverityHigh,
Category: "resources",
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "v1",
Kind: "Deployment",
Name: "nginx",
Namespace: "test",
UID: "536ab69f-1b3c-4bd9-9ba4-274a56188409",
}},
}
var FailPodResult = v1alpha2.PolicyReportResult{
ID: "124",
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",
Priority: v1alpha2.WarningPriority,
Result: v1alpha2.StatusFail,
Category: "Best Practices",
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "v1",
Kind: "Pod",
Name: "nginx",
Namespace: "test",
UID: "536ab69f-1b3c-4bd9-9ba4-274a56188419",
}},
}
var FailResultWithoutResource = 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",
Priority: v1alpha2.WarningPriority,
Result: v1alpha2.StatusFail,
Severity: v1alpha2.SeverityHigh,
Category: "resources",
Scored: true,
Source: "Kyverno",
}
var PassNamespaceResult = v1alpha2.PolicyReportResult{
ID: "125",
Message: "validation error: The label `test` is required. Rule check-for-GetLabels()-on-namespace",
Policy: "require-ns-GetLabels()",
Rule: "check-for-GetLabels()-on-namespace",
Priority: v1alpha2.ErrorPriority,
Result: v1alpha2.StatusPass,
Category: "namespaces",
Severity: v1alpha2.SeverityMedium,
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "v1",
Kind: "Namespace",
Name: "test",
UID: "536ab69f-1b3c-4bd9-9ba4-274a56188411",
}},
}
var FailNamespaceResult = v1alpha2.PolicyReportResult{
ID: "126",
Message: "validation error: The label `test` is required. Rule check-for-GetLabels()-on-namespace",
Policy: "require-ns-GetLabels()",
Rule: "check-for-GetLabels()-on-namespace",
Priority: v1alpha2.WarningPriority,
Result: v1alpha2.StatusFail,
Category: "namespaces",
Severity: v1alpha2.SeverityHigh,
Scored: true,
Source: "Kyverno",
Resources: []corev1.ObjectReference{{
APIVersion: "v1",
Kind: "Namespace",
Name: "dev",
UID: "536ab69f-1b3c-4bd9-9ba4-274a56188412",
}},
}