Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pkg/utils/kube/resource_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,13 @@ func (k *kubectlResourceOperations) ApplyResource(ctx context.Context, obj *unst
if dryRunStrategy != cmdutil.DryRunNone {
logWithLevel = logWithLevel.V(1)
}
logWithLevel.WithValues(
"dry-run", [...]string{"none", "client", "server"}[dryRunStrategy],
"manager", manager,
"serverSideApply", serverSideApply,
"serverSideDiff", true).Info(fmt.Sprintf("Applying resource %s/%s in cluster: %s, namespace: %s", obj.GetKind(), obj.GetName(), k.config.Host, obj.GetNamespace()))
if logWithLevel.V(0).Enabled() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not avoiding the if and adding the V(0) in the log statement below?

Copy link
Member Author

@ranakan19 ranakan19 Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought it best to not disturb the verbosity level, since for For dry-run the verbosity level is set at V(1) and the if logWithLevel.V(0).Enabled() condition should pass for V>=0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is going to make a difference if the intention is to suppress this log entry when Argo CD is running in error mode. Error logs are sent with log.Error() not with log.V().Info(). So.. My understanding is that no log entry sent with the Info() method would be visible when setting the log level with error.

logWithLevel.WithValues(
"dry-run", [...]string{"none", "client", "server"}[dryRunStrategy],
"manager", manager,
"serverSideApply", serverSideApply,
"serverSideDiff", true).Info(fmt.Sprintf("Applying resource %s/%s in cluster: %s, namespace: %s", obj.GetKind(), obj.GetName(), k.config.Host, obj.GetNamespace()))
}

return k.runResourceCommand(ctx, obj, dryRunStrategy, func(ioStreams genericclioptions.IOStreams, fileName string) error {
cleanup, err := processKubectlRun(k.onKubectlRun, "apply")
Expand Down