kubernetes/api

Ingress failed to list *v1beta1.Ingress: ingresses.extensions is forbidden

BuddhiWathsala opened this issue · 2 comments

I have used extensions/v1beta1 library to create ingress in my operator. I'm using operator-sdk to develop the operator. Here is the ingress structure creation code I have used.

func (reconcileSiddhiProcess *ReconcileSiddhiProcess) loadBalancerForSiddhiProcess(m *siddhiv1alpha1.SiddhiProcess) *extensionsv1beta1.Ingress {
	ingress := &extensionsv1beta1.Ingress{
		TypeMeta: metav1.TypeMeta{
			APIVersion: "extensions/v1beta1",
			Kind:       "Ingress",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name:      m.Name,
			Namespace: m.Namespace,
			Annotations: map[string]string{
				"kubernetes.io/ingress.class": "nginx",
				"nginx.ingress.kubernetes.io/rewrite-target": "/",
				"nginx.ingress.kubernetes.io/ssl-redirect": "false",
				"nginx.ingress.kubernetes.io/force-ssl-redirect": "false",
				"nginx.ingress.kubernetes.io/ssl-passthrough": "true",
				"nginx.ingress.kubernetes.io/affinity": "cookie",
				"nginx.ingress.kubernetes.io/session-cookie-name": "route",
				"nginx.ingress.kubernetes.io/session-cookie-hash": "sha1",
			},
		},
		Spec: extensionsv1beta1.IngressSpec{
			Rules: []extensionsv1beta1.IngressRule{
				{
					IngressRuleValue: extensionsv1beta1.IngressRuleValue{
						HTTP: &extensionsv1beta1.HTTPIngressRuleValue{
							Paths: []extensionsv1beta1.HTTPIngressPath{
								{
									Path:    "/",
									Backend: extensionsv1beta1.IngressBackend{ServiceName: m.Name, ServicePort: intstr.IntOrString{Type: Int, IntVal: 8006}},
								},
							},
						},
					},
				},
			},
		},
	}

When I build the operator image and deploy in my minikube cluster and the Service and Deployment created successfully. But Ingress did not create and gives an error like below.

E0401 15:22:25.956017  1 reflector.go:134] sigs.k8s.io/controller-runtime/pkg/cache/internal/informers_map.go:196: Failed to list *v1beta1.Ingress: ingresses.extensions is forbidden: User "system:serviceaccount:default:siddhi-operator" cannot list resource "ingresses" in API group "extensions" in the namespace "default"

I just change the namespace and do it. But it also gives the same error.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@BuddhiWathsala Looks like you don't have enough permissions to list it. 😬

Closing since this isn't an issue with the kubernetes API.