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

selector with matchFields DoesNotExist does not match #802

Closed
martyspiewak opened this issue Apr 12, 2022 · 0 comments · Fixed by #803
Closed

selector with matchFields DoesNotExist does not match #802

martyspiewak opened this issue Apr 12, 2022 · 0 comments · Fixed by #803
Assignees
Labels
bug Something isn't working

Comments

@martyspiewak
Copy link
Contributor

Bug description:

When using the matchFields selector with the DoesNotExist operator, the option does not match when the json path does not exist.

Steps to reproduce:

Please provide a set of steps to reproduce the behavior (example):

  1. Apply this supply chain (with some ClusterTemplates first and second):
apiVersion: carto.run/v1alpha1
kind: ClusterSupplyChain
metadata:
  name: test
selector:
  test: true
resources:
  - name: first
     templateRef:
       kind: ClusterTemplate
       options:
         - name: first
            selector:
              matchFields:
                - key: .spec.params[?(@.name=="non-existent")]
                  operator: DoesNotExist
         - name: second
            selector:
              matchFields:
                - key: .spec.params[?(@.name=="non-existent")]
                  operator: Exists
  1. Apply this workload:
apiVersion: carto.run/v1alpha1
kind: Workload
metadata:
  name: test
labels:
  test: true
spec:
  params:
    - name: some-param
      value: true
  1. Observe status of Workload

Expected behavior:

The first template should match.

Actual behavior:

The status reports an error that 0 templates matched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

1 participant