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

ignoreDifferences fields not being ignored #18197

Open
tman5 opened this issue May 13, 2024 · 2 comments
Open

ignoreDifferences fields not being ignored #18197

tman5 opened this issue May 13, 2024 · 2 comments
Labels
bug Something isn't working component:diffing

Comments

@tman5
Copy link

tman5 commented May 13, 2024

argo-cd version 2.10.9

  resource.customizations.ignoreDifferences.ConfigMap: |
    jsonPointers:
    - /metadata/annotations/control-plane.alpha.kubernetes.io~1leader
  resource.customizations.ignoreDifferences.Deployment: |
    jqPathExpressions:
    - '.spec.template.spec.containers[0].env[]?.valueFrom.resourceFieldRef.divisor'

Using these configs, I was hoping to exclude argo-cd from constantly seeing updates to those fields in those resources. Here are samples. The ConfigMap field keeps changing and I argo-cd to ignore it:

apiVersion: v1
kind: ConfigMap
metadata:
  annotations:
    control-plane.alpha.kubernetes.io/leader: '{"holderIdentity":"awx-operator-controller-manager-6d9798d479-f72h4_cb240f2f-2d65-43c2-ab4f-29de79a845f4","leaseDurationSeconds":15,"acquireTime":"2024-04-29T20:06:38Z","renewTime":"2024-05-13T12:55:41Z","leaderTransitions":81}'
  creationTimestamp: "2023-10-20T15:20:01Z"
  name: awx-operator
  namespace: awx
  resourceVersion: "815928804"
  uid: c35b6f74-e1b3-41fb-8add-4712237042b4



apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: '127'
  creationTimestamp: '2023-09-01T13:25:12Z'
  generation: 128
  name: clickhouse-operator-altinity-clickhouse-operator
  resourceVersion: '370879221'
  uid: 76e0cfab-2275-4124-bf50-980db6320ab3
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/instance: clickhouse-operator
      app.kubernetes.io/name: altinity-clickhouse-operator
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        checksum/confd-files: edf01e4ffedc0bee07b3946a6cdc949b7d7e4ae2d4306ed9150faa2e1f4975e7
        checksum/configd-files: 8f095c03d0830bf89b9e9d2386ec0ea88cde3f0bef02645704562e568ac9b3e3
        checksum/files: 47ed1460eedaa6bc56d39817a901670154e4552ba86dd09ee3ce6184374de940
        checksum/templatesd-files: 6326575e70831b95612839911f8efbe7fada01600aa70b9c42c897b7dcd0b152
        checksum/usersd-files: b3bddf0ecb44753f75307cd276b21495511a56d3df9b8480ae4a809dee93703c
        clickhouse-operator-metrics/port: '9999'
        clickhouse-operator-metrics/scrape: 'true'
        kubectl.kubernetes.io/restartedAt: '2024-01-19T12:01:29Z'
        prometheus.io/port: '8888'
        prometheus.io/scrape: 'true'
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: clickhouse-operator
        app.kubernetes.io/name: altinity-clickhouse-operator
    spec:
      affinity: {}
      containers:
        - env:
            - name: OPERATOR_POD_NODE_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
            - name: OPERATOR_POD_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.name
            - name: OPERATOR_POD_NAMESPACE
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.namespace
            - name: OPERATOR_POD_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.podIP
            - name: OPERATOR_POD_SERVICE_ACCOUNT
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.serviceAccountName
            - name: OPERATOR_CONTAINER_CPU_REQUEST
              valueFrom:
                resourceFieldRef:
                  containerName: altinity-clickhouse-operator
                  divisor: '0'
@tman5 tman5 added the bug Something isn't working label May 13, 2024
@pict0
Copy link

pict0 commented May 29, 2024

This is how I have it configured. Docs show it needs to be apps_Deployment not Deployment. Hope this helps.

resource.customizations.ignoreDifferences.apps_Deployment: |
      jqPathExpressions:
      - '.spec.template.spec.containers[0].env[]?.valueFrom.resourceFieldRef.divisor'

@jennerm
Copy link

jennerm commented Oct 3, 2024

Thanks @pict0, your ignoreDifferences config works for me.
I tweaked it slightly to apply to all containers, rather than just the first one:

jqPathExpressions:                                                                                                                                                                                                                                        
  - '.spec.template.spec.containers[].env[]?.valueFrom.resourceFieldRef.divisor'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component:diffing
Projects
None yet
Development

No branches or pull requests

4 participants