[podified] Dataplane secret name configurable

Tobiko obtains the ssh keys to connect to EDPM nodes from a certain
Openshift secret. Its name was hardcoded. With this patch, the secret
name is configurable.

Depends-On: If90056ae1de4a6a3557fc870497e6233088bfb02
Depends-On: I54f8144a3347c3c5bf2e2e99e9d500a0c6fb89eb

Change-Id: Id38018dd26750e6140b4f61f9218e094ec0e5ce6
This commit is contained in:
Eduardo Olivares 2025-04-10 17:27:11 +02:00
parent 054b74aeee
commit 21470b22e4
2 changed files with 11 additions and 4 deletions

View File

@ -32,7 +32,6 @@ LOG = log.getLogger(__name__)
OSP_CONTROLPLANE = 'openstackcontrolplane'
OSP_DP_NODESET = 'openstackdataplanenodeset'
DP_SSH_SECRET_NAME = 'secret/dataplane-ansible-ssh-private-key-secret'
OSP_CONFIG_SECRET_NAME = 'secret/openstack-config-secret'
OSP_BM_HOST = 'baremetalhost.metal3.io'
OSP_BM_CRD = 'baremetalhosts.metal3.io'
@ -145,11 +144,15 @@ def has_podified_cp() -> bool:
def get_dataplane_ssh_keypair():
private_key = ""
public_key = ""
secret_name = (
f'secret/{CONF.tobiko.podified.dataplane_node_ssh_key_secret}')
try:
with oc.project(CONF.tobiko.podified.osp_project):
secret_object = oc.selector(DP_SSH_SECRET_NAME).object()
private_key = secret_object.as_dict()['data']['ssh-privatekey']
public_key = secret_object.as_dict()['data']['ssh-publickey']
secret_object = oc.selector(secret_name).object()
private_key = secret_object.as_dict(
).get('data', {}).get('ssh-privatekey', "")
public_key = secret_object.as_dict(
).get('data', {}).get('ssh-publickey', "")
except oc.OpenShiftPythonException as err:
LOG.error("Error while trying to get Dataplane secret SSH Key: %s",
err)

View File

@ -32,6 +32,10 @@ OPTIONS = [
cfg.StrOpt('osp_project',
default='openstack',
help="Openshift project that includes the Openstack resources"),
cfg.StrOpt('dataplane_node_ssh_key_secret',
default='dataplane-ansible-ssh-private-key-secret',
help="Name of the Openshift secret where ssh keys to connect "
"to EDPM nodes can be obtained from."),
cfg.StrOpt('background_tasks_project',
default='tobiko',
help='Name of the OpenShift project which will be used to run '