plugin call credentials is supported by default today ?
Description: In one our user case, we want to set gRPC call credential from some file content(the file is in envoy container). My question is : Is there any extra work needs to be done to make plugin call credentials work ? Or it should work by default with correct configuration (and how to) ?
From code, comment inside function callCredentials says // We don't handle plugin credentials here, callers can do so instead if they want. and plugin call credentials in extension pkg already supported reading cred from file today.
Repro steps:
- below is from envoy config I used (confirmed
/var/run/secrets/tokentest/vault-tokenfile exists in envoy container and has data in it, also the account envoy runs as is the file owner so no permission issue)
[
{
"google_grpc": {
"target_uri": "unix:/var/run/sds/uds_path",
"channel_credentials": {
"local_credentials": {}
},
"call_credentials": [
{
"from_plugin": {
"name": "envoy.grpc_credentials.file_based_metadata",
"config": {
"secret_data": {
"filename": "/var/run/secrets/tokentest/vault-token"
},
"header_key": "istio-header"
}
}
}
],
"stat_prefix": "sdsstat"
}
}
]
- didn't see
istoi-headerheader from envoy's request
/cc @qiwzhang @lizan @htuch
@quanjielin could you add following line into your google_grpc config
credentials_factory_name: envoy.grpc_credentials.file_based_metadata
it should be at the same level as targer_uri
after adding that, envoy failed in validation step(validate against real k8s sa jwt token)
E1008 16:21:51.098493878 20 plugin_credentials.cc:95] Plugin added invalid metadata value.
[2018-10-08 16:21:51.098][11][warning][upstream] external/envoy/source/common/config/grpc_mux_impl.cc:243] gRPC config stream closed: 13,
E1008 16:21:51.128181499 19 plugin_credentials.cc:94] validate_metadata_from_plugin:
token is passed successfully with below config, thanks @qiwzhang !
"tls_certificate_sds_secret_configs": [
{
"name": "default",
"sds_config": {
"api_config_source": {
"api_type": "GRPC",
"grpc_services": [
{
"google_grpc": {
"target_uri": "unix:/var/run/sds/uds_path",
"channel_credentials": {
"local_credentials": {}
},
"call_credentials": [
{
"from_plugin": {
"name": "envoy.grpc_credentials.file_based_metadata",
"config": {
"header_key": "istio_sds_credentail_header-bin",
"secret_data": {
"filename": "/var/run/secrets/tokentest/vault-token"
}
}
}
}
],
"stat_prefix": "sdsstat",
"credentials_factory_name": "envoy.grpc_credentials.file_based_metadata"
}
}
]
}
}
}
]