Skip to content

resourceName override on ResourceTemplate to support CRDs with irregular plural #16732

Description

@pcandido

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/<name>404 ("the server could not find the requested resource").

The bug is known (issue #9393, PR #9396) and was fixed for cases like gatewaygateways, but not for chaoschaos (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:

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 👍.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions