Skip to content

Unfortunate CEL validation on ExternalAuth filters #5118

Description

@bittrance

Currently, If you try to create an HTTPRoute with a basic ExternalAuth filter, like so:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: hello-rest
spec:
  parentRefs:
    - name: hello-rest
  rules:
    - filters:
        - type: ExternalAuth
          externalAuth:
            protocol: GRPC
            backendRef:
              kind: Service
              name: external-oauth2
              port: 8080
      backendRefs:
        - name: hello-rest
          port: 8080

... you will get a validation error:

The HTTPRoute "hello-rest" is invalid: spec.rules[0].filters[0].externalAuth: Invalid value: grpc must be specified when protocol is set to 'GRPC'

The validation is in HTTPExternalAuthFilter.

However, on reading the docs for GRPCAuthConfig all its (1) attributes are optional, and explicitly states a default behavior: "If this list is empty, then all headers must be sent." The same goes for HTTPAuthConfig. As it stands, if an Application Developer wants to create a HTTPRoute with default behavior, they need to add a grpc: {allowedHeaders: ~} or similar no-op to satisfy the validation.

I think we are unlikely to add mandatory attributes to HTTPAuthConfig/GRPCAuthConfig in the future, so probably the validation rule should be removed?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions