diff --git a/.crds/chainsaw.kyverno.io_configurations.yaml b/.crds/chainsaw.kyverno.io_configurations.yaml index 875fb6fac..19c6dbadd 100644 --- a/.crds/chainsaw.kyverno.io_configurations.yaml +++ b/.crds/chainsaw.kyverno.io_configurations.yaml @@ -96,7 +96,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -150,7 +149,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -245,11 +243,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -562,7 +558,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -617,7 +612,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -816,7 +810,6 @@ spec: namespaceTemplate: description: NamespaceTemplate defines a template to create the test namespace. - type: object x-kubernetes-preserve-unknown-fields: true parallel: description: The maximum number of tests to run at once. @@ -1052,7 +1045,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1107,7 +1099,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1202,11 +1193,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -1522,7 +1511,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1577,7 +1565,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1756,7 +1743,6 @@ spec: type: string template: description: Template defines a template to create the test namespace. - type: object x-kubernetes-preserve-unknown-fields: true type: object report: diff --git a/.crds/chainsaw.kyverno.io_steptemplates.yaml b/.crds/chainsaw.kyverno.io_steptemplates.yaml index 23b2d95cb..49858c35f 100644 --- a/.crds/chainsaw.kyverno.io_steptemplates.yaml +++ b/.crds/chainsaw.kyverno.io_steptemplates.yaml @@ -112,7 +112,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -166,7 +165,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -261,11 +259,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -578,7 +574,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -633,7 +628,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -828,7 +822,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -882,7 +875,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -977,11 +969,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -1294,7 +1284,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -1349,7 +1338,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1544,7 +1532,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -1598,7 +1585,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1693,11 +1679,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2010,7 +1994,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -2065,7 +2048,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2305,11 +2287,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2330,7 +2310,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2414,7 +2393,6 @@ spec: type: string resource: description: Check provides a check used in assertions. - type: object x-kubernetes-preserve-unknown-fields: true template: description: Template determines whether resources should @@ -2454,7 +2432,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -2508,7 +2485,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2602,11 +2578,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2627,7 +2601,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2722,11 +2695,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2900,7 +2871,6 @@ spec: type: string resource: description: Check provides a check used in assertions. - type: object x-kubernetes-preserve-unknown-fields: true template: description: Template determines whether resources should @@ -3087,11 +3057,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3112,7 +3080,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3249,7 +3216,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3303,7 +3269,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -3358,7 +3323,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3454,11 +3418,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3479,7 +3441,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. diff --git a/.crds/chainsaw.kyverno.io_tests.yaml b/.crds/chainsaw.kyverno.io_tests.yaml index 2fccf1f24..9e136c4ef 100644 --- a/.crds/chainsaw.kyverno.io_tests.yaml +++ b/.crds/chainsaw.kyverno.io_tests.yaml @@ -113,7 +113,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -167,7 +166,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -262,11 +260,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -579,7 +575,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -634,7 +629,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -830,7 +824,6 @@ spec: namespaceTemplate: description: NamespaceTemplate defines a template to create the test namespace. - type: object x-kubernetes-preserve-unknown-fields: true scenarios: description: Scenarios defines test scenarios. @@ -955,7 +948,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1011,7 +1003,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1110,11 +1101,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -1436,7 +1425,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1492,7 +1480,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1691,7 +1678,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1747,7 +1733,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1846,11 +1831,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2172,7 +2155,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -2228,7 +2210,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2462,7 +2443,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -2518,7 +2498,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2617,11 +2596,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2943,7 +2920,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -2999,7 +2975,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3281,11 +3256,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3306,7 +3279,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3392,7 +3364,6 @@ spec: type: string resource: description: Check provides a check used in assertions. - type: object x-kubernetes-preserve-unknown-fields: true template: description: Template determines whether resources @@ -3432,7 +3403,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -3488,7 +3458,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3586,11 +3555,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3611,7 +3578,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3708,11 +3674,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3890,7 +3854,6 @@ spec: type: string resource: description: Check provides a check used in assertions. - type: object x-kubernetes-preserve-unknown-fields: true template: description: Template determines whether resources @@ -4083,11 +4046,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -4108,7 +4069,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -4248,7 +4208,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -4302,7 +4261,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -4358,7 +4316,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -4458,11 +4415,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -4483,7 +4438,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. diff --git a/.schemas/json/configuration-chainsaw-v1alpha1.json b/.schemas/json/configuration-chainsaw-v1alpha1.json index 87cdc6642..faa67d501 100644 --- a/.schemas/json/configuration-chainsaw-v1alpha1.json +++ b/.schemas/json/configuration-chainsaw-v1alpha1.json @@ -442,10 +442,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -539,10 +535,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -693,15 +685,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -1216,10 +1203,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1316,10 +1299,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1640,10 +1619,6 @@ }, "namespaceTemplate": { "description": "NamespaceTemplate defines a template to create the test namespace.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "parallel": { diff --git a/.schemas/json/configuration-chainsaw-v1alpha2.json b/.schemas/json/configuration-chainsaw-v1alpha2.json index 9224a5066..39f21a483 100644 --- a/.schemas/json/configuration-chainsaw-v1alpha2.json +++ b/.schemas/json/configuration-chainsaw-v1alpha2.json @@ -570,10 +570,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -667,10 +663,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -821,15 +813,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -1344,10 +1331,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1444,10 +1427,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1736,10 +1715,6 @@ }, "template": { "description": "Template defines a template to create the test namespace.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, diff --git a/.schemas/json/steptemplate-chainsaw-v1alpha1.json b/.schemas/json/steptemplate-chainsaw-v1alpha1.json index 7f88da88b..49509b5ed 100644 --- a/.schemas/json/steptemplate-chainsaw-v1alpha1.json +++ b/.schemas/json/steptemplate-chainsaw-v1alpha1.json @@ -475,10 +475,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -572,10 +568,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -726,15 +718,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -1249,10 +1236,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1349,10 +1332,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1693,10 +1672,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1790,10 +1765,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1944,15 +1915,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -2467,10 +2433,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -2567,10 +2529,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -2911,10 +2869,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -3008,10 +2962,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -3162,15 +3112,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -3685,10 +3630,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -3785,10 +3726,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -4208,15 +4145,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -4249,10 +4181,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -4693,10 +4621,6 @@ }, "resource": { "description": "Check provides a check used in assertions.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "template": { @@ -4771,10 +4695,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -4868,10 +4788,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -5024,15 +4940,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -5065,10 +4976,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -5530,15 +5437,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -5816,10 +5718,6 @@ }, "resource": { "description": "Check provides a check used in assertions.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "template": { @@ -6137,15 +6035,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -6178,10 +6071,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -6718,10 +6607,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -6800,10 +6685,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -6900,10 +6781,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -7066,15 +6943,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -7107,10 +6979,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { diff --git a/.schemas/json/test-chainsaw-v1alpha1.json b/.schemas/json/test-chainsaw-v1alpha1.json index 7f011de90..960c4c02e 100644 --- a/.schemas/json/test-chainsaw-v1alpha1.json +++ b/.schemas/json/test-chainsaw-v1alpha1.json @@ -475,10 +475,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -572,10 +568,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -726,15 +718,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -1249,10 +1236,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1349,10 +1332,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1672,10 +1651,6 @@ }, "namespaceTemplate": { "description": "NamespaceTemplate defines a template to create the test namespace.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "scenarios": { @@ -1921,10 +1896,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -2018,10 +1989,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -2172,15 +2139,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -2695,10 +2657,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -2795,10 +2753,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -3139,10 +3093,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -3236,10 +3186,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -3390,15 +3336,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -3913,10 +3854,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -4013,10 +3950,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -4414,10 +4347,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -4511,10 +4440,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -4665,15 +4590,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -5188,10 +5108,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -5288,10 +5204,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -5787,15 +5699,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -5828,10 +5735,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -6272,10 +6175,6 @@ }, "resource": { "description": "Check provides a check used in assertions.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "template": { @@ -6350,10 +6249,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -6447,10 +6342,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -6603,15 +6494,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -6644,10 +6530,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -7109,15 +6991,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -7395,10 +7272,6 @@ }, "resource": { "description": "Check provides a check used in assertions.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "template": { @@ -7716,15 +7589,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -7757,10 +7625,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -8297,10 +8161,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -8379,10 +8239,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -8479,10 +8335,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -8645,15 +8497,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -8686,10 +8533,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { diff --git a/go.mod b/go.mod index 0f00cbaa8..00848727b 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/jmespath-community/go-jmespath v1.1.2-0.20240919193755-5e4e8ae73c8a github.com/jstemmer/go-junit-report/v2 v2.1.0 github.com/kudobuilder/kuttl v0.19.0 - github.com/kyverno/kyverno-json v0.0.4-0.20240730143747-aade3d42fc0e + github.com/kyverno/kyverno-json v0.0.4-0.20240927122954-790f57dc7b22 github.com/kyverno/pkg/ext v0.0.0-20240418121121-df8add26c55c github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 github.com/prometheus/common v0.59.1 @@ -26,7 +26,7 @@ require ( k8s.io/api v0.31.1 k8s.io/apimachinery v0.31.1 k8s.io/client-go v0.31.1 - k8s.io/utils v0.0.0-20240821151609-f90d01438635 + k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 sigs.k8s.io/controller-runtime v0.19.0 sigs.k8s.io/kubectl-validate v0.0.5-0.20240827210056-ce13d95db263 sigs.k8s.io/yaml v1.4.0 @@ -54,7 +54,7 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.12.1 // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect @@ -85,7 +85,6 @@ require ( github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jinzhu/copier v0.4.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -104,7 +103,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/onsi/gomega v1.34.1 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.20.2 // indirect + github.com/prometheus/client_golang v1.20.4 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect @@ -118,39 +117,39 @@ require ( go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect go.etcd.io/etcd/client/v3 v3.5.15 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect - go.opentelemetry.io/otel v1.29.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0 // indirect - go.opentelemetry.io/otel/metric v1.29.0 // indirect - go.opentelemetry.io/otel/sdk v1.29.0 // indirect - go.opentelemetry.io/otel/trace v1.29.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect + go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/sdk v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.30.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.26.0 // indirect - golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.22.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/term v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect + golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.6.0 // indirect google.golang.org/api v0.194.0 // indirect - google.golang.org/genproto v0.0.0-20240827150818-7e3bb234dfed // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/apiextensions-apiserver v0.31.0 // indirect - k8s.io/apiserver v0.31.0 // indirect - k8s.io/component-base v0.31.0 // indirect + k8s.io/apiextensions-apiserver v0.31.1 // indirect + k8s.io/apiserver v0.31.1 // indirect + k8s.io/component-base v0.31.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2 // indirect + k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect diff --git a/go.sum b/go.sum index 003c8bed8..bd5ab2bcd 100644 --- a/go.sum +++ b/go.sum @@ -244,8 +244,9 @@ github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -340,8 +341,8 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6 github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/cel-go v0.20.1 h1:nDx9r8S3L4pE61eDdt8igGj8rf5kjYR3ILxWIpWNi84= github.com/google/cel-go v0.20.1/go.mod h1:kWcIzTsPX0zmQ+H3TirHstLLf9ep5QTsZBN9u4dOYLg= github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 h1:0VpGH+cDhbDtdcweoyCVsF3fhN8kejK6rFe/2FFX2nU= @@ -448,8 +449,6 @@ github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= -github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jmespath-community/go-jmespath v1.1.2-0.20240919193755-5e4e8ae73c8a h1:baQnVszUF+wENqBnqJDlgmSIBpJLMqQE0i+hICMZ9sI= github.com/jmespath-community/go-jmespath v1.1.2-0.20240919193755-5e4e8ae73c8a/go.mod h1:VL6C6nwf/wRivvXAjziX9yFRVmvOC1qzERc8RTQ0tv4= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= @@ -484,8 +483,8 @@ github.com/kudobuilder/kuttl v0.19.0 h1:6fJ20R5lqCtY1c5K2UkCZH50kEHMoyuzpz+8+Mob github.com/kudobuilder/kuttl v0.19.0/go.mod h1:LgyzxMNqEpxev3N7Lu1T6mbo5E1ABiTzpXiekkhxx64= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/kyverno/kyverno-json v0.0.4-0.20240730143747-aade3d42fc0e h1:gh9iMuJS8yloxo3JIzvgLWZWwy5iRjEkA8/U7rK3iu8= -github.com/kyverno/kyverno-json v0.0.4-0.20240730143747-aade3d42fc0e/go.mod h1:3LgZogzltja+Sx0o5CIa7d7+991v8sWXHskU0fWSOsQ= +github.com/kyverno/kyverno-json v0.0.4-0.20240927122954-790f57dc7b22 h1:byaWh4rwiqGK/3be0A0YoK1a64WXqe4YT2ujlTkDnQQ= +github.com/kyverno/kyverno-json v0.0.4-0.20240927122954-790f57dc7b22/go.mod h1:VTWmJihVuZcuBBWIuzMZebEDdpe0kX+wXz3PS9/p35Y= github.com/kyverno/pkg/ext v0.0.0-20240418121121-df8add26c55c h1:lAolpR9H8BwM5lRRvgCQ8JowswyxZRH+fgtIQzHFVCk= github.com/kyverno/pkg/ext v0.0.0-20240418121121-df8add26c55c/go.mod h1:02vxM0GNXz9+B/i6+rMfWAIwibUuAH+qFsd73IFskgQ= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -524,8 +523,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= -github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= -github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -545,8 +544,8 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/smarty/assertions v1.15.1 h1:812oFiXI+G55vxsFf+8bIZ1ux30qtkdqzKbEFwyX3Tk= -github.com/smarty/assertions v1.15.1/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec= +github.com/smarty/assertions v1.16.0 h1:EvHNkdRA4QHMrn75NZSoUQ/mAUXAYWfatfB01yTCzfY= +github.com/smarty/assertions v1.16.0/go.mod h1:duaaFdCS0K9dnoM50iyek/eYINOZ64gbh1Xlf6LG7AI= github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY= github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= @@ -620,22 +619,22 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= -go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= -go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 h1:dIIDULZJpgdiHz5tXrTgKIMLkus6jEFa7x5SOKcyR7E= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0/go.mod h1:jlRVBe7+Z1wyxFSUs48L6OBQZ5JwH2Hg/Vbl+t9rAgI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0 h1:nSiV3s7wiCam610XcLbYOmMfJxB9gO4uK3Xgv5gmTgg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0/go.mod h1:hKn/e/Nmd19/x1gvIHwtOwVWM+VhuITSWip3JUDghj0= -go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= -go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= -go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= -go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= -go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= -go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 h1:hCq2hNMwsegUvPzI7sPOvtO9cqyy5GbWt/Ybp2xrx8Q= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0/go.mod h1:LqaApwGx/oUmzsbqxkzuBvyoPpkxk3JQWnqfVrJ3wCA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 h1:ZIg3ZT/aQ7AfKqdwp7ECpOK6vHqquXXuyTjIO8ZdmPs= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0/go.mod h1:DQAwmETtZV00skUwgD6+0U89g80NKsJE3DCKeLLPQMI= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0 h1:lsInsfvhVIfOI6qHVyysXMNDnjO9Npvl7tlDPJFBVd4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0/go.mod h1:KQsVNh4OjgjTG0G6EiNi1jVpnaeeKsKMRwbLN+f1+8M= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0 h1:m0yTiGDLUvVYaTFbAvCkVYIYcvwKt3G7OLoN77NUs/8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0/go.mod h1:wBQbT4UekBfegL2nx0Xk1vBcnzyBPsIVm9hRG4fYcr4= +go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= +go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/sdk v1.30.0 h1:cHdik6irO49R5IysVhdn8oaiR9m8XluDaJAs4DfOrYE= +go.opentelemetry.io/otel/sdk v1.30.0/go.mod h1:p14X4Ok8S+sygzblytT1nqG98QG2KYKv++HE0LY/mhg= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= @@ -651,8 +650,8 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -663,8 +662,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= -golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -739,8 +738,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -766,8 +765,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -849,13 +848,13 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= -golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -866,8 +865,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -928,8 +927,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1096,12 +1095,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240827150818-7e3bb234dfed h1:4C4dbrVFtfIp3GXJdMX1Sj25mahfn5DywOo65/2ISQ8= -google.golang.org/genproto v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:ICjniACoWvcDz8c8bOsHVKuuSGDJy1z5M4G0DM3HzTc= -google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed h1:3RgNmBoI9MZhsj3QxC+AP/qQhNwpCLOvYDYYsFrhFt0= -google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= +google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:hL97c3SYopEHblzpxRL4lSs523++l8DYxGM1FQiYmb4= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.18.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1138,8 +1137,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1190,24 +1189,24 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.31.1 h1:Xe1hX/fPW3PXYYv8BlozYqw63ytA92snr96zMW9gWTU= k8s.io/api v0.31.1/go.mod h1:sbN1g6eY6XVLeqNsZGLnI5FwVseTrZX7Fv3O26rhAaI= -k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= -k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= +k8s.io/apiextensions-apiserver v0.31.1 h1:L+hwULvXx+nvTYX/MKM3kKMZyei+UiSXQWciX/N6E40= +k8s.io/apiextensions-apiserver v0.31.1/go.mod h1:tWMPR3sgW+jsl2xm9v7lAyRF1rYEK71i9G5dRtkknoQ= k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U= k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/apiserver v0.31.0 h1:p+2dgJjy+bk+B1Csz+mc2wl5gHwvNkC9QJV+w55LVrY= -k8s.io/apiserver v0.31.0/go.mod h1:KI9ox5Yu902iBnnyMmy7ajonhKnkeZYJhTZ/YI+WEMk= +k8s.io/apiserver v0.31.1 h1:Sars5ejQDCRBY5f7R3QFHdqN3s61nhkpaX8/k1iEw1c= +k8s.io/apiserver v0.31.1/go.mod h1:lzDhpeToamVZJmmFlaLwdYZwd7zB+WYRYIboqA1kGxM= k8s.io/client-go v0.31.1 h1:f0ugtWSbWpxHR7sjVpQwuvw9a3ZKLXX0u0itkFXufb0= k8s.io/client-go v0.31.1/go.mod h1:sKI8871MJN2OyeqRlmA4W4KM9KBdBUpDLu/43eGemCg= -k8s.io/component-base v0.31.0 h1:/KIzGM5EvPNQcYgwq5NwoQBaOlVFrghoVGr8lG6vNRs= -k8s.io/component-base v0.31.0/go.mod h1:TYVuzI1QmN4L5ItVdMSXKvH7/DtvIuas5/mm8YT3rTo= +k8s.io/component-base v0.31.1 h1:UpOepcrX3rQ3ab5NB6g5iP0tvsgJWzxTyAo20sgYSy8= +k8s.io/component-base v0.31.1/go.mod h1:WGeaw7t/kTsqpVTaCoVEtillbqAhF2/JgvO0LDOMa0w= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kms v0.31.0 h1:KchILPfB1ZE+ka7223mpU5zeFNkmb45jl7RHnlImUaI= -k8s.io/kms v0.31.0/go.mod h1:OZKwl1fan3n3N5FFxnW5C4V3ygrah/3YXeJWS3O6+94= -k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2 h1:GKE9U8BH16uynoxQii0auTjmmmuZ3O0LFMN6S0lPPhI= -k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2/go.mod h1:coRQXBK9NxO98XUv3ZD6AK3xzHCxV6+b7lrquKwaKzA= -k8s.io/utils v0.0.0-20240821151609-f90d01438635 h1:2wThSvJoW/Ncn9TmQEYXRnevZXi2duqHWf5OX9S3zjI= -k8s.io/utils v0.0.0-20240821151609-f90d01438635/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/kms v0.31.1 h1:cGLyV3cIwb0ovpP/jtyIe2mEuQ/MkbhmeBF2IYCA9Io= +k8s.io/kms v0.31.1/go.mod h1:OZKwl1fan3n3N5FFxnW5C4V3ygrah/3YXeJWS3O6+94= +k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 h1:1dWzkmJrrprYvjGwh9kEUxmcUV/CtNU8QM7h1FLWQOo= +k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38/go.mod h1:coRQXBK9NxO98XUv3ZD6AK3xzHCxV6+b7lrquKwaKzA= +k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 h1:b2FmK8YH+QEwq/Sy2uAEhmqL5nPfGYbJOcaqjeYYZoA= +k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/pkg/apis/compiler.go b/pkg/apis/compiler.go new file mode 100644 index 000000000..62fb1b3b6 --- /dev/null +++ b/pkg/apis/compiler.go @@ -0,0 +1,16 @@ +package apis + +import ( + "github.com/kyverno/chainsaw/pkg/engine/functions" + "github.com/kyverno/kyverno-json/pkg/core/compilers" + "github.com/kyverno/kyverno-json/pkg/core/compilers/cel" + "github.com/kyverno/kyverno-json/pkg/core/compilers/jp" +) + +var ( + defaultCompilers = compilers.Compilers{ + Jp: jp.NewCompiler(jp.WithFunctionCaller(functions.Caller())), + Cel: cel.NewCompiler(), + } + DefaultCompilers = defaultCompilers.WithDefaultCompiler(compilers.CompilerJP) +) diff --git a/pkg/apis/v1alpha1/action.go b/pkg/apis/v1alpha1/action.go index c5c3c5104..c0b5b92f4 100644 --- a/pkg/apis/v1alpha1/action.go +++ b/pkg/apis/v1alpha1/action.go @@ -26,7 +26,7 @@ type ActionCheckRef struct { // Check provides a check used in assertions. // +optional - Check *Check `json:"resource,omitempty"` + Check *Projection `json:"resource,omitempty"` // Template determines whether resources should be considered for templating. // +optional diff --git a/pkg/apis/v1alpha1/catch_finally_test.go b/pkg/apis/v1alpha1/catch_finally_test.go index 08a9ae96d..1b3c4eb3e 100644 --- a/pkg/apis/v1alpha1/catch_finally_test.go +++ b/pkg/apis/v1alpha1/catch_finally_test.go @@ -25,14 +25,14 @@ func TestFinally_Bindings(t *testing.T) { }{{ fields: fields{ Command: &Command{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, }, { fields: fields{ Delete: &Delete{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, @@ -55,7 +55,7 @@ func TestFinally_Bindings(t *testing.T) { }, { fields: fields{ Script: &Script{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, @@ -107,7 +107,7 @@ func TestFinally_Outputs(t *testing.T) { }{{ fields: fields{ Command: &Command{ - ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", Any{Value: "bar"}}}}}, + ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", NewProjection("bar")}}}}, }, }, want: 1, @@ -134,7 +134,7 @@ func TestFinally_Outputs(t *testing.T) { }, { fields: fields{ Script: &Script{ - ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", Any{Value: "bar"}}}}}, + ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", NewProjection("bar")}}}}, }, }, want: 1, diff --git a/pkg/apis/v1alpha1/configuration.go b/pkg/apis/v1alpha1/configuration.go index 22d476333..ed0879be1 100644 --- a/pkg/apis/v1alpha1/configuration.go +++ b/pkg/apis/v1alpha1/configuration.go @@ -77,7 +77,7 @@ type ConfigurationSpec struct { // NamespaceTemplate defines a template to create the test namespace. // +optional - NamespaceTemplate *Any `json:"namespaceTemplate,omitempty"` + NamespaceTemplate *Projection `json:"namespaceTemplate,omitempty"` // FullName makes use of the full test case folder path instead of the folder name. // +optional diff --git a/pkg/apis/v1alpha1/operation_test.go b/pkg/apis/v1alpha1/operation_test.go index 56f3d71da..bc2d4ca86 100644 --- a/pkg/apis/v1alpha1/operation_test.go +++ b/pkg/apis/v1alpha1/operation_test.go @@ -14,35 +14,35 @@ func TestOperation_Bindings(t *testing.T) { }{{ operation: Operation{ Apply: &Apply{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, }, { operation: Operation{ Assert: &Assert{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, }, { operation: Operation{ Command: &Command{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, }, { operation: Operation{ Create: &Create{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, }, { operation: Operation{ Delete: &Delete{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, @@ -54,7 +54,7 @@ func TestOperation_Bindings(t *testing.T) { }, { operation: Operation{ Error: &Error{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, @@ -71,7 +71,7 @@ func TestOperation_Bindings(t *testing.T) { }, { operation: Operation{ Patch: &Patch{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, @@ -88,7 +88,7 @@ func TestOperation_Bindings(t *testing.T) { }, { operation: Operation{ Script: &Script{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, @@ -99,7 +99,7 @@ func TestOperation_Bindings(t *testing.T) { }, { operation: Operation{ Update: &Update{ - ActionBindings: ActionBindings{Bindings: []Binding{{"foo", Any{Value: "bar"}}}}, + ActionBindings: ActionBindings{Bindings: []Binding{{"foo", NewProjection("bar")}}}, }, }, want: 1, @@ -125,7 +125,7 @@ func TestOperation_Outputs(t *testing.T) { }{{ operation: Operation{ Apply: &Apply{ - ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", Any{Value: "bar"}}}}}, + ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", NewProjection("bar")}}}}, }, }, want: 1, @@ -136,14 +136,14 @@ func TestOperation_Outputs(t *testing.T) { }, { operation: Operation{ Command: &Command{ - ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", Any{Value: "bar"}}}}}, + ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", NewProjection("bar")}}}}, }, }, want: 1, }, { operation: Operation{ Create: &Create{ - ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", Any{Value: "bar"}}}}}, + ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", NewProjection("bar")}}}}, }, }, want: 1, @@ -170,7 +170,7 @@ func TestOperation_Outputs(t *testing.T) { }, { operation: Operation{ Patch: &Patch{ - ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", Any{Value: "bar"}}}}}, + ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", NewProjection("bar")}}}}, }, }, want: 1, @@ -185,7 +185,7 @@ func TestOperation_Outputs(t *testing.T) { }, { operation: Operation{ Script: &Script{ - ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", Any{Value: "bar"}}}}}, + ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", NewProjection("bar")}}}}, }, }, want: 1, @@ -196,7 +196,7 @@ func TestOperation_Outputs(t *testing.T) { }, { operation: Operation{ Update: &Update{ - ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", Any{Value: "bar"}}}}}, + ActionOutputs: ActionOutputs{Outputs: []Output{{Binding: Binding{"foo", NewProjection("bar")}}}}, }, }, want: 1, diff --git a/pkg/apis/v1alpha1/projection.go b/pkg/apis/v1alpha1/projection.go new file mode 100644 index 000000000..77cea0d3d --- /dev/null +++ b/pkg/apis/v1alpha1/projection.go @@ -0,0 +1,52 @@ +package v1alpha1 + +import ( + "encoding/json" + + "github.com/kyverno/kyverno-json/pkg/utils/copy" +) + +// Projection can be any type. +// +k8s:deepcopy-gen=false +// +kubebuilder:validation:XPreserveUnknownFields +// +kubebuilder:validation:Type:="" +type Projection struct { + _value any +} + +func NewProjection(value any) Projection { + return Projection{ + _value: value, + } +} + +func (a *Projection) Value() any { + return a._value +} + +func (a *Projection) MarshalJSON() ([]byte, error) { + return json.Marshal(a._value) +} + +func (a *Projection) UnmarshalJSON(data []byte) error { + var v any + err := json.Unmarshal(data, &v) + if err != nil { + return err + } + a._value = v + return nil +} + +func (in *Projection) DeepCopyInto(out *Projection) { + out._value = copy.DeepCopy(in._value) +} + +func (in *Projection) DeepCopy() *Projection { + if in == nil { + return nil + } + out := new(Projection) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/v1alpha1/test.go b/pkg/apis/v1alpha1/test.go index 122586d28..e154d4b06 100644 --- a/pkg/apis/v1alpha1/test.go +++ b/pkg/apis/v1alpha1/test.go @@ -66,7 +66,7 @@ type TestSpec struct { // NamespaceTemplate defines a template to create the test namespace. // +optional - NamespaceTemplate *Any `json:"namespaceTemplate,omitempty"` + NamespaceTemplate *Projection `json:"namespaceTemplate,omitempty"` // Scenarios defines test scenarios. // +optional diff --git a/pkg/apis/v1alpha1/types.go b/pkg/apis/v1alpha1/types.go index 1f1647ffd..23f96d67b 100644 --- a/pkg/apis/v1alpha1/types.go +++ b/pkg/apis/v1alpha1/types.go @@ -13,10 +13,12 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -var identifier = regexp.MustCompile(`^(?:\w+|\(.+\))$`) - -// Any represents any type. -type Any = v1alpha1.Any +var ( + identifier = regexp.MustCompile(`^(?:\w+|\(.+\))$`) + NewAny = v1alpha1.NewAny + NewCheck = v1alpha1.NewAssertionTree + NewMatch = v1alpha1.NewAssertionTree +) // Binding represents a key/value set as a binding in an executing test. type Binding struct { @@ -26,9 +28,7 @@ type Binding struct { Name Expression `json:"name"` // Value value of the binding. - // +kubebuilder:validation:Schemaless - // +kubebuilder:pruning:PreserveUnknownFields - Value Any `json:"value"` + Value Projection `json:"value"` } func (b Binding) CheckName() error { @@ -39,7 +39,7 @@ func (b Binding) CheckName() error { } // Check represents a check to be applied on the result of an operation. -type Check = Any +type Check = v1alpha1.AssertionTree // Cluster defines cluster config and context. type Cluster struct { @@ -106,7 +106,7 @@ func (e Expression) Value(ctx context.Context, bindings binding.Bindings) (strin type Format Expression // Match represents a match condition against an evaluated object. -type Match = Any +type Match = v1alpha1.AssertionTree // ObjectName represents an object namespace and name. type ObjectName struct { diff --git a/pkg/apis/v1alpha1/types_test.go b/pkg/apis/v1alpha1/types_test.go index 8a4a8c665..9f853c03e 100644 --- a/pkg/apis/v1alpha1/types_test.go +++ b/pkg/apis/v1alpha1/types_test.go @@ -12,7 +12,7 @@ func TestBinding_CheckName(t *testing.T) { tests := []struct { name string bindingName Expression - bindingValue Any + bindingValue Projection wantErr bool }{{ name: "empty", diff --git a/pkg/apis/v1alpha2/options.go b/pkg/apis/v1alpha2/options.go index 7cb2a5768..82ac84f6c 100644 --- a/pkg/apis/v1alpha2/options.go +++ b/pkg/apis/v1alpha2/options.go @@ -89,7 +89,7 @@ type NamespaceOptions struct { // Template defines a template to create the test namespace. // +optional - Template *Any `json:"template,omitempty"` + Template *Projection `json:"template,omitempty"` } type ReportFormatType string diff --git a/pkg/apis/v1alpha2/types.go b/pkg/apis/v1alpha2/types.go index 160c441c6..e31e2ccf0 100644 --- a/pkg/apis/v1alpha2/types.go +++ b/pkg/apis/v1alpha2/types.go @@ -6,7 +6,7 @@ import ( ) type ( - Any = v1alpha1.Any Clusters = v1alpha1.Clusters DefaultTimeouts = v1alpha1.DefaultTimeouts + Projection = v1alpha1.Projection ) diff --git a/pkg/data/crds/chainsaw.kyverno.io_configurations.yaml b/pkg/data/crds/chainsaw.kyverno.io_configurations.yaml index 875fb6fac..19c6dbadd 100644 --- a/pkg/data/crds/chainsaw.kyverno.io_configurations.yaml +++ b/pkg/data/crds/chainsaw.kyverno.io_configurations.yaml @@ -96,7 +96,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -150,7 +149,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -245,11 +243,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -562,7 +558,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -617,7 +612,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -816,7 +810,6 @@ spec: namespaceTemplate: description: NamespaceTemplate defines a template to create the test namespace. - type: object x-kubernetes-preserve-unknown-fields: true parallel: description: The maximum number of tests to run at once. @@ -1052,7 +1045,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1107,7 +1099,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1202,11 +1193,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -1522,7 +1511,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1577,7 +1565,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1756,7 +1743,6 @@ spec: type: string template: description: Template defines a template to create the test namespace. - type: object x-kubernetes-preserve-unknown-fields: true type: object report: diff --git a/pkg/data/crds/chainsaw.kyverno.io_steptemplates.yaml b/pkg/data/crds/chainsaw.kyverno.io_steptemplates.yaml index 23b2d95cb..49858c35f 100644 --- a/pkg/data/crds/chainsaw.kyverno.io_steptemplates.yaml +++ b/pkg/data/crds/chainsaw.kyverno.io_steptemplates.yaml @@ -112,7 +112,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -166,7 +165,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -261,11 +259,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -578,7 +574,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -633,7 +628,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -828,7 +822,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -882,7 +875,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -977,11 +969,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -1294,7 +1284,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -1349,7 +1338,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1544,7 +1532,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -1598,7 +1585,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1693,11 +1679,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2010,7 +1994,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -2065,7 +2048,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2305,11 +2287,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2330,7 +2310,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2414,7 +2393,6 @@ spec: type: string resource: description: Check provides a check used in assertions. - type: object x-kubernetes-preserve-unknown-fields: true template: description: Template determines whether resources should @@ -2454,7 +2432,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -2508,7 +2485,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2602,11 +2578,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2627,7 +2601,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2722,11 +2695,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2900,7 +2871,6 @@ spec: type: string resource: description: Check provides a check used in assertions. - type: object x-kubernetes-preserve-unknown-fields: true template: description: Template determines whether resources should @@ -3087,11 +3057,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3112,7 +3080,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3249,7 +3216,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3303,7 +3269,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -3358,7 +3323,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3454,11 +3418,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3479,7 +3441,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. diff --git a/pkg/data/crds/chainsaw.kyverno.io_tests.yaml b/pkg/data/crds/chainsaw.kyverno.io_tests.yaml index 2fccf1f24..9e136c4ef 100644 --- a/pkg/data/crds/chainsaw.kyverno.io_tests.yaml +++ b/pkg/data/crds/chainsaw.kyverno.io_tests.yaml @@ -113,7 +113,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -167,7 +166,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -262,11 +260,9 @@ spec: properties: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -579,7 +575,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will be @@ -634,7 +629,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -830,7 +824,6 @@ spec: namespaceTemplate: description: NamespaceTemplate defines a template to create the test namespace. - type: object x-kubernetes-preserve-unknown-fields: true scenarios: description: Scenarios defines test scenarios. @@ -955,7 +948,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1011,7 +1003,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1110,11 +1101,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -1436,7 +1425,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1492,7 +1480,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1691,7 +1678,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -1747,7 +1733,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -1846,11 +1831,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2172,7 +2155,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -2228,7 +2210,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2462,7 +2443,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -2518,7 +2498,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -2617,11 +2596,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -2943,7 +2920,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -2999,7 +2975,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3281,11 +3256,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3306,7 +3279,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3392,7 +3364,6 @@ spec: type: string resource: description: Check provides a check used in assertions. - type: object x-kubernetes-preserve-unknown-fields: true template: description: Template determines whether resources @@ -3432,7 +3403,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -3488,7 +3458,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3586,11 +3555,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3611,7 +3578,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -3708,11 +3674,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -3890,7 +3854,6 @@ spec: type: string resource: description: Check provides a check used in assertions. - type: object x-kubernetes-preserve-unknown-fields: true template: description: Template determines whether resources @@ -4083,11 +4046,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -4108,7 +4069,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -4248,7 +4208,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -4302,7 +4261,6 @@ spec: check: description: Check is an assertion tree to validate the operation outcome. - type: object x-kubernetes-preserve-unknown-fields: true cluster: description: Cluster defines the target cluster (will @@ -4358,7 +4316,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. @@ -4458,11 +4415,9 @@ spec: check: description: Check defines the verification statement. - type: object x-kubernetes-preserve-unknown-fields: true match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true required: - check @@ -4483,7 +4438,6 @@ spec: properties: match: description: Match defines the matching statement. - type: object x-kubernetes-preserve-unknown-fields: true name: description: Name the name of the binding. diff --git a/pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json b/pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json index 87cdc6642..faa67d501 100644 --- a/pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json +++ b/pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json @@ -442,10 +442,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -539,10 +535,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -693,15 +685,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -1216,10 +1203,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1316,10 +1299,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1640,10 +1619,6 @@ }, "namespaceTemplate": { "description": "NamespaceTemplate defines a template to create the test namespace.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "parallel": { diff --git a/pkg/data/schemas/json/configuration-chainsaw-v1alpha2.json b/pkg/data/schemas/json/configuration-chainsaw-v1alpha2.json index 9224a5066..39f21a483 100644 --- a/pkg/data/schemas/json/configuration-chainsaw-v1alpha2.json +++ b/pkg/data/schemas/json/configuration-chainsaw-v1alpha2.json @@ -570,10 +570,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -667,10 +663,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -821,15 +813,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -1344,10 +1331,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1444,10 +1427,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1736,10 +1715,6 @@ }, "template": { "description": "Template defines a template to create the test namespace.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, diff --git a/pkg/data/schemas/json/steptemplate-chainsaw-v1alpha1.json b/pkg/data/schemas/json/steptemplate-chainsaw-v1alpha1.json index 7f88da88b..49509b5ed 100644 --- a/pkg/data/schemas/json/steptemplate-chainsaw-v1alpha1.json +++ b/pkg/data/schemas/json/steptemplate-chainsaw-v1alpha1.json @@ -475,10 +475,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -572,10 +568,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -726,15 +718,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -1249,10 +1236,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1349,10 +1332,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1693,10 +1672,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1790,10 +1765,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1944,15 +1915,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -2467,10 +2433,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -2567,10 +2529,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -2911,10 +2869,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -3008,10 +2962,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -3162,15 +3112,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -3685,10 +3630,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -3785,10 +3726,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -4208,15 +4145,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -4249,10 +4181,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -4693,10 +4621,6 @@ }, "resource": { "description": "Check provides a check used in assertions.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "template": { @@ -4771,10 +4695,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -4868,10 +4788,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -5024,15 +4940,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -5065,10 +4976,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -5530,15 +5437,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -5816,10 +5718,6 @@ }, "resource": { "description": "Check provides a check used in assertions.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "template": { @@ -6137,15 +6035,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -6178,10 +6071,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -6718,10 +6607,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -6800,10 +6685,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -6900,10 +6781,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -7066,15 +6943,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -7107,10 +6979,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { diff --git a/pkg/data/schemas/json/test-chainsaw-v1alpha1.json b/pkg/data/schemas/json/test-chainsaw-v1alpha1.json index 7f011de90..960c4c02e 100644 --- a/pkg/data/schemas/json/test-chainsaw-v1alpha1.json +++ b/pkg/data/schemas/json/test-chainsaw-v1alpha1.json @@ -475,10 +475,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -572,10 +568,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -726,15 +718,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -1249,10 +1236,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -1349,10 +1332,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -1672,10 +1651,6 @@ }, "namespaceTemplate": { "description": "NamespaceTemplate defines a template to create the test namespace.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "scenarios": { @@ -1921,10 +1896,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -2018,10 +1989,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -2172,15 +2139,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -2695,10 +2657,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -2795,10 +2753,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -3139,10 +3093,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -3236,10 +3186,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -3390,15 +3336,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -3913,10 +3854,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -4013,10 +3950,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -4414,10 +4347,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -4511,10 +4440,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -4665,15 +4590,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -5188,10 +5108,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -5288,10 +5204,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -5787,15 +5699,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -5828,10 +5735,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -6272,10 +6175,6 @@ }, "resource": { "description": "Check provides a check used in assertions.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "template": { @@ -6350,10 +6249,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -6447,10 +6342,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -6603,15 +6494,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -6644,10 +6530,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -7109,15 +6991,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -7395,10 +7272,6 @@ }, "resource": { "description": "Check provides a check used in assertions.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "template": { @@ -7716,15 +7589,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -7757,10 +7625,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -8297,10 +8161,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -8379,10 +8239,6 @@ }, "check": { "description": "Check is an assertion tree to validate the operation outcome.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "cluster": { @@ -8479,10 +8335,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { @@ -8645,15 +8497,10 @@ "properties": { "check": { "description": "Check defines the verification statement.", - "type": "object", "x-kubernetes-preserve-unknown-fields": true }, "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true } }, @@ -8686,10 +8533,6 @@ "properties": { "match": { "description": "Match defines the matching statement.", - "type": [ - "object", - "null" - ], "x-kubernetes-preserve-unknown-fields": true }, "name": { diff --git a/pkg/engine/bindings/bindings_test.go b/pkg/engine/bindings/bindings_test.go index 9bb294a8e..dd7549c4e 100644 --- a/pkg/engine/bindings/bindings_test.go +++ b/pkg/engine/bindings/bindings_test.go @@ -83,7 +83,7 @@ func TestResolveBinding(t *testing.T) { input: nil, variable: v1alpha1.Binding{ Name: "foo", - Value: v1alpha1.Any{Value: "bar"}, + Value: v1alpha1.NewProjection("bar"), }, wantName: "foo", wantValue: "bar", @@ -94,7 +94,7 @@ func TestResolveBinding(t *testing.T) { input: nil, variable: v1alpha1.Binding{ Name: "$foo", - Value: v1alpha1.Any{Value: "bar"}, + Value: v1alpha1.NewProjection("bar"), }, wantErr: true, }, { @@ -103,7 +103,7 @@ func TestResolveBinding(t *testing.T) { input: nil, variable: v1alpha1.Binding{ Name: "foo", - Value: v1alpha1.Any{Value: "($bar)"}, + Value: v1alpha1.NewProjection("($bar)"), }, wantErr: true, }, { @@ -112,7 +112,7 @@ func TestResolveBinding(t *testing.T) { input: nil, variable: v1alpha1.Binding{ Name: "($foo)", - Value: v1alpha1.Any{Value: "bar"}, + Value: v1alpha1.NewProjection("bar"), }, wantErr: true, }, { @@ -121,7 +121,7 @@ func TestResolveBinding(t *testing.T) { input: nil, variable: v1alpha1.Binding{ Name: "($foo)", - Value: v1alpha1.Any{Value: "($bar)"}, + Value: v1alpha1.NewProjection("($bar)"), }, wantName: "abc", wantValue: "def", diff --git a/pkg/engine/checks/check.go b/pkg/engine/checks/check.go index 3ece58630..a59a09680 100644 --- a/pkg/engine/checks/check.go +++ b/pkg/engine/checks/check.go @@ -5,10 +5,8 @@ import ( "errors" "github.com/jmespath-community/go-jmespath/pkg/binding" + "github.com/kyverno/chainsaw/pkg/apis" "github.com/kyverno/chainsaw/pkg/apis/v1alpha1" - "github.com/kyverno/chainsaw/pkg/engine/functions" - "github.com/kyverno/kyverno-json/pkg/engine/assert" - "github.com/kyverno/kyverno-json/pkg/engine/template" "k8s.io/apimachinery/pkg/util/validation/field" ) @@ -16,11 +14,15 @@ func Check(ctx context.Context, obj any, bindings binding.Bindings, check *v1alp if check == nil { return nil, errors.New("check is null") } - if check.Value == nil { + if check.IsNil() { return nil, errors.New("check value is null") } - if bindings == nil { - bindings = binding.NewBindings() + if assertion, err := check.Compile(nil, apis.DefaultCompilers); err != nil { + return nil, err + } else { + if bindings == nil { + bindings = binding.NewBindings() + } + return assertion.Assert(nil, obj, bindings) } - return assert.Assert(ctx, nil, assert.Parse(ctx, check.Value), obj, bindings, template.WithFunctionCaller(functions.Caller())) } diff --git a/pkg/engine/checks/check_test.go b/pkg/engine/checks/check_test.go index a3ea512a6..876aac0b2 100644 --- a/pkg/engine/checks/check_test.go +++ b/pkg/engine/checks/check_test.go @@ -8,6 +8,7 @@ import ( "github.com/kyverno/chainsaw/pkg/apis/v1alpha1" "github.com/stretchr/testify/assert" "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/utils/ptr" ) func TestCheck(t *testing.T) { @@ -38,11 +39,11 @@ func TestCheck(t *testing.T) { "foo": "bar", }, bindings: nil, - check: &v1alpha1.Check{ - Value: map[string]any{ + check: ptr.To(v1alpha1.NewCheck( + map[string]any{ "foo": "bar", }, - }, + )), want: nil, wantErr: false, }, { @@ -51,11 +52,11 @@ func TestCheck(t *testing.T) { "foo": "bar", }, bindings: nil, - check: &v1alpha1.Check{ - Value: map[string]any{ + check: ptr.To(v1alpha1.NewCheck( + map[string]any{ "foo": "baz", }, - }, + )), want: []*field.Error{{ Type: field.ErrorTypeInvalid, Field: "foo", diff --git a/pkg/engine/checks/expect.go b/pkg/engine/checks/expect.go index 51b519a7e..40a152616 100644 --- a/pkg/engine/checks/expect.go +++ b/pkg/engine/checks/expect.go @@ -15,7 +15,7 @@ func Expect(ctx context.Context, obj unstructured.Unstructured, bindings binding var results field.ErrorList for _, expectation := range expect { // if a match is specified, skip the check if the resource doesn't match - if expectation.Match != nil && expectation.Match.Value != nil { + if expectation.Match != nil && !expectation.Match.IsNil() { if errs, err := Check(ctx, obj.UnstructuredContent(), nil, expectation.Match); err != nil { return true, err } else if len(errs) != 0 { diff --git a/pkg/engine/checks/expect_test.go b/pkg/engine/checks/expect_test.go index e5e682864..59cc96137 100644 --- a/pkg/engine/checks/expect_test.go +++ b/pkg/engine/checks/expect_test.go @@ -8,6 +8,7 @@ import ( "github.com/kyverno/chainsaw/pkg/apis/v1alpha1" "github.com/stretchr/testify/assert" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/utils/ptr" ) func TestExpectations(t *testing.T) { @@ -41,16 +42,16 @@ func TestExpectations(t *testing.T) { }, bindings: nil, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch( + map[string]any{ "foo": "baz", }, - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + )), + Check: v1alpha1.NewCheck( + map[string]any{ "foo": "bar", }, - }, + ), }}, want: false, wantErr: false, @@ -63,16 +64,16 @@ func TestExpectations(t *testing.T) { }, bindings: nil, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch( + map[string]any{ "foo": "bar", }, - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + )), + Check: v1alpha1.NewCheck( + map[string]any{ "foo": "bar", }, - }, + ), }}, want: true, wantErr: false, @@ -85,16 +86,16 @@ func TestExpectations(t *testing.T) { }, bindings: nil, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch( + map[string]any{ "foo": "bar", }, - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + )), + Check: v1alpha1.NewCheck( + map[string]any{ "(foo())": "bar", }, - }, + ), }}, want: true, wantErr: true, @@ -107,16 +108,16 @@ func TestExpectations(t *testing.T) { }, bindings: nil, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch( + map[string]any{ "(foo())": "bar", }, - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + )), + Check: v1alpha1.NewCheck( + map[string]any{ "foo": "bar", }, - }, + ), }}, want: true, wantErr: true, diff --git a/pkg/engine/functions/caller.go b/pkg/engine/functions/caller.go index 782dbf117..f1328f370 100644 --- a/pkg/engine/functions/caller.go +++ b/pkg/engine/functions/caller.go @@ -6,12 +6,12 @@ import ( jpfunctions "github.com/jmespath-community/go-jmespath/pkg/functions" "github.com/jmespath-community/go-jmespath/pkg/interpreter" - "github.com/kyverno/kyverno-json/pkg/engine/template" + "github.com/kyverno/kyverno-json/pkg/jp" ) var Caller = sync.OnceValue(func() interpreter.FunctionCaller { var funcs []jpfunctions.FunctionEntry - funcs = append(funcs, template.GetFunctions(context.Background())...) + funcs = append(funcs, jp.GetFunctions(context.Background())...) funcs = append(funcs, GetFunctions()...) return interpreter.NewFunctionCaller(funcs...) }) diff --git a/pkg/engine/operations/apply/operation.go b/pkg/engine/operations/apply/operation.go index 46d542108..52eb4aa2b 100644 --- a/pkg/engine/operations/apply/operation.go +++ b/pkg/engine/operations/apply/operation.go @@ -62,9 +62,7 @@ func (o *operation) Exec(ctx context.Context, tc binding.Bindings) (_ outputs.Ou internal.LogEnd(logger, logging.Apply, _err) }() if o.template { - template := v1alpha1.Any{ - Value: obj.UnstructuredContent(), - } + template := v1alpha1.NewProjection(obj.UnstructuredContent()) if merged, err := templating.TemplateAndMerge(ctx, obj, tc, template); err != nil { return nil, err } else { diff --git a/pkg/engine/operations/apply/operation_test.go b/pkg/engine/operations/apply/operation_test.go index 244a01eb6..7ca5ef0e9 100644 --- a/pkg/engine/operations/apply/operation_test.go +++ b/pkg/engine/operations/apply/operation_test.go @@ -14,6 +14,7 @@ import ( "github.com/stretchr/testify/assert" kerrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/utils/ptr" ) func Test_apply(t *testing.T) { @@ -161,11 +162,11 @@ func Test_apply(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error != null)": true, }, - }, + ), }}, expectedErr: errors.New("($error != null): Invalid value: false: Expected value: true"), }, { @@ -180,11 +181,11 @@ func Test_apply(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error != null)": true, }, - }, + ), }}, expectedErr: errors.New("($error != null): Invalid value: false: Expected value: true"), }, { @@ -200,11 +201,11 @@ func Test_apply(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error)": "expected patch failure", }, - }, + ), }}, expectedErr: nil, }, { @@ -219,11 +220,11 @@ func Test_apply(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error)": "expected create failure", }, - }, + ), }}, expectedErr: nil, }, { @@ -239,14 +240,12 @@ func Test_apply(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: podv2.UnstructuredContent(), - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch(podv2.UnstructuredContent())), + Check: v1alpha1.NewCheck( + map[string]any{ "kind": "Service", }, - }, + ), }}, expectedErr: nil, }, { @@ -262,14 +261,12 @@ func Test_apply(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: podv1.UnstructuredContent(), - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch(podv1.UnstructuredContent())), + Check: v1alpha1.NewCheck( + map[string]any{ "kind": "Service", }, - }, + ), }}, expectedErr: errors.New(`kind: Invalid value: "Pod": Expected value: "Service"`), }, { diff --git a/pkg/engine/operations/assert/operation.go b/pkg/engine/operations/assert/operation.go index 6d792ee35..98685da10 100644 --- a/pkg/engine/operations/assert/operation.go +++ b/pkg/engine/operations/assert/operation.go @@ -19,6 +19,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/utils/ptr" ) type operation struct { @@ -76,7 +77,7 @@ func (o *operation) execute(ctx context.Context, bindings binding.Bindings, obj } }() if obj.GetAPIVersion() == "" || obj.GetKind() == "" { - _errs, err := checks.Check(ctx, nil, bindings, &v1alpha1.Check{Value: obj.UnstructuredContent()}) + _errs, err := checks.Check(ctx, nil, bindings, ptr.To(v1alpha1.NewCheck(obj.UnstructuredContent()))) if err != nil { return false, err } @@ -100,7 +101,7 @@ func (o *operation) execute(ctx context.Context, bindings binding.Bindings, obj } else { for i := range candidates { candidate := candidates[i] - _errs, err := checks.Check(ctx, candidate.UnstructuredContent(), bindings, &v1alpha1.Check{Value: obj.UnstructuredContent()}) + _errs, err := checks.Check(ctx, candidate.UnstructuredContent(), bindings, ptr.To(v1alpha1.NewCheck(obj.UnstructuredContent()))) if err != nil { return false, err } diff --git a/pkg/engine/operations/command/operation.go b/pkg/engine/operations/command/operation.go index bef1ccb7a..e2fa2680a 100644 --- a/pkg/engine/operations/command/operation.go +++ b/pkg/engine/operations/command/operation.go @@ -133,7 +133,7 @@ func (o *operation) execute(ctx context.Context, bindings binding.Bindings, cmd _outputs = outputs } }(bindings) - if o.command.Check == nil || o.command.Check.Value == nil { + if o.command.Check == nil || o.command.Check.IsNil() { return nil, err } if errs, err := checks.Check(ctx, nil, bindings, o.command.Check); err != nil { diff --git a/pkg/engine/operations/command/operation_test.go b/pkg/engine/operations/command/operation_test.go index ff2823c5b..5268c2b88 100644 --- a/pkg/engine/operations/command/operation_test.go +++ b/pkg/engine/operations/command/operation_test.go @@ -86,11 +86,11 @@ func Test_operationCommand(t *testing.T) { Args: []string{"operation.go"}, ActionEnv: v1alpha1.ActionEnv{SkipLogOutput: true}, ActionCheck: v1alpha1.ActionCheck{ - Check: &v1alpha1.Check{ - Value: map[string]any{ + Check: ptr.To(v1alpha1.NewCheck( + map[string]any{ "($error != null)": true, }, - }, + )), }, }, basePath: "..", @@ -103,11 +103,11 @@ func Test_operationCommand(t *testing.T) { Args: []string{"operation.go"}, ActionEnv: v1alpha1.ActionEnv{SkipLogOutput: true}, ActionCheck: v1alpha1.ActionCheck{ - Check: &v1alpha1.Check{ - Value: map[string]any{ + Check: ptr.To(v1alpha1.NewCheck( + map[string]any{ "(foo('bar'))": true, }, - }, + )), }, }, basePath: "..", @@ -120,11 +120,11 @@ func Test_operationCommand(t *testing.T) { Args: []string{"operation.go"}, ActionEnv: v1alpha1.ActionEnv{SkipLogOutput: true}, ActionCheck: v1alpha1.ActionCheck{ - Check: &v1alpha1.Check{ - Value: map[string]any{ + Check: ptr.To(v1alpha1.NewCheck( + map[string]any{ "(foo('bar'))": true, }, - }, + )), }, }, basePath: "..", diff --git a/pkg/engine/operations/create/operation.go b/pkg/engine/operations/create/operation.go index cfac5348d..480a12b9e 100644 --- a/pkg/engine/operations/create/operation.go +++ b/pkg/engine/operations/create/operation.go @@ -61,9 +61,7 @@ func (o *operation) Exec(ctx context.Context, bindings binding.Bindings) (_ outp internal.LogEnd(logger, logging.Create, _err) }() if o.template { - template := v1alpha1.Any{ - Value: obj.UnstructuredContent(), - } + template := v1alpha1.NewProjection(obj.UnstructuredContent()) if merged, err := templating.TemplateAndMerge(ctx, obj, bindings, template); err != nil { return nil, err } else { diff --git a/pkg/engine/operations/create/operation_test.go b/pkg/engine/operations/create/operation_test.go index 5d99ee26e..87e549e61 100644 --- a/pkg/engine/operations/create/operation_test.go +++ b/pkg/engine/operations/create/operation_test.go @@ -15,6 +15,7 @@ import ( "github.com/stretchr/testify/assert" kerrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/utils/ptr" ) func Test_create(t *testing.T) { @@ -125,11 +126,11 @@ func Test_create(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error)": "some arbitrary error", }, - }, + ), }}, expectedErr: nil, }, { @@ -157,11 +158,11 @@ func Test_create(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error != null)": true, }, - }, + ), }}, expectedErr: errors.New("($error != null): Invalid value: false: Expected value: true"), }, { @@ -176,16 +177,16 @@ func Test_create(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch( + map[string]any{ "foo": "bar", }, - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + )), + Check: v1alpha1.NewCheck( + map[string]any{ "kind": "Service", }, - }, + ), }}, expectedErr: nil, }, { @@ -200,14 +201,12 @@ func Test_create(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: pod.UnstructuredContent(), - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch(pod.UnstructuredContent())), + Check: v1alpha1.NewCheck( + map[string]any{ "kind": "Service", }, - }, + ), }}, expectedErr: errors.New(`kind: Invalid value: "Pod": Expected value: "Service"`), }} diff --git a/pkg/engine/operations/delete/operation.go b/pkg/engine/operations/delete/operation.go index 47b742b9f..a0b5054ac 100644 --- a/pkg/engine/operations/delete/operation.go +++ b/pkg/engine/operations/delete/operation.go @@ -58,9 +58,7 @@ func (o *operation) Exec(ctx context.Context, bindings binding.Bindings) (_ outp internal.LogEnd(logger, logging.Delete, _err) }() if o.template { - template := v1alpha1.Any{ - Value: obj.UnstructuredContent(), - } + template := v1alpha1.NewProjection(obj.UnstructuredContent()) if merged, err := templating.TemplateAndMerge(ctx, obj, bindings, template); err != nil { return nil, err } else { diff --git a/pkg/engine/operations/delete/operation_test.go b/pkg/engine/operations/delete/operation_test.go index f68ea5350..45d1a7471 100644 --- a/pkg/engine/operations/delete/operation_test.go +++ b/pkg/engine/operations/delete/operation_test.go @@ -149,11 +149,11 @@ func Test_operationDelete(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error == 'dummy error')": true, }, - }, + ), }}, expectedErr: nil, expectedLogs: []string{"DELETE: RUN - []", "DELETE: DONE - []"}, diff --git a/pkg/engine/operations/error/operation.go b/pkg/engine/operations/error/operation.go index 88e082266..4e67e50fd 100644 --- a/pkg/engine/operations/error/operation.go +++ b/pkg/engine/operations/error/operation.go @@ -18,6 +18,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/utils/ptr" ) type operation struct { @@ -75,7 +76,7 @@ func (o *operation) execute(ctx context.Context, bindings binding.Bindings, obj } }() if obj.GetAPIVersion() == "" || obj.GetKind() == "" { - _errs, err := checks.Check(ctx, nil, bindings, &v1alpha1.Check{Value: obj.UnstructuredContent()}) + _errs, err := checks.Check(ctx, nil, bindings, ptr.To(v1alpha1.NewCheck(obj.UnstructuredContent()))) if err != nil { return false, err } @@ -94,7 +95,7 @@ func (o *operation) execute(ctx context.Context, bindings binding.Bindings, obj } else { for i := range candidates { candidate := candidates[i] - _errs, err := checks.Check(ctx, candidate.UnstructuredContent(), bindings, &v1alpha1.Check{Value: obj.UnstructuredContent()}) + _errs, err := checks.Check(ctx, candidate.UnstructuredContent(), bindings, ptr.To(v1alpha1.NewCheck(obj.UnstructuredContent()))) if err != nil { return false, err } diff --git a/pkg/engine/operations/errors/resource.go b/pkg/engine/operations/errors/resource.go index 1a5f27f6c..ae2894d28 100644 --- a/pkg/engine/operations/errors/resource.go +++ b/pkg/engine/operations/errors/resource.go @@ -55,9 +55,7 @@ func (e resourceError) Error() string { expected := e.expected var templateErr error if e.template { - template := v1alpha1.Any{ - Value: expected.UnstructuredContent(), - } + template := v1alpha1.NewProjection(expected.UnstructuredContent()) if merged, err := templating.TemplateAndMerge(context.TODO(), expected, e.bindings, template); err != nil { templateErr = err } else { diff --git a/pkg/engine/operations/patch/operation.go b/pkg/engine/operations/patch/operation.go index 5d790d5ef..b4efbf2ef 100644 --- a/pkg/engine/operations/patch/operation.go +++ b/pkg/engine/operations/patch/operation.go @@ -57,9 +57,7 @@ func (o *operation) Exec(ctx context.Context, bindings binding.Bindings) (_ outp internal.LogEnd(logger, logging.Patch, _err) }() if o.template { - template := v1alpha1.Any{ - Value: obj.UnstructuredContent(), - } + template := v1alpha1.NewProjection(obj.UnstructuredContent()) if merged, err := templating.TemplateAndMerge(ctx, obj, bindings, template); err != nil { return nil, err } else { diff --git a/pkg/engine/operations/patch/operation_test.go b/pkg/engine/operations/patch/operation_test.go index 77aad1f38..525ec6b85 100644 --- a/pkg/engine/operations/patch/operation_test.go +++ b/pkg/engine/operations/patch/operation_test.go @@ -14,6 +14,7 @@ import ( "github.com/stretchr/testify/assert" kerrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/utils/ptr" ) func Test_create(t *testing.T) { @@ -125,11 +126,11 @@ func Test_create(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error)": "some arbitrary error", }, - }, + ), }}, expectedErr: nil, }, { @@ -145,11 +146,11 @@ func Test_create(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error != null)": true, }, - }, + ), }}, expectedErr: errors.New("($error != null): Invalid value: false: Expected value: true"), }, { @@ -165,16 +166,16 @@ func Test_create(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch( + map[string]any{ "foo": "bar", }, - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + )), + Check: v1alpha1.NewCheck( + map[string]any{ "kind": "Service", }, - }, + ), }}, expectedErr: nil, }, { @@ -190,14 +191,12 @@ func Test_create(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: pod.UnstructuredContent(), - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch(pod.UnstructuredContent())), + Check: v1alpha1.NewCheck( + map[string]any{ "kind": "Service", }, - }, + ), }}, expectedErr: errors.New(`kind: Invalid value: "Pod": Expected value: "Service"`), }} diff --git a/pkg/engine/operations/script/operation.go b/pkg/engine/operations/script/operation.go index 123306b8d..14a68bb3c 100644 --- a/pkg/engine/operations/script/operation.go +++ b/pkg/engine/operations/script/operation.go @@ -131,7 +131,7 @@ func (o *operation) execute(ctx context.Context, bindings binding.Bindings, cmd _outputs = outputs } }(bindings) - if o.script.Check == nil || o.script.Check.Value == nil { + if o.script.Check == nil || o.script.Check.IsNil() { return nil, err } if errs, err := checks.Check(ctx, nil, bindings, o.script.Check); err != nil { diff --git a/pkg/engine/operations/script/operation_test.go b/pkg/engine/operations/script/operation_test.go index 28aa60a3a..1253477d7 100644 --- a/pkg/engine/operations/script/operation_test.go +++ b/pkg/engine/operations/script/operation_test.go @@ -80,11 +80,11 @@ func Test_operationScript(t *testing.T) { Content: "foo", ActionEnv: v1alpha1.ActionEnv{SkipLogOutput: true}, ActionCheck: v1alpha1.ActionCheck{ - Check: &v1alpha1.Check{ - Value: map[string]any{ + Check: ptr.To(v1alpha1.NewCheck( + map[string]any{ "($error != null)": true, }, - }, + )), }, }, basePath: "..", @@ -96,11 +96,11 @@ func Test_operationScript(t *testing.T) { Content: "foo", ActionEnv: v1alpha1.ActionEnv{SkipLogOutput: true}, ActionCheck: v1alpha1.ActionCheck{ - Check: &v1alpha1.Check{ - Value: map[string]any{ + Check: ptr.To(v1alpha1.NewCheck( + map[string]any{ "(foo('bar'))": true, }, - }, + )), }, }, basePath: "..", @@ -112,11 +112,11 @@ func Test_operationScript(t *testing.T) { Content: "cat operation.go", ActionEnv: v1alpha1.ActionEnv{SkipLogOutput: true}, ActionCheck: v1alpha1.ActionCheck{ - Check: &v1alpha1.Check{ - Value: map[string]any{ + Check: ptr.To(v1alpha1.NewCheck( + map[string]any{ "(foo('bar'))": true, }, - }, + )), }, }, basePath: "..", diff --git a/pkg/engine/operations/update/operation.go b/pkg/engine/operations/update/operation.go index 8c84bf189..b70543dc9 100644 --- a/pkg/engine/operations/update/operation.go +++ b/pkg/engine/operations/update/operation.go @@ -59,9 +59,7 @@ func (o *operation) Exec(ctx context.Context, bindings binding.Bindings) (_ outp internal.LogEnd(logger, op, _err) }() if o.template { - template := v1alpha1.Any{ - Value: obj.UnstructuredContent(), - } + template := v1alpha1.NewProjection(obj.UnstructuredContent()) if merged, err := templating.TemplateAndMerge(ctx, obj, bindings, template); err != nil { return nil, err } else { diff --git a/pkg/engine/operations/update/operation_test.go b/pkg/engine/operations/update/operation_test.go index 774b6315f..6e88b45a5 100644 --- a/pkg/engine/operations/update/operation_test.go +++ b/pkg/engine/operations/update/operation_test.go @@ -14,6 +14,7 @@ import ( "github.com/stretchr/testify/assert" kerrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/utils/ptr" ) func Test_update(t *testing.T) { @@ -101,11 +102,11 @@ func Test_update(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error)": "some arbitrary error", }, - }, + ), }}, expectedErr: nil, }, { @@ -121,11 +122,11 @@ func Test_update(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Check: v1alpha1.Check{ - Value: map[string]any{ + Check: v1alpha1.NewCheck( + map[string]any{ "($error != null)": true, }, - }, + ), }}, expectedErr: errors.New("($error != null): Invalid value: false: Expected value: true"), }, { @@ -141,16 +142,16 @@ func Test_update(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch( + map[string]any{ "foo": "bar", }, - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + )), + Check: v1alpha1.NewCheck( + map[string]any{ "kind": "Service", }, - }, + ), }}, expectedErr: nil, }, { @@ -166,14 +167,12 @@ func Test_update(t *testing.T) { }, }, expect: []v1alpha1.Expectation{{ - Match: &v1alpha1.Check{ - Value: pod.UnstructuredContent(), - }, - Check: v1alpha1.Check{ - Value: map[string]any{ + Match: ptr.To(v1alpha1.NewMatch(pod.UnstructuredContent())), + Check: v1alpha1.NewCheck( + map[string]any{ "kind": "Service", }, - }, + ), }}, expectedErr: errors.New(`kind: Invalid value: "Pod": Expected value: "Service"`), }} diff --git a/pkg/engine/outputs/outputs.go b/pkg/engine/outputs/outputs.go index c3ff2399a..7ca66ee95 100644 --- a/pkg/engine/outputs/outputs.go +++ b/pkg/engine/outputs/outputs.go @@ -14,7 +14,7 @@ type Outputs = map[string]any func Process(ctx context.Context, tc binding.Bindings, input any, outputs ...v1alpha1.Output) (Outputs, error) { var results Outputs for _, output := range outputs { - if output.Match != nil && output.Match.Value != nil { + if output.Match != nil && !output.Match.IsNil() { if errs, err := checks.Check(ctx, input, tc, output.Match); err != nil { return nil, err } else if len(errs) != 0 { diff --git a/pkg/engine/outputs/outputs_test.go b/pkg/engine/outputs/outputs_test.go index 2f7633c43..e1053a9e0 100644 --- a/pkg/engine/outputs/outputs_test.go +++ b/pkg/engine/outputs/outputs_test.go @@ -7,6 +7,7 @@ import ( "github.com/jmespath-community/go-jmespath/pkg/binding" "github.com/kyverno/chainsaw/pkg/apis/v1alpha1" "github.com/stretchr/testify/assert" + "k8s.io/utils/ptr" ) func TestProcess(t *testing.T) { @@ -31,7 +32,7 @@ func TestProcess(t *testing.T) { outputs: []v1alpha1.Output{{ Binding: v1alpha1.Binding{ Name: "foo", - Value: v1alpha1.Any{Value: "bar"}, + Value: v1alpha1.NewProjection("bar"), }, }}, want: Outputs{ @@ -43,14 +44,16 @@ func TestProcess(t *testing.T) { tc: binding.NewBindings(), input: map[string]any{}, outputs: []v1alpha1.Output{{ - Match: &v1alpha1.Any{ - Value: map[string]any{ - "bar": "baz", - }, - }, + Match: ptr.To( + v1alpha1.NewMatch( + map[string]any{ + "bar": "baz", + }, + ), + ), Binding: v1alpha1.Binding{ Name: "foo", - Value: v1alpha1.Any{Value: "bar"}, + Value: v1alpha1.NewProjection("bar"), }, }}, want: nil, @@ -60,14 +63,16 @@ func TestProcess(t *testing.T) { tc: binding.NewBindings(), input: nil, outputs: []v1alpha1.Output{{ - Match: &v1alpha1.Any{ - Value: map[string]any{ - "($bar)": "baz", - }, - }, + Match: ptr.To( + v1alpha1.NewMatch( + map[string]any{ + "($bar)": "baz", + }, + ), + ), Binding: v1alpha1.Binding{ Name: "foo", - Value: v1alpha1.Any{Value: "bar"}, + Value: v1alpha1.NewProjection("bar"), }, }}, want: nil, @@ -79,7 +84,7 @@ func TestProcess(t *testing.T) { outputs: []v1alpha1.Output{{ Binding: v1alpha1.Binding{ Name: "($foo)", - Value: v1alpha1.Any{Value: "bar"}, + Value: v1alpha1.NewProjection("bar"), }, }}, want: nil, diff --git a/pkg/engine/templating/resource_ref.go b/pkg/engine/templating/resource_ref.go index b683041d5..56351bda6 100644 --- a/pkg/engine/templating/resource_ref.go +++ b/pkg/engine/templating/resource_ref.go @@ -24,9 +24,7 @@ func ResourceRef(ctx context.Context, obj *unstructured.Unstructured, bindings b temp.SetName(obj.GetName()) temp.SetNamespace(obj.GetNamespace()) temp.SetLabels(obj.GetLabels()) - template := v1alpha1.Any{ - Value: temp.UnstructuredContent(), - } + template := v1alpha1.NewProjection(temp.UnstructuredContent()) if merged, err := TemplateAndMerge(ctx, temp, bindings, template); err != nil { return err } else { diff --git a/pkg/engine/templating/template.go b/pkg/engine/templating/template.go index dc7d271e5..505b9ad0a 100644 --- a/pkg/engine/templating/template.go +++ b/pkg/engine/templating/template.go @@ -4,19 +4,18 @@ import ( "context" "github.com/jmespath-community/go-jmespath/pkg/binding" + "github.com/kyverno/chainsaw/pkg/apis" "github.com/kyverno/chainsaw/pkg/apis/v1alpha1" - "github.com/kyverno/chainsaw/pkg/engine/functions" "github.com/kyverno/chainsaw/pkg/mutate" mapsutils "github.com/kyverno/chainsaw/pkg/utils/maps" - "github.com/kyverno/kyverno-json/pkg/engine/template" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) -func Template(ctx context.Context, tpl v1alpha1.Any, value any, bindings binding.Bindings) (any, error) { - return mutate.Mutate(ctx, nil, mutate.Parse(ctx, tpl.Value), value, bindings, template.WithFunctionCaller(functions.Caller())) +func Template(ctx context.Context, tpl v1alpha1.Projection, value any, bindings binding.Bindings) (any, error) { + return mutate.Mutate(ctx, nil, mutate.Parse(ctx, tpl.Value()), value, bindings, apis.DefaultCompilers.Jp.Options()...) } -func TemplateAndMerge(ctx context.Context, obj unstructured.Unstructured, bindings binding.Bindings, templates ...v1alpha1.Any) (unstructured.Unstructured, error) { +func TemplateAndMerge(ctx context.Context, obj unstructured.Unstructured, bindings binding.Bindings, templates ...v1alpha1.Projection) (unstructured.Unstructured, error) { for _, modifier := range templates { patch, err := Template(ctx, modifier, obj.UnstructuredContent(), bindings) if err != nil { diff --git a/pkg/engine/templating/template_test.go b/pkg/engine/templating/template_test.go index 410a00a45..a06cb347e 100644 --- a/pkg/engine/templating/template_test.go +++ b/pkg/engine/templating/template_test.go @@ -19,7 +19,7 @@ func TestTemplateAndMerge(t *testing.T) { name string in unstructured.Unstructured out unstructured.Unstructured - templates []v1alpha1.Any + templates []v1alpha1.Projection wantErr bool }{{ name: "nil", @@ -28,16 +28,18 @@ func TestTemplateAndMerge(t *testing.T) { }, { name: "empty", in: in, - templates: []v1alpha1.Any{}, + templates: []v1alpha1.Projection{}, out: in, }, { name: "merge", in: in, - templates: []v1alpha1.Any{{ - Value: map[string]any{ - "foo": "baz", - }, - }}, + templates: []v1alpha1.Projection{ + v1alpha1.NewProjection( + map[string]any{ + "foo": "baz", + }, + ), + }, out: unstructured.Unstructured{ Object: map[string]any{ "foo": "baz", diff --git a/pkg/expressions/string.go b/pkg/expressions/string.go index 23fd2a977..0662ed1d4 100644 --- a/pkg/expressions/string.go +++ b/pkg/expressions/string.go @@ -6,7 +6,8 @@ import ( "github.com/jmespath-community/go-jmespath/pkg/binding" "github.com/kyverno/chainsaw/pkg/engine/functions" - "github.com/kyverno/kyverno-json/pkg/engine/template" + "github.com/kyverno/kyverno-json/pkg/core/compilers" + "github.com/kyverno/kyverno-json/pkg/core/compilers/jp" ) func String(ctx context.Context, in string, bindings binding.Bindings) (string, error) { @@ -17,7 +18,7 @@ func String(ctx context.Context, in string, bindings binding.Bindings) (string, if expression == nil || expression.Engine == "" { return in, nil } - if converted, err := template.Execute(ctx, expression.Statement, nil, bindings, template.WithFunctionCaller(functions.Caller())); err != nil { + if converted, err := compilers.Execute(expression.Statement, nil, bindings, jp.NewCompiler(jp.WithFunctionCaller(functions.Caller()))); err != nil { return "", err } else { if converted, ok := converted.(string); !ok { diff --git a/pkg/expressions/string_pointer.go b/pkg/expressions/string_pointer.go index 6fc11eafe..3a9b5306d 100644 --- a/pkg/expressions/string_pointer.go +++ b/pkg/expressions/string_pointer.go @@ -6,7 +6,8 @@ import ( "github.com/jmespath-community/go-jmespath/pkg/binding" "github.com/kyverno/chainsaw/pkg/engine/functions" - "github.com/kyverno/kyverno-json/pkg/engine/template" + "github.com/kyverno/kyverno-json/pkg/core/compilers" + "github.com/kyverno/kyverno-json/pkg/core/compilers/jp" ) func StringPointer(ctx context.Context, in *string, bindings binding.Bindings) (*string, error) { @@ -20,7 +21,7 @@ func StringPointer(ctx context.Context, in *string, bindings binding.Bindings) ( if expression == nil || expression.Engine == "" { return in, nil } - if converted, err := template.Execute(ctx, expression.Statement, nil, bindings, template.WithFunctionCaller(functions.Caller())); err != nil { + if converted, err := compilers.Execute(expression.Statement, nil, bindings, jp.NewCompiler(jp.WithFunctionCaller(functions.Caller()))); err != nil { return nil, err } else if converted == nil { return nil, nil diff --git a/pkg/mutate/mutate.go b/pkg/mutate/mutate.go index 9224e4a58..ce1783904 100644 --- a/pkg/mutate/mutate.go +++ b/pkg/mutate/mutate.go @@ -4,10 +4,10 @@ import ( "context" "github.com/jmespath-community/go-jmespath/pkg/binding" - "github.com/kyverno/kyverno-json/pkg/engine/template" + "github.com/kyverno/kyverno-json/pkg/core/compilers/jp" "k8s.io/apimachinery/pkg/util/validation/field" ) -func Mutate(ctx context.Context, path *field.Path, mutation Mutation, value any, bindings binding.Bindings, opts ...template.Option) (any, error) { +func Mutate(ctx context.Context, path *field.Path, mutation Mutation, value any, bindings binding.Bindings, opts ...jp.Option) (any, error) { return mutation.mutate(ctx, path, value, bindings, opts...) } diff --git a/pkg/mutate/mutation.go b/pkg/mutate/mutation.go index b712f1d10..4e101fd1a 100644 --- a/pkg/mutate/mutation.go +++ b/pkg/mutate/mutation.go @@ -4,10 +4,10 @@ import ( "context" "github.com/jmespath-community/go-jmespath/pkg/binding" - "github.com/kyverno/kyverno-json/pkg/engine/template" + "github.com/kyverno/kyverno-json/pkg/core/compilers/jp" "k8s.io/apimachinery/pkg/util/validation/field" ) type Mutation interface { - mutate(context.Context, *field.Path, any, binding.Bindings, ...template.Option) (any, error) + mutate(context.Context, *field.Path, any, binding.Bindings, ...jp.Option) (any, error) } diff --git a/pkg/mutate/parse.go b/pkg/mutate/parse.go index 5f7ad1b79..4155d8de2 100644 --- a/pkg/mutate/parse.go +++ b/pkg/mutate/parse.go @@ -6,7 +6,8 @@ import ( "reflect" "github.com/jmespath-community/go-jmespath/pkg/binding" - "github.com/kyverno/kyverno-json/pkg/engine/template" + "github.com/kyverno/kyverno-json/pkg/core/compilers" + "github.com/kyverno/kyverno-json/pkg/core/compilers/jp" reflectutils "github.com/kyverno/kyverno-json/pkg/utils/reflect" "k8s.io/apimachinery/pkg/util/validation/field" ) @@ -36,7 +37,7 @@ func Parse(ctx context.Context, mutation any) Mutation { // it is responsible for projecting the analysed resource and passing the result to the descendant type mapNode map[any]Mutation -func (n mapNode) mutate(ctx context.Context, path *field.Path, value any, bindings binding.Bindings, opts ...template.Option) (any, error) { +func (n mapNode) mutate(ctx context.Context, path *field.Path, value any, bindings binding.Bindings, opts ...jp.Option) (any, error) { out := map[any]any{} for k, v := range n { var projection any @@ -60,7 +61,7 @@ func (n mapNode) mutate(ctx context.Context, path *field.Path, value any, bindin // if lengths match all descendants are evaluated with their corresponding items. type sliceNode []Mutation -func (n sliceNode) mutate(ctx context.Context, path *field.Path, value any, bindings binding.Bindings, opts ...template.Option) (any, error) { +func (n sliceNode) mutate(ctx context.Context, path *field.Path, value any, bindings binding.Bindings, opts ...jp.Option) (any, error) { if value != nil && reflectutils.GetKind(value) != reflect.Slice && reflectutils.GetKind(value) != reflect.Array { return nil, field.TypeInvalid(path, value, "expected a slice or array") } else { @@ -90,13 +91,13 @@ type scalarNode struct { rhs any } -func (n *scalarNode) mutate(ctx context.Context, path *field.Path, value any, bindings binding.Bindings, opts ...template.Option) (any, error) { +func (n *scalarNode) mutate(ctx context.Context, path *field.Path, value any, bindings binding.Bindings, opts ...jp.Option) (any, error) { rhs := n.rhs expression := parseExpression(ctx, rhs) // we only project if the expression uses the engine syntax // this is to avoid the case where the value is a map and the RHS is a string if expression != nil && expression.Engine != "" { - projected, err := template.Execute(ctx, expression.Statement, value, bindings, opts...) + projected, err := compilers.Execute(expression.Statement, value, bindings, jp.NewCompiler(opts...)) if err != nil { return nil, field.InternalError(path, err) } diff --git a/pkg/runner/processors/context.go b/pkg/runner/processors/context.go index d24a8c35e..e3d9579bf 100644 --- a/pkg/runner/processors/context.go +++ b/pkg/runner/processors/context.go @@ -13,7 +13,7 @@ import ( type namespaceData struct { name string - template *v1alpha1.Any + template *v1alpha1.Projection cleaner cleaner.CleanerCollector } diff --git a/pkg/runner/processors/namespace.go b/pkg/runner/processors/namespace.go index e5e40f72f..01e5d9253 100644 --- a/pkg/runner/processors/namespace.go +++ b/pkg/runner/processors/namespace.go @@ -12,12 +12,12 @@ import ( corev1 "k8s.io/api/core/v1" ) -func buildNamespace(ctx context.Context, name string, template *v1alpha1.Any, tc binding.Bindings) (*corev1.Namespace, error) { +func buildNamespace(ctx context.Context, name string, template *v1alpha1.Projection, tc binding.Bindings) (*corev1.Namespace, error) { namespace := kube.Namespace(name) if template == nil { return &namespace, nil } - if template.Value == nil { + if template.Value() == nil { return &namespace, nil } object := kube.ToUnstructured(&namespace) diff --git a/pkg/runner/processors/step.go b/pkg/runner/processors/step.go index e00d8af25..8a947e351 100644 --- a/pkg/runner/processors/step.go +++ b/pkg/runner/processors/step.go @@ -1017,8 +1017,8 @@ func (p *stepProcessor) waitOperation(id int, namespacer namespacer.Namespacer, } func (p *stepProcessor) fileRefOrCheck(ctx context.Context, ref v1alpha1.ActionCheckRef, bindings binding.Bindings) ([]unstructured.Unstructured, error) { - if ref.Check != nil && ref.Check.Value != nil { - if object, ok := ref.Check.Value.(map[string]any); !ok { + if ref.Check != nil && ref.Check.Value() != nil { + if object, ok := ref.Check.Value().(map[string]any); !ok { return nil, errors.New("resource must be an object") } else { return []unstructured.Unstructured{{Object: object}}, nil diff --git a/pkg/runner/processors/step_test.go b/pkg/runner/processors/step_test.go index d34463837..f43b31a1b 100644 --- a/pkg/runner/processors/step_test.go +++ b/pkg/runner/processors/step_test.go @@ -542,8 +542,8 @@ func TestStepProcessor_Run(t *testing.T) { { Assert: &v1alpha1.Assert{ ActionCheckRef: v1alpha1.ActionCheckRef{ - Check: &v1alpha1.Check{ - Value: map[string]any{ + Check: ptr.To(v1alpha1.NewProjection( + map[string]any{ "apiVersion": "v1", "kind": "Pod", "metadata": map[string]any{ @@ -567,7 +567,7 @@ func TestStepProcessor_Run(t *testing.T) { }, }, }, - }, + )), }, }, }, diff --git a/pkg/runner/processors/test.go b/pkg/runner/processors/test.go index bd4f9e4ca..b24a7aade 100644 --- a/pkg/runner/processors/test.go +++ b/pkg/runner/processors/test.go @@ -28,7 +28,7 @@ func NewTestProcessor( test discovery.Test, size int, clock clock.PassiveClock, - nsTemplate *v1alpha1.Any, + nsTemplate *v1alpha1.Projection, delayBeforeCleanup *time.Duration, terminationGracePeriod *metav1.Duration, timeouts v1alpha1.DefaultTimeouts, @@ -37,7 +37,7 @@ func NewTestProcessor( skipDelete bool, catch ...v1alpha1.CatchFinally, ) TestProcessor { - if template := test.Test.Spec.NamespaceTemplate; template != nil && template.Value != nil { + if template := test.Test.Spec.NamespaceTemplate; template != nil && template.Value() != nil { nsTemplate = template } if test.Test.Spec.DelayBeforeCleanup != nil { @@ -78,7 +78,7 @@ type testProcessor struct { test discovery.Test size int clock clock.PassiveClock - nsTemplate *v1alpha1.Any + nsTemplate *v1alpha1.Projection delayBeforeCleanup *time.Duration terminationGracePeriod *metav1.Duration timeouts v1alpha1.DefaultTimeouts diff --git a/website/apis/config.yaml b/website/apis/config.yaml index e6281cd59..e753f886b 100644 --- a/website/apis/config.yaml +++ b/website/apis/config.yaml @@ -1,5 +1,6 @@ hiddenMemberFields: - - "TypeMeta" +- TypeMeta +- _value externalPackages: - match: ^k8s\.io/apimachinery/pkg/apis/meta/v1\.Duration$ diff --git a/website/docs/reference/apis/chainsaw.v1alpha1.md b/website/docs/reference/apis/chainsaw.v1alpha1.md index ad7b934af..f40747d7a 100644 --- a/website/docs/reference/apis/chainsaw.v1alpha1.md +++ b/website/docs/reference/apis/chainsaw.v1alpha1.md @@ -83,7 +83,7 @@ auto_generated: true | Field | Type | Required | Inline | Description | |---|---|---|---|---| -| `check` | `policy/v1alpha1.Any` | | |
Check is an assertion tree to validate the operation outcome.
| +| `check` | `policy/v1alpha1.AssertionTree` | | |Check is an assertion tree to validate the operation outcome.
| ## ActionCheckRef {#chainsaw-kyverno-io-v1alpha1-ActionCheckRef} @@ -98,7 +98,7 @@ auto_generated: true | Field | Type | Required | Inline | Description | |---|---|---|---|---| | `FileRef` | [`FileRef`](#chainsaw-kyverno-io-v1alpha1-FileRef) | :white_check_mark: | :white_check_mark: | *No description provided.* | -| `resource` | `policy/v1alpha1.Any` | | |Check provides a check used in assertions.
| +| `resource` | [`Projection`](#chainsaw-kyverno-io-v1alpha1-Projection) | | |Check provides a check used in assertions.
| | `template` | `bool` | | |Template determines whether resources should be considered for templating.
| ## ActionClusters {#chainsaw-kyverno-io-v1alpha1-ActionClusters} @@ -344,7 +344,7 @@ during the testing process. | Field | Type | Required | Inline | Description | |---|---|---|---|---| | `name` | [`Expression`](#chainsaw-kyverno-io-v1alpha1-Expression) | :white_check_mark: | |Name the name of the binding.
| -| `value` | `policy/v1alpha1.Any` | :white_check_mark: | |Value value of the binding.
| +| `value` | [`Projection`](#chainsaw-kyverno-io-v1alpha1-Projection) | :white_check_mark: | |Value value of the binding.
| ## CatchFinally {#chainsaw-kyverno-io-v1alpha1-CatchFinally} @@ -428,7 +428,7 @@ during the testing process. | `reportPath` | `string` | | |ReportPath defines the path.
| | `reportName` | `string` | | |ReportName defines the name of report to create. It defaults to "chainsaw-report".
| | `namespace` | `string` | | |Namespace defines the namespace to use for tests. If not specified, every test will execute in a random ephemeral namespace unless the namespace is overridden in a the test spec.
| -| `namespaceTemplate` | `policy/v1alpha1.Any` | | |NamespaceTemplate defines a template to create the test namespace.
| +| `namespaceTemplate` | [`Projection`](#chainsaw-kyverno-io-v1alpha1-Projection) | | |NamespaceTemplate defines a template to create the test namespace.
| | `fullName` | `bool` | | |FullName makes use of the full test case folder path instead of the folder name.
| | `excludeTestRegex` | `string` | | |ExcludeTestRegex is used to exclude tests based on a regular expression.
| | `includeTestRegex` | `string` | | |IncludeTestRegex is used to include tests based on a regular expression.
| @@ -561,8 +561,8 @@ with a match filter to determine if the verification should be considered. | Field | Type | Required | Inline | Description | |---|---|---|---|---| -| `match` | `policy/v1alpha1.Any` | | |Match defines the matching statement.
| -| `check` | `policy/v1alpha1.Any` | :white_check_mark: | |Check defines the verification statement.
| +| `match` | `policy/v1alpha1.AssertionTree` | | |Match defines the matching statement.
| +| `check` | `policy/v1alpha1.AssertionTree` | :white_check_mark: | |Check defines the verification statement.
| ## Expression {#chainsaw-kyverno-io-v1alpha1-Expression} @@ -731,7 +731,7 @@ For multiple objects use labels. | Field | Type | Required | Inline | Description | |---|---|---|---|---| | `Binding` | [`Binding`](#chainsaw-kyverno-io-v1alpha1-Binding) | :white_check_mark: | :white_check_mark: |Binding determines the binding to create when the match succeeds.
| -| `match` | `policy/v1alpha1.Any` | | |Match defines the matching statement.
| +| `match` | `policy/v1alpha1.AssertionTree` | | |Match defines the matching statement.
| ## Patch {#chainsaw-kyverno-io-v1alpha1-Patch} @@ -771,6 +771,21 @@ If a resource doesn't exist yet in the cluster it will fail. | `container` | [`Expression`](#chainsaw-kyverno-io-v1alpha1-Expression) | | |Container in pod to get logs from else --all-containers is used.
| | `tail` | `int` | | |Tail is the number of last lines to collect from pods. If omitted or zero, then the default is 10 if you use a selector, or -1 (all) if you use a pod name. This matches default behavior of `kubectl logs`.
| +## Projection {#chainsaw-kyverno-io-v1alpha1-Projection} + +**Appears in:** + +- [ActionCheckRef](#chainsaw-kyverno-io-v1alpha1-ActionCheckRef) +- [Binding](#chainsaw-kyverno-io-v1alpha1-Binding) +- [ConfigurationSpec](#chainsaw-kyverno-io-v1alpha1-ConfigurationSpec) +- [TestSpec](#chainsaw-kyverno-io-v1alpha1-TestSpec) + +Projection can be any type.
+ + +| Field | Type | Required | Inline | Description | +|---|---|---|---|---| + ## Proxy {#chainsaw-kyverno-io-v1alpha1-Proxy} **Appears in:** @@ -884,7 +899,7 @@ If a resource doesn't exist yet in the cluster it will fail. | `skipDelete` | `bool` | | |SkipDelete determines whether the resources created by the test should be deleted after the test is executed.
| | `template` | `bool` | | |Template determines whether resources should be considered for templating.
| | `namespace` | `string` | | |Namespace determines whether the test should run in a random ephemeral namespace or not.
| -| `namespaceTemplate` | `policy/v1alpha1.Any` | | |NamespaceTemplate defines a template to create the test namespace.
| +| `namespaceTemplate` | [`Projection`](#chainsaw-kyverno-io-v1alpha1-Projection) | | |NamespaceTemplate defines a template to create the test namespace.
| | `scenarios` | [`[]Scenario`](#chainsaw-kyverno-io-v1alpha1-Scenario) | | |Scenarios defines test scenarios.
| | `bindings` | [`[]Binding`](#chainsaw-kyverno-io-v1alpha1-Binding) | | |Bindings defines additional binding key/values.
| | `steps` | [`[]TestStep`](#chainsaw-kyverno-io-v1alpha1-TestStep) | :white_check_mark: | |Steps defining the test.
| diff --git a/website/docs/reference/apis/chainsaw.v1alpha2.md b/website/docs/reference/apis/chainsaw.v1alpha2.md index e1e7e3d0a..022a27a41 100644 --- a/website/docs/reference/apis/chainsaw.v1alpha2.md +++ b/website/docs/reference/apis/chainsaw.v1alpha2.md @@ -130,7 +130,7 @@ auto_generated: true | Field | Type | Required | Inline | Description | |---|---|---|---|---| | `name` | `string` | | |Name defines the namespace to use for tests. If not specified, every test will execute in a random ephemeral namespace unless the namespace is overridden in a the test spec.
| -| `template` | `policy/v1alpha1.Any` | | |Template defines a template to create the test namespace.
| +| `template` | [`Projection`](#chainsaw-kyverno-io-v1alpha1-Projection) | | |Template defines a template to create the test namespace.
| ## ReportFormatType {#chainsaw-kyverno-io-v1alpha2-ReportFormatType} diff --git a/website/docs/reference/jp/examples/add.md b/website/docs/reference/jp/examples/add.md index ff56d6c9a..6fa1ebeca 100644 --- a/website/docs/reference/jp/examples/add.md +++ b/website/docs/reference/jp/examples/add.md @@ -6,7 +6,7 @@ ## Description - +does arithmetic addition of two specified values of numbers, quantities, and durations ## Examples diff --git a/website/docs/reference/jp/examples/base64_decode.md b/website/docs/reference/jp/examples/base64_decode.md index 8be8c474f..b2797c24f 100644 --- a/website/docs/reference/jp/examples/base64_decode.md +++ b/website/docs/reference/jp/examples/base64_decode.md @@ -6,7 +6,7 @@ ## Description - +decodes a base 64 string ## Examples diff --git a/website/docs/reference/jp/examples/base64_encode.md b/website/docs/reference/jp/examples/base64_encode.md index fc607a763..5f574edc4 100644 --- a/website/docs/reference/jp/examples/base64_encode.md +++ b/website/docs/reference/jp/examples/base64_encode.md @@ -6,7 +6,7 @@ ## Description - +encodes a regular, plaintext and unencoded string to base64 ## Examples diff --git a/website/docs/reference/jp/examples/compare.md b/website/docs/reference/jp/examples/compare.md index 875b63e4b..4f9eb3bc8 100644 --- a/website/docs/reference/jp/examples/compare.md +++ b/website/docs/reference/jp/examples/compare.md @@ -6,7 +6,7 @@ ## Description - +compares two strings lexicographically ## Examples diff --git a/website/docs/reference/jp/examples/divide.md b/website/docs/reference/jp/examples/divide.md index 52efaea69..887818b01 100644 --- a/website/docs/reference/jp/examples/divide.md +++ b/website/docs/reference/jp/examples/divide.md @@ -6,7 +6,7 @@ ## Description - +divisor must be non zero ## Examples diff --git a/website/docs/reference/jp/examples/equal_fold.md b/website/docs/reference/jp/examples/equal_fold.md index 4433057ef..bba0d27f6 100644 --- a/website/docs/reference/jp/examples/equal_fold.md +++ b/website/docs/reference/jp/examples/equal_fold.md @@ -6,7 +6,7 @@ ## Description - +allows comparing two strings for equivalency where the only differences are letter cases ## Examples diff --git a/website/docs/reference/jp/examples/items.md b/website/docs/reference/jp/examples/items.md index 45479f4f0..d52d86fef 100644 --- a/website/docs/reference/jp/examples/items.md +++ b/website/docs/reference/jp/examples/items.md @@ -6,7 +6,7 @@ ## Description - +converts a map or array to an array of objects where each key:value is an item in the array ## Examples diff --git a/website/docs/reference/jp/examples/label_match.md b/website/docs/reference/jp/examples/label_match.md index 7dd95d82a..4a10bd0fd 100644 --- a/website/docs/reference/jp/examples/label_match.md +++ b/website/docs/reference/jp/examples/label_match.md @@ -6,7 +6,7 @@ ## Description - +object arguments must be enclosed in backticks; ex. `{{request.object.spec.template.metadata.labels}}` ## Examples diff --git a/website/docs/reference/jp/examples/lookup.md b/website/docs/reference/jp/examples/lookup.md index dfa7ed0fb..7f07e84cf 100644 --- a/website/docs/reference/jp/examples/lookup.md +++ b/website/docs/reference/jp/examples/lookup.md @@ -6,7 +6,7 @@ ## Description - +returns the value corresponding to the given key/index in the given object/array ## Examples diff --git a/website/docs/reference/jp/examples/modulo.md b/website/docs/reference/jp/examples/modulo.md index 7c2144d72..ac30e15a1 100644 --- a/website/docs/reference/jp/examples/modulo.md +++ b/website/docs/reference/jp/examples/modulo.md @@ -6,7 +6,7 @@ ## Description - +divisor must be non-zero, arguments must be integers ## Examples diff --git a/website/docs/reference/jp/examples/multiply.md b/website/docs/reference/jp/examples/multiply.md index d0e29d042..1c2e98706 100644 --- a/website/docs/reference/jp/examples/multiply.md +++ b/website/docs/reference/jp/examples/multiply.md @@ -6,7 +6,7 @@ ## Description - +does arithmetic multiplication of two specified values of numbers, quantities, and durations ## Examples diff --git a/website/docs/reference/jp/examples/object_from_lists.md b/website/docs/reference/jp/examples/object_from_lists.md index b4d0b74a2..136e57b3f 100644 --- a/website/docs/reference/jp/examples/object_from_lists.md +++ b/website/docs/reference/jp/examples/object_from_lists.md @@ -6,7 +6,7 @@ ## Description - +converts a pair of lists containing keys and values to an object ## Examples diff --git a/website/docs/reference/jp/examples/parse_json.md b/website/docs/reference/jp/examples/parse_json.md index d831c5c10..bf4883c46 100644 --- a/website/docs/reference/jp/examples/parse_json.md +++ b/website/docs/reference/jp/examples/parse_json.md @@ -6,7 +6,7 @@ ## Description - +decodes a valid JSON encoded string to the appropriate type. Opposite of `to_string` function ## Examples diff --git a/website/docs/reference/jp/examples/parse_yaml.md b/website/docs/reference/jp/examples/parse_yaml.md index 2305b3a42..76586120a 100644 --- a/website/docs/reference/jp/examples/parse_yaml.md +++ b/website/docs/reference/jp/examples/parse_yaml.md @@ -6,7 +6,7 @@ ## Description - +decodes a valid YAML encoded string to the appropriate type provided it can be represented as JSON ## Examples diff --git a/website/docs/reference/jp/examples/path_canonicalize.md b/website/docs/reference/jp/examples/path_canonicalize.md index 3ebdf18a2..45b142b95 100644 --- a/website/docs/reference/jp/examples/path_canonicalize.md +++ b/website/docs/reference/jp/examples/path_canonicalize.md @@ -6,7 +6,7 @@ ## Description - +normalizes or canonicalizes a given path by removing excess slashes ## Examples diff --git a/website/docs/reference/jp/examples/pattern_match.md b/website/docs/reference/jp/examples/pattern_match.md index ecd652d64..39a992970 100644 --- a/website/docs/reference/jp/examples/pattern_match.md +++ b/website/docs/reference/jp/examples/pattern_match.md @@ -6,7 +6,7 @@ ## Description - +'*' matches zero or more alphanumeric characters, '?' matches a single alphanumeric character ## Examples diff --git a/website/docs/reference/jp/examples/random.md b/website/docs/reference/jp/examples/random.md index 43e3cc821..5fe791617 100644 --- a/website/docs/reference/jp/examples/random.md +++ b/website/docs/reference/jp/examples/random.md @@ -6,7 +6,7 @@ ## Description - +Generates a random sequence of characters ## Examples diff --git a/website/docs/reference/jp/examples/regex_match.md b/website/docs/reference/jp/examples/regex_match.md index 13c4ec51c..de289ee80 100644 --- a/website/docs/reference/jp/examples/regex_match.md +++ b/website/docs/reference/jp/examples/regex_match.md @@ -6,7 +6,7 @@ ## Description - +first string is the regular exression which is compared with second input which can be a number or string ## Examples diff --git a/website/docs/reference/jp/examples/regex_replace_all.md b/website/docs/reference/jp/examples/regex_replace_all.md index eb0f8e5be..9ab41ab9d 100644 --- a/website/docs/reference/jp/examples/regex_replace_all.md +++ b/website/docs/reference/jp/examples/regex_replace_all.md @@ -6,7 +6,7 @@ ## Description - +converts all parameters to string ## Examples diff --git a/website/docs/reference/jp/examples/regex_replace_all_literal.md b/website/docs/reference/jp/examples/regex_replace_all_literal.md index e60f64770..a8453812d 100644 --- a/website/docs/reference/jp/examples/regex_replace_all_literal.md +++ b/website/docs/reference/jp/examples/regex_replace_all_literal.md @@ -6,7 +6,7 @@ ## Description - +converts all parameters to string ## Examples diff --git a/website/docs/reference/jp/examples/replace.md b/website/docs/reference/jp/examples/replace.md index 366ba647d..729ce7f7c 100644 --- a/website/docs/reference/jp/examples/replace.md +++ b/website/docs/reference/jp/examples/replace.md @@ -6,7 +6,7 @@ ## Description - +replaces a specified number of instances of the source string with the replacement string in a parent ## Examples diff --git a/website/docs/reference/jp/examples/replace_all.md b/website/docs/reference/jp/examples/replace_all.md index fe1149255..8e32ed2c6 100644 --- a/website/docs/reference/jp/examples/replace_all.md +++ b/website/docs/reference/jp/examples/replace_all.md @@ -6,7 +6,7 @@ ## Description - +replace all instances of one string with another in an overall parent string ## Examples diff --git a/website/docs/reference/jp/examples/round.md b/website/docs/reference/jp/examples/round.md index 754926506..4b9f69a45 100644 --- a/website/docs/reference/jp/examples/round.md +++ b/website/docs/reference/jp/examples/round.md @@ -6,7 +6,7 @@ ## Description - +does roundoff to upto the given decimal places ## Examples diff --git a/website/docs/reference/jp/examples/semver_compare.md b/website/docs/reference/jp/examples/semver_compare.md index 21b6aab6d..cfff2bc59 100644 --- a/website/docs/reference/jp/examples/semver_compare.md +++ b/website/docs/reference/jp/examples/semver_compare.md @@ -6,7 +6,7 @@ ## Description - +compares two strings which comply with the semantic versioning schema and outputs a boolean response as to the position of the second relative to the first ## Examples diff --git a/website/docs/reference/jp/examples/split.md b/website/docs/reference/jp/examples/split.md index dac216bd5..bcda9782a 100644 --- a/website/docs/reference/jp/examples/split.md +++ b/website/docs/reference/jp/examples/split.md @@ -6,7 +6,7 @@ ## Description - +splits the first string when the second string is found and converts it into an array ## Examples diff --git a/website/docs/reference/jp/examples/subtract.md b/website/docs/reference/jp/examples/subtract.md index 168645a7c..c0135b10d 100644 --- a/website/docs/reference/jp/examples/subtract.md +++ b/website/docs/reference/jp/examples/subtract.md @@ -6,7 +6,7 @@ ## Description - +does arithmetic subtraction of two specified values of numbers, quantities, and durations ## Examples diff --git a/website/docs/reference/jp/examples/sum.md b/website/docs/reference/jp/examples/sum.md index dc60abcd9..734a58fba 100644 --- a/website/docs/reference/jp/examples/sum.md +++ b/website/docs/reference/jp/examples/sum.md @@ -6,7 +6,7 @@ ## Description - +does arithmetic addition of specified array of values of numbers, quantities, and durations ## Examples diff --git a/website/docs/reference/jp/examples/time_add.md b/website/docs/reference/jp/examples/time_add.md index 81f2b7d21..78b2a99eb 100644 --- a/website/docs/reference/jp/examples/time_add.md +++ b/website/docs/reference/jp/examples/time_add.md @@ -6,7 +6,7 @@ ## Description - +adds duration (second string) to a time value (first string) ## Examples diff --git a/website/docs/reference/jp/examples/time_after.md b/website/docs/reference/jp/examples/time_after.md index 103a0d709..65e1d3b28 100644 --- a/website/docs/reference/jp/examples/time_after.md +++ b/website/docs/reference/jp/examples/time_after.md @@ -6,7 +6,7 @@ ## Description - +checks if a time is after another time, both in RFC3339 format ## Examples diff --git a/website/docs/reference/jp/examples/time_before.md b/website/docs/reference/jp/examples/time_before.md index 8380e62e8..d58117fe8 100644 --- a/website/docs/reference/jp/examples/time_before.md +++ b/website/docs/reference/jp/examples/time_before.md @@ -6,7 +6,7 @@ ## Description - +checks if a time is before another time, both in RFC3339 format ## Examples diff --git a/website/docs/reference/jp/examples/time_between.md b/website/docs/reference/jp/examples/time_between.md index c88367e80..5427a0d64 100644 --- a/website/docs/reference/jp/examples/time_between.md +++ b/website/docs/reference/jp/examples/time_between.md @@ -6,7 +6,7 @@ ## Description - +checks if a time is between a start and end time, all in RFC3339 format ## Examples diff --git a/website/docs/reference/jp/examples/time_diff.md b/website/docs/reference/jp/examples/time_diff.md index 72b804b74..e9361ff55 100644 --- a/website/docs/reference/jp/examples/time_diff.md +++ b/website/docs/reference/jp/examples/time_diff.md @@ -6,7 +6,7 @@ ## Description - +calculate the difference between a start and end date in RFC3339 format ## Examples diff --git a/website/docs/reference/jp/examples/time_now.md b/website/docs/reference/jp/examples/time_now.md index 2f6672367..032872d61 100644 --- a/website/docs/reference/jp/examples/time_now.md +++ b/website/docs/reference/jp/examples/time_now.md @@ -6,7 +6,7 @@ ## Description - +returns current time in RFC 3339 format ## Examples diff --git a/website/docs/reference/jp/examples/time_now_utc.md b/website/docs/reference/jp/examples/time_now_utc.md index ac57077d4..09c9e175c 100644 --- a/website/docs/reference/jp/examples/time_now_utc.md +++ b/website/docs/reference/jp/examples/time_now_utc.md @@ -6,7 +6,7 @@ ## Description - +returns current UTC time in RFC 3339 format ## Examples diff --git a/website/docs/reference/jp/examples/time_parse.md b/website/docs/reference/jp/examples/time_parse.md index 2a59700de..c25d5f7f7 100644 --- a/website/docs/reference/jp/examples/time_parse.md +++ b/website/docs/reference/jp/examples/time_parse.md @@ -6,7 +6,7 @@ ## Description - +changes a time value of a given layout to RFC 3339 ## Examples diff --git a/website/docs/reference/jp/examples/time_since.md b/website/docs/reference/jp/examples/time_since.md index 228fb0b25..747835891 100644 --- a/website/docs/reference/jp/examples/time_since.md +++ b/website/docs/reference/jp/examples/time_since.md @@ -6,7 +6,7 @@ ## Description - +calculate the difference between a start and end period of time where the end may either be a static definition or the then-current time ## Examples diff --git a/website/docs/reference/jp/examples/time_to_cron.md b/website/docs/reference/jp/examples/time_to_cron.md index 3fc7ea4c7..81eaba27b 100644 --- a/website/docs/reference/jp/examples/time_to_cron.md +++ b/website/docs/reference/jp/examples/time_to_cron.md @@ -6,7 +6,7 @@ ## Description - +converts a time (RFC 3339) to a cron expression (string). ## Examples diff --git a/website/docs/reference/jp/examples/time_truncate.md b/website/docs/reference/jp/examples/time_truncate.md index cb04678a1..b3571e830 100644 --- a/website/docs/reference/jp/examples/time_truncate.md +++ b/website/docs/reference/jp/examples/time_truncate.md @@ -6,7 +6,7 @@ ## Description - +returns the result of rounding time down to a multiple of duration ## Examples diff --git a/website/docs/reference/jp/examples/time_utc.md b/website/docs/reference/jp/examples/time_utc.md index b922bb4fc..18fa705ec 100644 --- a/website/docs/reference/jp/examples/time_utc.md +++ b/website/docs/reference/jp/examples/time_utc.md @@ -6,7 +6,7 @@ ## Description - +calcutes time in UTC from a given time in RFC 3339 format ## Examples diff --git a/website/docs/reference/jp/examples/to_boolean.md b/website/docs/reference/jp/examples/to_boolean.md index e579125be..4a1308f4e 100644 --- a/website/docs/reference/jp/examples/to_boolean.md +++ b/website/docs/reference/jp/examples/to_boolean.md @@ -6,7 +6,7 @@ ## Description - +It returns true or false for any string, such as 'True', 'TruE', 'False', 'FAlse', 'faLSE', etc. ## Examples diff --git a/website/docs/reference/jp/examples/to_lower.md b/website/docs/reference/jp/examples/to_lower.md index 7100e2aa9..0eb1f670b 100644 --- a/website/docs/reference/jp/examples/to_lower.md +++ b/website/docs/reference/jp/examples/to_lower.md @@ -6,7 +6,7 @@ ## Description - +takes in a string and outputs the same string with all lower-case letters ## Examples diff --git a/website/docs/reference/jp/examples/to_upper.md b/website/docs/reference/jp/examples/to_upper.md index 777cdc6f2..4674f4573 100644 --- a/website/docs/reference/jp/examples/to_upper.md +++ b/website/docs/reference/jp/examples/to_upper.md @@ -6,7 +6,7 @@ ## Description - +takes in a string and outputs the same string with all upper-case letters ## Examples diff --git a/website/docs/reference/jp/examples/trim.md b/website/docs/reference/jp/examples/trim.md index 054cf844d..a7c7704a2 100644 --- a/website/docs/reference/jp/examples/trim.md +++ b/website/docs/reference/jp/examples/trim.md @@ -6,7 +6,7 @@ ## Description - +trims both ends of the source string by characters appearing in the second string ## Examples diff --git a/website/docs/reference/jp/examples/trim_prefix.md b/website/docs/reference/jp/examples/trim_prefix.md index 451604cb7..e347ba6e6 100644 --- a/website/docs/reference/jp/examples/trim_prefix.md +++ b/website/docs/reference/jp/examples/trim_prefix.md @@ -6,7 +6,7 @@ ## Description - +trims the second string prefix from the first string if the first string starts with the prefix ## Examples diff --git a/website/docs/reference/jp/examples/truncate.md b/website/docs/reference/jp/examples/truncate.md index 3081e9da8..7a498877c 100644 --- a/website/docs/reference/jp/examples/truncate.md +++ b/website/docs/reference/jp/examples/truncate.md @@ -6,7 +6,7 @@ ## Description - +length argument must be enclosed in backticks; ex. "{{request.object.metadata.name | truncate(@, `9`)}}" ## Examples diff --git a/website/docs/reference/jp/examples/x509_decode.md b/website/docs/reference/jp/examples/x509_decode.md index a29bb40b7..c3720740b 100644 --- a/website/docs/reference/jp/examples/x509_decode.md +++ b/website/docs/reference/jp/examples/x509_decode.md @@ -6,7 +6,7 @@ ## Description - +decodes an x.509 certificate to an object. you may also use this in conjunction with `base64_decode` jmespath function to decode a base64-encoded certificate ## Examples diff --git a/website/docs/reference/jp/functions.md b/website/docs/reference/jp/functions.md index 9eb416ad3..3d4ee130b 100644 --- a/website/docs/reference/jp/functions.md +++ b/website/docs/reference/jp/functions.md @@ -65,52 +65,52 @@ | Name | Signature | Description | |---|---|---| -| [compare](./examples/compare.md) | `compare(string, string)` | | -| [equal_fold](./examples/equal_fold.md) | `equal_fold(string, string)` | | -| [replace](./examples/replace.md) | `replace(string, string, string, number)` | | -| [replace_all](./examples/replace_all.md) | `replace_all(string, string, string)` | | -| [to_upper](./examples/to_upper.md) | `to_upper(string)` | | -| [to_lower](./examples/to_lower.md) | `to_lower(string)` | | -| [trim](./examples/trim.md) | `trim(string, string)` | | -| [trim_prefix](./examples/trim_prefix.md) | `trim_prefix(string, string)` | | -| [split](./examples/split.md) | `split(string, string)` | | -| [regex_replace_all](./examples/regex_replace_all.md) | `regex_replace_all(string, string|number, string|number)` | | -| [regex_replace_all_literal](./examples/regex_replace_all_literal.md) | `regex_replace_all_literal(string, string|number, string|number)` | | -| [regex_match](./examples/regex_match.md) | `regex_match(string, string|number)` | | -| [pattern_match](./examples/pattern_match.md) | `pattern_match(string, string|number)` | | -| [label_match](./examples/label_match.md) | `label_match(object, object)` | | -| [to_boolean](./examples/to_boolean.md) | `to_boolean(string)` | | -| [add](./examples/add.md) | `add(any, any)` | | -| [sum](./examples/sum.md) | `sum(array)` | | -| [subtract](./examples/subtract.md) | `subtract(any, any)` | | -| [multiply](./examples/multiply.md) | `multiply(any, any)` | | -| [divide](./examples/divide.md) | `divide(any, any)` | | -| [modulo](./examples/modulo.md) | `modulo(any, any)` | | -| [round](./examples/round.md) | `round(number, number)` | | -| [base64_decode](./examples/base64_decode.md) | `base64_decode(string)` | | -| [base64_encode](./examples/base64_encode.md) | `base64_encode(string)` | | -| [time_since](./examples/time_since.md) | `time_since(string, string, string)` | | -| [time_now](./examples/time_now.md) | `time_now()` | | -| [time_now_utc](./examples/time_now_utc.md) | `time_now_utc()` | | -| [path_canonicalize](./examples/path_canonicalize.md) | `path_canonicalize(string)` | | -| [truncate](./examples/truncate.md) | `truncate(string, number)` | | -| [semver_compare](./examples/semver_compare.md) | `semver_compare(string, string)` | | -| [parse_json](./examples/parse_json.md) | `parse_json(string)` | | -| [parse_yaml](./examples/parse_yaml.md) | `parse_yaml(string)` | | -| [lookup](./examples/lookup.md) | `lookup(object|array, string|number)` | | -| [items](./examples/items.md) | `items(object|array, string, string)` | | -| [object_from_lists](./examples/object_from_lists.md) | `object_from_lists(array, array)` | | -| [random](./examples/random.md) | `random(string)` | | -| [x509_decode](./examples/x509_decode.md) | `x509_decode(string)` | | -| [time_to_cron](./examples/time_to_cron.md) | `time_to_cron(string)` | | -| [time_add](./examples/time_add.md) | `time_add(string, string)` | | -| [time_parse](./examples/time_parse.md) | `time_parse(string, string)` | | -| [time_utc](./examples/time_utc.md) | `time_utc(string)` | | -| [time_diff](./examples/time_diff.md) | `time_diff(string, string)` | | -| [time_before](./examples/time_before.md) | `time_before(string, string)` | | -| [time_after](./examples/time_after.md) | `time_after(string, string)` | | -| [time_between](./examples/time_between.md) | `time_between(string, string, string)` | | -| [time_truncate](./examples/time_truncate.md) | `time_truncate(string, string)` | | +| [compare](./examples/compare.md) | `compare(string, string)` | compares two strings lexicographically | +| [equal_fold](./examples/equal_fold.md) | `equal_fold(string, string)` | allows comparing two strings for equivalency where the only differences are letter cases | +| [replace](./examples/replace.md) | `replace(string, string, string, number)` | replaces a specified number of instances of the source string with the replacement string in a parent | +| [replace_all](./examples/replace_all.md) | `replace_all(string, string, string)` | replace all instances of one string with another in an overall parent string | +| [to_upper](./examples/to_upper.md) | `to_upper(string)` | takes in a string and outputs the same string with all upper-case letters | +| [to_lower](./examples/to_lower.md) | `to_lower(string)` | takes in a string and outputs the same string with all lower-case letters | +| [trim](./examples/trim.md) | `trim(string, string)` | trims both ends of the source string by characters appearing in the second string | +| [trim_prefix](./examples/trim_prefix.md) | `trim_prefix(string, string)` | trims the second string prefix from the first string if the first string starts with the prefix | +| [split](./examples/split.md) | `split(string, string)` | splits the first string when the second string is found and converts it into an array | +| [regex_replace_all](./examples/regex_replace_all.md) | `regex_replace_all(string, string|number, string|number)` | converts all parameters to string | +| [regex_replace_all_literal](./examples/regex_replace_all_literal.md) | `regex_replace_all_literal(string, string|number, string|number)` | converts all parameters to string | +| [regex_match](./examples/regex_match.md) | `regex_match(string, string|number)` | first string is the regular exression which is compared with second input which can be a number or string | +| [pattern_match](./examples/pattern_match.md) | `pattern_match(string, string|number)` | '*' matches zero or more alphanumeric characters, '?' matches a single alphanumeric character | +| [label_match](./examples/label_match.md) | `label_match(object, object)` | object arguments must be enclosed in backticks; ex. `{{request.object.spec.template.metadata.labels}}` | +| [to_boolean](./examples/to_boolean.md) | `to_boolean(string)` | It returns true or false for any string, such as 'True', 'TruE', 'False', 'FAlse', 'faLSE', etc. | +| [add](./examples/add.md) | `add(any, any)` | does arithmetic addition of two specified values of numbers, quantities, and durations | +| [sum](./examples/sum.md) | `sum(array)` | does arithmetic addition of specified array of values of numbers, quantities, and durations | +| [subtract](./examples/subtract.md) | `subtract(any, any)` | does arithmetic subtraction of two specified values of numbers, quantities, and durations | +| [multiply](./examples/multiply.md) | `multiply(any, any)` | does arithmetic multiplication of two specified values of numbers, quantities, and durations | +| [divide](./examples/divide.md) | `divide(any, any)` | divisor must be non zero | +| [modulo](./examples/modulo.md) | `modulo(any, any)` | divisor must be non-zero, arguments must be integers | +| [round](./examples/round.md) | `round(number, number)` | does roundoff to upto the given decimal places | +| [base64_decode](./examples/base64_decode.md) | `base64_decode(string)` | decodes a base 64 string | +| [base64_encode](./examples/base64_encode.md) | `base64_encode(string)` | encodes a regular, plaintext and unencoded string to base64 | +| [time_since](./examples/time_since.md) | `time_since(string, string, string)` | calculate the difference between a start and end period of time where the end may either be a static definition or the then-current time | +| [time_now](./examples/time_now.md) | `time_now()` | returns current time in RFC 3339 format | +| [time_now_utc](./examples/time_now_utc.md) | `time_now_utc()` | returns current UTC time in RFC 3339 format | +| [path_canonicalize](./examples/path_canonicalize.md) | `path_canonicalize(string)` | normalizes or canonicalizes a given path by removing excess slashes | +| [truncate](./examples/truncate.md) | `truncate(string, number)` | length argument must be enclosed in backticks; ex. "{{request.object.metadata.name | truncate(@, `9`)}}" | +| [semver_compare](./examples/semver_compare.md) | `semver_compare(string, string)` | compares two strings which comply with the semantic versioning schema and outputs a boolean response as to the position of the second relative to the first | +| [parse_json](./examples/parse_json.md) | `parse_json(string)` | decodes a valid JSON encoded string to the appropriate type. Opposite of `to_string` function | +| [parse_yaml](./examples/parse_yaml.md) | `parse_yaml(string)` | decodes a valid YAML encoded string to the appropriate type provided it can be represented as JSON | +| [lookup](./examples/lookup.md) | `lookup(object|array, string|number)` | returns the value corresponding to the given key/index in the given object/array | +| [items](./examples/items.md) | `items(object|array, string, string)` | converts a map or array to an array of objects where each key:value is an item in the array | +| [object_from_lists](./examples/object_from_lists.md) | `object_from_lists(array, array)` | converts a pair of lists containing keys and values to an object | +| [random](./examples/random.md) | `random(string)` | Generates a random sequence of characters | +| [x509_decode](./examples/x509_decode.md) | `x509_decode(string)` | decodes an x.509 certificate to an object. you may also use this in conjunction with `base64_decode` jmespath function to decode a base64-encoded certificate | +| [time_to_cron](./examples/time_to_cron.md) | `time_to_cron(string)` | converts a time (RFC 3339) to a cron expression (string). | +| [time_add](./examples/time_add.md) | `time_add(string, string)` | adds duration (second string) to a time value (first string) | +| [time_parse](./examples/time_parse.md) | `time_parse(string, string)` | changes a time value of a given layout to RFC 3339 | +| [time_utc](./examples/time_utc.md) | `time_utc(string)` | calcutes time in UTC from a given time in RFC 3339 format | +| [time_diff](./examples/time_diff.md) | `time_diff(string, string)` | calculate the difference between a start and end date in RFC3339 format | +| [time_before](./examples/time_before.md) | `time_before(string, string)` | checks if a time is before another time, both in RFC3339 format | +| [time_after](./examples/time_after.md) | `time_after(string, string)` | checks if a time is after another time, both in RFC3339 format | +| [time_between](./examples/time_between.md) | `time_between(string, string, string)` | checks if a time is between a start and end time, all in RFC3339 format | +| [time_truncate](./examples/time_truncate.md) | `time_truncate(string, string)` | returns the result of rounding time down to a multiple of duration | ## chainsaw functions diff --git a/website/jp/main.go b/website/jp/main.go index d22a79829..cdf24da60 100644 --- a/website/jp/main.go +++ b/website/jp/main.go @@ -8,8 +8,8 @@ import ( jpfunctions "github.com/jmespath-community/go-jmespath/pkg/functions" chainsawfunctions "github.com/kyverno/chainsaw/pkg/engine/functions" - "github.com/kyverno/kyverno-json/pkg/engine/template/functions" - kyvernofunctions "github.com/kyverno/kyverno-json/pkg/engine/template/kyverno" + "github.com/kyverno/kyverno-json/pkg/jp/functions" + kyvernofunctions "github.com/kyverno/kyverno-json/pkg/jp/kyverno" ) //go:embed examples