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
-
Open the
Webhooks
setting page in your GitLab repository.
-
Configure the webhook trigger.
-
URL: your Argo CD webhook endpoint url.
-
Secret token: the same value you set in
gitlabSecret
field during the previous step. -
Press
Add webhook
.