Skip to content

Commit

Permalink
api: cross-namespace policy target selectors
Browse files Browse the repository at this point in the history
Signed-off-by: Guy Daich <[email protected]>
  • Loading branch information
guydc committed Jan 24, 2025
1 parent 5b82a02 commit 5772ec8
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api/v1alpha1/policy_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ type TargetSelector struct {

// MatchLabels are the set of label selectors for identifying the targeted resource
MatchLabels map[string]string `json:"matchLabels"`

// NamespaceSelector determines if the label selectors specified in MatchLabels are applied in
// the policy namespace or across all namespaces.
// Note: when referencing targets in a different namespace, appropriate ReferenceGrants must be
// configured to allow the selection.
// +optional
// +notImplementedHide
NamespaceSelector *NamespaceSelector `json:"namespaceSelector,omitempty"`
}

// NamespaceSelector is a selector for selecting either all namespaces or the current namespace.
type NamespaceSelector struct {
// Boolean describing whether all namespaces are selected.
Any bool `json:"any,omitempty"`
}

func (p PolicyTargetReferences) GetTargetRefs() []gwapiv1a2.LocalPolicyTargetReferenceWithSectionName {
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2898,6 +2898,20 @@ _Appears in:_
| `OpenTelemetry` | |


#### NamespaceSelector



NamespaceSelector is a selector for selecting either all namespaces or the current namespace.

_Appears in:_
- [TargetSelector](#targetselector)

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `any` | _boolean_ | true | | Boolean describing whether all namespaces are selected. |


#### OIDC


Expand Down
14 changes: 14 additions & 0 deletions site/content/zh/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2898,6 +2898,20 @@ _Appears in:_
| `OpenTelemetry` | |


#### NamespaceSelector



NamespaceSelector is a selector for selecting either all namespaces or the current namespace.

_Appears in:_
- [TargetSelector](#targetselector)

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `any` | _boolean_ | true | | Boolean describing whether all namespaces are selected. |


#### OIDC


Expand Down

0 comments on commit 5772ec8

Please sign in to comment.