我使用ArgoCD已经有几个星期了,我不太明白如何在应用程序中定义spec.source.path。
我设置了以下路径:
...
spec:
source:
repoURL: https://github.com/theautomation/home-assistant.git
targetRevision: main
path: deploy/k8s
...但是,argoCD同步在回购过程中在此路径之外提交提交时,argoCD应该只查看此路径是否发生更改,对吗?还是它不是这样运作的?
充分应用yaml:
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: home-assistant
namespace: devops
annotations:
notifications.argoproj.io/subscribe.slack: cicd
argocd.argoproj.io/manifest-generate-paths: /deploy
spec:
project: default
source:
repoURL: https://github.com/theautomation/home-assistant.git
targetRevision: main
path: deploy/k8s
directory:
recurse: true
destination:
server: https://kubernetes.default.svc
namespace: home-automation
syncPolicy:
syncOptions:
- CreateNamespace=true
- Validate=true
- PrunePropagationPolicy=foreground
- PruneLast=true
automated:
selfHeal: true
prune: true
retry:
limit: 2
backoff:
duration: 5s
factor: 2
maxDuration: 3m发布于 2022-07-27 13:08:12
默认情况下,无论修改了哪些文件,Argo CD都会在提交更改时同步。当应用程序目录引用(通过符号链接或其他机制)中的某个内容位于其目录之外时,这可能会有所帮助。
如果您使用webhooks来触发同步,并且您知道应用程序不受外部文件的影响,则可以使用注解指定要监视更改的目录(或目录)。
如果您不使用webhooks并且依赖于通常的协调循环,那么不管注释是什么,同步仍然会发生。
发布于 2022-07-22 13:57:16
Argo只会查找已应用于您的targetRevision (即main)的更改,以及您定义的path中的更改。假设您在该空间中有一堆清单的deploy/k8s,它将自动查找该路径中文件的更改。此外,bc您已经配置了syncPolicy.automated,它会在找到它时自动应用更改(通常是bc 3-5分钟的git轮询,除非您已经配置了webhooks )。
https://stackoverflow.com/questions/73072273
复制相似问题