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

Add syncAnnotations field to EventSourceSpec #3205

Closed
wants to merge 1 commit into from

Conversation

omerap12
Copy link
Contributor

Checklist:

As part of #3200 ,enable the option to sync annotations of an event source deployment through the event source manifest.
Tested locally and added unit-tests:
For example, this manifest:

apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
  name: webhook
  annotations:
    test1: "test1"
    test2: "test2"
spec:
  syncAnnotations: true
  service:
    ports:
      - port: 12000
        targetPort: 12000
  webhook:
    example:
      port: "12000"
      endpoint: /example
      method: POST

Will create the following deployment (using kubectl get deployment -o yaml):

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "2"
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"argoproj.io/v1alpha1","kind":"EventSource","metadata":{"annotations":{"test1":"test1","test2":"test2"},"name":"webhook","namespace":"argo-events"},"spec":{"service":{"ports":[{"port":12000,"targetPort":12000}]},"syncAnnotations":true,"webhook":{"example":{"endpoint":"/example","method":"POST","port":"12000"}}}}
    resource-spec-hash: "800170066"
    test1: test1
    test2: test2
  creationTimestamp: "2024-07-13T14:47:31Z"
  generateName: webhook-eventsource-
  generation: 2
  labels:
    controller: eventsource-controller
    eventsource-name: webhook
    owner-name: webhook
  name: webhook-eventsource-97297
  namespace: argo-events
  ownerReferences:
  - apiVersion: argoproj.io/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: EventSource
    name: webhook
    uid: ce14698c-63df-4401-b8bc-ab6a964dce4d
  resourceVersion: "1579"
  uid: 1f8f0b39-7e7f-47a9-a964-0c923864e7c7
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      controller: eventsource-controller
      eventsource-name: webhook
      owner-name: webhook
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        controller: eventsource-controller
        eventsource-name: webhook
        owner-name: webhook
    spec:
      containers:
      - args:
        - eventsource-service
        env:
        - name: EVENTSOURCE_OBJECT
          value: eyJtZXRhZGF0YSI6eyJuYW1lIjoid2ViaG9vayIsIm5hbWVzcGFjZSI6ImFyZ28tZXZlbnRzIiwiY3JlYXRpb25UaW1lc3RhbXAiOm51bGwsImFubm90YXRpb25zIjp7Imt1YmVjdGwua3ViZXJuZXRlcy5pby9sYXN0LWFwcGxpZWQtY29uZmlndXJhdGlvbiI6IntcImFwaVZlcnNpb25cIjpcImFyZ29wcm9qLmlvL3YxYWxwaGExXCIsXCJraW5kXCI6XCJFdmVudFNvdXJjZVwiLFwibWV0YWRhdGFcIjp7XCJhbm5vdGF0aW9uc1wiOntcInRlc3QxXCI6XCJ0ZXN0MVwiLFwidGVzdDJcIjpcInRlc3QyXCJ9LFwibmFtZVwiOlwid2ViaG9va1wiLFwibmFtZXNwYWNlXCI6XCJhcmdvLWV2ZW50c1wifSxcInNwZWNcIjp7XCJzZXJ2aWNlXCI6e1wicG9ydHNcIjpbe1wicG9ydFwiOjEyMDAwLFwidGFyZ2V0UG9ydFwiOjEyMDAwfV19LFwic3luY0Fubm90YXRpb25zXCI6dHJ1ZSxcIndlYmhvb2tcIjp7XCJleGFtcGxlXCI6e1wiZW5kcG9pbnRcIjpcIi9leGFtcGxlXCIsXCJtZXRob2RcIjpcIlBPU1RcIixcInBvcnRcIjpcIjEyMDAwXCJ9fX19XG4iLCJyZXNvdXJjZS1zcGVjLWhhc2giOiIxNTMzNDg3MiIsInRlc3QxIjoidGVzdDEiLCJ0ZXN0MiI6InRlc3QyIn19LCJzcGVjIjp7InNlcnZpY2UiOnsicG9ydHMiOlt7InBvcnQiOjEyMDAwLCJ0YXJnZXRQb3J0IjoxMjAwMH1dfSwic3luY0Fubm90YXRpb25zIjp0cnVlLCJ3ZWJob29rIjp7ImV4YW1wbGUiOnsiZW5kcG9pbnQiOiIvZXhhbXBsZSIsIm1ldGhvZCI6IlBPU1QiLCJwb3J0IjoiMTIwMDAiLCJ1cmwiOiIifX19LCJzdGF0dXMiOnt9fQ==
        - name: EVENTBUS_SUBJECT
          value: eventbus-argo-events
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: LEADER_ELECTION
        - name: EVENTBUS_CONFIG
          value: eyJuYXRzIjp7InVybCI6Im5hdHM6Ly9ldmVudGJ1cy1kZWZhdWx0LXN0YW4tc3ZjOjQyMjIiLCJjbHVzdGVySUQiOiJldmVudGJ1cy1kZWZhdWx0IiwiYXV0aCI6InRva2VuIiwiYWNjZXNzU2VjcmV0Ijp7Im5hbWUiOiJldmVudGJ1cy1kZWZhdWx0LWNsaWVudCIsImtleSI6ImNsaWVudC1hdXRoIn19fQ==
        image: quay.io/argoproj/argo-events:v1.9.0
        imagePullPolicy: Always
        name: main
        ports:
        - containerPort: 7777
          name: metrics
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/eventbus/auth
          name: auth-volume
        - mountPath: /tmp
          name: tmp
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: auth-volume
        secret:
          defaultMode: 420
          items:
          - key: client-auth
            path: auth.yaml
          secretName: eventbus-default-client
      - emptyDir: {}
        name: tmp
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2024-07-13T14:47:33Z"
    lastUpdateTime: "2024-07-13T14:47:33Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2024-07-13T14:47:31Z"
    lastUpdateTime: "2024-07-13T14:47:33Z"
    message: ReplicaSet "webhook-eventsource-97297-c98f7db5b" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 2
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1

Flag default is off.

@omerap12 omerap12 requested a review from whynowy as a code owner July 13, 2024 15:02
Signed-off-by: Omer Aplatony <omerap12@gmail.com>
@whynowy
Copy link
Member

whynowy commented Jul 19, 2024

@omerap12 - curious, what is the reason you want to propagate the annotations to the deployment?

@omerap12
Copy link
Contributor Author

@omerap12 - curious, what is the reason you want to propagate the annotations to the deployment?

For passing datadog annotations for example (https://docs.datadoghq.com/containers/kubernetes/integrations/?tab=annotations)

@whynowy
Copy link
Member

whynowy commented Jul 26, 2024

@omerap12 - curious, what is the reason you want to propagate the annotations to the deployment?

For passing datadog annotations for example (https://docs.datadoghq.com/containers/kubernetes/integrations/?tab=annotations)

@omerap12 - I read the doc your posted, it looks like the ask is to add annotations to the pods. There is already a way to customize the labels/annotations to the eventsource/sensor pods, for example:

apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
  name: aws-sqs
spec:
  sqs:
    example:
      metadata:
        annotations:
          a: b

Let me know if this works for you.

Copy link
Contributor

This Pull Request is stale because it has been open for 60 days with
no activity. It will be closed in 7 days if no further activity.

@github-actions github-actions bot added the stale label Sep 25, 2024
@github-actions github-actions bot closed this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants