argoproj / argoproj/argo-workflows

`resourceName` override on ResourceTemplate to support CRDs with irregular plural

Open
#16,732 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
17k
Forks
3.7k
Avg merge
1d 20h
Merged PRs (30d)
138

Description

# Summary

The executor builds the `selfLink` used for `successCondition`/`failureCondition` polling by pluralizing the `Kind` naively (via `k8s.io/gengo/namer.NewAllLowercasePluralNamer`). For CRDs with an irregular plural — where the plural does **not** follow the gengo rules — the resulting path is invalid and the polling fails with 404.

Concrete case: the Chaos Mesh `NetworkChaos` CRD has `plural: networkchaos` (same as the singular). gengo applies the "ends in `s` → add `es`" rule and produces `networkchaoses`. The `WaitResource` then does `GET /apis/chaos-mesh.org/v1alpha1/namespaces/demo/networkchaoses/` → **404** ("the server could not find the requested resource").

The bug is known (issue #9393, PR #9396) and was fixed for cases like `gateway`→`gateways`, but **not** for `chaos`→`chaos` (the gengo rule still produces `chaoses`).

## Use Cases

- Resource templates that create **Chaos Mesh** CRDs (`NetworkChaos`, `PodChaos`, `StressChaos`) and need `successCondition` to wait for the perturbation to revert.
- Any CRD whose plural does not follow English pluralization rules (singular == plural, e.g. `networkchaos`, `podchaos`).

## Proposed change

Add an optional `resourceName` field to `ResourceTemplate`:

```yaml
resource:
action: create
resourceName: networkchaos # override the inferred plural
successCondition: status.experiment.desiredPhase == Stop
manifest: |
apiVersion: chaos-mesh.org/v1alpha1
kind: NetworkChaos
...
```

When `resourceName` is set, `inferObjectSelfLink` uses that value verbatim in the path instead of the inferred plural. When empty, current behavior (backwards compatible).

---

**Message from the maintainers**:

Love this feature request? Give it a 👍. We prioritise the proposals with the most 👍.

Contributor guide

Open the contributing guide

Research direction

Start by tracing ResourceTemplate handling to inferObjectSelfLink and the WaitResource polling path, including how successCondition and failureCondition build the selfLink. Add an optional resourceName override that is used verbatim when set while preserving inferred pluralization when empty; done means irregular-plural CRDs poll successfully without changing existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.