Skip to content
Snippets Groups Projects
Commit 7930e42f authored by Alain Atemnkeng's avatar Alain Atemnkeng :first_place:
Browse files

Merge branch 'master' into 'PLATFORM-2207-aatemnke2'

# Conflicts:
#   Chart.yaml
parents 79d6e2f0 30b6a0c4
Branches
Tags
Pipeline #851132 passed with stages
in 18 seconds
package allow_rollout_restart
package allow_rollout_restart_deployment
# Violation caused when user is not flux and not in the admin group, trying to use UPDATE to change a DEPLOYMENT. The old annotations get patched with a value to build the datastructure, but it gets removed in the next step, so the value is innocuous.
# Violation caused when user is not the local flux, nor stakater-reloader, and not in the admin group, trying to use UPDATE to change a DEPLOYMENT. The old annotations get patched with a value to build the datastructure, but it gets removed in the next step, so the value is innocuous.
violation[{"msg": msg}] {
not input.review.userInfo.username == "system:serviceaccount:platform-stakater-reloader:stakater-reloader"
flux_username := concat("",["system:serviceaccount:",input.review.namespace,":flux"])
not input.review.userInfo.username == flux_username
not contains(input.review.userInfo.groups, "oidc:it.platform.roles.admin")
......
package allow_rollout_restart
package allow_rollout_restart_deployment
test_with_deployment_and_correct_annotation {
input := review_deployment_patch_existing("kubectl.kubernetes.io/restartedAt","14oclock","randomuser","randomgroup","13oclock")
......@@ -27,6 +27,15 @@ test_with_deployment_and_incorrect_annotation_with_flux {
count(results) == 0
}
test_with_deployment_and_incorrect_annotation_with_stakater {
input := review_deployment_patch_existing("wrongAnnotation","wrong","system:serviceaccount:platform-stakater-reloader:stakater-reloader","randomgroup","13oclock")
results := violation
with input as input
count(results) == 0
}
test_with_deployment_and_incorrect_annotation_with_platform_admin_group {
input := review_deployment_patch_existing("wrongAnnotation","wrong","randomuser","oidc:it.platform.roles.admin","13oclock")
......
package allow_rollout_restart
package allow_rollout_restart_statefulset
# Violation caused when user is not flux and not in the admin group, trying to use UPDATE to change a StatefulSet. The old annotations get patched with a value to build the datastructure, but it gets removed in the next step, so the value is innocuous.
# Violation caused when user is not local flux, not the stakater-reloader, and not in the admin group, trying to use UPDATE to change a StatefulSet. The old annotations get patched with a value to build the datastructure, but it gets removed in the next step, so the value is innocuous.
violation[{"msg": msg}] {
not input.review.userInfo.username == "system:serviceaccount:platform-stakater-reloader:stakater-reloader"
flux_username := concat("",["system:serviceaccount:",input.review.namespace,":flux"])
not input.review.userInfo.username == flux_username
not contains(input.review.userInfo.groups, "oidc:it.platform.roles.admin")
......
package allow_rollout_restart
package allow_rollout_restart_statefulset
test_with_statefulset_and_correct_annotation {
input := review_statefulset_patch_existing("kubectl.kubernetes.io/restartedAt","14oclock","randomuser","randomgroup","13oclock")
......@@ -27,6 +27,15 @@ test_with_statefulset_and_incorrect_annotation_with_flux {
count(results) == 0
}
test_with_statefulset_and_incorrect_annotation_with_stakater {
input := review_statefulset_patch_existing("wrongAnnotation","wrong","system:serviceaccount:platform-stakater-reloader:stakater-reloader","randomgroup","13oclock")
results := violation
with input as input
count(results) == 0
}
test_with_statefulset_and_incorrect_annotation_with_platform_admin_group {
input := review_statefulset_patch_existing("wrongAnnotation","wrong","randomuser","oidc:it.platform.roles.admin","13oclock")
......
......@@ -352,7 +352,7 @@ review_ingress_route_tcp(matchRule) = out {
},
"object": {
"kind": "IngressRouteTCP",
"apiVersion": "traefik.containo.us/v1alpha1",
"apiVersion": "traefik.io/v1alpha1",
"metadata": {
"name": "my-ingress",
},
......@@ -374,7 +374,7 @@ review_ingress_route(matchRule) = out {
},
"object": {
"kind": "IngressRoute",
"apiVersion": "traefik.containo.us/v1alpha1",
"apiVersion": "traefik.io/v1alpha1",
"metadata": {
"name": "my-ingress",
},
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment