How can I pass a pointer to a file in helm upgrade command?

2/27/2020

I have a truststore file(a binary file) that I need to provide during helm upgrade. This file is different for each target env(dev,qa,staging or prod). So I can only provide this file at time of deployment. helm upgrade --set-file does not take a binary file. This seem to be the issue I found here: https://github.com/helm/helm/issues/3276. This truststore files are stored in Jenkins Credential store.

-- alltej
jenkins
kubernetes
kubernetes-helm

1 Answer

3/11/2020

As the command itself is described below:

--set-file stringArray     set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)

it is also important to know The Format and Limitations of --set.

The error you see: Error: failed parsing --set-file data... means that the file you are trying to use does not meet the requirements. See the example below:

--set-file key=filepath is another variant of --set. It reads the file and use its content as a value. An example use case of it is to inject a multi-line text into values without dealing with indentation in YAML. Say you want to create a brigade project with certain value containing 5 lines JavaScript code, you might write a values.yaml like:

defaultScript: |
  const { events, Job } = require("brigadier")
  function run(e, project) {
    console.log("hello default script")
  }
  events.on("run", run)

Being embedded in a YAML, this makes it harder for you to use IDE features and testing framework and so on that supports writing code. Instead, you can use --set-file defaultScript=brigade.js with brigade.js containing:

const { events, Job } = require("brigadier")
function run(e, project) {
  console.log("hello default script")
}
events.on("run", run)

I hope it helps.

-- OhHiMark
Source: StackOverflow