Skip to content

Commit cb0f2d5

Browse files
MohdcodeKamaalJimBugwadia
authored
Update ArgoCD docs for Kyverno Helm chart with ServerSideApply and di… (#1440)
* Update ArgoCD docs for Kyverno Helm chart with ServerSideApply and diff guidance Signed-off-by: Kamaal <kamaal@macs-MacBook-Air.local> * Update content/en/docs/installation/platform-notes.md Signed-off-by: Jim Bugwadia <jim@nirmata.com> --------- Signed-off-by: Kamaal <kamaal@macs-MacBook-Air.local> Signed-off-by: Jim Bugwadia <jim@nirmata.com> Co-authored-by: Kamaal <kamaal@macs-MacBook-Air.local> Co-authored-by: Jim Bugwadia <jim@nirmata.com>
1 parent e75c8e4 commit cb0f2d5

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

content/en/docs/installation/platform-notes.md

+29-6
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,38 @@ Depending on the application used to either install and manage Kyverno or the Ku
1010

1111
### Notes for ArgoCD users
1212

13-
When deploying the Kyverno Helm chart with ArgoCD, you will need to enable `Replace` in the `syncOptions`. You may want to also ignore differences in aggregated ClusterRoles which Kyverno uses by default. Aggregated ClusterRoles are built by aggregating other ClusterRoles in the cluster and are dynamic by nature, therefore desired and observed states cannot match.
13+
ArgoCD v2.10 introduced support for `ServerSideDiff`, leveraging Kubernetes’ Server Side Apply feature to resolve OutOfSync issues. This strategy ensures comparisons are handled on the server side, respecting fields like `skipBackgroundRequests` that Kubernetes sets by default, and fields set by mutating admission controllers like Kyverno, thereby preventing unnecessary `OutOfSync` errors caused by local manifest discrepancies.
1414

15-
You can do so by following instructions in these pages of the ArgoCD documentation:
15+
You can enable `ServerSideDiff` in two ways:
16+
* Per Application: Add the `argocd.argoproj.io/compare-options` annotation.
17+
* Globally: Configure it in the `argocd-cmd-params-cm` ConfigMap.
1618

17-
* [Enable Replace in the syncOptions](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#replace-resource-instead-of-applying-changes)
19+
Here is a YAML fragment that shows the annotation in an ArgoCD Application resource:
20+
21+
```yaml
22+
apiVersion: argoproj.io/v1alpha1
23+
kind: Application
24+
metadata:
25+
annotations:
26+
argocd.argoproj.io/compare-options: ServerSideDiff=true,IncludeMutationWebhook=true
27+
28+
...
29+
30+
```
31+
32+
When deploying the Kyverno Helm chart with ArgoCD, it is recommended to use `ServerSideApply` in the `syncOptions`. This approach helps handle metadata issues that may arise when applying the chart.
33+
34+
Additionally, you may want to ignore differences in aggregated ClusterRoles, which Kyverno uses by default. Aggregated ClusterRoles are dynamic and built by combining other ClusterRoles in the cluster, leading to discrepancies between desired and observed states.
35+
36+
You can do so by following these instructions in the ArgoCD documentation:
37+
38+
* [Enable ServerSideApply](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#server-side-apply)
1839
* [Ignore diff in aggregated cluster roles](https://argo-cd.readthedocs.io/en/stable/user-guide/diffing/#ignoring-rbac-changes-made-by-aggregateroles)
1940

20-
ArgoCD uses Helm only for templating but applies the results with `kubectl`. Unfortunately `kubectl` adds metadata that exceeds the limit allowed by Kubernetes. Using `Replace` overcomes this limitation. Another option is to use server-side apply, supported in ArgoCD v2.5+.
41+
**Note:** You may want to avoid using `Replace=true` in the `syncOptions` as it can cause issues with existing resources. It is generally recommended to rely on `ServerSideApply` for handling resource updates smoothly.
42+
2143

22-
Below is an example of an ArgoCD Application manifest that should work with the Kyverno Helm chart:
44+
Here’s an example of an ArgoCD Application manifest that should work with the Kyverno Helm chart:
2345

2446
```yaml
2547
apiVersion: argoproj.io/v1alpha1
@@ -42,7 +64,8 @@ spec:
4264
selfHeal: true
4365
syncOptions:
4466
- CreateNamespace=true
45-
- Replace=true
67+
- ServerSideApply=true
68+
4669
```
4770

4871
For considerations when using Argo CD along with Kyverno mutate policies, see the documentation [here](../writing-policies/mutate.md#argocd).

content/en/docs/writing-policies/mutate.md

+1-14
Original file line numberDiff line numberDiff line change
@@ -1222,22 +1222,9 @@ See the [platform notes](../installation/platform-notes.md#notes-for-argocd-user
12221222

12231223
#### ArgoCD v2.10+
12241224

1225-
ArgoCD version 2.10 added support for [sever side diff](https://argo-cd.readthedocs.io/en/latest/user-guide/diff-strategies/#server-side-diff) which leverage the Kubernetes Server Side Apply feature.
12261225

1227-
Enabling SSA based diffs, requires an annotation to be specified on the application or globally via the “argocd-cmd-params-cm” config map.
1226+
For considerations when using Argo CD (v2.10+) along with Kyverno, ServerSideDiff is recommended as it resolves OutOfSync warnings by delegating the comparison process to Kubernetes. See the documentation [here](../installation/platform-notes.md#argocd).
12281227

1229-
Here is a YAML fragment that shows the annotation in an ArgoCD Application resource:
1230-
1231-
```yaml
1232-
apiVersion: argoproj.io/v1alpha1
1233-
kind: Application
1234-
metadata:
1235-
annotations:
1236-
argocd.argoproj.io/compare-options: ServerSideDiff=true,IncludeMutationWebhook=true
1237-
1238-
...
1239-
1240-
```
12411228

12421229
This [CNCF blog post](https://www.cncf.io/blog/2024/01/18/gitops-and-mutating-policies-the-tale-of-two-loops/) provides a complete example.
12431230

0 commit comments

Comments
 (0)