Discovered Upstream Configuration via Annotations

Gloo Edge looks for discovered upstream configuration in the annotations of any Kubernetes service that it identifies. For Gloo Edge to discover the upstream configuration, include an annotation in the service in a key-value format. The key is gloo.solo.io/upstream_config and the value is the upstream configuration, formatted as JSON.

For example, we can set the initial stream window size on the discovered upstream using the a modified version of the pet store manifest provided in the parent document:

kubectl apply -f - <<EOF
# petstore service
apiVersion: v1
kind: Service
metadata:
  annotations:
    gloo.solo.io/upstream_config: '{"initial_stream_window_size": 2048}'
  name: petstore
  namespace: default
  labels:
    service: petstore
spec:
  ports:
  - port: 8080
    protocol: TCP
  selector:
    app: petstore
---
#petstore deployment 
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: petstore
  name: petstore
  namespace: default
spec:
  selector:
    matchLabels:
      app: petstore
  replicas: 1
  template:
    metadata:
      labels:
        app: petstore
    spec:
      containers:
      - image: soloio/petstore-example:latest
        name: petstore
        ports:
        - containerPort: 8080
          name: http
EOF

Now that you created the pet store app, check for the discovered upstream. In the output of the following command, note the upstream with the namespace, name, and port of the service , default-petstore-8080.

kubectl get upstreams -n gloo-system

Review the upstream to make sure that the configuration from the Kubernetes service was picked up in the upstream.

kubectl get upstream -n gloo-system default-petstore-8080 -oyaml

As you can see, the configuration set spec.initialStreamWindowSize to 2048 on the discovered upstream!