There are many instances where the addition of one CR will result in the automatic generation of additional resources. This creates a problem where ArgoCD will not modify the generated resource because it does not yet exist. The first thought might be to use sync waves to so that the first resource would get applied before the second, generated, resource. However, that will not work because, by default, ArgoCD first attempts to do a dry run on all of the resources, but will fail on the resource that does not yet exist.
The solution is to use the annotation SkipDryRunOnMissingResources:
Here is an example that creates the required StorageProfile to allow OpenShift Virtualization to use the Democratic CSI with RWX (ReadWriteMany) storage.
apiVersion: cdi.kubevirt.io/v1beta1
kind: StorageProfile
metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "6"
name: freenas-nfs-csi
spec:
claimPropertySets:
- accessModes:
- ReadWriteMany
volumeMode: Filesystem
cloneStrategy: csi-clone