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
MoM's policy DSL is extremely powerful, but I've been struggling with how to apply it as the documentation is pretty minimal.
I've been trying to write a policy that is selectively applied based on hostname. I've written a helper function (see below), but I can't figure out how to apply it.
# Kubernetes and nomad are orchestrators, so we don't want to apply the balloon policy to them.
# Set "1" (true) if the host is an orchestrator
(def is_orchestrator (guest)
{ (defvar guest_name (guest.Prop "name"))
(defvar is_orchestrator 0)
(if (or (== guest_name "kubernetes.example.com")
(== guest_name "nomad.example.com"))
(set is_orchestrator 1)
is_orchestrator)
}
)
Debug logging shows the value is correctly set. The below result [1, 1, 0, 0] shows that the code finds the 4 guests on the host and correctly sets the is_orchestator value (1 for kubernetes/nomad, 0 for the other hosts):
I'm stuck at the next step; I can't seem to apply the policy conditionally. Various permutations of if statements/parenthesis end up with arity errors or empty results.
Any suggestions on how to write the policy would be appreciated. I'm happy to make a PR for updating the docs once I have a working example. Thanks for your time!
The text was updated successfully, but these errors were encountered:
MoM's policy DSL is extremely powerful, but I've been struggling with how to apply it as the documentation is pretty minimal.
I've been trying to write a policy that is selectively applied based on hostname. I've written a helper function (see below), but I can't figure out how to apply it.
Debug logging shows the value is correctly set. The below result
[1, 1, 0, 0]
shows that the code finds the 4 guests on the host and correctly sets theis_orchestator
value (1 for kubernetes/nomad, 0 for the other hosts):I'm stuck at the next step; I can't seem to apply the policy conditionally. Various permutations of
if
statements/parenthesis end up witharity
errors or empty results.Any suggestions on how to write the policy would be appreciated. I'm happy to make a PR for updating the docs once I have a working example. Thanks for your time!
The text was updated successfully, but these errors were encountered: