document receivers.spec.resources.matchLabels in v1 API

This functionality has been implemented in #482 but we only want to
expose it in v1 of the API.

Signed-off-by: Max Jonas Werner <mail@makk.es>
This commit is contained in:
Max Jonas Werner 2023-03-27 18:00:42 +02:00
parent ec03bd20a3
commit dbeb5a3241
No known key found for this signature in database
GPG Key ID: EB525E0F02B52140
4 changed files with 36 additions and 5 deletions

View File

@ -29,6 +29,7 @@ type CrossNamespaceObjectReference struct {
Kind string `json:"kind"`
// Name of the referent
// If multiple resources are targeted `*` may be set.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=53
// +required
@ -44,6 +45,7 @@ type CrossNamespaceObjectReference struct {
// MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
// map is equivalent to an element of matchExpressions, whose key field is "key", the
// operator is "In", and the values array contains only "value". The requirements are ANDed.
// MatchLabels requires the name to be set to `*`.
// +optional
MatchLabels map[string]string `json:"matchLabels,omitempty"`
}

View File

@ -87,10 +87,11 @@ spec:
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
are ANDed. MatchLabels requires the name to be set to `*`.
type: object
name:
description: Name of the referent
description: Name of the referent If multiple resources are
targeted `*` may be set.
maxLength: 53
minLength: 1
type: string

View File

@ -215,7 +215,8 @@ string
</em>
</td>
<td>
<p>Name of the referent</p>
<p>Name of the referent
If multiple resources are targeted <code>*</code> may be set.</p>
</td>
</tr>
<tr>
@ -241,7 +242,8 @@ map[string]string
<em>(Optional)</em>
<p>MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is &ldquo;key&rdquo;, the
operator is &ldquo;In&rdquo;, and the values array contains only &ldquo;value&rdquo;. The requirements are ANDed.</p>
operator is &ldquo;In&rdquo;, and the values array contains only &ldquo;value&rdquo;. The requirements are ANDed.
MatchLabels requires the name to be set to <code>*</code>.</p>
</td>
</tr>
</tbody>

View File

@ -637,9 +637,35 @@ A resource entry contains the following fields:
`GitRepository`, `Kustomization`, `HelmRelease`, `HelmChart`,
`HelmRepository`, `ImageRepository`, `ImagePolicy`, `ImageUpdateAutomation`
and `OCIRepository`.
- `name`: The Flux Custom Resource `.metadata.name`.
- `name`: The Flux Custom Resource `.metadata.name` or `*` (if `matchLabels` is specified)
- `namespace` (Optional): The Flux Custom Resource `.metadata.namespace`.
When not specified, the Receiver's `.metadata.namespace` is used instead.
- `matchLabels` (Optional): Annotate Flux Custom Resources with specific labels.
The `name` field must be set to `*` when using `matchLabels`
#### Reconcile objects by name
To reconcile a single object, set the `kind`, `name` and `namespace`:
```yaml
resources:
- apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImageRepository
name: podinfo
```
#### Reconcile objects by label
To reconcile objects of a particular kind with specific labels:
```yaml
resources:
- apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImageRepository
name: "*"
matchLabels:
app: podinfo
```
**Note:** Cross-namespace references [can be disabled for security
reasons](#disabling-cross-namespace-selectors).