Notification slack
slack ์ค์
https://argocd-notifications.readthedocs.io/en/stable/services/slack/
slack์์ add apps ==> app directory ==> build ==> create custom app




create an app from scratch


oauth & permission

bot token scope ==> add an oauth scope ==>

chat:write์ถ๊ฐ
chat:write:customize๋ ๋ฉ์ธ์ง๋ฅผ ์ปค์คํฐ ๋ง์ด์ฆํ๋ ค๋ฉด ์ถ๊ฐ
Install App to Workspace

allow
ํ ํฐ์ด ์์ฑ์ด ๋๋ฉด ๋ณต์ฌํด๋๋ค.

argocd ์ฑ๋์ application์ถ๊ฐ
์ฑ๋์์ Add apps >> channel detail >> integration >> argocd-notifications



argocd์ ์ค์นํ๊ธฐ
mkdir -p core/argocd-notifications
cd core/argocd-notifications
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/v1.1.1/manifests/install.yaml
patches:
- path: https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/v1.1.1/catalog/install.yaml
target:
kind: ConfigMap
name: argocd-notifications-cm
- path: slack-secret.yml
target:
kind: Secret
name: argocd-notifications-secret
patchesStrategicMerge:
- slack-configmap.yml
argocd์์ ์ฑ์ ์ถ๊ฐํ์.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: argocd-notifications
spec:
destination:
name: ''
namespace: argocd
server: 'https://kubernetes.default.svc'
source:
path: apps/core/argocd-notifications
repoURL: 'git@github.com:xxxxx/xxxx.git'
targetRevision: HEAD
project: default
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
kubectl apply -f add-apps/argocd-notifications.yml
subscribe trigger
Application
Application์ annotations ์ ์ถ๊ฐํด์ฃผ๋ฉด๋๋ค.
kubectl edit application AAA -n argocd
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
# ์ฌ๊ธฐ๋ง ์ถ๊ฐ
annotations:
notifications.argoproj.io/subscribe.on-sync-succeeded.slack: my_channel
์ด๋ฌ๋ฉด ์๋ฆผ์ ๋ฐ์์ ์๋ค.
Project
Project ๋จ์์ ๋ค ๋ณด๋ด๋ ค๋ฉด ํ๋ก์ ํธ์ค์ ์ annotations ์ ์ถ๊ฐํด์ฃผ๋ฉด ๋๋ค.
kubectl get AppProjects -n argocd

kubectl edit appProject default -n argocd
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
# ์ฌ๊ธฐ๋ง ์ถ๊ฐ
annotations:
notifications.argoproj.io/subscribe.on-sync-succeeded.slack: my-channel1;my-channel2
command line์ผ๋ก
metadata:
annotations:
notifications.argoproj.io/subscribe.on-sync-succeeded.slack: argocd
kubectl patch AppProjects default -n argocd --patch "$(cat trigger.yaml)" --type=merge
Last updated
Was this helpful?