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

ExternalService implementation not working with ingress-rules #2263

Open
BasLijten opened this issue Sep 29, 2023 · 0 comments
Open

ExternalService implementation not working with ingress-rules #2263

BasLijten opened this issue Sep 29, 2023 · 0 comments
Assignees
Labels
Milestone

Comments

@BasLijten
Copy link

BasLijten commented Sep 29, 2023

Describe the bug

I have created an external service to route my traffic. However, when trying to applying the ingress-rule, Yarp throws an error

To Reproduce

  1. Create an external service and ingress rule for that service - By lack of documentation, I copied this from one of your test-assets. I had to add "ingressClassName: yarp", otherwise, Yarp would not even see changes in the ingress rules
apiVersion: v1
kind: Service
metadata:
  name: external-service
  namespace: default
spec:
  type: ExternalName
  externalName: external-service.example.com
--- 
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: external-ingress
  namespace: default
  annotations:
    yarp.ingress.kubernetes.io/backend-protocol: https
spec:
  ingressClassName: yarp
  rules:
  - http:
      paths:
      - pathType: Prefix
        path: /cb
        backend:
          service:
            name: external-service
            port:
              number: 443
  1. Apply it kubectl apply -f .\ingress-external.yaml
  2. what the exception being thrown
[06:48:46 DBG] Informer V1Service received Modified notification for Service/external-service.default at resource version 191835
[06:48:46 WRN] Uncaught exception occured while reconciling ingress default/external-ingress
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at Yarp.Kubernetes.Controller.Converters.YarpParser.HandleIngressRule(YarpIngressContext ingressContext, List`1 endpoints, IList`1 defaultSubsets, V1IngressRule rule, YarpConfigContext configContext) in /src/src/Kubernetes.Controller/Converters/YarpParser.cs:line 42
   at Yarp.Kubernetes.Controller.Converters.YarpParser.ConvertFromKubernetesIngress(YarpIngressContext ingressContext, YarpConfigContext configContext) in /src/src/Kubernetes.Controller/Converters/YarpParser.cs:line 31
   at Yarp.Kubernetes.Controller.Services.Reconciler.ProcessAsync(CancellationToken cancellationToken) in /src/src/Kubernetes.Controller/Services/Reconciler.cs:line 56
[06:48:46 INF] [{"RouteId":"minimal-ingress.default:/foo","Match":{"Methods":null,"Hosts":[],"Path":"/foo/{**catch-all}","QueryParameters":null,"Headers":null},"Order":null,"ClusterId":"foo-service.default:8080","AuthorizationPolicy":null,"CorsPolicy":null,"MaxRequestBodySize":null,"Metadata":null,"Transforms":[{"PathPattern":"/{**catch-all}"}]},{"RouteId":"minimal-ingress.default:/bar","Match":{"Methods":null,"Hosts":[],"Path":"/bar/{**catch-all}","QueryParameters":null,"Headers":null},"Order":null,"ClusterId":"bar-service.default:8080","AuthorizationPolicy":null,"CorsPolicy":null,"MaxRequestBodySize":null,"Metadata":null,"Transforms":[{"PathPattern":"/{**catch-all}"}]}]
[06:48:46 INF] [{"ClusterId":"foo-service.default:8080","LoadBalancingPolicy":null,"SessionAffinity":null,"HealthCheck":null,"HttpClient":null,"HttpRequest":null,"Destinations":{"http://10.244.1.2:8080":{"Address":"http://10.244.1.2:8080","Health":null,"Metadata":null}},"Metadata":null},{"ClusterId":"bar-service.default:8080","LoadBalancingPolicy":null,"SessionAffinity":null,"HealthCheck":null,"HttpClient":null,"HttpRequest":null,"Destinations":{"http://10.244.1.3:8080":{"Address":"http://10.244.1.3:8080","Health":null,"Metadata":null}},"Metadata":null}]

Further technical details

  • I was using the latest version in the main branch, as /release/latest didn't work with the kubernetes controller
  • another ingress rule does exist. It doesn't matter if I include the external service with this definition
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations: 
    yarp.ingress.kubernetes.io/transforms: |
      - PathPattern: "/{**catch-all}"
spec:
  ingressClassName: yarp
  rules:
  - http:
      paths:      
      - pathType: Prefix
        path: /foo
        backend:
          service:
            name: foo-service
            port:
              number: 8080
      - pathType: Prefix
        path: /bar
        backend:
          service:
            name: bar-service
            port:
              number: 8080
@BasLijten BasLijten added the Type: Bug Something isn't working label Sep 29, 2023
@MihaZupan MihaZupan self-assigned this Oct 3, 2023
@MihaZupan MihaZupan added this to the v.Next milestone Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants