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

Operator crash loops on RLP targetting HTTPRoute with no namespace in parentRef #333

Closed
adam-cattermole opened this issue Nov 23, 2023 · 0 comments · Fixed by #335
Closed
Assignees

Comments

@adam-cattermole
Copy link
Member

I was testing deploying a RLP in a cluster where I have an HTTPRoute targetting a gateway without the namespace set explicitly. The operator crash loops on this line because we deref a nil pointer https://github.com/Kuadrant/kuadrant-operator/blob/main/pkg/common/gatewayapi_utils.go#L221 as the parentRef.Namespace is nil.

Gateway:

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: toystore-gateway
  namespace: kuadrant-system
spec:
  gatewayClassName: istio
  listeners:
    - allowedRoutes:
        namespaces:
          from: All
      name: http
      port: 80
      protocol: HTTP

HTTPRoute:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: toystore
  namespace: kuadrant-system
spec:
  hostnames:
    - api.toystore.com
  parentRefs:
    - group: gateway.networking.k8s.io
      kind: Gateway
      name: toystore-gateway
  rules:
    - backendRefs:
        - group: ''
          kind: Service
          name: toystore
          port: 80
          weight: 1
      matches:
        - method: GET
          path:
            type: PathPrefix
            value: /cars
        - method: GET
          path:
            type: PathPrefix
            value: /dolls
    - backendRefs:
        - group: ''
          kind: Service
          name: toystore
          port: 80
          weight: 1
      matches:
        - path:
            type: PathPrefix
            value: /admin

RLP:

apiVersion: kuadrant.io/v1beta2
kind: RateLimitPolicy
metadata:
  namespace: kuadrant-system
  finalizers:
    - ratelimitpolicy.kuadrant.io/finalizer
spec:
  limits:
    create-toy:
      rates:
        - duration: 10
          limit: 5
          unit: second
      routeSelectors:
        - matches:
            - method: GET
              path:
                type: Exact
                value: /cars
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: toystore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: To test
Development

Successfully merging a pull request may close this issue.

1 participant