nautobot / helm-charts

Helm Charts for using Nautobot in Kubernetes environments.
https://docs.nautobot.com/projects/helm-charts/en/stable/
Apache License 2.0
23 stars 18 forks source link

Error defining lifecycleHooks #411

Closed danialre closed 3 months ago

danialre commented 4 months ago

When making the following changes in the chart Values.yaml:

...
nautobot:
  ...
  lifecycleHooks:
    postStart:
      exec:
        # script is volume mounted, defined in extraVolumes and extraVolumeMounts
        command: ["python3", "/some_script.py"]
  ...

I get this error from Helm when updating an existing Nautobot installation:

Error: UPGRADE FAILED: cannot patch "nautobot-default" with kind Deployment: Deployment.apps "nautobot-default" is invalid: spec.template.spec.initContainers[0].lifecycle: Forbidden: may not be set for init containers without restartPolicy=Always

It appears the lifecycle field is applied to the default Nautobot initContainer, which isn't supported by Kubernetes: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#differences-from-regular-containers

Chart version: 2.1.2

gertzakis commented 3 months ago

Nice catch!