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

Autogenerated upstream from (service) backend does not match name from CRD: upstream doesn't exist #2267

Open
martin-schulze-e2m opened this issue Jul 25, 2024 · 7 comments

Comments

@martin-schulze-e2m
Copy link

martin-schulze-e2m commented Jul 25, 2024

Current State

I could find no documentation about how to do this. My understanding was, that the upstream should be named the same as the referenced service and be in the same namespace but I still get:

ApisixIngress synced failed, with error: upstream doesn't exist. It will be created after ApisixRoute is created referencing it.

For a concrete example:

apiVersion: apisix.apache.org/v2
kind: ApisixUpstream
metadata:
  name: bitter
spec:
  timeout:
    read: 180s
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: bitter
spec:
  http:
    - backends:
        - serviceName: bitter
          servicePort: 80
      match:
        hosts:
          - bitter.test
        paths:
          - /*
      name: route-open

I can see that this backend creates an upstream called default_bitter_80 but the upstream config is not applied (as told by the error message). Similarly, I can't name the Upstream default_bitter_80 because K8s forbids _, so how am I supposed to get this to match?

Update
When I tried to use another name I get the error message ApisixIngress synced failed, with error: service "bitter--80" not found, so it seems the name was right but the upstream was still not matched

APISIX Version: 3.9.1

Desired State

Describe how one can configure the autogenerated upstream from a backend route.

@kayx23
Copy link
Member

kayx23 commented Jul 25, 2024

I have run into upstream doesn't exist. It will be created after ApisixRoute is created referencing it. when kubectl apply an upstream manifest. But once I created the service with route in it pointing to the upstream, I can apply the ApisixUpstream manifest without issue.

All I did was I made sure these correspond:

image

and that you create the ApisixRoute first and ApisixUpstream second.

@martin-schulze-e2m
Copy link
Author

martin-schulze-e2m commented Jul 31, 2024

I deleted the upstream and upgraded the helm chart that creates both route and upstream. Still the same error despite the route existing before the upstream.

I am also wondering how the matching should work, considering that the full upstream name contains the port number but the upstream CRD does not.

@martin-schulze-e2m
Copy link
Author

martin-schulze-e2m commented Jul 31, 2024

I reproduced this on a local test cluster with log_level: debug in the ingress controller and got this additional message:

debug	apisix/upstream.go:43	try to look up upstream	{"name": "default_bitter_80_service"

However, as I said, the actual upstream name is default_bitter_80, so no wonder there is no match.

Please note that I am relying on the bitnami chart version 3.3.9.

With this I also think that this is not a docs issue (though the docs around this could be improved) but an actual bug.

This used to work with APISIX 3.5.0 (from bitnami chart version 2.1.1)

@martin-schulze-e2m martin-schulze-e2m changed the title docs: How to configure an upstream from an autogenerated (service) backend via CRDs? Upstream from an autogenerated (service) backend does not match name from CRD: upstream doesn't exist Aug 6, 2024
@martin-schulze-e2m martin-schulze-e2m changed the title Upstream from an autogenerated (service) backend does not match name from CRD: upstream doesn't exist Autogenerated upstream from (service) backend does not match name from CRD: upstream doesn't exist Aug 6, 2024
Copy link

github-actions bot commented Nov 5, 2024

This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 5, 2024
@martin-schulze-e2m
Copy link
Author

I would still like to get this working as it prevents upgrades.

@github-actions github-actions bot removed the stale label Nov 6, 2024
@renanramonh
Copy link

I'm having the same issue. ApisixUpstream is not working in the latest version.

@rizalalfarizi123
Copy link

rizalalfarizi123 commented Nov 20, 2024

I'm having the same issue. ApisixUpstream is not working in the latest version.

any updates? @renanramonh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants