Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more detailed parameters to resource.exclusions #3415

Closed
h3poteto opened this issue Apr 15, 2020 · 7 comments
Closed

Add more detailed parameters to resource.exclusions #3415

h3poteto opened this issue Apr 15, 2020 · 7 comments
Labels
component:core Syncing, diffing, cluster state cache enhancement New feature or request type:usability Enhancement of an existing feature

Comments

@h3poteto
Copy link

Summary

Add name, annotations or labels parameter to resource.exclusions argument.

Motivation

I want to exclude some Job resources, so I tried to set resource.exclusions:

apiVersion: v1
data:
  resource.exclusions: |
    - apiGroups:
      - "batch"
      kinds:
      - "Job"
      clusters:
      - "*"
kind: ConfigMap

But this parameter can only specify apiGroup, kinds and clusters, so it ignores all Job resources. I don't ignore all Job resources, I want to exclude only specific Jobs.

Next, I tried to specify argocd.argoproj.io/hook: Skip to the Jobs. This is the desired behavior, but the application status is missing and OutOfSync.

Proposal

Add name, annotations or labels to FilteredResource, and implement match functions.
https://github.com/argoproj/argo-cd/blob/476b09cbbf/util/settings/filtered_resource.go

@h3poteto h3poteto added the enhancement New feature or request label Apr 15, 2020
@jannfis jannfis added component:core Syncing, diffing, cluster state cache type:usability Enhancement of an existing feature labels May 14, 2020
h3poteto added a commit to h3poteto/argo-cd that referenced this issue Sep 30, 2020
Add Labels in addition to APIGroups, Kinds, and Clusters to exclude specified resources
h3poteto added a commit to h3poteto/argo-cd that referenced this issue Oct 1, 2020
Add Annotations in addition to APIGroups, Kinds, and Clusters to exclude specified resources
@LeartBeqiraj
Copy link

Is this supported yet?

@unknownbanana
Copy link

We have a use-case for this feature-request.

We're trying to manage a Istio/Maistra controlplane namespace with ArgoCD. However, the Istio/Maistra operator creates NetworkPolicies and RoleBindings for several namespaces in the ControlPlaneServiceMesh. ArgoCD then detects these resources and will mark them as OutOfSync.

This is undesired behavior, since the Istio/Maistra operator is responsible for generating the resources, and since we cannot configure this behavior per namespace would have to resort to exclude all RoleBindings.

If ArgoCD would allow for exclusion based on annotations then we would be able to exclude the generated resources from ArgoCD Syncing without sacrificing current behavior where Argo Syncs RoleBindings for us.

@phj-incom
Copy link

Any updates on this? I am using kyverno to replicate resources in other namespaces, and this is causing argocd to show the generated objects as out of sync.

@AurimasNav
Copy link

AurimasNav commented Sep 16, 2024

Would be really nice to have for all these 3rd party product operators that do not care much about gitops style deployments (like gihtub itself: actions/actions-runner-controller#3533).

@agaudreault
Copy link
Member

Reading all the comments above, this feature is mainly used to improve argo performance by watching less resources that are not required to show in the UI (things like Endpoints, EndpointSlice, kyverno PolicyReport, etc.) and are never expected to be created as code, such as resources created by Kubernetes controller.

If an Argo Application detects these resources and they are OutOfSync state, that would mean that these resources desired state is in git, or they are wrongly configured with the tracking method argo is configured with, but their real desired state is what the controller applies. If they are in git, but they are expected to be created and managed by a controller, you should remove them from git (with kustomize patch delete if you are using kustomize). If you want to define them partially in git, but the controller overrides some necessary initial configurations, the ignoreDifferences can be configured on the Application so the resources appear in the UI, but not out of sync. If they are caused by the tracking method, it is highly suggested to configure the tracking by annotation. If the controller adds that annotation to the object it creates, the controller behavior will need to be fixed.

@unknownbanana
Copy link

Reading all the comments above, this feature is mainly used to improve argo performance by watching less resources that are not required to show in the UI (things like Endpoints, EndpointSlice, kyverno PolicyReport, etc.) and are never expected to be created as code, such as resources created by Kubernetes controller.

If an Argo Application detects these resources and they are OutOfSync state, that would mean that these resources desired state is in git, or they are wrongly configured with the tracking method argo is configured with, but their real desired state is what the controller applies. If they are in git, but they are expected to be created and managed by a controller, you should remove them from git (with kustomize patch delete if you are using kustomize). If you want to define them partially in git, but the controller overrides some necessary initial configurations, the ignoreDifferences can be configured on the Application so the resources appear in the UI, but not out of sync. If they are caused by the tracking method, it is highly suggested to configure the tracking by annotation. If the controller adds that annotation to the object it creates, the controller behavior will need to be fixed.

For us there was no desired state in git, since the resources were generated based on a CRD. Yet Argo still picked up the generated resources and marked them as OutOfSync. We cannot be expected to have all resources in git at all times especially with controllers that generate resources based on CRs.

@agaudreault
Copy link
Member

@unknownbanana Can you validate that the resources created by the controllers, that are not in git, don't contain the configured Argo Tracking label/annotations?

The fix here is to configure your deployed resources not to conflict with argo internal tracking and/or configure argo to use tracking by annotations.

Closing the issue because it can be resolved with existing configurations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:core Syncing, diffing, cluster state cache enhancement New feature or request type:usability Enhancement of an existing feature
Projects
None yet
Development

No branches or pull requests

7 participants