@@ -75,8 +75,8 @@ type WebhookAuthorizer struct {
75
75
}
76
76
77
77
// NewFromInterface creates a WebhookAuthorizer using the given subjectAccessReview client
78
- func NewFromInterface (subjectAccessReview authorizationv1client.AuthorizationV1Interface , authorizedTTL , unauthorizedTTL time.Duration , retryBackoff wait.Backoff , metrics AuthorizerMetrics ) (* WebhookAuthorizer , error ) {
79
- return newWithBackoff (& subjectAccessReviewV1Client {subjectAccessReview .RESTClient ()}, authorizedTTL , unauthorizedTTL , retryBackoff , nil , metrics )
78
+ func NewFromInterface (subjectAccessReview authorizationv1client.AuthorizationV1Interface , authorizedTTL , unauthorizedTTL time.Duration , retryBackoff wait.Backoff , decisionOnError authorizer. Decision , metrics AuthorizerMetrics ) (* WebhookAuthorizer , error ) {
79
+ return newWithBackoff (& subjectAccessReviewV1Client {subjectAccessReview .RESTClient ()}, authorizedTTL , unauthorizedTTL , retryBackoff , decisionOnError , nil , metrics )
80
80
}
81
81
82
82
// New creates a new WebhookAuthorizer from the provided kubeconfig file.
@@ -98,19 +98,19 @@ func NewFromInterface(subjectAccessReview authorizationv1client.AuthorizationV1I
98
98
//
99
99
// For additional HTTP configuration, refer to the kubeconfig documentation
100
100
// https://kubernetes.io/docs/user-guide/kubeconfig-file/.
101
- func New (config * rest.Config , version string , authorizedTTL , unauthorizedTTL time.Duration , retryBackoff wait.Backoff , matchConditions []apiserver.WebhookMatchCondition ) (* WebhookAuthorizer , error ) {
101
+ func New (config * rest.Config , version string , authorizedTTL , unauthorizedTTL time.Duration , retryBackoff wait.Backoff , decisionOnError authorizer. Decision , matchConditions []apiserver.WebhookMatchCondition ) (* WebhookAuthorizer , error ) {
102
102
subjectAccessReview , err := subjectAccessReviewInterfaceFromConfig (config , version , retryBackoff )
103
103
if err != nil {
104
104
return nil , err
105
105
}
106
- return newWithBackoff (subjectAccessReview , authorizedTTL , unauthorizedTTL , retryBackoff , matchConditions , AuthorizerMetrics {
106
+ return newWithBackoff (subjectAccessReview , authorizedTTL , unauthorizedTTL , retryBackoff , decisionOnError , matchConditions , AuthorizerMetrics {
107
107
RecordRequestTotal : noopMetrics {}.RecordRequestTotal ,
108
108
RecordRequestLatency : noopMetrics {}.RecordRequestLatency ,
109
109
})
110
110
}
111
111
112
112
// newWithBackoff allows tests to skip the sleep.
113
- func newWithBackoff (subjectAccessReview subjectAccessReviewer , authorizedTTL , unauthorizedTTL time.Duration , retryBackoff wait.Backoff , matchConditions []apiserver.WebhookMatchCondition , metrics AuthorizerMetrics ) (* WebhookAuthorizer , error ) {
113
+ func newWithBackoff (subjectAccessReview subjectAccessReviewer , authorizedTTL , unauthorizedTTL time.Duration , retryBackoff wait.Backoff , decisionOnError authorizer. Decision , matchConditions []apiserver.WebhookMatchCondition , metrics AuthorizerMetrics ) (* WebhookAuthorizer , error ) {
114
114
// compile all expressions once in validation and save the results to be used for eval later
115
115
cm , fieldErr := apiservervalidation .ValidateAndCompileMatchConditions (matchConditions )
116
116
if err := fieldErr .ToAggregate (); err != nil {
@@ -122,7 +122,7 @@ func newWithBackoff(subjectAccessReview subjectAccessReviewer, authorizedTTL, un
122
122
authorizedTTL : authorizedTTL ,
123
123
unauthorizedTTL : unauthorizedTTL ,
124
124
retryBackoff : retryBackoff ,
125
- decisionOnError : authorizer . DecisionNoOpinion ,
125
+ decisionOnError : decisionOnError ,
126
126
metrics : metrics ,
127
127
celMatcher : cm ,
128
128
}, nil
0 commit comments