Add RetryPolicy CRUD API and armadactl support#4805
Add RetryPolicy CRUD API and armadactl support#4805dejanzele wants to merge 1 commit intoarmadaproject:masterfrom
Conversation
Greptile SummaryThis PR adds a complete RetryPolicy CRUD API — proto messages, gRPC service, PostgreSQL repository, REST gateway bindings, client library, and Confidence Score: 5/5This PR is safe to merge; all previously flagged issues have been addressed and the implementation follows established patterns. All prior P0/P1 concerns (missing migration, wrong gRPC codes, permission asymmetry, free-form operator string, missing name validation) are fully resolved. The only remaining finding is a P2 cosmetic issue with null output for an empty policy list. No files require special attention; Important Files Changed
Sequence DiagramsequenceDiagram
participant CLI as armadactl
participant Client as pkg/client/retrypolicy
participant Submit as Submit gRPC Server
participant Service as retrypolicy.Server
participant Repo as PostgresRetryPolicyRepository
participant DB as PostgreSQL
CLI->>Client: Create/Update/Delete/Get(policy)
Client->>Submit: gRPC or REST HTTP
Submit->>Service: delegate (e.g. CreateRetryPolicy)
Service->>Service: AuthorizeAction(ctx, permission)
Service->>Service: validate req.Name != ""
Service->>Repo: CreateRetryPolicy(ctx, policy)
Repo->>Repo: proto.Marshal(policy)
Repo->>DB: INSERT INTO retry_policy ON CONFLICT DO NOTHING
DB-->>Repo: RowsAffected
Repo-->>Service: nil or ErrAlreadyExists
Service-->>Submit: types.Empty{} or gRPC status error
Submit-->>Client: response
Client-->>CLI: result
Reviews (10): Last reviewed commit: "Add RetryPolicy CRUD API and armadactl s..." | Re-trigger Greptile |
1d4f603 to
45023c8
Compare
45023c8 to
2119aab
Compare
a797d8b to
63f1c89
Compare
513e46f to
07bffb3
Compare
Introduce RetryPolicy as a first-class API resource with full CRUD operations. This is pure infrastructure with no scheduling behavior changes. Proto: Add RetryPolicy, RetryRule, RetryExitCodeMatcher messages and RetryPolicyService gRPC service with REST gateway bindings on the Submit service. Add retry_policy field to Queue message. Server: Add retrypolicy package with PostgresRetryPolicyRepository (stores serialized proto in retry_policy table) and Server handler with authorization checks. Wire into server startup and register the gRPC service. Add CreateRetryPolicy/DeleteRetryPolicy permissions. Client: Add pkg/client/retrypolicy with Create/Update/Delete/Get/GetAll functions matching the queue client pattern. CLI: Add armadactl commands for create/update/delete/get retry-policy and get retry-policies, all using file-based input for create/update. Add --retry-policy flag to queue create and update commands. Add RetryPolicy as a valid ResourceKind for file-based creation. Signed-off-by: Dejan Zele Pejchev <pejchev@gmail.com> Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
07bffb3 to
aed9ba2
Compare
What type of PR is this?
Feature (retry policy PR 2 of 4)
What this PR does / why we need it
Adds RetryPolicy as a first-class API resource with full CRUD operations, following the same patterns as Queue. Operators can create retry policies and assign them to queues by name.
RetryPolicy,RetryRule,RetryExitCodeMatcherproto messages andRetryActionenum tosubmit.protoRetryPolicyServicegRPC service with Create/Update/Delete/Get/List RPCs/v1/retry-policy/...)retry_policyfield (string, references policy by name) to the Queue proto messageinternal/server/retrypolicy/- repository (PostgreSQL) and gRPC handler, mirroringinternal/server/queue/pkg/client/retrypolicy/- client library for all CRUD operationscmd/armadactl/cmd/retrypolicy.go- CLI commands for managing retry policies--retry-policyflag to queue create/update commandsRetryPolicyresource kind for file-based creation (armadactl create -f policy.yaml)Usage:
Which issue(s) this PR fixes
Part of #4683 (Retry Policy)
Special notes for your reviewer
retry_policytable (name text PK, definition bytea) stores serialized proto, same as thequeuetable