Skip to content

Automatic modules synchronization

Wrap your platform modules in an application

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: modules
  namespace: argocd
spec:
  destination:
    namespace: argocd
    server: https://kubernetes.default.svc
  project: default
  source:
    repoURL: ${PLATFORM_REPOSITORY}
    targetRevision: main
    path: modules
  syncPolicy:
    syncOptions:
      - PrunePropagationPolicy=orphan
    automated: {}
  • PLATFORM_REPOSITORY: GitLab repository hosting your platform configuration.

Notice the sync-option PrunePropagationPolicy=orphan. It provides a deletion security: if the application file get deleted, the applications generated by the modules applicationSets files will be left on the platform.

With the sync policy set to automated, each change applied to a module file will be automatically synchronized on the platform.

You can apply this file in your platform with kubectl.

Ensure that ArgoCD endpoint is expose

Configure your GitLab repository to trigger Argo CD webhook

  1. Open the Webhooks setting page in your GitLab repository.
    image

  2. Configure the webhook trigger.
    image

  3. URL: your Argo CD webhook endpoint url.

  4. Secret token: the same value you set in gitlabSecret field during the previous step.

  5. Press Add webhook.
    image