newrelic-kubernetes-operator
newrelic-kubernetes-operator copied to clipboard
Bug: Removing `conditions` from Policy spec does not delete conditions
Current behavior
Deleting lines 10-22 from code snippet below, then running kubectl apply
does not delete the NRQL alert condition.
apiVersion: nr.k8s.newrelic.com/v1
kind: Policy
metadata:
name: my-policy
spec:
api_key: {{ NEW_RELIC_API_KEY }}
name: "Alert Policy Created With k8s"
region: "us"
# Remove everything below here
conditions:
- spec:
name: "NRQL Alert Condition Created With k8s"
nrql:
query: "SELECT average(duration) FROM Transaction WHERE appName = 'Dummy App'"
since_value: "3"
enabled: true
terms:
- threshold: "5"
time_function: "all"
duration: "3"
priority: "critical"
operator: "above"
But, if you leave conditions:
there, but leave it empty, it will delete the conditions from the policy.
From an earlier note: Removing the
conditions
property after creating a condition does NOT delete the condition when runningkubectl apply
, however, leaving theconditions
property and leaving it empty will delete any previously created conditions on the policy.
Expected behavior
Removing the conditions
attribute (and its children) should delete the alert conditions.
@sanderblue - I just tested after my most recent work on the policy controller and this appears to be resolved. Can you please confirm and if so, close this issue?
Sure thing. Will take a look.