argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.74k stars 5.4k forks source link

ServerSide diff is not working #20473

Open kotyara85 opened 1 day ago

kotyara85 commented 1 day ago

Checklist:

Describe the bug

I set annotation argocd.argoproj.io/compare-options=ServerSideDiff=true

Here's helm template sample:

{{- define "k8sServiceHost" }}
  {{- if lookup "v1" "ConfigMap" "kube-public" "cluster-info" }}
    {{- $configmap := (lookup "v1" "ConfigMap" "kube-public" "cluster-info") }}
    {{- $kubeconfig := get $configmap.data "kubeconfig" }}
    {{- $k8sServer := get ($kubeconfig | fromYaml) "clusters" | mustFirst | dig "cluster" "server" "" }}
    {{- $uri := (split "https://" $k8sServer)._1 | trim }}
    {{- (split ":" $uri)._0 | quote }}
  {{- end }}
{{- end }}

which does work correctly with --dry-run=server using helm command

Template:

apiVersion: v1
kind: ConfigMap
metadata:
  name: test
data:
    host: {{ include "k8sServiceHost" . }}

results into:

apiVersion: v1
data:
  host: ''
kind: ConfigMap
metadata:
  labels:
    argocd.argoproj.io/instance: test
  name: test
  namespace: test

Version 1.12.6

crenshaw-dev commented 18 hours ago

I don't think this is related to ServerSideDiff. Argo CD doesn't support Helm lookups (i.e. Helm's --dry-run=server. ServerSideDiff uses the Kubernetes API's server-side dry run feature, not Helm's.