Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix kubelet cloud config not updating when azure data changes #131

Merged
merged 2 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions reactive/kubernetes_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from charms.reactive import is_state, is_flag_set, any_flags_set
from charms.reactive import when, when_any, when_not, when_none
from charms.reactive import data_changed, is_data_changed
from charms.reactive import register_trigger

from charmhelpers.core import hookenv, unitdata
from charmhelpers.core.host import service_stop, service_restart
Expand Down Expand Up @@ -102,6 +103,11 @@
db = unitdata.kv()


register_trigger(
when="endpoint.azure.ready.changed", clear_flag="kubernetes-worker.cloud.ready"
)


@hook("upgrade-charm")
def upgrade_charm():
# migrate to new flags
Expand Down Expand Up @@ -1265,6 +1271,7 @@ def cloud_ready():
write_gcp_snap_config("kubelet")
elif is_state("endpoint.azure.ready"):
write_azure_snap_config("kubelet")
clear_flag("endpoint.azure.ready.changed")
set_state("kubernetes-worker.cloud.ready")
set_state("kubernetes-worker.restart-needed") # force restart

Expand Down
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ deps =
commands =
flake8 {toxinidir}/reactive {toxinidir}/tests {toxinidir}/actions
black --check {toxinidir}/reactive {toxinidir}/tests {toxinidir}/actions

[testenv:format]
deps =
black
commands =
black {toxinidir}/reactive {toxinidir}/tests {toxinidir}/actions
Comment on lines +47 to +52
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THANK YOU!