Skip to content

Commit 3de2f0b

Browse files
Add documentation
Signed-off-by: Roelof Kuijpers <[email protected]>
1 parent a1104f5 commit 3de2f0b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pkg/health/health_pod.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ func getCorev1PodHealth(pod *corev1.Pod) (*HealthStatus, error) {
120120
}, nil
121121
}
122122
policy := pod.Spec.RestartPolicy
123+
// If the pod has the AnnotationIgnoreRestartPolicy annotation or its restart policy is Always,
124+
// then treat it as a long-running pod and check its health status.
123125
if _, ok := pod.Annotations[common.AnnotationIgnoreRestartPolicy]; ok || policy == corev1.RestartPolicyAlways {
124126
return getHealthStatus(pod)
125127
}

pkg/sync/doc.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ The following policies define when the hook will be deleted.
6565
- HookFailed - the hook resource is deleted after the hook failed.
6666
- BeforeHookCreation - any existing hook resource is deleted before the new one is created
6767
68+
**Pods with restartPolicy Never or OnFailure**
69+
70+
During synchronization, the application may show the resource health as *Progressing* when it deploys a Pod that has the `restartPolicy` set to `Never` or `OnFailure` (see Kubernetes docs for restart policy). Generally, these resources behave like a Job and are expected to complete. This is intended behavior, since Jobs are commonly used for sync hooks and must finish before an application is considered *Healthy*.
71+
72+
A workaround is to use the annotation: argocd.argoproj.io/ignore-restart-policy: "true".
73+
74+
When this annotation is set on the Pod resource, the controller will ignore the `restartPolicy` and consider the Pod *Running* as a valid healthy state.
75+
6876
# Sync Waves
6977
7078
The waves allow to group sync execution of syncing process into batches when each batch is executed sequentially one after

0 commit comments

Comments
 (0)