Skip to content

Commit

Permalink
Merge pull request #501 from fluxcd/matchlabels-v1
Browse files Browse the repository at this point in the history
un-document receivers.spec.resources.matchLabels
  • Loading branch information
makkes authored Mar 27, 2023
2 parents f8ab99e + e7c8c7b commit 0863edc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 40 deletions.
2 changes: 0 additions & 2 deletions api/v1beta2/reference_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ type CrossNamespaceObjectReference struct {
Kind string `json:"kind,omitempty"`

// Name of the referent.
// If multiple resources are targeted `*` may be set.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=53
// +required
Expand All @@ -45,7 +44,6 @@ 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"`
}
5 changes: 2 additions & 3 deletions config/crd/bases/notification.toolkit.fluxcd.io_alerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,10 @@ 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. MatchLabels requires the name to be set to `*`.
are ANDed.
type: object
name:
description: Name of the referent. If multiple resources are
targeted `*` may be set.
description: Name of the referent.
maxLength: 53
minLength: 1
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,10 @@ 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. MatchLabels requires the name to be set to `*`.
are ANDed.
type: object
name:
description: Name of the referent. If multiple resources are
targeted `*` may be set.
description: Name of the referent.
maxLength: 53
minLength: 1
type: string
Expand Down
6 changes: 2 additions & 4 deletions docs/api/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,7 @@ string
</em>
</td>
<td>
<p>Name of the referent.
If multiple resources are targeted <code>*</code> may be set.</p>
<p>Name of the referent.</p>
</td>
</tr>
<tr>
Expand All @@ -768,8 +767,7 @@ 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.
MatchLabels requires the name to be set to <code>*</code>.</p>
operator is &ldquo;In&rdquo;, and the values array contains only &ldquo;value&rdquo;. The requirements are ANDed.</p>
</td>
</tr>
</tbody>
Expand Down
29 changes: 1 addition & 28 deletions docs/spec/v1beta2/receivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,36 +635,9 @@ A resource entry contains the following fields:
`GitRepository`, `Kustomization`, `HelmRelease`, `HelmChart`,
`HelmRepository`, `ImageRepository`, `ImagePolicy`, `ImageUpdateAutomation`
and `OCIRepository`.
- `name`: The Flux Custom Resource `.metadata.name` or it can be set to '*' wildcard(when `matchLabels` is specified)
- `name`: The Flux Custom Resource `.metadata.name`.
- `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`

#### Annotate objects by name

To annotate single Flux object, set the `kind`, `name` and `namespace`:

```yaml
resources:
- apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageRepository
name: podinfo
```

#### Annotate objects by label

To annotate Flux objects of a particular kind with specific labels:

```yaml
resources:
- apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageRepository
name: "*"
matchLabels:
app: podinfo
```


**Note:** Cross-namespace references [can be disabled for security
reasons](#disabling-cross-namespace-selectors).
Expand Down

0 comments on commit 0863edc

Please sign in to comment.