Remove element from Kubernetes object array with Argo Events

21 Views Asked by At

I have following Argo Events manifest with Sensor configuration that consume messages from AWS SQS message queue.

apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
  name: aws-sqs
spec:
  template:
    serviceAccountName: admin-user
  replicas: 1
  dependencies:
    - name: test-name
      eventSourceName: aws-sqs
      eventName: example
  triggers:
    - template:
        name: create-deployment
        k8s:
          operation: create
          patchStrategy: "application/strategic-merge-patch+json"
          source:
            resource:
              apiVersion: apps/v1
              kind: Deployment
              metadata:
                name: nginx-deployment
                labels:
                  app: nginx
              spec:
                replicas: 1
                selector:
                  matchLabels:
                    app: nginx
                template:
                  metadata:
                    labels:
                      app: nginx
                  spec:
                    containers:
                    - name: nginx
                      image: nginx:1.14.2
                      ports:
                      - containerPort: 80
          parameters:
            - src:
                dependencyName: test-name
                dataTemplate: "{{ .Input.body.name | lower }}"
              dest: spec.template.spec.containers.0.nameam

Base on message body I am able to append new elements to containers list and add as many containers as I would like to.

Problem start when I am trying to do the opposite since I don't know how to remove element from array with Argo Events.

My desire scenario is to send message on different AWS SQS queue with container name and Argo Events sensor will remove only container mentioned by name in queue.

Is this even possible natively in Argo Events or I will need to create custom application that will do the job and configure webhook endpoint that will be triggered when new message arrive to queue?

0

There are 0 best solutions below