argoproj / argo-cd

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

argocd failed to sync application when argocd connect to cluster apiserver through http proxy,but the http server doesn't support keep-alives conenction. #16480

Open ivan-cai opened 11 months ago

ivan-cai commented 11 months ago

Checklist:

Describe the bug If ArgoCD connect to a cluster apiserver through http proxy,but the http server doesn't support keep-alives conenction, we will get error:

Patch "https://x.x.x.x:6443/apis/apiextensions.k8s.io/v1/customresourcedefinitions/podprobemarkers.apps.kruise.io?fieldManager=argocd-controller": http: server closed idle connection

image image

This issue is related to the number of resources to be applied. The greater the number of resources, the more likely it is to occur. Because ArgoCD creates a task for each resource to be applied, all resources of each Application correspond to a task array. If one task fails, all tasks will be retried. Eventually, some tasks(apply resource) failed when the Last Sync was retried.

the application yaml is:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: ack-verystar-local-kruise-test-reg
  namespace: argocd
spec:
  destination:
    namespace: kruise-system
    server: ${server_url}
  ignoreDifferences:
  - group: admissionregistration.k8s.io
    jqPathExpressions:
    - .webhooks[]?.clientConfig.caBundle
    - .metadata.annotations.template
    kind: MutatingWebhookConfiguration
  - group: admissionregistration.k8s.io
    jqPathExpressions:
    - .webhooks[]?.clientConfig.caBundle
    - .metadata.annotations.template
    kind: ValidatingWebhookConfiguration
  project: default
  sources:
  - chart: kruise
    helm:
      parameters:
      - name: fullnameOverride
        value: kruise
      - name: nameOverride
        value: kruise
      releaseName: kruise
      values: |
        manager:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
                - matchExpressions:
                    - key: type
                      operator: NotIn
                      values:
                        - virtual-kubelet
          resources:
            limits:
              cpu: 200m
              memory: 1Gi
            requests:
              cpu: 100m
              memory: 256Mi
        daemon:
          affinity:
            nodeAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                nodeSelectorTerms:
                  - matchExpressions:
                      - key: type
                        operator: NotIn
                        values:
                          - virtual-kubelet
    repoURL: https://openkruise.github.io/charts/
    targetRevision: 1.5.0
  syncPolicy:
    automated:
      prune: true
    syncOptions:
    - CreateNamespace=true
Paste any relevant application logs here.

Version argocd version:2.7.12

Cloud ArgoCD support set DisableKeepAlives while applying resources(and deleting). For the connection to apiserver with proxy, use HTTP non-persistent connection.

ivan-cai commented 11 months ago

/assign

andrii-korotkov-verkada commented 3 days ago

ArgoCD versions 2.10 and below have reached EOL. Can you upgrade and let us know if the issue is still present, please?