Skip to content

Commit

Permalink
Add ArgoCD sync option server-side apply for CRDs
Browse files Browse the repository at this point in the history
This prevents sync errors when the last-applied-configuration
annotation becomes too big.
  • Loading branch information
haasad committed Jun 27, 2024
1 parent 4de306d commit 562baf7
Show file tree
Hide file tree
Showing 3 changed files with 2,656 additions and 1,216 deletions.
4 changes: 2 additions & 2 deletions class/backup-k8up.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ parameters:
input_type: jsonnet
output_path: apps/
- input_paths:
- backup-k8up/crds/${backup_k8up:images:k8up:tag}/
- backup-k8up/component/crds.jsonnet
output_path: ${_instance}
input_type: copy
input_type: jsonnet
output_type: yaml
- output_path: ${_instance}/01_k8up_helmchart
input_type: helm
Expand Down
25 changes: 25 additions & 0 deletions component/crds.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local prometheus = import 'lib/prometheus.libsonnet';
local inv = kap.inventory();
local params = inv.parameters.backup_k8up;

local load_crds(name) =
std.parseJson(kap.yaml_load_stream(
'dependencies/backup-k8up/crds/%s/%s.yaml' % [
params.images.k8up.tag,
name,
]
));

local syncOptionAnnotation = {
metadata+: {
annotations+: {
'argocd.argoproj.io/sync-options': 'ServerSideApply=true',
},
},
};

local crds = [ crd + syncOptionAnnotation for crd in load_crds('02_k8up_crds') ];

{ '02_k8up_crds': crds }
Loading

0 comments on commit 562baf7

Please sign in to comment.