roboll / helmfile

Deploy Kubernetes Helm Charts
MIT License
4.04k stars 565 forks source link

Missing kubeContext option in helmfile 0.41+ #421

Open astorath opened 5 years ago

astorath commented 5 years ago

Hi!

Helmfile v0.41 dropped support for kubeContext option defined inside release. If you have several kube clusters it is very convenient to define a default kubeContext (so you don't accidently release something on different kube cluster). We used this option with different environments (which can be located in different clusters).

michaelgeorgeattard commented 5 years ago

Looks like 0.40.3 has the same problem

osterman commented 5 years ago

https://github.com/roboll/helmfile/pull/403/files

The option just moved to helmDefaults for consistency. Can you try this or share an example of your configuration that does not work?

astorath commented 5 years ago

I know it is present in helmDefaults, but we need different kontext inside release depending on environment. Besides, every other option in helmDefaults may be overriden on per release basis

osterman commented 5 years ago

Oh wow, that should definitely be supported per release the same way all the other defaults can be defined per release.

astorath commented 5 years ago

@osterman Hi, I've realized that I can use environment variables (e.g. .Environment.Values) inside helmDefaults block, so there is no actual problem here.

Moreover, using different contexts inside one deployment is a bit strange, but maybe there are some use cases here.

So it's up to you to close this issue.

ghost commented 5 years ago

I have just met this problem with context. It seems to be ignored and the defaults one is taken.

Config:

xulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail> ls -la
total 8
drwxr-xr-x   4 xulsitatirev  staff  128 Feb 11 13:42 .
drwxr-xr-x  10 xulsitatirev  staff  320 Feb 14 14:15 ..
-rw-r--r--   1 xulsitatirev  staff   28 Nov 18 15:07 README.md
drwxr-xr-x   9 xulsitatirev  staff  288 Feb 14 14:17 helmfile.d
xulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail> ls -la helmfile.d/helmfile.yaml 
-rw-r--r--  1 xulsitatirev  staff  329 Feb 14 14:16 helmfile.d/helmfile.yaml
xulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail> bat helmfile.d/helmfile.yaml
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: helmfile.d/helmfile.yaml
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ ---
   2   │ 
   3   │ helmDefaults:
   4   │   kubeContext: k8s-jail.<redacted>
   5   │   verify: true
   6   │   wait: true
   7   │   timeout: 600
   8   │   recreatePods: true
   9   │   force: true

Flow:

ulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail> kubectx k8s-betrayal.<redacted> 
Switched to context "k8s-betrayal.<redacted>".
xulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail> 
xulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail> kubectx
k8s-betrayal.<redacted>
k8s-jail.<redacted>
xulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail> helmfile diff
[..]
Error: Get https://api-k8s-betrayal-<redacted>/api/v1/namespaces/kube-system/pods?labelSelector=app%3Dhelm%2Cname%3Dtiller: EOF
[...]
xulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail> 

Version:

xulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail> helmfile --version
helmfile version v0.43.2
xulsitatirev@tecta-macbook ~/D/P/g/g/g/g/g/k8s-jail>