Skip to content

Commit

Permalink
Merge pull request #145 from francescotimperi/redis-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
francescotimperi authored Mar 3, 2024
2 parents 6f5dee3 + 4c76fbe commit e7e95d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion nuvolaris/operator_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import nuvolaris.config as cfg
import nuvolaris.util as ut
import nuvolaris.whisk_actions_deployer as system
import nuvolaris.redis as redis

from nuvolaris.nuvolaris_metadata import NuvolarisMetadata

Expand Down Expand Up @@ -75,10 +76,15 @@ def whisk_post_resume(name):
"""
Executes a set of common operations after the operator resumes, which is also the scenario
triggered by a nuv update operator
- restore redis nuvolaris namespace if redis is active
- annotate operator deployed components version
- redeploys system actions
"""
logging.info(f"*** whisk_post_resume {name}")
logging.info(f"*** whisk_post_resume {name}")

if cfg.get("components.redis"):
redis.restore_nuvolaris_db_user()

annotate_operator_components_version()
sysres = system.deploy_whisk_system_action()

Expand Down
4 changes: 4 additions & 0 deletions nuvolaris/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def wait_for_redis_ready():
# dynamically detect redis pod and wait for readiness
util.wait_for_pod_ready("{.items[?(@.metadata.labels.name == 'redis')].metadata.name}")

def restore_nuvolaris_db_user():
data = util.get_redis_config_data()
create_nuvolaris_db_user(data)

def create_nuvolaris_db_user(data):
logging.info(f"authorizing redis for namespace nuvolaris")
try:
Expand Down
2 changes: 1 addition & 1 deletion nuvolaris/templates/redis-conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ data:
# The filename where to dump the DB (uncomment the line)
dbfilename dump.rdb
# the direcotry where redis will store data.
# the directory where redis will store data.
dir /bitnami/redis/data
{% endif %}
Expand Down

0 comments on commit e7e95d7

Please sign in to comment.