LogoLogo
Login to CortexBook a DemoCortex Academycortex.io
  • Cortex Docs
  • Cortex Quick Start
  • Ingesting data into Cortex
    • Managing Entities
      • Adding entities
        • Add services
        • Add domains
        • Add teams
        • Add custom entity types
        • Defining dependencies
      • Entity details page
      • Defining ownership
      • Defining relationship types
      • Grouping entities
      • Adding external documentation
      • Adding Deploy data
      • Adding custom data
      • Viewing discovered entities
      • Archiving entities
      • Relationship graph
      • Using On-call Assistant for incidents
      • Managing Terraform infra in Cortex
    • Managing Catalogs
    • Integrations
      • Internally hosted integrations
      • ArgoCD
      • AWS
      • Azure DevOps
      • Azure Resources
      • BambooHR
      • Bitbucket
      • BugSnag
      • Buildkite
      • Checkmarx
      • CircleCI
      • ClickUp
      • Codecov
      • Coralogix
      • Datadog
      • Dynatrace
      • Entra ID (Azure AD)
      • FireHydrant
      • GitHub
      • GitLab
      • Google
      • Grafana
      • incident.io
      • Instana
      • Jenkins
      • Jira
      • Kubernetes
      • LaunchDarkly
      • Lightstep
      • Mend
      • Microsoft Teams
      • New Relic
      • Okta
      • Opsgenie
      • PagerDuty
      • Prometheus
      • Rollbar
      • Rootly
      • Sentry
      • ServiceNow
      • Slack
      • Snyk
      • SonarQube
      • Splunk Observability Cloud (SignalFx)
      • Splunk On-Call (VictorOps)
      • Sumo Logic
      • Veracode
      • Wiz
      • Workday
      • xMatters
  • Scorecards
    • Initiatives and Action items
      • Creating issues based on Initiatives
    • Scorecard rule exemptions
    • Scorecard rule filters
    • Scorecard examples
    • Scorecards as code
  • Reports
    • Executive report
    • All Scorecards report
    • Bird's eye report
    • Progress report
    • Report card
  • Eng Intelligence
    • Custom Metrics
    • Jira Metrics
    • Metrics Explorer (Beta)
  • Cortex Query Language (CQL)
    • Using CQL reports
    • Using JQ in Cortex
  • Workflows
    • Creating a Workflow
      • Workflows as code
    • Blocks
    • Running a Workflow
    • Registering a Scaffolder template
      • Scaffolder advanced usage
    • Using a Workflow to sync in ArgoCD
    • Kicking off a Jenkins pipeline in a Workflow
  • Plugins
    • Creating a plugin
      • Creating a plugin proxy
    • Migrating Backstage plugins to Cortex
  • Engineering homepage
  • Workspace Settings
    • Using GitOps for Cortex
      • GitOps logs
    • Managing users
      • Roles and permissions
        • Custom roles
        • Team ownership entity editing
      • Configuring SSO
        • Microsoft Entra ID
        • Google
        • Other OIDC providers
        • Okta
          • Okta SCIM
      • Configuring identity mappings
      • Onboarding management
    • API keys, secrets, and tokens
      • Secrets
      • Personal tokens
    • Audit logs
    • Entity settings
      • Data verification
      • Auto archiving entities
    • IP allowlist
    • Notifications
      • Notification logs
    • Customizing your workspace
    • Using search in Cortex
  • Cortex API
    • REST API operations
      • API Keys
      • Audit Logs
      • Catalog Entities
      • Custom Data
        • Custom Data (Advanced)
      • Custom Events
      • Custom Metrics
      • Dependencies
      • Deploys
      • Discovery Audit
      • Docs
      • Eng Intel: User Labels
      • Entity Relationship Types (Beta)
      • Entity Relationships (Beta)
      • Entity Types
      • GitOps Logs
      • Groups
      • Initiatives
      • Integrations APIs
        • Azure Active Directory (Entra ID) API
        • Azure Resources API
        • AWS API
        • Azure DevOps API
        • CircleCI API
        • Coralogix API
        • Datadog API
        • GitHub API
        • GitLab API
        • incident.io API
        • LaunchDarkly API
        • New Relic API
        • PagerDuty API
        • Prometheus API
        • SonarQube API
      • IP Allowlist
      • Notification Logs
      • On call
      • Packages
      • Plugins
      • Queries
      • SCIM
      • Scorecards
      • Secrets
      • Team Hierarchies
      • Teams
      • Workflows
Powered by GitBook
On this page
  • Setup
  • Troubleshooting
  • Still need help?​

Was this helpful?

Export as PDF
  1. Ingesting data into Cortex
  2. Integrations

ArgoCD

Last updated 5 hours ago

Was this helpful?

is a declarative, GitOps continuous delivery tool for Kubernetes.

Integrating Cortex with ArgoCD allows you to:

  • Send information about ArgoCD syncs into Cortex

    • This data appears on .

  • Use

Setup

Notification webhooks

To send Cortex information about syncs in ArgoCD, you can use ArgoCD notification to call the Cortex flexible .

Here is an example of what a argocd-notifications-cm config map may look like:

apiVersion: v1
kind: ConfigMap
data:
  context: |
    argocdUrl: https://argo.company.com
  service.webhook.cortex-webhook: |
    url: https://api.getcortexapp.com
    headers:
    - name: Content-Type
      value: application/json
    - name: Accept
      value: application/json
    - name: Authorization
      value: Bearer $token 
    subscriptions: |
      - recipients:
        - cortex-webhook
        triggers:
        - on-sync-succeeded
  template.app-sync-succeeded: |
    webhook:
      cortex-webhook:
        method: POST
        path: /api/v1/catalog/{{.app.metadata.name}}/deploys 
        body: |
          { "customData": { "Sync Status": "{{.app.status.sync.status}}","Sync Details": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" },
            "environment": "{{.app.spec.destination.name}}",
            "sha": "{{.app.status.operationState.operation.sync.revision}}",
            "timestamp": "{{.app.status.operationState.finishedAt}}",
            "title": "Sync by ArgoCD",
            "type": "DEPLOY"
          }
  trigger.on-sync-succeeded: |
    - send:
      - app-sync-succeeded
      when: app.status.operationState.phase in ['Succeeded']
        

The above example assumes your ArgoCD application's name matches the x-cortex-tag. In this case, each application in ArgoCD can subscribe to the same trigger.

If your application name doesn't match the x-cortex-tag, add a value/pair to the info section of the Application manifest. Then, instead of using .app.metadata.name in the url, use .app.spec.info[0].value.

Subscribing application to webhooks

The last step is to subscribe your application to the webhook. You do this by adding a label annotation in the Application spec in the following format:

    notifications.argoproj.io/subscribe.<trigger-name>.<webhook-name>: ""

For example, if we want to subscribe an application to the example webhook above, our Application yaml may look something like this:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  annotations:
    notifications.argoproj.io/subscribe.on-sync-succeeded.cortex-webhook: ""
...  

Troubleshooting

Ensure the Cortex API Key is encoded correctly

Make sure the encoded Cortex API Key does not contain an extra line. Use a tool like https://www.base64encode.org/ to ensure your encoded key does not contain an extra line.

Check the ArgoCD logs

The notification webhook is managed by the argocd-notifications-controller which will have a pod running in your ArgoCD namespace.

Assuming the ArgoCD is running in the argocd namepsace, run the following command to get the list of pods:

kubectl get pods -n argocd

This will return a list of pods similar to the ones listed below:

NAME                                                READY   STATUS    RESTARTS   AGE
argocd-application-controller-0                     1/1     Running   0          108d
argocd-applicationset-controller-69f96ccf5b-5jnpv   1/1     Running   0          108d
argocd-dex-server-5dff9c5998-j29zd                  1/1     Running   0          80d
argocd-notifications-controller-6cd988b564-sql55    1/1     Running   0          107d
argocd-redis-54c687db9d-kdxwj                       1/1     Running   0          80d
argocd-repo-server-6c6f8859c7-mrwll                 1/1     Running   0          108d
argocd-server-b77b48886-s2mtg                       1/1     Running   0          80d

In this example, the pod managing the webhook notifications is argocd-notifications-controller-6cd988b564-sql55. To get the logs, run the following command:

kubectl logs argocd-notifications-controller-6cd988b564-sql55 -n argocd

If your trigger was successful, you should seem something similar to this:

time="2023-07-19T02:41:13Z" level=info msg="Start processing" app=argocd/app-direct
time="2023-07-19T02:41:13Z" level=info msg="Trigger on-sync-succeeded result: []" app=argocd/app-direct
time="2023-07-19T02:41:13Z" level=info msg="Notification about condition 'on-sync-succeeded.[0].zxM90Et6k4Elb1-fHdjtDJq0xR0' already sent to ''" app=argocd/app-direct
time="2023-07-19T02:41:13Z" level=info msg="Processing completed" app=argocd/app-direct

The following options are available to get assistance from the Cortex Customer Engineering team:

  • Chat: Available in the Resource Center

  • Slack: Users with a connected Slack channel will have a workflow added to their account. From here, you can either @CortexTechnicalSupport or add a :ticket: reaction to a question in Slack, and the team will respond directly.

Don’t have a Slack channel? Talk with your Customer Success Manager.

Still need help?

Email: , or open a support ticket in the in app Resource Center

ArgoCD
entity detail pages
Cortex Workflows to automate ArgoCD syncs
Webhooks
deploy REST endpoint
​
help@cortex.io