Desired/Actual State Patterns

HVAC stands for heating, ventilation, and air conditioning.

  • Desired State is the state that you want the system to be in
  • Actual State is the state that the system is actually in

HVAC 에서 원하는(desried) 실내 온도를 설정할 수 있다. 그리고 Actual Temperature 와 비교(diff) 하고 실내 온도가 Desired Temperature 에 도달할 때 까지 해당 과정을 반복해서 수행한다.

Desired/Actual State PatternsKubernetes 에서도 적용된다.

yaml 이 Desired State 이며 resources(pods, …) 들이 Actual State 이다.

By convention, the Kubernetes API makes a distinction between the specification of the desired state of an object (a nested object field called spec(Desired State)) and the status of the object at the current time (a nested object field called status(Actual State)). Over time the system will work to bring the status into line with the spec.

In distributed systems Perceived State refers to the imprecision of our measurements and lag time between when the system was measured and when we observe the results. In the HVAC example, you can think of the current temperature reported by the thermostat as being the Perceived State and know that the Actual State may have changed slightly since the temperature was last probed.

When you’re employing GitOps and IaC, your CD trigger is often the divergence between the actual and desired states.