cmd: support type!=status in get --status-selector
`flux get --status-selector` only supported equality (`type=status`),
so finding objects that are not in a given state required multiple
invocations, e.g. listing everything that is not ready needed both
`Ready=False` and `Ready=Unknown`.
Add support for a negated selector `type!=status`. Since all resource
adapters delegate matching to the shared `statusMatches` helper and
filtering is centralised in `getRowsToPrint`, negation is implemented
purely in the parse/filter layer by inverting the match result. This
covers every resource type and the `--watch` path without touching the
per-resource adapters.
A missing condition is treated as not-matching by `statusMatches` (Flux
considers it "waiting to be reconciled"), so `Ready!=True` also surfaces
objects that have no Ready condition yet, i.e. the complete not-ready set:
flux get all -A --status-selector Ready!=True
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: 3uzbcqje <3uzbcqje@addy.to>
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
NAME REVISION SUSPENDED READY MESSAGE
|
||||
gr-failed False False failed to checkout and determine revision
|
||||
@@ -0,0 +1,3 @@
|
||||
NAME REVISION SUSPENDED READY MESSAGE
|
||||
gr-failed False False failed to checkout and determine revision
|
||||
gr-unknown False Unknown reconciliation in progress
|
||||
@@ -0,0 +1,2 @@
|
||||
NAME REVISION SUSPENDED READY MESSAGE
|
||||
gr-ready main@sha1:696f056d False True Fetched revision: main@sha1:696f056d
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: {{ .fluxns }}
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
name: gr-failed
|
||||
namespace: {{ .fluxns }}
|
||||
spec:
|
||||
ref:
|
||||
branch: main
|
||||
secretRef:
|
||||
name: flux-system
|
||||
url: ssh://git@github.com/example/repo
|
||||
interval: 5m
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-07-20T00:48:16Z"
|
||||
message: 'failed to checkout and determine revision'
|
||||
reason: GitOperationFailed
|
||||
status: "False"
|
||||
type: Ready
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
name: gr-ready
|
||||
namespace: {{ .fluxns }}
|
||||
spec:
|
||||
ref:
|
||||
branch: main
|
||||
secretRef:
|
||||
name: flux-system
|
||||
url: ssh://git@github.com/example/repo
|
||||
interval: 5m
|
||||
status:
|
||||
artifact:
|
||||
lastUpdateTime: "2021-08-01T04:28:42Z"
|
||||
revision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f
|
||||
path: "example"
|
||||
url: "example"
|
||||
digest: sha1:696f056df216eea4f9401adbee0ff744d4df390f
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-07-20T00:48:16Z"
|
||||
message: 'Fetched revision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f'
|
||||
reason: GitOperationSucceed
|
||||
status: "True"
|
||||
type: Ready
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
name: gr-unknown
|
||||
namespace: {{ .fluxns }}
|
||||
spec:
|
||||
ref:
|
||||
branch: main
|
||||
secretRef:
|
||||
name: flux-system
|
||||
url: ssh://git@github.com/example/repo
|
||||
interval: 5m
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-07-20T00:48:16Z"
|
||||
message: 'reconciliation in progress'
|
||||
reason: Progressing
|
||||
status: "Unknown"
|
||||
type: Ready
|
||||
Reference in New Issue
Block a user