ArgoCD 使用示例
示例
- argocd 检测 git 频率:
timeout.reconciliation: 180s
,参考
权限
AppProject
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: abc
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
clusterResourceWhitelist:
- group: '*'
kind: '*'
namespaceResourceWhitelist:
- group: '*'
kind: '*'
description: abc Team AppProject
destinations:
- name: in-cluster
namespace: argocd
server: https://kubernetes.default.svc
- name: in-cluster
namespace: abc
server: https://kubernetes.default.svc
roles:
- name: admin
description: admin privileges to abc
groups:
- <some-group>
policies:
- p, proj:abc:admin, applications, *, abc/*, allow
- name: readonly
description: Read-only privileges to abc
groups:
- <some-group>
policies:
- p, proj:abc:readonly, applications, get, abc/*, allow
sourceRepos:
- https://github.com/xiexianbin/k8s-manifests.git
json 格式问题
- 当 workflows 参数为 json 时,会出现
workflow.parameters.json
非标准字符串(双引号问题),可参考解决
from base64 import b64decode
from json import loads
from json.decoder import JSONDecodeError
parameters_json = b64decode(r"{{=sprig.b64enc(workflow.parameters.json)}}".encode()).decode()
try:
parameters = loads(parameters_json)
except JSONDecodeError as e:
print(f"JSON not ok: {e}")
raise e
except Exception as e:
print(f"Something not ok: {e}")
raise e
else:
print(parameters)