# Functions
PerformCheckHeadlessMode validates if the Agent has reached the correct goal state The state is fetched from K8s automation config Secret directly to avoid flakiness of mounting process Dev note: there is an alternative way to get current namespace: to read from /var/run/secrets/kubernetes.io/serviceaccount/namespace file (see https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#accessing-the-api-from-a-pod) though passing the namespace as an environment variable makes the code simpler for testing and saves an IO operation.