Skip to content

Approval patch examples hardcode observedGeneration: 1 #105

Description

Both content/en/docs/how-tos/staged-update.md and content/en/docs/tutorials/ArgoCD/index.md show approval kubectl patch commands with a hardcoded \"observedGeneration\":1:

kubectl patch clusterapprovalrequests <name> --type='merge' \
  -p '{"status":{"conditions":[{"type":"Approved","status":"True","reason":"approved","message":"approved","lastTransitionTime":"...","observedGeneration":1}]}}' \
  --subresource=status

The observedGeneration in a metav1.Condition must match the actual .metadata.generation of the ApprovalRequest object at the time of patching; hardcoding 1 will cause the approval controller to reject the condition or misinterpret the approval state if the object has been updated.

The examples should retrieve the generation dynamically, for example:

GEN=$(kubectl get clusterapprovalrequest <name> -o jsonpath='{.metadata.generation}')

and substitute $GEN in the patch payload, or use the kubectl fleet approve plugin (which already handles this correctly) as the primary example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions