argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.4k stars 5.29k forks source link

Unable to use sleep preStop hook #18992

Open mogopz opened 2 months ago

mogopz commented 2 months ago

Checklist:

Describe the bug

I'm trying to use the new sleep preStop hook (link) but am getting a field not declared in schema error. After looking at the FAQ the reason is that the Kubernetes library hasn't been updated to 1.30.

To Reproduce

Try to sync a deployment with the following preStop hook in a 1.30 cluster.

lifecycle:
  preStop:
    sleep:
      seconds: 20
christianh814 commented 2 months ago

@mogopz Just for testing (workaround), does annotating the resource with:

metadata:
  annotations:
    argocd.argoproj.io/sync-options: Validate=false

Work at all? https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#disable-kubectl-validation

jlgeering commented 1 month ago

That did not seem to help

jlgeering commented 1 month ago

this worked for us (we have no mutation webhook):

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app
  # and https://argo-cd.readthedocs.io/en/stable/user-guide/diff-strategies/
  annotations:
    argocd.argoproj.io/compare-options: ServerSideDiff=true