feat: add LABEL_SELECTOR to filter which OnePasswordItems the operator reconciles#276
Open
ochumakov wants to merge 1 commit into
1Password:main1Password/onepassword-operator:mainfrom
ochumakov:feature/label-selector-filterochumakov/onepassword-operator:feature/label-selector-filterCopy head branch name to clipboard
Open
feat: add LABEL_SELECTOR to filter which OnePasswordItems the operator reconciles#276ochumakov wants to merge 1 commit into1Password:main1Password/onepassword-operator:mainfrom ochumakov:feature/label-selector-filterochumakov/onepassword-operator:feature/label-selector-filterCopy head branch name to clipboard
ochumakov wants to merge 1 commit into
1Password:main1Password/onepassword-operator:mainfrom
ochumakov:feature/label-selector-filterochumakov/onepassword-operator:feature/label-selector-filterCopy head branch name to clipboard
Conversation
Contributor
|
If you're new to commit signing, there are different ways to set it up: Sign commits with
|
ochumakov
force-pushed
the
feature/label-selector-filter
branch
from
July 6, 2026 16:28
8241f9f to
ca57cdb
Compare
ochumakov
force-pushed
the
feature/label-selector-filter
branch
from
July 6, 2026 16:29
ca57cdb to
2008de6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ Summary
Adds an optional
LABEL_SELECTORenvironment variable. When set, the operator only reconcilesOnePasswordItemresources whose labels match the selector; unset (the default) reconciles all items, so behavior is unchanged for existing deployments.This enables running multiple operators that watch the same namespaces where each 1Password Connect token / service account only has access to its own vaults. Without it, every operator reconciles every
OnePasswordItemcluster-wide and returns403: token does not have access to vaulton items it doesn't own, racing to overwrite each other'sOnePasswordItemstatus. Giving each operator a distinct label selector makes each item owned by exactly one operator.Implementation: a
predicate.LabelSelectorPredicateon theOnePasswordItemcontroller'sSetupWithManager(scoped to that controller only — the Deployment auto-restart watcher is untouched). The selector is parsed once fromLABEL_SELECTORviametav1.ParseToLabelSelector; an invalid value fails fast at startup. No CRD/API change — it filters on existingmetadata.labels.Example:
```yaml
operator Deployment env
value: "operator-owner=team-a"
apiVersion: onepassword.com/v1
kind: OnePasswordItem
metadata:
name: example-secret
labels:
operator-owner: team-a # reconciled by the operator above; others ignore it
spec:
itemPath: "vaults//items/"
```
🔗 Resolves:
N/A (no existing issue found)
✅ Checklist
internal/controller/onepassworditem_predicate_test.go)USAGEGUIDE.md(both env-var lists + a new "Filtering which OnePasswordItems an operator reconciles" section),config/manager/manager.yaml,test/e2e/manifests/manager.yaml,CHANGELOG.md🕵️ Review Notes &⚠️ Risks
LABEL_SELECTORset ⇒ nil selector ⇒ no predicate ⇒ all items reconciled (today's behavior).OnePasswordItemcontroller; the Deployment/secret-update paths are unchanged.make testandmake lintpass; no generated-file drift.Secretdata (notOnePasswordItemstatus), so it does not cause the status flapping this addresses. Could be a follow-up if desired.{#PR}placeholder in theCHANGELOG.md"Latest" entry should be replaced with this PR number.