2021-04-09 01:14:08 +02:00
|
|
|
package mutate
|
|
|
|
|
|
|
|
// MutateTests is E2E Test Config for mutation
|
|
|
|
var MutateTests = []struct {
|
|
|
|
//TestName - Name of the Test
|
|
|
|
TestName string
|
|
|
|
// Data - The Yaml file of the ClusterPolicy
|
|
|
|
Data []byte
|
2021-06-03 00:18:28 +05:30
|
|
|
// ResourceNamespace - Namespace of the Resource
|
|
|
|
ResourceNamespace string
|
2021-06-21 21:35:43 +05:30
|
|
|
// PolicyName - Name of the Policy
|
|
|
|
PolicyName string
|
2021-04-09 01:14:08 +02:00
|
|
|
}{
|
|
|
|
{
|
2021-06-03 00:18:28 +05:30
|
|
|
TestName: "test-mutate-with-context",
|
|
|
|
Data: configMapMutationYaml,
|
|
|
|
ResourceNamespace: "test-mutate",
|
2021-06-21 21:35:43 +05:30
|
|
|
PolicyName: "mutate-policy",
|
2021-04-09 01:14:08 +02:00
|
|
|
},
|
|
|
|
{
|
2021-06-03 00:18:28 +05:30
|
|
|
TestName: "test-mutate-with-logic-in-context",
|
|
|
|
Data: configMapMutationWithContextLogicYaml,
|
|
|
|
ResourceNamespace: "test-mutate",
|
2021-06-21 21:35:43 +05:30
|
|
|
PolicyName: "mutate-policy",
|
2021-04-09 01:14:08 +02:00
|
|
|
},
|
2021-04-26 23:02:52 +02:00
|
|
|
{
|
2021-06-03 00:18:28 +05:30
|
|
|
TestName: "test-mutate-with-context-label-selection",
|
|
|
|
Data: configMapMutationWithContextLabelSelectionYaml,
|
|
|
|
ResourceNamespace: "test-mutate",
|
2021-06-21 21:35:43 +05:30
|
|
|
PolicyName: "mutate-policy",
|
2021-04-26 23:02:52 +02:00
|
|
|
},
|
2021-04-09 01:14:08 +02:00
|
|
|
}
|
2021-05-13 12:03:13 -07:00
|
|
|
|
|
|
|
var ingressTests = struct {
|
|
|
|
testNamesapce string
|
|
|
|
cpol []byte
|
2021-06-21 21:35:43 +05:30
|
|
|
policyName string
|
2021-05-13 12:03:13 -07:00
|
|
|
tests []struct {
|
|
|
|
testName string
|
|
|
|
group, version, rsc, resourceName string
|
|
|
|
resource []byte
|
|
|
|
}
|
|
|
|
}{
|
|
|
|
testNamesapce: "test-ingress",
|
|
|
|
cpol: mutateIngressCpol,
|
2021-06-21 21:35:43 +05:30
|
|
|
policyName: "mutate-ingress-host",
|
2021-05-13 12:03:13 -07:00
|
|
|
tests: []struct {
|
|
|
|
testName string
|
|
|
|
group, version, rsc, resourceName string
|
|
|
|
resource []byte
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
testName: "test-networking-v1-ingress",
|
|
|
|
group: "networking.k8s.io",
|
|
|
|
version: "v1",
|
|
|
|
rsc: "ingresses",
|
|
|
|
resourceName: "kuard-v1",
|
|
|
|
resource: ingressNetworkingV1,
|
|
|
|
},
|
|
|
|
// the following two tests can be removed after 1.22 cluster
|
|
|
|
{
|
|
|
|
testName: "test-networking-v1beta1-ingress",
|
|
|
|
group: "networking.k8s.io",
|
|
|
|
version: "v1beta1",
|
|
|
|
rsc: "ingresses",
|
|
|
|
resourceName: "kuard-v1beta1",
|
|
|
|
resource: ingressNetworkingV1beta1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
testName: "test-extensions-v1beta1-ingress",
|
|
|
|
group: "extensions",
|
|
|
|
version: "v1beta1",
|
|
|
|
rsc: "ingresses",
|
|
|
|
resourceName: "kuard-extensions",
|
|
|
|
resource: ingressExtensionV1beta1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|