Skip to content

Commit

Permalink
fix(backendconnection): add another annotation for ArgoCD
Browse files Browse the repository at this point in the history
This is a follow-up to 9b3360f. In
addition to adding the annotation
argocd.argoproj.io/sync-options: Prune=false, we now also set
argocd.argoproj.io/compare-options: IgnoreExtraneous.

This should exclude the resources managed by the operator ArgoCD sync
completely.

See
https://argo-cd.readthedocs.io/en/stable/user-guide/compare-options/#ignoring-resources-that-are-extraneous
  • Loading branch information
basti1302 committed Jan 14, 2025
1 parent 449877f commit dbb8be9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/backendconnection/otelcolresources/desired_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1091,10 +1091,12 @@ func addCommonMetadata(object client.Object) clientObject {
// level resources are pruned (that is basically the same as resources without an owner reference).
// * The docs for preventing this on a resource level are here:
// https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#no-prune-resources
// https://argo-cd.readthedocs.io/en/stable/user-guide/compare-options/#ignoring-resources-that-are-extraneous
if object.GetAnnotations() == nil {
object.SetAnnotations(map[string]string{})
}
object.GetAnnotations()["argocd.argoproj.io/sync-options"] = "Prune=false"
object.GetAnnotations()["argocd.argoproj.io/compare-options"] = "IgnoreExtraneous"
return clientObject{
object: object,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ var _ = Describe("The desired state of the OpenTelemetry Collector resources", f
for _, wrapper := range desiredState {
object := wrapper.object
annotations := object.GetAnnotations()
Expect(annotations).To(HaveLen(1))
Expect(annotations).To(HaveLen(2))
Expect(annotations["argocd.argoproj.io/sync-options"]).To(Equal("Prune=false"))
Expect(annotations["argocd.argoproj.io/compare-options"]).To(Equal("IgnoreExtraneous"))
}
collectorConfigConfigMapContent := getDaemonSetCollectorConfigConfigMapContent(desiredState)
Expect(collectorConfigConfigMapContent).To(ContainSubstring(fmt.Sprintf("endpoint: %s", EndpointDash0TestQuoted)))
Expand Down

0 comments on commit dbb8be9

Please sign in to comment.