-
Notifications
You must be signed in to change notification settings - Fork 757
CMP-3589: Add variable for routes rate limit #14023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
applications/openshift/networking/var_routes_excluded_namespaces_regex.var
Outdated
Show resolved
Hide resolved
…heck Introduce a new variable 'var_routes_excluded_namespaces_regex' to define namespaces that should be excluded from the routes rate limit compliance check.
|
tested with |
…refine jqfilter in rate limit rule Change the default value of 'var_network_policies_namespaces_exempt_regex' to match namespaces starting with 'kube-' or 'openshift-'. Additionally, modify the jqfilter in 'rule.yml' to utilize the updated regex for improved namespace exclusion in rate limit checks.
| routes outside the excluded namespaces (as defined by the variable | ||
| <tt>ocp4-var-routes-excluded-namespaces-regex</tt>) without rate limiting annotations. | ||
| Use following command to list the routes that would fail the test: | ||
| <tt>{{{ ocil_oc_pipe_jq_filter('routes', jqfilter) }}}</tt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be use {{{ ocil_oc_pipe_jq_filter('routes --all-namespaces', jqfilter) }}}?
Currently, the command in the instructions will always return [].
'''
% oc get ccr upstream-ocp4-stig-routes-rate-limit -o=jsonpath={.instructions}
This rule checks routes that do not have rate limiting enabled and fails if there are
routes outside the excluded namespaces (as defined by the variable
ocp4-var-routes-excluded-namespaces-regex) without rate limiting annotations.
Use following command to list the routes that would fail the test:
$ oc get routes -o json | jq '[.items[] | select(.metadata.namespace | test("^kube-.|openshift-."; "") | not) | select(.metadata.annotations["haproxy.router.openshift.io/rate-limit-connections"] == "true" | not) | .metadata.name]'
Is it the case that Rate limit is not enabled for all routes outside the excluded namespaces?%
% oc get routes -o json | jq '[.items[] | select(.metadata.namespace | test("^kube-.|openshift-."; "") | not) | select(.metadata.annotations["haproxy.router.openshift.io/rate-limit-connections"] == "true" | not) | .metadata.name]'
[]
% oc get routes --all-namespaces -o json | jq '[.items[] | select(.metadata.namespace | test("^kube-.|openshift-."; "") | not) | select(.metadata.annotations["haproxy.router.openshift.io/rate-limit-connections"] == "true" | not) | .metadata.name]'
[
"test-route"
]
% oc get ccr | grep routes-rate-limit
ocp4-stig-routes-rate-limit FAIL medium
upstream-ocp4-stig-routes-rate-limit FAIL medium
'''
|
It works well at the function part. The only issue is the instruction need to updated a little bit. |
|
@Vincent056: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
| routes outside the excluded namespaces (as defined by the variable | ||
| <tt>ocp4-var-routes-excluded-namespaces-regex</tt>) without rate limiting annotations. | ||
| Use following command to list the routes that would fail the test: | ||
| <tt>{{{ ocil_oc_pipe_jq_filter('routes --all-namespaces', jqfilter) }}}</tt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this so it returns all routes.
rhmdnd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
/packit retest-required |
|
Overriding |
Add a variable for excluded namespaces in the routes rate limit check
Introduce a new variable 'var_routes_excluded_namespaces_regex' to define namespaces that should be excluded from the routes rate limit compliance check.