본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Argo Rollouts Google Chat 알림

원문 보기 위키 갱신

Argo Rollouts의 알림 서비스 중 하나인 Google Chat 통합 설정을 소개합니다. Google Chat 웹훅(webhook)으로 메시지 알림을 보내는 방식이며, 웹훅 설정부터 ConfigMap/Secret 구성, 구독 생성, 그리고 텍스트·카드 메시지 템플릿 작성까지 단계별로 설명합니다.

출처: Argo Rollouts 문서

본문

파라미터 (Parameters)

Google Chat 알림 서비스는 google chat 웹훅으로 메시지 알림을 보냅니다. 이 서비스는 다음 설정을 사용합니다:

  • webhooks - webhookName: webhookUrl 형태의 맵

구성 (Configuration)

  1. Google chat을 열고 메시지를 보내려는 스페이스(space)로 이동합니다
  2. 페이지 상단의 메뉴에서 Configure Webhooks 를 선택합니다
  3. Incoming Webhooks 아래에서 Add Webhook 을 클릭합니다
  4. 웹훅에 이름을 지정하고, 선택적으로 이미지를 추가한 뒤 Save 를 클릭합니다
  5. 웹훅 옆에 있는 URL을 복사합니다
  6. URL을 argocd-notification-secret에 저장하고 argo-rollouts-notification-configmap에 선언합니다
apiVersion: v1
kind: ConfigMap
metadata:
  name: argo-rollouts-notification-configmap
data:
  service.googlechat: |
    webhooks:
      spaceName: $space-webhook-url
apiVersion: v1
kind: Secret
metadata:
  name: <secret-name>
stringData:
  space-webhook-url: https://chat.googleapis.com/v1/spaces/<space_id>/messages?key=<key>&token=<token>
  1. 스페이스에 대한 구독(subscription)을 생성합니다
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  annotations:
    notifications.argoproj.io/subscribe.on-sync-succeeded.googlechat: spaceName

템플릿 (Templates)

Google Chat 스페이스에 단순 텍스트 또는 카드 메시지를 보낼 수 있습니다. 단순 텍스트 메시지 템플릿은 다음과 같이 정의할 수 있습니다:

template.app-sync-succeeded: |
  message: The app {{ .app.metadata.name }} has successfully synced!

카드 메시지는 다음과 같이 정의할 수 있습니다:

template.app-sync-succeeded: |
  googlechat:
    cardsV2: |
      - header:
          title: ArgoCD Bot Notification
        sections:
          - widgets:
              - decoratedText:
                  text: The app {{ .app.metadata.name }} has successfully synced!
          - widgets:
              - decoratedText:
                  topLabel: Repository
                  text: {{ call .repo.RepoURLToHTTPS .app.spec.source.repoURL }}
              - decoratedText:
                  topLabel: Revision
                  text: {{ .app.spec.source.targetRevision }}
              - decoratedText:
                  topLabel: Author
                  text: {{ (call .repo.GetCommitMetadata .app.status.sync.revision).Author }}

모든 Card 필드가 지원되며 알림에 사용할 수 있습니다. 이전(현재는 deprecated) cards 키를 사용해 레거시 카드 필드를 사용하는 것도 가능하지만, Google이 이 필드를 deprecated 처리하고 더 새로운 cardsV2를 권장하므로 추천하지 않습니다.

카드 메시지는 JSON으로도 작성할 수 있습니다.

채팅 스레드 (Chat Threads)

스레드에 고유한 키를 지정하면 채팅 스레드에서 단순 텍스트와 카드 메시지를 모두 보낼 수 있습니다. 스레드 키는 다음과 같이 정의할 수 있습니다:

template.app-sync-succeeded: |
  message: The app {{ .app.metadata.name }} has successfully synced!
  googlechat:
    threadKey: {{ .app.metadata.name }}

더 알아보기 (Learn more)