Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ingress await semantics are too strict #1810

Closed
lkt82 opened this issue Nov 23, 2021 · 8 comments · Fixed by #1832
Closed

Ingress await semantics are too strict #1810

lkt82 opened this issue Nov 23, 2021 · 8 comments · Fixed by #1832
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@lkt82
Copy link

lkt82 commented Nov 23, 2021

Hi

After upgrading to version 3.10.1 We are getting this error on creation of a ingress object

the Kubernetes API server reported that "ingress-system/gateway-default-8i88hdw3" failed to fully initialize or become live: 'gateway-default-8i88hdw3' timed out waiting to be Ready
Ingress has at least one rule that does not target any Service. Field '.spec.rules[].http.paths[].backend.service.name' may not match any active Service

We are using a default Ingress object without any http rules other then host. This has allowed us to share TLS setting with other Ingress objects. This is suppoted by the nginx controller we use.

var defaultIngress = new Pulumi.Kubernetes.Networking.V1.Ingress(
	GetLogicalName("default"), new IngressArgs
	{
		Metadata = new ObjectMetaArgs
		{
			Namespace = _namespace.Metadata.Apply(c => c.Name),
			Annotations =
			{
				{ "nginx.ingress.kubernetes.io/ssl-redirect", "false" }
			}
		},
		Spec = new IngressSpecArgs
		{
			IngressClassName = "nginx",
			Tls ={
				new IngressTLSArgs
				{
					Hosts = PublicIpFqdn,
					SecretName = _certificate.Apply(c=> c.KubernetesSecretName)!
				}
			},
			Rules = new IngressRuleArgs
			{
				Host = PublicIpFqdn
			}
		}

	}, new()
	{
		Parent = this,
		DependsOn = _chart.GetChildren()
	});

Issue details

Steps to reproduce

  1. Provision a ingress object without any http rules

Expected: The update to have no breaking changes
Actual: Did have a breaking change

@lkt82 lkt82 added the kind/bug Some behavior is incorrect or out of spec label Nov 23, 2021
@mikhailshilkov
Copy link
Member

@viveklak It sounds related to #1795. Could you check?

@viveklak
Copy link
Contributor

FWIW before #1795 networking.v1.Ingress was not being waited on at all - essentially the equivalent of setting pulumi.com/skipAwait: "true". This might have worked by accident in the past. I believe you are running into this assertion in the code:

if rule.HTTP == nil {
iia.config.logStatus(diag.Error, fmt.Sprintf("expected value %q is unset for ingress: %s",
".spec.rules[*].http", obj.Name))
return apiVersion, false
}
which was added in #928. I can't find a reference in the ingress spec that suggests rules without HTTP blocks are invalid. I will look a bit deeper. For the time-being you may be able to workaround this by adding the skipAwait annotation above.

@lkt82
Copy link
Author

lkt82 commented Nov 24, 2021

Hi @viveklak I will try to see if skipAwait works.

It's hard for me to say if this usage is invalid or not but what I can say is that we use this in production and ingress-nginx allows it.

@viveklak
Copy link
Contributor

Hi @viveklak I will try to see if skipAwait works.

It's hard for me to say if this usage is invalid or not but what I can say is that we use this in production and ingress-nginx allows it.

I am a bit puzzled about this myself. I will check with @lblackstone when he is back from vacation since it struck me as odd as well. For the time being the skipAwait workaround should work - since essentially that was the behavior you were opaquely relying on previously.

@sziegler-skyhook
Copy link

sziegler-skyhook commented Nov 24, 2021

I am also running into this problem using the AWS ALB Controller + K8S Ingresses.

The ALB controller uses annotations to forward traffic to a specific target group and therefore the backend service name is not an actual K8S service. (see here: https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.2/guide/ingress/annotations/#traffic-routing)

Here is my use case:

kind: Ingress
metadata:
  name: ingress-a
  namespace: default
  annotations:
    alb.ingress.kubernetes.io/actions.forward-to-9443: '{"type":"forward","targetGroupARN":"{{ .Values.aws.primary.TargetGroup }}"}'
  spec:
  rules:
  - http:
      paths:
        - pathType: Prefix
          path: /a
          backend:
            service:
              name: forward-to-9443
              port:
                name: use-annotation
        - pathType: Prefix
          path: /b
          backend:
            service:
              name: forward-to-9443
              port:
                name: use-annotation
        - pathType: Exact
          path: /c
          backend:
            service:
              name: forward-to-9443
              port:
                name: use-annotation

This results in error: Ingress has at least one rule that does not target any Service. Field '.spec.rules[].http.paths[].backend.service.name' may not match any active Service because the service forward-to-9443 does not exist, it is an AWS ALB Annotation.

@viveklak viveklak changed the title Ingress broke in 3.10.1 Ingress await semantics are too strict Nov 24, 2021
@viveklak
Copy link
Contributor

I renamed the issue to use this as a tracking issue to consider relaxing the constraints currently imposed for ingress await logic. The suggested workaround for the moment is to use the pulumi.com/skipAwait: "true" annotation on the affected ingress objects. However, attempts to extract loadbalancer addresses etc. will have to resort to refreshing or polling the ingress object in such cases.

@sziegler-skyhook
Copy link

I agree on both points, skipAwait is a good workaround but the requirements should be relaxed if possible.

@lblackstone
Copy link
Member

Yeah, I expect that we're being too strict on the await logic here. This logic was added back in 2019, so I don't recall the exact reasons for this assertion, but it's most likely just a misunderstanding of the allowed options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants