오류 해결

오류 해결 (Troubleshooting errors)

Argo CD Notification을 구성하다 보면 YAML 파싱, 서비스 타입, 다중 소스(multiple sources) 등에서 오류를 만나기 쉬워요. 여기서는 흔한 오류 메시지별 원인과 해결 방법을 정리해요.

출처: 문서

본문

새 설정을 파싱하지 못함 (Failed to parse new settings)

error converting YAML to JSON

YAML 문법이 잘못되었어요.

잘못된 예:

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-notifications-cm
data:
  service.slack: |
    token: $slack-token
    icon: :rocket:

올바른 예:

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-notifications-cm
data:
  service.slack: |
    token: $slack-token
    icon: ":rocket:" # <- diff here

icon: :rocket:처럼 특수 문자(:)로 시작하는 값은 YAML에서 매핑으로 해석될 수 있어요. 값 전체를 따옴표로 감싸면 문자열로 인식돼요.

service type 'xxxx' is not supported

argocd-notifications 컨트롤러 버전을 확인해 보세요. 예를 들어 Teams 통합은 v1.1.0부터 지원되기 시작했어요.

수신자에게 알림 실패 (Failed to notify recipient)

notification service 'xxxx' is not supported

argocd-notifications-cmxxxx를 정의하지 않았거나 파싱이 실패했어요.

GitHub.repoURL (\u003cno value\u003e) does not have a / using the configuration

다중 소스(multiple sources)를 가진 Application에서 발생할 가능성이 높아요.

spec:
  sources:  # <- multiple sources
  - repoURL: https://github.com/exampleOrg/first.git
    path: sources/example
  - repoURL: https://github.com/exampleOrg/second.git
    targetRevision: "{{branch}}"

표준 알림 템플릿은 단일 소스({{.app.spec.source.repoURL}})만 지원해요. 배열 안에서 인덱스로 소스를 지정하세요.

template.example: |
  github:
    repoURLPath: "{{ (index .app.spec.source.sources 0).repoURL }}"

오류 메시지 POST https://api.github.com/repos/xxxx/yyyy/statuses/: 404 Not Found

이 경우는 앞의 경우와 비슷하게 Application 매니페스트에 소스가 여러 개(multiple sources)일 때 발생해요. 기본 revisionPath 템플릿 {{.app.status.operationState.syncResult.revision}}은 단일 소스 Application을 위한 것이에요.

다중 소스 애플리케이션은 애플리케이션 상태를 배열로 보고해요.

status:
  operationState:
    syncResult:
      revisions:
        - 38cfa22edf9148caabfecb288bfb47dc4352dfc6
        - 38cfa22edf9148caabfecb288bfb47dc4352dfc6

빠른 해결책은 index 함수로 첫 번째 revision을 가져오는 거예요.

template.example: |
  github:
    revisionPath: "{{index .app.status.operationState.syncResult.revisions 0}}"

config referenced xxx, but key does not exist in secret

  • 커스텀 시크릿을 사용한다면 시크릿이 같은 네임스페이스에 있는지 확인하세요.
  • 시크릿에 app.kubernetes.io/part-of: argocd 라벨을 추가했는지 확인하세요.
  • argocd-notifications 컨트롤러를 재시작해 봤는지 확인하세요.

예시:

Secret:

apiVersion: v1
kind: Secret
metadata:
  name: argocd-slackbot
  namespace: <the namespace where argocd is installed>
  labels:
    app.kubernetes.io/part-of: argocd
type: Opaque
data:
  slack-token: <base64encryptedtoken>

ConfigMap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-notifications-cm
data:
  service.slack: |
    token: $argocd-slackbot:slack-token

$<시크릿이름>:<키> 형식으로 시크릿의 값을 참조하며, 시크릿은 Argo CD가 설치된 네임스페이스에 app.kubernetes.io/part-of: argocd 라벨과 함께 있어야 해요.

더 알아보기 (Learn more)