Skip to content

Commit

Permalink
run hacks in health monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
okozachenko1203 committed May 2, 2024
1 parent 3432b0c commit 7deaf42
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
5 changes: 0 additions & 5 deletions magnum_cluster_api/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from magnum_cluster_api import (
clients,
exceptions,
hacks,
monitor,
objects,
resources,
Expand Down Expand Up @@ -192,7 +191,6 @@ def update_cluster_status(
cluster.status = fields.ClusterStatus.UPDATE_COMPLETE

cluster.save()
return

if cluster.status == fields.ClusterStatus.DELETE_IN_PROGRESS:
if capi_cluster and capi_cluster.exists():
Expand Down Expand Up @@ -227,9 +225,6 @@ def update_cluster_status(
cluster.status_reason = None
cluster.status = fields.ClusterStatus.DELETE_COMPLETE
cluster.save()
return

hacks.set_certificate_expiry_days(self.k8s_api)

@cluster_lock_wrapper
def update_cluster(
Expand Down
8 changes: 0 additions & 8 deletions magnum_cluster_api/hacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,3 @@ def set_certificate_expiry_days(
utils.kube_apply_patch(kcpt)

CERTIFICATE_EXPIRY_DAYS_FIX_APPLIED = True

kcps = objects.KubeadmControlPlane.objects(
api, namespace="magnum-system"
).all()
for kcp in kcps:
kcp.obj["spec"].setdefault("rolloutBefore", {})
kcp.obj["spec"]["rolloutBefore"]["certificatesExpiryDays"] = 21
utils.kube_apply_patch(kcp)
4 changes: 3 additions & 1 deletion magnum_cluster_api/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from oslo_log import log as logging
from oslo_utils import strutils

from magnum_cluster_api import clients, objects, utils
from magnum_cluster_api import clients, hacks, objects, utils

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -78,3 +78,5 @@ def poll_health_status(self):
self.data["health_status"] = fields.ClusterHealthStatus.HEALTHY

self.poll_nodegroup_replicas()

hacks.set_certificate_expiry_days(self.k8s_api)
7 changes: 1 addition & 6 deletions magnum_cluster_api/tests/functional/test_hacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
# under the License.

import pytest
from tenacity import (
Retrying,
retry_if_result,
stop_after_delay,
wait_fixed,
)
from tenacity import Retrying, retry_if_result, stop_after_delay, wait_fixed

from magnum_cluster_api import clients, hacks, objects, resources, utils

Expand Down

0 comments on commit 7deaf42

Please sign in to comment.