argo-events: Gateway pod is leaking memory.

Describe the bug Gateway pod is leaking memory. Is this a bug? Is there a deployment method to prevent it?

Environment (please complete the following information):

  • OS: macOS Mojave 10.14.4
  • minikube: v1.0.1
  • Helm: v2.14.0
  • argo workflow: v2.2.1
  • Argo-events: v0.9.2

To Reproduce

Setup minikube & helm.

minikube start
minikube addons enable ingress
helm init

Install argo & argo-events.

helm repo add argo https://argoproj.github.io/argo-helm
kubectl create namespace argo
helm install argo/argo --name argo --namespace argo

kubectl create namespace argo-events
helm install argo/argo-events --name argo-events --namespace argo-events

Apply argo-events webhook sample.

kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/event-sources/webhook.yaml
kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/webhook.yaml
kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/sensors/webhook.yaml

Set monitring environment. Check minikube ip.

minikube ip

Add minikube IP to /etc/hosts.

sudo vim /etc/hosts
192.168.99.106  alertmanager.minikube prometheus.minikube grafana.minkube

Prepare prometheus.yaml.

alertmanager:
  ingress:
    enabled: true
    hosts:
      - alertmanager.minikube
  persistentVolume:
    size: 1Gi
    storageClass: "standard"
server:
  ingress:
    enabled: true
    hosts:
      - prometheus.minikube
  persistentVolume:
    size: 1Gi
    storageClass: "standard"
  retention: "12h"
pushgateway:
  enabled: false

Install promehteus

kubectl create namespace monitoring
helm install --name prometheus --namespace monitoring -f prometheus.yaml stable/prometheus

acesess http://prometheus.minikube and do the following query.

container_memory_working_set_bytes{pod_name="webhook-gateway-http"}

Screenshots screenshots

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

Here’s my update:

  • Migrating from 0.11 to 0.12 was terrible – no docs and a ton of model changes. Thankfully, the changes were fairly good and well structured, so 🙌 for that!

  • 0.12 seems to have fixed the memory leaks 🎉 🎉 🥂 image

Here are the notes I took while migrating, and a summary of changes I noticed:

  • Migrating from 0.11 to 0.12 webhook configs:
    • Webhook Gateway

      • “watchers” turned into “subscribes” and points to the service endpoint, not the sensor itself
    • Webhook Sensor

      • dependencies specify the gateway in a formalized object of { name, gatewayName, eventName }, EX: old format of my-gateway:my-event-source is now { name: 'myEventName', gatewayName: 'my-gateway', eventName: 'my-event-source' }, you can access this in parameters using myEventName.
      • Change eventProtocol to subscription object to attach to the gateway
      • Major changes/formalization of parameterization – a little more nested and mostly more consistent.
      • MAJOR gotcha around what object the parameters apply to. parameters as a child of template see the entire template object. parameters as a child of the k8s object in the template see k8s.source as the object – so, one extra layer deep. Example below:
        triggers:
          - template:
              # all these spaces in is correct
              name: my-webhook-workflow
              k8s:
                group: argoproj.io
                version: v1alpha1
                resource: workflows
                operation: create
                source:
                  git:
                    url: "git@github.com:some-github/repo.git"
                    cloneDirectory: "/git"
                    sshKeyPath: "/secret/key"
                    filePath: "TEMPLATED_FILLS_IN"
                    branch: "master"
      
                # Resource-level paramters - the paths here are rooted at the !!! k8s.source object !!!
                parameters:
                  - src:
                      dependencyName: gateway-dep
                      dataKey: body.some.other.path
                    # Notice it is NOT source.spec or k8s.source, but spec.
                    dest: spec.arguments.parameters.0.value
            # Trigger-level parameters -- the paths here are rooted at the entire template object.
            parameters:
              - src:
                  dependencyName: gateway-dep
            # dataKey will deserialize the data base64, it is a json object of { body, headers, ... }
                  dataKey: body.some.json.path
                  value: "master"
            # Notice k8s pathing
                dest: k8s.source.git.branch
      
      • EventSoruce
        • Actual custom resource as opposed to a config map
        • Formalized the document – spec types define the event source shape (IE: webhook) and the further configs, the example for a webhook event source is easy enough to follow.

Other notes:

  • Triggers sources are standardized until k8s standard resources, so they’re all nested 1 more deep
  • Event source dependencies are formalized, you declare the dependency then use it in params
  • Parameterization is formalized as a dependency source and then a contextKey or a dataKey
    • Events have { context, data } shape where context is meta about the event itself.
    • At the event level, data is base64 encoded raw of whatever the payload is
    • Depending on the event, data can take different forms/values
    • For webhooks, data is the JSON of the full http request, IE: { header, body }
    • To extract webhook payload json, you need to do: dataKey: body.[...], like dataKey: body.some.json.path
  • Be careful about the nesting for parameters in a trigger definition – where is important.

@emilssolmanis It’s been 12 days since your comment. Did the upgrade fix the leak? Did you upgrade from 0.10? Any tips when upgrading?

This is definitely here on v0.11, had it die after ~15 days or so.

image