nats-io / k8s

NATS on Kubernetes with Helm Charts
Apache License 2.0
444 stars 300 forks source link

Patch args in NATS container #906

Closed ypoplavs closed 2 months ago

ypoplavs commented 2 months ago

What version were you using?

1.1.5 version of Helm charts

What environment was the server running in?

GKE

Is this defect reproducible?

yes

Given the capability you are leveraging, describe your expectation?

Add an option to patch args in NATS container, my goal is to add DEBUG to a command. I'd like to have smth like:

  container:
    patch:
    - op: "replace"
      path: "/spec/template/spec/containers/0/args/-"
      value: ["--config", "/etc/nats-config/nats.conf", "-D"]

Given the expectation, what is the defect you are observing?

Cannot patch args in NATS Container: https://github.com/nats-io/k8s/blob/main/helm/charts/nats/files/stateful-set/nats-container.yaml#L13

caleblloyd commented 2 months ago

Try:

  container:
    patch:
    - op: "add"
      path: "/spec/template/spec/containers/0/args/-"
      value: "-D"
ypoplavs commented 2 months ago

Unfortunately it doesn't work for both cases with the same error:

Error: execution error at (testkube-enterprise/charts/nats/templates/stateful-set.yaml:3:4): key spec does not exist
helm.go:84: [debug] execution error at (testkube-enterprise/charts/nats/templates/stateful-set.yaml:3:4): key spec does not exist
caleblloyd commented 2 months ago

Actually since you are patching the container the path is just /args/-

It may be simpler just to set config.merge.debug = true though