Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whereami not displaying istio headers properly #157

Closed
boredabdel opened this issue Dec 2, 2020 · 3 comments
Closed

Whereami not displaying istio headers properly #157

boredabdel opened this issue Dec 2, 2020 · 3 comments

Comments

@boredabdel
Copy link
Member

Hi,

I deployed whereami:v1.1.1 today behind istio. Enabled headers but i don't see them in the output

My deployment manifest and configMap look liek this

apiVersion: apps/v1
kind: Deployment
metadata:
  name: whereami
spec:
  replicas: 2
  selector:
    matchLabels:
      app: whereami
  template:
    metadata:
      labels:
        app: whereami
    spec:
      containers:
      - name: whereami
        image: gcr.io/google-samples/whereami:v1.1.1
        ports:
          - name: http
            containerPort: 8080
        readinessProbe:
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
        env:
          - name: METADATA #An arbitrary metadata field that can be used to label JSON responses
            valueFrom:
              configMapKeyRef:
                name: whereami-configmap
                key: METADATA
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: whereami-configmap
data:
  METADATA: "echo_headers_enabled"
  ECHO_HEADERS: "True"

The output is missing the headers

➜  istio-ingress-e2e-tls git:(master) ✗ curl https://gke1.abdel.cloud -s | jq .
{
  "cluster_name": "gke-1",
  "host_header": "gke1.abdel.cloud",
  "metadata": "echo_headers_enabled",
  "node_name": "gke-gke-1-default-pool-94ebed87-q2z9.c.lbg-project-278414.internal",
  "pod_name": "whereami-8454b9bbf8-5czfx",
  "pod_name_emoji": "👩‍❤️‍👩",
  "project_id": "lbg-project-278414",
  "timestamp": "2020-12-02T09:46:44",
  "zone": "us-west1-a"
}```

Even if the metatadata is set echo_headers_enabled

What i expect is something similar to the echoserver, deployed the same way, the output looks like

curl https://gke1.abdel.cloud -s
CLIENT VALUES:
client_address=127.0.0.1
command=GET
real path=/
query=nil
request_version=1.1
request_uri=http://gke1.abdel.cloud:8080/

SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001

HEADERS RECEIVED:
accept=/
content-length=0
host=gke1.abdel.cloud
user-agent=curl/7.72.0
via=1.1 google
x-b3-parentspanid=f43fa3a13fd64a8c
x-b3-sampled=1
x-b3-spanid=67c62c3cedef3d7b
x-b3-traceid=1b2af99f21ce5da6f43fa3a13fd64a8c
x-client-data=CgSL6ZsV
x-cloud-trace-context=7a4858982a3a0949ff73adfc32cc202e/4550108360082774779
x-envoy-attempt-count=1
x-envoy-external-address=130.211.2.42
x-forwarded-client-cert=By=spiffe://cluster.local/ns/default/sa/default;Hash=15b8e7eb324184a1aa7ae9598db6e500eaedee9caa7e5da6120499c3dbd95775;Subject="";URI=spiffe://cluster.local/ns/istio-system/sa/istio-ingressgateway-service-account
x-forwarded-for=80.216.72.128, 34.120.200.50,130.211.2.42
x-forwarded-proto=https
x-request-id=136c88d9-cbe2-95d3-afd3-e0084eda08e6
BODY:

@theemadnes
Copy link
Member

Ok let me take a look.

@theemadnes
Copy link
Member

@boredabdel you're missing an env definition in your deployment spec. You only have the METADATA entry. That's just used as a string, but there's another env var named ECHO_HEADERS:

- name: ECHO_HEADERS
  valueFrom:
    configMapKeyRef:
      name: whereami-configmap
      key: ECHO_HEADERS

@theemadnes
Copy link
Member

{"cluster_name":"asm-test-01","headers":{"Accept":"*/*","Content-Length":"0","Host":"35.238.34.122","User-Agent":"curl/7.64.1","X-B3-Sampled":"0","X-B3-Spanid":"a8c4ef49fb63d4a3","X-B3-Traceid":"8a240cd17a6bff8ea8c4ef49fb63d4a3","X-Forwarded-Proto":"http","X-Request-Id":"3d3fd5f0-dbd6-491e-977f-a6556ea27e34"},"host_header":"35.238.34.122","metadata":"echo_headers_enabled","node_name":"gke-asm-test-01-default-pool-f9ad78c0-4qe7.c.alexmattson-scratch.internal","pod_name":"whereami-abdel-c4bf8f85b-dz84q","pod_name_emoji":"🥗","project_id":"alexmattson-scratch","timestamp":"2020-12-04T05:03:30","zone":"us-central1-f"}```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants