Brigade: If a Job.env{} var is empty, it will cause a Kubernetes error

Created on 22 May 2018  路  8Comments  路  Source: brigadecore/brigade

Consider this:

j = new Job("foo", "alpine:3.7")
j.env = {
  foo: null
}

The above will create a Kubernetes pod with this in the env section:

          {
            "name": "foo",
            "valueFrom": {}
          }

The above is invalid. It should be:

          {
            "name": "foo",
            "value": ""
          }

Or something else that is structurally allowed.

The code that generates this is in the worker's k8s.ts file somewhere.

good first issue

Most helpful comment

I can pick this up!

All 8 comments

This one's my fault. It's these lines:

https://github.com/Azure/brigade/blob/a2646de88d941a4921b0cf805d108fe4a2f6f8f1/brigade-worker/src/k8s.ts#L216-L243

This could be fixed by adding another part to the if-statement at line 234, something like:

} else if (val === null) {
   envVars.push({
     name: key,
     value: ""
  } as kubernetes.V1EnvVar);
} else {
// ...

I can pick this up!

@shubheksha excellent! Thanks!

@shubheksha did you still want to work on this one?

@biskit1, I'm on the move for a bit, so I won't be able to, you can pick it up!

Thanks @shubheksha! Will try to get this done over the weekend. Will keep you posted!

Just to update anyone who comes around: I'm trying to figure out how to set up the dev environment so I can run/implement the appropriate tests once I make the small change suggested above.

I had to prioritize some other things given the time I estimated setting this up/figuring it out would take, so I just want you to know that I'm still on it and will complete it ASAP.

If anyone (@jdotjdot , @technosophos) has some suggestions for setting up the dev environment just for this portion, please share :) for now, I'm getting started by following the steps listed in this developers guide to get the appropriate tools installed and set up the environment.

closing since #670 has been merged

Was this page helpful?
0 / 5 - 0 ratings