Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void GrpcClientImpl::onFailure(Grpc::Status::GrpcStatus status, const std::strin
ASSERT(status != Grpc::Status::GrpcStatus::Ok);
Response response{};
response.status = CheckStatus::Error;
response.status_code = Http::Code::Forbidden;
response.status_code = Http::Code::ServiceUnavailable;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per our conversation in GH, please make ServiceUnavailable configurable and default it to false. This way we avoid breaking changes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah... I thought you said it's okay to hard code 502 as the response :) Seems it's getting more complex than what I thought.

Any idea on the name of the configuration? Any guidance/docs on introducing new configs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I misread your last comment about hardcode the status. Unfortunatelly, we can't do that. I think something like status_code_on_error, and then let the user decide which status they want would be sufficient.
Normally, the filter config is done here:

Copy link
Author

@hanyu-liu hanyu-liu Mar 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointer. I searched for the code of "use_alpha" in "ext_authz" - seems a little bit complex. Do you mind working on top of the current change? I'm more than happy to code review your change. @gsagula

Copy link
Member

@gsagula gsagula Mar 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't mind doing it, but I can't promise when I will have time.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! We are blocked by this while integrating Envoy with our (Twilio) gateway. Your help is greatly appreciated!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsagula do you actually think an enum can work well for status_code_on_error? Don't want users to abuse the system by returning like 200, when the ext_authz is down.

callbacks_->onComplete(std::make_unique<Response>(response));
callbacks_ = nullptr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,11 @@ TEST_P(ExtAuthzGrpcClientTest, UnknownError) {
expectCallSend(request);
client_->check(request_callbacks_, request, Tracing::NullSpan::instance());

EXPECT_CALL(request_callbacks_,
onComplete_(WhenDynamicCastTo<ResponsePtr&>(AuthzErrorResponse(CheckStatus::Error))));
auto authz_response = Response{};
authz_response.status = CheckStatus::Error;

EXPECT_CALL(request_callbacks_, onComplete_(WhenDynamicCastTo<ResponsePtr&>(
AuthzResponseNoAttributes(authz_response))));
client_->onFailure(Grpc::Status::Unknown, "", span_);
}

Expand All @@ -195,8 +198,11 @@ TEST_P(ExtAuthzGrpcClientTest, AuthorizationRequestTimeout) {
expectCallSend(request);
client_->check(request_callbacks_, request, Tracing::NullSpan::instance());

EXPECT_CALL(request_callbacks_,
onComplete_(WhenDynamicCastTo<ResponsePtr&>(AuthzErrorResponse(CheckStatus::Error))));
auto authz_response = Response{};
authz_response.status = CheckStatus::Error;

EXPECT_CALL(request_callbacks_, onComplete_(WhenDynamicCastTo<ResponsePtr&>(
AuthzResponseNoAttributes(authz_response))));
client_->onFailure(Grpc::Status::DeadlineExceeded, "", span_);
}

Expand Down