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

Dapr generates invalid service when target deployment uses select.matchExpressions instead of selector.matchLabels #7731

Open
astromechza opened this issue May 15, 2024 · 0 comments
Labels
kind/bug Something isn't working

Comments

@astromechza
Copy link

In what area(s)?

/area operator

/area docs

What version of Dapr?

1.1.x

Expected Behavior

When I submitted the following deployment, I expected the generated nodeapp-dapr service to use the match expressions.

apiVersion: apps/v1
kind: Deployment
metadata:
    name: node-example-app
spec:
    replicas: 1
    selector:
        matchExpressions:
            - key: score-workload
              operator: In
              values:
                - node-example-app
    template:
        metadata:
            annotations:
                dapr.io/app-id: nodeapp
                dapr.io/app-port: "3000"
                dapr.io/enable-api-logging: "true"
                dapr.io/enabled: "true"
            labels:
                score-workload: node-example-app
        spec:
            containers:
                - env:
                    - name: APP_PORT
                      value: "3000"
                    - name: STATE_STORE_NAME
                      value: redis-bhdai2
                  image: ghcr.io/dapr/samples/hello-k8s-node:latest
                  name: nodeapp

Actual Behavior

Due to

Selector: wrapper.GetMatchLabels(),
and
return d.Spec.Selector.MatchLabels
, the service ends up with NO selector, and ends up not matching any pods - making the service uncallable.

Steps to Reproduce the Problem

Follow the hello-world-kubernetes tutorial (with pythonapp and nodeapp) but replace the match labels in the node app with equivalent match expressions.

Release Note

RELEASE NOTE: FIX Dapr operator now correctly supports applications using matchExpressions.

@astromechza astromechza added the kind/bug Something isn't working label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant