colebrooke / kubernetes-nagios

Basic health checks for a Kubernetes cluster
MIT License
50 stars 44 forks source link

.status.conditions[] order behavior changed in version 1.20? #23

Open Soren90 opened 2 years ago

Soren90 commented 2 years ago

Hi,

I've been using this script for a while and it has been working great. But I've had some issues with the deployment script as it seems like .status.conditions[-1] has changed to .status.conditions[0] on all of my deployments except for coredns.

Example deployment 1:

    "availableReplicas": 1,
    "conditions": [
      {
        "lastTransitionTime": "2021-11-01T13:00:41Z",
        "lastUpdateTime": "2021-11-01T13:00:41Z",
        "message": "Deployment has minimum availability.",
        "reason": "MinimumReplicasAvailable",
        "status": "True",
        "type": "Available"
      },
      {
        "lastTransitionTime": "2021-11-01T13:51:56Z",
        "lastUpdateTime": "2021-11-29T15:04:01Z",
        "message": "ReplicaSet \"snapshot-controller-786647474f\" has successfully progressed.",
        "reason": "NewReplicaSetAvailable",
        "status": "True",
        "type": "Progressing"
      }
    ],

Example deployment 2:

    "availableReplicas": 2,
    "conditions": [
      {
        "lastTransitionTime": "2021-11-01T13:51:25Z",
        "lastUpdateTime": "2021-11-01T13:51:32Z",
        "message": "ReplicaSet \"coredns-8474476ff8\" has successfully progressed.",
        "reason": "NewReplicaSetAvailable",
        "status": "True",
        "type": "Progressing"
      },
      {
        "lastTransitionTime": "2021-11-01T13:51:32Z",
        "lastUpdateTime": "2021-11-01T13:51:32Z",
        "message": "Deployment has minimum availability.",
        "reason": "MinimumReplicasAvailable",
        "status": "True",
        "type": "Available"
      }
    ],

This causes my check to get this result:

$ ./check_kube_deployments.sh -n kube-system
Unknown: snapshot-controller has condition Progressing: True - ReplicaSet "snapshot-controller-786647474f" has successfully progressed.
Unknown: dns-autoscaler has condition Progressing: True - ReplicaSet "dns-autoscaler-7df78bfcfb" has successfully progressed.
Unknown: csi-cinder-controllerplugin has condition Progressing: True - ReplicaSet "csi-cinder-controllerplugin-74d8dd876d" has successfully progressed.
OK: coredns has condition Available: True - Deployment has minimum availability.

Anyone else had this issue before?

fireba11 commented 2 years ago

I got this on 2 out of 27 or so deployments -_-