How could the existance of the "spec.rules.host" field in each item under "speck.rules" can be checked, in a way that if any of them do not have such entry, it would trigger a "deny"?
apiVersion: getambassador.io/v3alpha1
kind: FilterPolicy
metadata:
name: multi-domain-policy
spec:
rules:
- host: foo.bar.com
path: "*"
filters:
- name: foo-keycloak
- host: example.com
path: "*"
filters:
- name: example-auth0
For some reason I can't understand, this is not workin:
violation[{"msg": msg}] {
hostExists := input.review.object.spec.rules[_].host
not hostExists
msg := sprintf("This is the value: %v", [hostExists])
}
You could use an array comprehension to collect rules where the host attribute is missing, then simply count those rules to see if there are any: