ArgoCD 不会执行 Kubernetes 构建,但可以使用 kubectl
命令检查资源是否已经同步。以下是一个示例脚本,用于检查是否有同步问题:
#!/usr/bin/env bash
# Set the kubectl context
kubectl config use-context
# Loop through all the applications in ArgoCD to see if they are in sync
for app in $(argocd app list | awk '{ print $1 }' | grep -v NAME)
do
# Get the status of the application
status=$(argocd app get $app | awk '{ print $2 }' | grep -v STATUS)
# Check if the application is OutOfSync
if [[ "$status" == "OutOfSync" ]]
then
echo "Application $app is OutOfSync"
fi
done
该脚本会列出 ArgoCD 中所有应用程序的状态,并检查是否存在同步问题("OutOfSync")。如果存在同步问题,则会输出相应的信息。