newrelic-kubernetes-operator
newrelic-kubernetes-operator copied to clipboard
Alert Policy: `region` does not have a default
Description
Currently a user is required to supply the region
field as part of the spec
for the Policy
configuration. This should be not required.
If the user does not explicitly set a region
, the default value of US
should be used.
Current behavior
When executing kubectl apply -f ./my-alert-policy.yaml
, the operation appears to have succeeded, however the policy is not created and an error occurs under the hood.
Note: The command should also fail to execute which has been reported as a bug in issue #45.
Steps To Reproduce
Steps to reproduce the behavior:
- Ensure the operator is installed and ready
- Use the following
yaml
to configure a minimal Alert Policy (my-alert-policy.yaml
)apiVersion: nr.k8s.newrelic.com/v1 kind: Policy metadata: name: my-policy spec: api_key: <your API key> name: "alert policy created with k8s"
Note: Adding
region: "US"
to the spec will allow a successfulapply
. - Tail the logs of your controller node - first get the node's full name, then tail those logs
kubectl describe nodes -n newrelic-kubernetes-operator-system | grep controller-manager
kubectl logs -f -n newrelic-kubernetes-operator-system -c manager newrelic-kubernetes-operator-controller-manager-<hash goes here>
- Open a new terminal in the current working directory and run the follow command.
The command "succeeds" with an output ofkubectl apply -f ./my-alert-policy.yaml
policy.nr.k8s.newrelic.com/my-policy created
, however an error occurred and the policy does not exist in New Relic. - See error - kubernetes will continue to attempt to provision the resource over and over due to the error:
"error":"unknown region"
Debug Output (if applicable)
{"level":"error", ... ... "msg":"Reconciler error","controller":"policy","request":"default/my-policy","error":"unknown region","stacktrace": ... etc etc