Merge "Pass through environment to scheduler, web and launcher"

This commit is contained in:
Zuul 2021-07-30 00:05:42 +00:00 committed by Gerrit Code Review
commit 4107016ff8
4 changed files with 25 additions and 4 deletions

View File

@ -355,6 +355,13 @@ verbatim):
* ``tls.crt``
* ``tls.key``
.. attr:: env
A list of environment variables. This will be passed through
to the Pod specifications for the scheduler, launcher, and
web. This may be used to set http_proxy environment
variables.
.. attr:: scheduler
.. attr:: config

View File

@ -28,9 +28,7 @@ spec:
containers:
- name: launcher
image: {{ spec.imagePrefix }}/nodepool-launcher:{{ spec.nodepoolImageVersion }}
env:
- name: KUBECONFIG
value: /etc/kubernetes/kube.config
env: {{ spec.env | zuul_to_json }}
volumeMounts:
- name: nodepool-config
mountPath: /etc/nodepool

View File

@ -166,6 +166,7 @@ spec:
readOnly: true
{%- endif %}
{%- endfor %}
env: {{ spec.env | zuul_to_json }}
volumes:
- name: zuul-config
secret:
@ -232,6 +233,7 @@ spec:
- name: zookeeper-client-tls
mountPath: /tls/client
readOnly: true
env: {{ spec.env | zuul_to_json }}
volumes:
- name: zuul-config
secret:

View File

@ -86,6 +86,20 @@ class Zuul:
self.spec.setdefault('zuulRegistryImageVersion', 'latest')
self.spec.setdefault('nodepoolImageVersion', 'latest')
default_env = {
'KUBECONFIG': '/etc/kubernetes/kube.config'
}
env = self.spec.setdefault('env', [])
for default_key, default_value in default_env.items():
# Don't allow the user to override our defaults
for item in env:
if item.get('name') == default_key:
env.remove(item)
break
# Set our defaults
env.append({'name': default_key,
'value': default_value})
self.cert_manager = certmanager.CertManager(
self.api, self.namespace, self.log)
self.installing_cert_manager = False