Skip to content

Commit 161491c

Browse files
ADD userguide/managingApp/configuration-drift-detection (#6411)
* ADD managingApp/config-drift-detection Signed-off-by: rahulshendre <rahulshendre789@gmail.com> * wording change Signed-off-by: rahulshendre <rahulshendre789@gmail.com> * Update configuration-drift-detection.md Signed-off-by: Eeshaan Sawant <100678386+eeshaanSA@users.noreply.github.com> * fixed formatting Signed-off-by: Rahul Shendre <144231863+rahulshendre@users.noreply.github.com> --------- Signed-off-by: rahulshendre <rahulshendre789@gmail.com> Signed-off-by: Eeshaan Sawant <100678386+eeshaanSA@users.noreply.github.com> Signed-off-by: Rahul Shendre <144231863+rahulshendre@users.noreply.github.com> Co-authored-by: Eeshaan Sawant <100678386+eeshaanSA@users.noreply.github.com>
1 parent a6063fe commit 161491c

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
title: "Configuration drift detection"
3+
linkTitle: "Configuration drift detection"
4+
weight: 8
5+
description: >
6+
Detect and resolve differences between running resources and Git definitions.
7+
---
8+
9+
Configuration drift occurs when running resources diverge from their definitions in Git, typically due to manual ad-hoc changes or direct updates to the cluster.
10+
11+
Since PipeCD uses Git as the single source of truth, all application and infrastructure changes should go through pull requests. When drift occurs, developers need to be notified so they can reconcile the differences.
12+
PipeCD's **configuration drift detection** feature helps you identify these discrepancies. It periodically compares your running resources against the definitions in Git and:
13+
14+
- Displays the comparison results on the application details page
15+
- Sends notifications to developers when drift is detected
16+
17+
## Enabling Configuration drift detection
18+
19+
Configuration drift detection is enabled by default for all applications. You can adjust the interval for how frequently PipeCD compares running resources against Git definitions in your `Piped` configuration. To customize notifications for drift events, see [Configuring notifications](../../managing-piped/configuring-notifications/).
20+
21+
## Ignoring drift detection for specific fields
22+
23+
> **Note:** This feature is currently supported only for Kubernetes Applications.
24+
25+
You can also ignore drift detection for specified fields in your application manifests. In other words, even if the selected fields have different values between live state and Git, the application status will not be set to `Out of Sync`.
26+
27+
Suppose you have the application manifest:
28+
29+
```yaml
30+
apiVersion: apps/v1
31+
kind: Deployment
32+
metadata:
33+
name: simple
34+
spec:
35+
replicas: 2
36+
template:
37+
spec:
38+
containers:
39+
- args:
40+
- hi
41+
- hello
42+
image: gcr.io/pipecd/helloworld:v1.0.0
43+
name: helloworld
44+
```
45+
46+
And you want to ignore the drift detection for these two fields:
47+
- pod's replicas
48+
- `helloworld` container's args
49+
50+
You can add the following statements to `app.pipecd.yaml`:
51+
52+
```yaml
53+
spec:
54+
...
55+
driftDetection:
56+
ignoreFields:
57+
- apps/v1:Deployment:default:simple#spec.replicas
58+
- apps/v1:Deployment:default:simple#spec.template.spec.containers.0.args
59+
```
60+
61+
>**Note:** `ignoreFields` is in the format `apiVersion:kind:namespace:name#yamlFieldPath`
62+
63+
## Detection results
64+
65+
Drift detection reports one of three statuses: `SYNCED`, `OUT_OF_SYNC`, or `DEPLOYING`.
66+
67+
### SYNCED
68+
69+
No drift detected. All running resources match their Git definitions. The application details page displays a green "Synced" mark.
70+
71+
![A screenshot of displaying a 'SYNCED' state](/images/application-synced.png)
72+
<p style="text-align: center;">
73+
Application in SYNCED state
74+
</p>
75+
76+
### OUT_OF_SYNC
77+
78+
Drift detected. An application enters this status when any of the following is true:
79+
80+
- A resource is defined in Git but not running in the cluster
81+
- A resource is running in the cluster but not defined in Git
82+
- A resource exists in both but with differing configurations
83+
84+
The application details page displays a red "Out of Sync" mark.
85+
86+
![Screenshot showing "OUT OF SYNC" resources configuration state](/images/application-out-of-sync.png)
87+
<p style="text-align: center;">
88+
Application in OUT_OF_SYNC state
89+
</p>
90+
91+
Click **Show Details** to see what caused the drift. In the example below, a Deployment's replica count is `300` in Git but `3` in the cluster.
92+
93+
![Application out of sync](/images/application-out-of-sync-details.png)
94+
<p style="text-align: center;">
95+
Details showing why the application is OUT_OF_SYNC
96+
</p>
97+
98+
### DEPLOYING
99+
100+
Deployment in progress. PipeCD pauses drift detection while a deployment is running and resumes it once the deployment completes.
101+
102+
For more information, see the [configuration reference](./configuration-reference/#driftdetection).

0 commit comments

Comments
 (0)