solo-io / wasm

Web Assembly tools and SDKs for extending cloud-native infrastructure
Apache License 2.0
305 stars 39 forks source link

wasme deploy fails when serverHeaderTransformation exists in gateway config #257

Open jameshbarton opened 3 years ago

jameshbarton commented 3 years ago

Describe the bug wasme deploy fails when serverHeaderTransformation already exists in gateway config. For context, see this blog post.

To Reproduce Steps to reproduce the behavior:

  1. Install httpbin: kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/httpbin/httpbin.yaml
  2. Add a route to httpbin:
    apiVersion: gateway.solo.io/v1
    kind: VirtualService
    metadata:
    name: httpbin
    namespace: gloo-system
    spec:
    virtualHost:
    domains:
    - '*'
    routes:
    - matchers:
      - prefix: /
      routeAction:
        single:
          upstream:
            name: default-httpbin-8000
            namespace: gloo-system
  3. Patch the gateway to add serverHeaderTransformation:
    kubectl patch gateway -n gloo-system gateway-proxy --type merge -p '{"spec":{"httpGateway":{"options":{"httpConnectionManagerSettings":{"serverHeaderTransformation":"PASS_THROUGH"}}}}}'
  4. Deploy a WASM filter to the gateway. Observe the unexpected error. Running this without the patched gateway from step 3 works fine.
    % wasme deploy gloo webassemblyhub.io/jameshbarton/remove-headers:v1.0 --id=remove-headers --config "x-envoy,server"
    Error: All attempts fail:
    #1: converting output crd: reading crd spec on resource gateway-proxy in namespace gloo-system into v1Gateway: unknown field "serverHeaderTransformation" in hcm.HttpConnectionManagerSettings

Expected behavior The wasme deploy succeeds with no errors.

Additional context

% glooctl version
Client: {"version":"1.7.0"}
Server: {"type":"Gateway","enterprise":true,"kubernetes":{"containers":[{"Tag":"1.7.0","Name":"discovery","Registry":"quay.io/solo-io"},{"Tag":"1.7.0","Name":"extauth-ee","Registry":"quay.io/solo-io"},{"Tag":"1.7.0","Name":"gateway","Registry":"quay.io/solo-io"},{"Tag":"1.7.0","Name":"gloo-ee-envoy-wrapper","Registry":"quay.io/solo-io"},{"Tag":"1.7.0","Name":"gloo-ee","Registry":"quay.io/solo-io"},{"Tag":"1.7.0","Name":"observability-ee","Registry":"quay.io/solo-io"},{"Tag":"1.7.0","Name":"rate-limit-ee","Registry":"quay.io/solo-io"},{"Tag":"5","Name":"redis","Registry":"docker.io"}],"namespace":"gloo-system"}}
Sodman commented 3 years ago

We'll need to bump the version of Gloo used to one that includes this field - https://github.com/solo-io/wasm/blob/master/tools/wasme/cli/go.mod#L30 (We are using Gloo 1.5 and I believe this field was added in Gloo 1.6)