-
Notifications
You must be signed in to change notification settings - Fork 192
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
make rbac max concurrent calls configurable #2331
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
269de8f
to
4f52692
Compare
The following is the coverage report on the affected files.
|
/release-note-none |
4f52692
to
1cc8aa8
Compare
The following is the coverage report on the affected files.
|
@@ -376,6 +378,17 @@ func (r *rbac) handleSCCInNamespace(ctx context.Context, ns *corev1.Namespace) e | |||
return nil | |||
} | |||
|
|||
func getRBACMaxCalls() int { |
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.
Changing an environment variable will lead to the recreation of the pod. So this can be part of init where we change defaultRbacMaxConcurrentCalls if environment variable is provided.
return defaultRbacMaxConcurrentCalls | ||
} | ||
if parsedValue, err := strconv.Atoi(envValue); err == nil { | ||
return parsedValue |
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.
@jkhelil please do some range verification, for example: allow only 1
to 100
.
do not allow, 0
, -1
, 10000
, etc.,
return parsedValue | ||
} | ||
return defaultRbacMaxConcurrentCalls | ||
} |
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.
please write a unit test for this function: getRBACMaxCalls
@@ -376,6 +378,17 @@ func (r *rbac) handleSCCInNamespace(ctx context.Context, ns *corev1.Namespace) e | |||
return nil | |||
} | |||
|
|||
func getRBACMaxCalls() int { | |||
envValue := os.Getenv("OCP_RBAC_MAX_CONCURRENT_CALLS") |
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.
@jkhelil keep the environment variable key as a constant in https://github.com/tektoncd/operator/blob/main/pkg/reconciler/openshift/const.go
if envValue == "" { | ||
return defaultRbacMaxConcurrentCalls | ||
} | ||
if parsedValue, err := strconv.Atoi(envValue); err == nil { |
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.
@jkhelil if the error is not nil
, print the error in the log and say, taking the default value: 20
also print a info
message, about what value used finally
1cc8aa8
to
37a195b
Compare
The following is the coverage report on the affected files.
|
37a195b
to
851b661
Compare
The following is the coverage report on the affected files.
|
851b661
to
adb5b4d
Compare
The following is the coverage report on the affected files.
|
Changes
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make test lint
before submitting a PRSee the contribution guide for more details.
Release Notes