Drone

Drone helm chart does not support installing license key

Hello, I purchased an enterprise license for drone but cannot install the license with the helm chart on https://github.com/helm/charts/tree/master/stable/drone. am i missing something or is this feature missing from the chart?

note: i am not using drone for kubernetes. I’m running regular drone server/agent on kubernetes.

hey there and thanks for purchasing a license :slight_smile: Unfortunately we are not responsible for the helm chart (have never actually used helm).

does the helm chart prevent you from specifying custom environment variables and custom config maps? Ideally you could store the license key in a config map that is mounted into the server container, and then set DRONE_LICENSE variable to that mount path.

Correct, there is no way in the chart to mount an arbitrary file into the server container (from configmap or secret).

I can specify an environment variable, but it looks like that is just a reference to the file. From best i can tell, you cant just put the license key value into the env var.

In this case we should be able to add an option to load the secret directly from an environment variable (as an alternative to a file). We should be able to have an updated image available end of day today.

Appreciate it, but i do have one concern with this approach. Since the license key has line breaks, im not sure how well that would work as an environment variable value. It may need to be encoded so it can be a single line string, then the drone server could decode it before using it. just a thought. im sure there are other methods.

I shared your concerns so I did some testing and can confirm this will work. I created a multi-line environment variable with the following command:

DRONE_LICENSE=$(cat /tmp/LICENSE.txt)

Note that when you print the variable you need to wrap in quotes, otherwise bash strips the newlines.

$ cat "$DRONE_LICENSE"
-----BEGIN LICENSE KEY-----
Thjh7sTA1VDE4OjM2tpmQQZCyRd43M1ODI1OVoiLCJkYXQiSukU/Y
-----END LICENSE KEY-----

I then applied and tested the below patch, which I was able to confirm works with files and with string literals.

	var decoded *license.License
+	if strings.HasPrefix(path, "-----BEGIN LICENSE KEY-----") {
+		decoded, err = license.Decode([]byte(path), pub)
	} else {
		decoded, err = license.DecodeFile(path, pub)
	}

I know kubernetes supports multi-line environment variable files, although I’m not sure about helm. I am guessing that when you configure with helm you will need to use a scalar string to preserve newlines:

DRONE_LICENSE: |
  -----BEGIN LICENSE KEY-----
  Thjh7sTA1VDE4OjM2tpmQQZCyRd43M1ODI1OVoiLCJkYXQiSukU/Y
  -----END LICENSE KEY-----

The above changes are now available in drone/drone:latest. Please give it a try and let me know if it works for you. If not, no worries, we will come up with another solution.

Thanks! I’ll give it a shot and let you know.

Works like a charm!

For anyone else finding this post, here’s how to do it.

if you have an umbrella chart where you provide values overrides, add the following:

drone:
server:
env:
DRONE_LICENSE: |
-----BEGIN LICENSE KEY-----
ThjhQnd7lIif…

If you have a shared kubernetes environment and need to secure the key as a kubernetes secret, you could use the envsecrets object on the chart to reference a secret that you create with the key.

@bradrydzewski how do your releases work? just wondering when this will be available in a tagged version of the container so im not continuing to run latest.

This worked great! I posted another comment with some details on how i implemented this, but it was blocked by the filter. maybe someone can release it.

How do releases work with this project? just wondering when i can expect to see this in a versioned build.