Regression: Ambassador fails to start if there is an IngressClass resource in the cluster
See original GitHub issueDescribe the bug
Ambassador fails to start in a cluster that has an IngressClass
resource (see [1] for log output).
The error appears to be related to the logic here when working with IngressClasses - where the code calls obj.namespace
which fails for IngressClass
because it is a cluster-scoped resource.
This does not fail with Ambassador version 1.8.1 - I believe because the validation in def namespace (self)
was only added in this commit.
To Reproduce Steps to reproduce the behavior:
- Create an IngressClass resource e.g.
apiVersion: networking.k8s.io/v1beta1
kind: IngressClass
metadata:
creationTimestamp: "2021-01-05T22:37:32Z"
generation: 1
managedFields:
- apiVersion: networking.k8s.io/v1beta1
fieldsType: FieldsV1
fieldsV1:
f:spec:
f:controller: {}
manager: oc
operation: Update
time: "2021-01-05T22:37:32Z"
name: nginx
resourceVersion: "5440401"
selfLink: /apis/networking.k8s.io/v1beta1/ingressclasses/nginx
uid: 9f33c857-c6fa-4adb-90cc-a2954b9c962b
spec:
controller: nginx.org/ingress-controller
- Start Ambassador - the pod will fail to start with the error in [1]
Expected behavior
Ambassador startup is not impacted by IngressClass
resources
Versions (please complete the following information):
- Ambassador: 1.9.1, 1.10.0
- Kubernetes environment [e.g. Minikube, bare metal, Google Kubernetes Engine]
- Version [e.g. 1.8.1]
Additional context
Note - we are using annotations
for Ambassador configuration instead of CRDs.
Startup logs: [1]
2021-01-05 23:43:01 diagd 1.9.1 [P61TAEW] ERROR: could not reconfigure: KubernetesObject ingressclass.networking.k8s.io nginx has no namespace (it is cluster-scoped)
2021-01-05 23:43:01 diagd 1.9.1 [P61TAEW] ERROR: KubernetesObject ingressclass.networking.k8s.io nginx has no namespace (it is cluster-scoped)
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/ambassador-0.0.0.dev0-py3.8.egg/ambassador_diag/diagd.py", line 1298, in run
self.load_config_watt(rqueue, url)
File "/usr/lib/python3.8/site-packages/ambassador-0.0.0.dev0-py3.8.egg/ambassador_diag/diagd.py", line 1447, in load_config_watt
fetcher.parse_watt(serialization)
File "/usr/lib/python3.8/site-packages/ambassador-0.0.0.dev0-py3.8.egg/ambassador/fetch/fetcher.py", line 242, in parse_watt
self.handle_k8s(obj)
File "/usr/lib/python3.8/site-packages/ambassador-0.0.0.dev0-py3.8.egg/ambassador/fetch/fetcher.py", line 315, in handle_k8s
if not self.check_k8s_dup(obj.kind, obj.namespace, obj.name):
File "/usr/lib/python3.8/site-packages/ambassador-0.0.0.dev0-py3.8.egg/ambassador/fetch/k8sobject.py", line 119, in namespace
raise AttributeError(f'{self.__class__.__name__} {self.gvk.domain} {self.name} has no namespace (it is cluster-scoped)')
AttributeError: KubernetesObject ingressclass.networking.k8s.io nginx has no namespace (it is cluster-scoped)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Ambassador fails to start if there is an IngressClass resource ...
Ambassador fails to start in a cluster that has an IngressClass resource (see [1] for log output). The error appears to be related...
Read more >Ingress controller | Ambassador
Kubernetes 1.18 introduced the IngressClass resource to the existing networking.k8s.io/v1beta1 API. If you are using 1.14 and above, it is recommended to use ......
Read more >Notes on Ingress Class Compatibility - cert-manager
See Regression: HTTP-01 challenges fail with Istio, Traefik, ingress-gce and Azure AGIC. In v1.5.5, v1.6.2 and 1.7.1 we fixed this problem. If you...
Read more >What Are the Kubernetes Ingress Implementation Options?
Pros: externalTrafficPolicy: “Cluster” has greater compatibility with different Kubernetes Implementations compared to “Local”. (It's not ...
Read more >Using Ambassador Ingress Controller - Minikube - Kubernetes
Note: The Ingress resource must have the annotation kubernetes.io/ingress.class: ambassador for Ambassador to pick it up. hello-ingress.yaml.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @impl . I did try this in a cluster and it appears to have fixed the issue.
Leaving this open until a release ships with the fix.