From 022fb85b10d64673c9687693655c3f8fe48f0936 Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Tue, 19 Nov 2024 12:56:38 +0100 Subject: [PATCH] Fix initial sync for `ClusterLogForwarder` resources Add `SkipDryRunOnMissingResource=true` to `ClusterLogForwarder` so that the initial sync of the openshift4-logging ArgoCD app can succeed. --- component/config_forwarding.libsonnet | 10 ++++++++++ .../openshift4-logging/31_cluster_logforwarding.yaml | 3 ++- .../openshift4-logging/31_cluster_logforwarding.yaml | 3 ++- .../openshift4-logging/32_namespace_logforwarding.yaml | 6 ++++-- .../openshift4-logging/31_cluster_logforwarding.yaml | 3 ++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/component/config_forwarding.libsonnet b/component/config_forwarding.libsonnet index dcaa4aa..c1cf1e5 100644 --- a/component/config_forwarding.libsonnet +++ b/component/config_forwarding.libsonnet @@ -225,6 +225,11 @@ local unfoldSpecs(specs) = { // ClusterLogForwarder: // Create definitive ClusterLogForwarder resource from specs. local clusterLogForwarder = lib.ClusterLogForwarder(params.namespace, 'instance') { + metadata+: { + annotations+: { + 'argocd.argoproj.io/sync-options': 'SkipDryRunOnMissingResource=true', + }, + }, spec: unfoldSpecs(clusterLogForwarderSpec), }; @@ -243,6 +248,11 @@ local namespaceLogForwarder = [ local serviceAccount = std.get(specs, 'serviceAccountName', utils.namespacedName(forwarder).name); lib.ClusterLogForwarder(namespace, name) { + metadata+: { + annotations+: { + 'argocd.argoproj.io/sync-options': 'SkipDryRunOnMissingResource=true', + }, + }, spec: { serviceAccountName: serviceAccount } + com.makeMergeable(unfoldSpecs(specs)), } for forwarder in std.objectFields(params.namespaceLogForwarder) diff --git a/tests/golden/legacy/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml b/tests/golden/legacy/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml index b6f6990..69c1e22 100644 --- a/tests/golden/legacy/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml +++ b/tests/golden/legacy/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml @@ -1,7 +1,8 @@ apiVersion: logging.openshift.io/v1 kind: ClusterLogForwarder metadata: - annotations: {} + annotations: + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true labels: name: instance name: instance diff --git a/tests/golden/master/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml b/tests/golden/master/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml index c4d68e0..6ed51d1 100644 --- a/tests/golden/master/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml +++ b/tests/golden/master/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml @@ -1,7 +1,8 @@ apiVersion: logging.openshift.io/v1 kind: ClusterLogForwarder metadata: - annotations: {} + annotations: + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true labels: name: instance name: instance diff --git a/tests/golden/master/openshift4-logging/openshift4-logging/32_namespace_logforwarding.yaml b/tests/golden/master/openshift4-logging/openshift4-logging/32_namespace_logforwarding.yaml index 1c2d4e6..f9b4483 100644 --- a/tests/golden/master/openshift4-logging/openshift4-logging/32_namespace_logforwarding.yaml +++ b/tests/golden/master/openshift4-logging/openshift4-logging/32_namespace_logforwarding.yaml @@ -1,7 +1,8 @@ apiVersion: logging.openshift.io/v1 kind: ClusterLogForwarder metadata: - annotations: {} + annotations: + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true labels: name: bar name: bar @@ -27,7 +28,8 @@ spec: apiVersion: logging.openshift.io/v1 kind: ClusterLogForwarder metadata: - annotations: {} + annotations: + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true labels: name: hands name: hands diff --git a/tests/golden/multilineerr/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml b/tests/golden/multilineerr/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml index ad037a2..15009bd 100644 --- a/tests/golden/multilineerr/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml +++ b/tests/golden/multilineerr/openshift4-logging/openshift4-logging/31_cluster_logforwarding.yaml @@ -1,7 +1,8 @@ apiVersion: logging.openshift.io/v1 kind: ClusterLogForwarder metadata: - annotations: {} + annotations: + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true labels: name: instance name: instance