Skip to content
Snippets Groups Projects
Commit 9fb4b49b authored by Alex ubuntu vm's avatar Alex ubuntu vm
Browse files

BUG FIX: switch ip now is saved correctly in the database, using a better...

BUG FIX: switch ip now is saved correctly in the database, using a better trigger for the ip assigning event
parent e559ae1e
No related branches found
No related tags found
1 merge request!2repo: added new directory where utils scripts will be
...@@ -100,7 +100,7 @@ def build_db(body, logger, annotations, **kwargs): ...@@ -100,7 +100,7 @@ def build_db(body, logger, annotations, **kwargs):
db.close() db.close()
logger.info(f"Node {body['spec']['nodeName']} has been registered in the operator") logger.info(f"Node {body['spec']['nodeName']} has been registered in the operator")
@kopf.on.update('pods.v1', labels={'l2sm-component': 'l2sm-switch'}) @kopf.on.field('pods.v1', labels={'l2sm-component': 'l2sm-switch'}, field='status.podIP')
def update_db(body, logger, annotations, **kwargs): def update_db(body, logger, annotations, **kwargs):
if 'status' in body and 'podIP' in body['status']: if 'status' in body and 'podIP' in body['status']:
db = pymysql.connect(host=databaseIP,user="l2sm",password="l2sm;",db="L2SM") db = pymysql.connect(host=databaseIP,user="l2sm",password="l2sm;",db="L2SM")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment