StackJanitor is a serverless, event-driven stack cleanup tool.
Whenever EKS is setup, an AWS managed ENI is added to the selected VPC.
I can see 2 ways to solve the possibility of allowing multiple VPCs connecting to a single EKS master:
Right now without this, we can register nodes in other VPCs and have pods scheduled to those nodes, but we cannot do kubectl
API operations which must originate from the API server (i.e. kubectl logs|exec
)
I'd be happy with either option -> Please prioritise AWS :pray:
Describe the bug
The exec.env
adds all the environment variables passed in through the KUBECONFIG
to the process.env
global variable.
For our usage, it introduces a race condition depending on when the call to the k8s API client occurs.
e.g. the KUBECONFIG users
block below changes the entire nodejs process env:
users:
- name: arn:aws:eks:us-east-2:702880000000:cluster/our-cluster user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- --region
- ap-southeast-2
- eks
- get-token
- --cluster-name
- our-cluster
command: aws
env:
- name: teddy
value: testing
It's not really necessary to do this, instead we can pass a copy of the process.env
with the appended env
array from the KUBECONFIG
to the child_process
.
** Client Version **
e.g. 0.18.0
** Server Version **
e.g. 1.23.0
To Reproduce Steps to reproduce the behavior:
Run the code with the env
specified in the KUBECONFIG:
...
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
console.log(`how come ${process.env.teddy} is not set?`)
const nodes = await k8sApi.listNode();
console.log(`how come ${process.env.teddy} is set?`)
Expected behavior
Entire process.env should not be mutated (unknowingly depending on what is stored in env
of the KUBECONFIG).
Environment (please complete the following information):
Fixed pending release/publish of new version -> https://github.com/kubernetes-client/javascript/pull/955
@brendandburns failed CI prettier check which I've just changed
lint/prettier bug!
Signed-off-by: edward kim edward.kim@lendi.com.au
Quick change which fixes the issue I just raised around modifying the global process.env state https://github.com/kubernetes-client/javascript/issues/954
Describe the bug
The exec.env
adds all the environment variables passed in through the KUBECONFIG
to the process.env
global variable.
For our usage, it introduces a race condition depending on when the call to the k8s API client occurs.
e.g. the KUBECONFIG users
block below changes the entire nodejs process env:
users:
- name: arn:aws:eks:us-east-2:702880000000:cluster/our-cluster user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- --region
- ap-southeast-2
- eks
- get-token
- --cluster-name
- our-cluster
command: aws
env:
- name: teddy
value: testing
It's not really necessary to do this, instead we can pass a copy of the process.env
with the appended env
array from the KUBECONFIG
to the child_process
.
** Client Version **
e.g. 0.18.0
** Server Version **
e.g. 1.23.0
To Reproduce Steps to reproduce the behavior:
Run the code with the env
specified in the KUBECONFIG:
...
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
console.log(`how come ${process.env.teddy} is not set?`)
const nodes = await k8sApi.listNode();
console.log(`how come ${process.env.teddy} is set?`)
Expected behavior
Entire process.env should not be mutated (unknowingly depending on what is stored in env
of the KUBECONFIG).
Environment (please complete the following information):
take a copy of the environment and don't actually mutate it
Signed-off-by: edward kim edward.kim@lendi.com.au