Skip to content

Commit

Permalink
Fix: Temporarily disable snap/k8sd config sync during snap upgrade (#…
Browse files Browse the repository at this point in the history
…1164)

The snap and k8sd configurations are synchronized via k8s x-snapd-config in the configure hook. However, this process requires access to the k8sd API, which may be unavailable during an upgrade. For instance, in a clustered setup with microcluster, the upgrade process can be blocked until all nodes are on the same version, causing the reconciliation to time out.

We now explicitly disable the config sync during the snap upgrade to
avoid such scenarios.
  • Loading branch information
bschimke95 authored Mar 7, 2025
1 parent 63009fb commit 0ad9507
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions snap/hooks/post-refresh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -e
. "$SNAP/k8s/lib.sh"

k8s::common::setup_env

# Enable the snap config reconciler after the snap refresh completes.
# The reconcile command will synchronize the k8sd configuration with the snap config
# and then set the meta orb to "snapd," effectively re-enabling the sync process.
echo "Re-enabling snapd config sync after snap refresh"
k8s::cmd::k8s x-snapd-config reconcile
9 changes: 9 additions & 0 deletions snap/hooks/pre-refresh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -e
. "$SNAP/k8s/lib.sh"

k8s::common::setup_env

# disable snap set/get on snap refresh as microcluster need to sync first.
# the sync will be enabled again after the refresh.
echo "Disabling snapd config sync during snap refresh"
k8s::cmd::k8s x-snapd-config disable

0 comments on commit 0ad9507

Please sign in to comment.