Add config options for the tobiko background pod
Three new config options can be used with the tobiko background pod. When they are used, the CR that is used to create the tobiko background pod is updated accordingly. Example: [podified] tobiko_pod_tolerations=[{effect: NoSchedule, key: testOperator, value: true}, {effect: NoExecute, key: testOperator, value: true}] tobiko_pod_extra_network=mynetwork tobiko_pod_node_selector=kubernetes.io/hostname:worker-3 Change-Id: I7eca4df7ce48fc0f897673e800e7def265eba549
This commit is contained in:
parent
2e7f89fd7f
commit
eb83ebe860
@ -381,6 +381,16 @@ def _start_tobiko_command_pod(cmd_args, pod_name):
|
||||
}
|
||||
}
|
||||
|
||||
if CONF.tobiko.podified.tobiko_pod_extra_network:
|
||||
pod_def["metadata"]["k8s.v1.cni.cncf.io/networks"] = \
|
||||
CONF.tobiko.podified.tobiko_pod_extra_network
|
||||
if CONF.tobiko.podified.tobiko_pod_tolerations:
|
||||
pod_def["spec"]["tolerations"] = \
|
||||
CONF.tobiko.podified.tobiko_pod_tolerations
|
||||
if CONF.tobiko.podified.tobiko_pod_node_selector:
|
||||
pod_def["spec"]["nodeSelector"] = \
|
||||
CONF.tobiko.podified.tobiko_pod_node_selector
|
||||
|
||||
with tobiko_project_context():
|
||||
pod_sel = oc.create(pod_def)
|
||||
with oc.timeout(CONF.tobiko.podified.tobiko_start_pod_timeout):
|
||||
|
@ -15,7 +15,7 @@ from __future__ import absolute_import
|
||||
|
||||
import itertools
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_config import cfg, types
|
||||
|
||||
|
||||
def setup_tobiko_config(conf):
|
||||
@ -49,6 +49,27 @@ OPTIONS = [
|
||||
'registry it will need just few seconds to start POD but '
|
||||
'if image is not yet cached locally it may take a bit '
|
||||
'longer time to download it.'),
|
||||
cfg.ListOpt('tobiko_pod_tolerations',
|
||||
default=[],
|
||||
bounds=True,
|
||||
item_type=types.Dict(bounds=True),
|
||||
help='List of tolerations that have to be applied to the '
|
||||
'tobiko background pod. It is hence a list of '
|
||||
'dictionaries. No nested disctionaries can be used. '
|
||||
'The list has to be bound by [] and each dict has to '
|
||||
'be bound by {}. Example: [{effect: NoSchedule, key: testOperator, value: true}, {effect: NoExecute, key: testOperator, value: true}]'), # noqa
|
||||
cfg.StrOpt('tobiko_pod_extra_network',
|
||||
default=None,
|
||||
help='Extra network interface that needs to be attached to the '
|
||||
'tobiko background pod.'),
|
||||
cfg.DictOpt('tobiko_pod_node_selector',
|
||||
default={},
|
||||
help='Configuration that has to be added to the tobiko '
|
||||
'background pod in order to select a specific OCP node.'
|
||||
' The provided value has to be a non-nested dictionary '
|
||||
'without any {} bouds. '
|
||||
'Example: kubernetes.io/hostname:worker-3'),
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user