crossplane-contrib / crossplane-contrib/function-extra-resources

Unable to select without matchLabels filter.

Open
#59 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
33
Forks
22
PR merge metrics
No merged PRs in 30d

Description

### 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.