argo-cd icon indicating copy to clipboard operation
argo-cd copied to clipboard

Application and deployment are stuck in degraded despite everything is healthy

Open PercevalCox opened this issue 7 months ago • 2 comments

Checklist:

  • [x] I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • [ ] I've included steps to reproduce the bug.
  • [x] I've pasted the output of argocd version.

Describe the bug

One replicaset was in "Degraded" state, but is now healthy. However, the application state is still Degraded despite all resources are Healthy. Moreover, the deployment is marked as "Degraded" but in the UI, when we click on it, deployment is marked as Healthy (screenshot 3)

Expected behavior Application should by "Healthy" and not "Degraded"

Screenshots

image image image

Version

argocd-server: v2.9.2+c5ea5c4
  BuildDate: 2023-11-20T17:18:26Z
  GitCommit: c5ea5c4df52943a6fff6c0be181fde5358970304
  GitTreeState: clean
  GoVersion: go1.21.3
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v5.2.1 2023-10-19T20:13:51Z
  Helm Version: v3.13.2+g2a2fb3b
  Kubectl Version: v0.24.2
  Jsonnet Version: v0.20.0

chart version : 5.51.4

Logs

time="2023-11-29T10:26:39Z" level=info msg="Refreshing app status (normal refresh requested), level (3)" application=argocd/dev-test-template-golang-master
time="2023-11-29T10:26:39Z" level=info msg="Comparing app state (cluster: https://kubernetes.default.svc, namespace: coresre)" application=argocd/dev-test-template-golang-master
time="2023-11-29T10:26:39Z" level=info msg="getRepoObjs stats" application=argocd/dev-test-template-golang-master build_options_ms=0 helm_ms=0 plugins_ms=0 repo_ms=0 time_ms=8 unmarshal_ms=7 version_ms=0
time="2023-11-29T10:26:39Z" level=info msg="Skipping auto-sync: application status is Synced" application=argocd/dev-test-template-golang-master
time="2023-11-29T10:26:39Z" level=info msg="Updated health status: Degraded -> Healthy" application=dev-test-template-golang-master dest-namespace=coresre dest-server="https://kubernetes.default.svc" reason=ResourceUpdated type=Normal
time="2023-11-29T10:26:39Z" level=error msg="Error constructing app status patch: unable to find api field in struct RawExtension for the json field \"image\"" application=argocd/dev-test-template-golang-master
time="2023-11-29T10:26:39Z" level=info msg="Reconciliation completed" application=argocd/dev-test-template-golang-master dedup_ms=0 dest-name= dest-namespace=coresre dest-server="https://kubernetes.default.svc" diff_ms=30 fields.level=3 git_ms=8 health_ms=0 live_ms=5 patch_ms=0 setop_ms=0 settings_ms=0 sync_ms=0 time_ms=78     

PercevalCox avatar Nov 29 '23 10:11 PercevalCox

More context on @PercevalCox issue.

In fact, it seems to come from the valuesObject section of the Application for helm.

We had an Application looking somewhat like

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: the-application-name
  namespace: argocd
  finalizers:
  - resources-finalizer.argocd.argoproj.io
spec:
  project: a-project-name
  source:
    repoURL: git@github.***.tld:***/***git
    path: helm
    targetRevision: a-git-revision
    helm:
      valueFiles:
        - values-dev.yaml
      valuesObject:
        image:
            tag: a-tag
      parameters:
        - name: parameter1
          value: parameter1Value
        - name: parameter2
          value: parameter2Value
  destination:
    server: 'https://kubernetes.default.svc'
    namespace: the-namespace
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

This error message in log time="2023-11-29T10:26:39Z" level=error msg="Error constructing app status patch: unable to find api field in struct RawExtension for the json field \"image\"" application=argocd/dev-test-template-golang-master

made us think it could come from the parsing/marshalling of the valuesObject parameter

Moving to something like:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: the-application-name
  namespace: argocd
  finalizers:
  - resources-finalizer.argocd.argoproj.io
spec:
  project: a-project-name
  source:
    repoURL: git@github.***.tld:***/***git
    path: helm
    targetRevision: a-git-revision
    helm:
      valueFiles:
        - values-dev.yaml
      parameters:
        - name: parameter1
          value: parameter1Value
        - name: parameter2
          value: parameter2Value
        - name: image.tag
          value: a-tag
  destination:
    server: 'https://kubernetes.default.svc'
    namespace: the-namespace
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

made the healthy state coming back from degraded to healthy after deployment was complete.

So it seems there's something buggy/misunderstood in the valuesObject section.

Maybe someone can help on this?

vincentlepot avatar Nov 29 '23 13:11 vincentlepot

This looks like a duplicate of #15126 to me; more info in that thread

PaulSonOfLars avatar Jan 02 '24 10:01 PaulSonOfLars

Agreed, closing as dupe, as above

jgwest avatar Mar 28 '24 19:03 jgwest