Unable to parse JSON as proto (INVALID_ARGUMENT:check_settings: Cannot find field.)
Issue Template
Excluding ext-auth from route fails to apply.
Description: I'm trying to exclude a route from the ext-auth filter. I've tried following this but either i'm doing something strange or the docs aren't updated: https://www.envoyproxy.io/docs/envoy/latest/configuration/http_filters/ext_authz_filter.html#per-route-configuration
Error:
[2018-11-29 10:53:51.563][000009][critical][main] [source/server/server.cc:85] error initializing configuration '/etc/envoy/envoy.yaml': Unable to parse JSON as proto (INVALID_ARGUMENT:check_settings: Cannot find field.): {"check_settings":{"context_extensions":{"virtual_host":"local_service"}}}
[2018-11-29 10:53:51.563][000009][info][main] [source/server/server.cc:502] exiting
Full yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: myapi-envoy-config
labels:
app.kubernetes.io/name: myapi
data:
envoy.yaml: |-
admin:
access_log_path: /tmp/admin_access.log # seems to be necessary to have an admin endpoint
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 9901
static_resources:
listeners:
- name: listener_0 #setup something that listens on port 10000, which is exposed in k8s manifest later
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
- name: envoy.http_connection_manager # definitions for what the listener listens for
config:
stat_prefix: ingress_http
access_log:
- name: envoy.file_access_log
config:
path: "/dev/stdout"
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
per_filter_config:
envoy.filters.http.jwt_authn:
check_settings:
context_extensions:
virtual_host: local_service
routes:
- match:
prefix: "/swagger.json"
route:
cluster: service_local
per_filter_config:
envoy.filters.http.jwt_authn:
disabled: true
- match:
prefix: "/"
route:
cluster: service_local # route this to the upstream "local_service" defined under clusters below
http_filters:
- name: envoy.filters.http.jwt_authn # more filters.... see https://github.com/envoyproxy/envoy/blob/master/api/envoy/config/filter/http/jwt_authn/v2alpha/config.proto
config:
providers:
idpname:
issuer: https://someopenidconnectserver.com/-
audiences:
- https://someopenidconnectserver.com
remote_jwks:
http_uri:
uri: https://someopenidconnectserver.com/jwks
cluster: idpname # important: this names the cluster where the jwt/jwks info can be found, defined under "cluster" section
cache_duration:
seconds: 300
rules:
- match:
prefix: /
requires: # actual challenges that must be met to allow access
provider_name: idpname
- name: envoy.router # no idea why, but this seems neccessary
clusters:
- name: service_local
connect_timeout: 1s
type: LOGICAL_DNS # no idea...
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
hosts:
- socket_address:
address: localhost
port_value: 8080
- name: idpname # config to map the "cluster"
type: STRICT_DNS # no idea...
connect_timeout: 1s
hosts:
- socket_address:
address: someopenidconnectserver
port_value: 443
tls_context: { sni: someopenidconnectserver }
@qiwzhang could you help out here? Thanks.
I assume you are using jwt_authn filter, but your link points to ext_authz filter.
jwt_authn filter doesn't support per_roue config yet. So your setting here
per_filter_config: envoy.filters.http.jwt_authn:
Cause the parsing fail.
The idea is, in jwt_authn config, you can use rules to specify per path requirements. So there is not need to support per-route config.
Indeed we were looking at the wrong filter! Thank you 👍 This works
apiVersion: v1
kind: ConfigMap
metadata:
name: myapi-envoy-config
labels:
app.kubernetes.io/name: myapi
data:
envoy.yaml: |-
admin:
access_log_path: /tmp/admin_access.log # seems to be necessary to have an admin endpoint
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 9901
static_resources:
listeners:
- name: listener_0 #setup something that listens on port 10000, which is exposed in k8s manifest later
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
- name: envoy.http_connection_manager # definitions for what the listener listens for
config:
stat_prefix: ingress_http
access_log:
- name: envoy.file_access_log
config:
path: "/dev/stdout"
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
per_filter_config:
envoy.filters.http.jwt_authn:
check_settings:
context_extensions:
virtual_host: local_service
routes:
- match:
prefix: "/swagger.json"
route:
cluster: service_local
per_filter_config:
envoy.filters.http.jwt_authn:
disabled: true
- match:
prefix: "/"
route:
cluster: service_local # route this to the upstream "local_service" defined under clusters below
http_filters:
- name: envoy.filters.http.jwt_authn # more filters.... see https://github.com/envoyproxy/envoy/blob/master/api/envoy/config/filter/http/jwt_authn/v2alpha/config.proto
config:
providers:
idpname:
issuer: https://someopenidconnectserver.com/-
audiences:
- https://someopenidconnectserver.com
remote_jwks:
http_uri:
uri: https://someopenidconnectserver.com/jwks
cluster: idpname # important: this names the cluster where the jwt/jwks info can be found, defined under "cluster" section
cache_duration:
seconds: 300
rules:
- match:
prefix: /swagger.json
- match:
prefix: /healthz
- match:
prefix: /
requires: # actual challenges that must be met to allow access
provider_name: idpname
- name: envoy.router # no idea why, but this seems neccessary
clusters:
- name: service_local
connect_timeout: 1s
type: LOGICAL_DNS # no idea...
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
hosts:
- socket_address:
address: localhost
port_value: 8080
- name: idpname # config to map the "cluster"
type: STRICT_DNS # no idea...
connect_timeout: 1s
hosts:
- socket_address:
address: someopenidconnectserver
port_value: 443
tls_context: { sni: someopenidconnectserver }