MAQPNADocs

maqpna delete

Delete resources by name, selector or file (kubectl delete)

Run agents-o json | yaml

Synopsis#

maqpna delete TYPE NAME... | TYPE/NAME... | -f FILE|DIR|URL [-n NS] [-l SELECTOR | --all] [--field-selector F]
              [--cascade background|foreground|orphan] [--grace-period N] [--now] [--force] [--wait=true|false]
              [--timeout D] [--ignore-not-found] [--dry-run none|client|server] [--yes]

Description#

Deleting named objects works as in kubectl. Deleting by selector, --all or a category (maqpna) deletes many objects at once: it asks first on a terminal and needs --yes in scripts, like maqpna's other destructive commands. Deleting an AgentSession tears its sandbox down; maqpna session delete --terminate-now also revokes its token at the gateway at once. activerevocations are deleted through the gateway (maqpna revocations delete).

Flags#

FlagTypeDescriptionDefault
-A, --all-namespacesswitchall namespacesnone
-R, --recursiveswitchrecurse into sub-directories of -f directoriesnone
--allswitchevery object of the type (in the namespace, or with -A in all)none
--allow-gateway-mismatchswitchsend the context's login token to a gateway other than the one it was issued for (env MAQPNA_ALLOW_GATEWAY_MISMATCH=1)none
--cascadestringbackground | foreground | orphan (dependents: sandboxes, pods)background
--dry-runstringnone | client (nothing is sent) | server (the API server checks the change and stores nothing)none
-f, --filenamestringmanifest file, directory, URL or - (stdin); repeatablenone
--field-selectorstringfield selector evaluated on any field (spec.agentRef=coder,status.phase!=Failed)none
--forceswitchwith --grace-period=0: remove at once, without waiting for the termination to be confirmednone
--gatewaystringgateway base URL (env MAQPNA_GATEWAY_URL; default: the context's gateway)none
--grace-periodintseconds the objects get to terminate (-1: their default)-1
--ignore-not-foundswitcha missing named object is not an errornone
-l, --selectorstringlabel selector (e.g. app=coder,tier!=t0); Kubernetes kindsnone
-n, --namespacestringnamespacedefault
--nowswitchsame as --grace-period=1none
--oidc-token-filestringfile holding an OIDC access token for the admin API (env MAQPNA_OIDC_TOKEN_FILE); wins over --tokennone
--timeoutdurationgive up waiting after this long (0: no limit)none
--tokenstringstatic admin token (env MAQPNA_ADMIN_TOKEN; dev/break-glass)none
--waitswitchwait until the objects are gonetrue
-y, --yesswitchdo not ask for confirmation (required when stdin is not a terminal)none

The global flags (--context, -o, --no-color, ...) work with every command.

Examples#

maqpna delete sess coder-x1 -n team-a
maqpna delete -f agent.yaml
maqpna delete sess -l maqpna.com/agent=coder -n team-a --yes

What happens when you run it#

  • Talks to the gateway: --gateway, else MAQPNA_GATEWAY_URL, else the current context's gateway (maqpna context).
  • Authenticates to the admin API with the token stored by maqpna login, --oidc-token-file, or a static --token (MAQPNA_ADMIN_TOKEN).
  • --dry-run: none | client (nothing is sent) | server (the API server checks the change and stores nothing).
  • --yes: do not ask for confirmation (required when stdin is not a terminal).
  • --force: with --grace-period=0: remove at once, without waiting for the termination to be confirmed.
  • --wait: wait until the objects are gone.
  • Prints a table by default; -o json or -o yaml print the data, and --jq EXPR filters the JSON.

Exit codes#

CodeMeaning
0success
1error (the message says what failed, with a hint when there is one)
2usage error: unknown flag, missing argument or bad value; the synopsis is printed
3a check failed, a change is blocked, or a result did not match (tamper, policy mismatch) (not used by this command)