Select Page
by

Vardhan NS

|
last updated on November 28, 2023
Share

Intro to Argo CD Notifications

If you are using Argo CD for GitOps-style deployment of Kubernetes applications, then you should get notified about the real-time application changes to various environments. In such cases, Argo CD Notifications can be used for providing updates about application deployments or any status change for better collaboration. 

This article shows how to configure Argo CD Notifications with the leading collaboration platform Slack. 

Intro to Argo CD Notifications

Based on various scenarios, Argo CD Notifications provides a series of triggers to notify users. Examples of use-case in Argo CD when these triggers can be fired:

  1. Application created 
  2. Application deleted
  3. Application deployed
  4. Application health degraded
  5. Application sync failed
  6. App sync running
  7. App sync status unknown
  8. App sync succeeded 

Steps involved while integrating Argo CD Notifications and Slack

Step-1: Create a dedicated slack channel for application delivery status

Create a Slack channel, either public or private, based on your requirement. If you have a channel or a workspace for tracking all the deployment changes, ignore it. 

You can create a new app in Slack using this URL. After that, sign in to your Slack account. Refer to the screenshots below.

sign in to your Slack account

Now you can click on Create an App

Create an app From scratch(click)

Provide the appname and pick the workspace and then create app

Step-2: Go to OAuth & Permissions settings in Slack

Once the application is created, you can navigate to OAuth & Permissions to be permit Argo CD Notifications to send notification to the channel. 

You can go to the Scopes section and add an OAuth Scope. You can read more about the scopes in Slack to understand about users, tokens and bots. 

Provide below permissions:

chat:write

chat:write.customize 

Once the scope created, Scroll back to the top, click ‘Install to Workspace‘ 

You should allow your workspace for notifications

Step-3: Copy Slack token into Argo CD Notifications secrets file

Once you allow the app to access the workspace, you will be able to see the Bot User OAuth Token. You need to copy it to local and convert into base64. 

You can use the following command to convert the token into base64.

				
					echo -n  XXXTOKENXXX | base64
				
			

After the encoding, you can edit the secret called argocd-notifications-secret.yaml file, in the namespace where argocd is  installed, and use the encoded secret. 

				
					apiVersion: v1
kind: Secret
metadata:
  name: argocd-notifications-secret
stringData:
  slack-token: <base64 encoded auth-token>
				
			

You can also configure the Slack integration token in configmap file- argocd-notifications-cm

				
					apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-notifications-cm
data:
  service.slack: |
    apiURL: <url>  # optional URL, e.g.https://example.com/api
    token: $slack-token
    username: <override-username> # optional username
    icon: <override-icon>         # optional icon for the message (supports both emoij and url notation)
				
			

Make sure you have the Argo CD slack template in the same configmap (if installed using helm it will be automatically created). If you want more information about this template contact OpsMx Argo CD experts.

Step-4: Add your application to the required Slack channel

Open Slack, click on channel name-> integrations-> add an App. And then search for your app name and add it. ( refer the screenshot below)

Once added it is notified in the channel.

Step-5: Configure Argo CD application for notifications

After the app is added, you can now configure notification in any Argo CD application. All you need to do is edit the application and add annotation to it. Based on annotations, notifications will be sent to Slack channels. 

 

Examples of Annotations : notifications.argoproj.io/subscribe.on-sync-succeeded.slack: <Channel Name>

————————————————————————

  annotations:

    notifications.argoproj.io/subscribe.on-deleted.slack: maheshapp-argo-pub

    notifications.argoproj.io/subscribe.on-deployed.slack: maheshapp-argo-pub

    notifications.argoproj.io/subscribe.on-sync-failed.slack: maheshapp-argo-pub

    notifications.argoproj.io/subscribe.on-sync-status-unknown.slack: maheshapp-argo-pub

    notifications.argoproj.io/subscribe.on-health-degraded.slack: maheshapp-argo-pub

    notifications.argoproj.io/subscribe.on-sync-succeeded.slack: maheshapp-argo-pub

Once annotations are added and application is Synced, stakeholders will in the channel will receive the applications status notifications when any event is triggered. 

Conclusion

Collaboration between stakeholders can be enhanced in GitOps-style delivery using Argo CD and Slack integration. If you want to visualize real-time information application deployment and audit information, then explore OpsMx ISD for Argo.

If you have any doubts, please get in touch with Argo CD experts

Tags : Argo, Argo CD

Vardhan NS

Vardhan is a technologist and a marketing professional, currently working as a Sr. PMM at OpsMx. His strength lies in understanding complex technologies, and explaining them in un-complicated ways. Vardhan is a passionate Product Marketer with a keen focus on Content, helping brands Position themselves uniquely with clear messaging and competitive differentiation. Outside of work, he is an athlete that is passionate about Football, Swimming and Surfing.

Link

0 Comments

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.