Change:
Deployment is defined in a json file with several environment varibles. Deployment is deployed using "kubectl apply -f ". Pods get most of the environment variables defined, but not all. Specifically, the variables defined in the are named: { "name": "DBHOSTS", "value": "10.0.0.1" }, { "name": "SLACKENDPOINT", "value": "ERRORNOT" }, { "name": "LACKENDPOINT", "value": "ERRORNOT" }, { "name": "SLACK", "value": "ERRORNOT" }, { "name": "CKENDPOINT", "value": "ERRORNOT" }, { "name": "ACKENDPOINT", "value": "ERRORNOT" }, { "name": "KENDPOINT", "value": "ERRORNOT" }, { "name": "CASSANDRALOGGINGLEVEL", "value": "ERROR" }, { "name": "ENABLEGETIP", "value": "" } the environment variables that appear in a pod are: ENABLEGETIP CASSANDRALOGGINGLEVEL KENDPOINT ACKENDPOINT CKENDPOINT DBHOSTS That is, ENV variables named "SLACKENDPOINT", "LACKENDPOINT" and "SLACK" never get passed on to the pods.
It also won't accept "randomshit" as an environment varible. When I add that as an environment variable to an existing deployment and run "kubctl apply -f " nothing happens. This is on version v1.2.4 /
Ehh? Can you post a full but minimized yaml that I can run to reproduce it? , drashkov wrote:
We use JSON files, here is the full one. "SLACK_ENDPOINT" does not appear as an environment variable in the pods. Doing "kubectl apply -f " does not create new pods, and does not pass these variables to the pods. If I change the number of replicas and add a new pod, that pod will be created, but won't have that varible.
I am not able to reproduce on GKE at 1.2.4 when exec'ing into one of the Pods and printing the environment. This is the yaml I used - note the image is different: What are the symptoms you are seeing? Can you provide yaml using standard public image along with the specific symptoms you are seeing?
did you create the deployment first with out the env vars, then add them via an apply?
Thanks for looking into it I managed to reproduce it with the yaml you posted. Here's what I did: the yaml you provided as '' the "SLACKENDPOINT" env var from that file and saved that as "" (no other changes) This creates the deployment with all env vars as expected This re-creates a new set of pods and they don't have the SLACKENDPOINT var, as expected. This does not re-create the pods, so the env var is not passed along. kubectl does not return errors.
cc cc
Thanks, I was able to reproduce the issue. It looks like the config with the ENV does get stored in the last-applied-configurations annotation: But does not get put into the pods:
After a few tries I found that if you add the env as the last one you'll be able to add it. Definitely a bug.
The generated three way merge patch wasn't correct (the annotation is good, but look at the spec part): "spec":{"template":{"spec":{"containers":[{"env":[{"name":"CASSANDRALOGGING_LEVEL","value":"ERROR"}],"name":"test-api"}]}}}}
It only recognizes the last env as diff
Opened a PR ptal.
Thanks everyone.

Discussion:
if !ignoreChangesAndAdditions { // Add any remaining items found only in modified for ; modifiedIndex < len(modifiedSorted); modifiedIndex++ { <del> patch = append(patch, modified[modifiedIndex]) </del> <ins> patch = append(patch, modifiedSorted[modifiedIndex]) </ins> } }