Skip to content

Unable to select without matchLabels filter. #59

@martivo

Description

@martivo

What happened?

I want to select all resources without using the "matchLabels" field.

  - step: pull-extra-resources
    functionRef:
      name: function-extra-resources
    input:
      apiVersion: extra-resources.fn.crossplane.io/v1beta1
      kind: Input
      spec:
        extraResources:
          - kind: XFirewallRules
            into: XFirewallRules
            apiVersion: example.com/v1
            type: Selector
            selector:
              minMatch: 1
              maxMatch: 10

I also tried

  - step: pull-extra-resources
    functionRef:
      name: function-extra-resources
    input:
      apiVersion: extra-resources.fn.crossplane.io/v1beta1
      kind: Input
      spec:
        extraResources:
          - kind: XFirewallRules
            into: XFirewallRules
            apiVersion: example.com/v1
            type: Selector
            selector:
              minMatch: 1
              maxMatch: 10
              matchLabels: []

This however finds no objects at all. When I change it to have some "matchLabels" then it works.

  - step: pull-extra-resources
    functionRef:
      name: function-extra-resources
    input:
      apiVersion: extra-resources.fn.crossplane.io/v1beta1
      kind: Input
      spec:
        extraResources:
          - kind: XFirewallRules
            into: XFirewallRules
            apiVersion: example.com/v1
            type: Selector
            selector:
              minMatch: 1
              maxMatch: 10
              matchLabels:
              - key: crossplane.io/claim-namespace
                type: Value
                value: default

I also tried

              matchLabels:
                - key: crossplane.io/composite
                  operator: Exists

But this is not supported by the spec.

How should this work?

As a workaround I have added static labels to all objects so the matchLabels has something to match against.

How can we reproduce it?

Create an extraResource of type Selector that has no "matchLabels" field.

What environment did it happen in?

Function version: 0.1.0 (latest at the moment)

  • Crossplane version 1.20.1

  • Cloud provider or hardware configuration
    AWS

  • Kubernetes version (use kubectl version)
    Client Version: v1.31.3
    Kustomize Version: v5.4.2
    Server Version: v1.32.6-eks-931bdca

  • Kubernetes distribution
    EKS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions