You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In toolkit/k8s/verify.go, there's a function named CheckUnstructuredForReadyState, which takes in an unstructured kubernetes resources and checks if it is in a good state or not. It does this by checking if the resource's phase and conditions, (and container statuses if applicable), are all in a 'good' state. This gets a bit tricky, as each resource can have a different set of applicable phases and conditions. Additionally for conditions, it's not as simple as checking if they are all 'true' as some conditions are only considered 'good' if they are in a false state. For instance, Ready needs to be true, but DiskPressure needs to be false.
Problem
There are two main helper functions invoked by CheckUnstructuredForReadyState to check phases and conditions:
They both use a switch statement to check for known-goods and known-bads, then return an error if something unknown is given. This means that if we want to cover every resource available to kubernetes, we have to 'encode' all the relevant phase and condition info into these functions. This becomes an explosion problem over time as more environments and resources are to be supported. Recently, support for GKE-specific NodeConditions was brought up: #60
How can these functions be simplified to avoid having to update them over time?
The text was updated successfully, but these errors were encountered:
Background
In toolkit/k8s/verify.go, there's a function named
CheckUnstructuredForReadyState
, which takes in an unstructured kubernetes resources and checks if it is in a good state or not. It does this by checking if the resource's phase and conditions, (and container statuses if applicable), are all in a 'good' state. This gets a bit tricky, as each resource can have a different set of applicable phases and conditions. Additionally for conditions, it's not as simple as checking if they are all 'true' as some conditions are only considered 'good' if they are in a false state. For instance,Ready
needs to be true, butDiskPressure
needs to be false.Problem
There are two main helper functions invoked by
CheckUnstructuredForReadyState
to check phases and conditions:They both use a switch statement to check for known-goods and known-bads, then return an error if something unknown is given. This means that if we want to cover every resource available to kubernetes, we have to 'encode' all the relevant phase and condition info into these functions. This becomes an explosion problem over time as more environments and resources are to be supported. Recently, support for GKE-specific NodeConditions was brought up: #60
How can these functions be simplified to avoid having to update them over time?
The text was updated successfully, but these errors were encountered: