[Bug] Ingress.extensions "grafana-ingress" is invalid - pathType must be specified on Kubernetes 1.20+ #487
Description
Describe the bug
I am not sure whether this is a bug in the opeator behavior, or just the documentation missing a note, but since I haven't found anything related in issues or docs I'm opening this issue.
When running Grafana Operator with kind
in Kubernetes version 1.20 or 1.21, I get the following error when deploying using the default Grafana.yaml
available in deploy/examples
:
2021-07-25T18:53:30.880-0300 DEBUG controller-runtime.manager.eventsWarning {"object": {"kind":"Grafana","namespace":"grafana-operator","name":"example-grafana","uid":"ce1178b4-adaf-490c-a982-767c2a3a53be","apiVersion":"integreatly.org/v1alpha1","resourceVersion":"1264"}, "reason": "ProcessingError", "message": "Ingress.extensions \"grafana-ingress\" is invalid: spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified"}
I have been able to fix this issue by adding the following two attributes to Grafana.yaml
in spec.ingress
:
path: /
pathType: Prefix
If I add just the pathType: Prefix
field the error message changes to:
2021-07-26T09:12:34.486-0300 DEBUG controller-runtime.manager.events Warning {"object": {"kind":"Grafana","namespace":"grafana-operator","name":"example-grafana","uid":"1c0340b9-1e21-4e6b-8e62-920db186e8cf","apiVersion":"integreatly.org/v1alpha1","resourceVersion":"1614"}, "reason": "ProcessingError", "message": "Ingress.extensions \"grafana-ingress\" is invalid: spec.rules[0].http.paths[0].path: Invalid value: \"\": must be an absolute path"}
I think I can submit a PR to fix this issue, but I'd like to know if it's better to just document the required values in the example Grafana.yaml
file or change the operator behavior to automatically add a default value for this field.
To Reproduce
Steps to reproduce the behavior:
- Create
kind
cluster with the commandkind create cluster --image=kindest/node:v1.20.7
- Deploy the Grafana Operator by running:
make install && make cluster/prepare/local
- Run the Operator locally with
make run
- Ingress object is not created, and the processing error message is seen in the logs
Expected behavior
Operator should automatically add a default value OR the example Grafana.yaml
file should be updated to document the required fields in the affected Kubernetes versions.
Suspect component/Location where the bug might be occuring
unknown
Runtime (please complete the following information):
- OS: Linux
- Grafana Operator Version: Latest (running from
master
branch) - Environment: Kind version 0.11.1, Kubernetes 1.21.1 and 1.20.7
- Deployment type: running the operator locally
Additional context
I believe this related to a change introduced in Kubernetes v1.19, where the Ingress pathType
no longer has a default value, and another change introduced in Kubernetes v1.20, which fixes field validation when the host
field contains a wildcard.
I have tested with Kubernetes v1.19.11
and could not reproduce the same problem.
Activity