diff --git a/src/k8s/pkg/k8sd/app/hooks_bootstrap.go b/src/k8s/pkg/k8sd/app/hooks_bootstrap.go index 001dc2af0..41be0ccc7 100644 --- a/src/k8s/pkg/k8sd/app/hooks_bootstrap.go +++ b/src/k8s/pkg/k8sd/app/hooks_bootstrap.go @@ -18,6 +18,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/types" snaputil "github.com/canonical/k8s/pkg/snap/util" "github.com/canonical/k8s/pkg/utils" + "github.com/canonical/k8s/pkg/utils/experimental/snapdconfig" "github.com/canonical/microcluster/state" ) @@ -334,6 +335,10 @@ func (a *App) onBootstrapControlPlane(s *state.State, bootstrapConfig apiv1.Boot return fmt.Errorf("database transaction to update cluster configuration failed: %w", err) } + if err := snapdconfig.SetSnapdFromK8sd(s.Context, cfg.ToUserFacing(), snap); err != nil { + return fmt.Errorf("failed to set snapd configuration from k8sd: %w", err) + } + // Start services if err := startControlPlaneServices(s.Context, snap, cfg.Datastore.GetType()); err != nil { return fmt.Errorf("failed to start services: %w", err) diff --git a/src/k8s/pkg/k8sd/app/hooks_join.go b/src/k8s/pkg/k8sd/app/hooks_join.go index 430a10d91..90e896c3c 100644 --- a/src/k8s/pkg/k8sd/app/hooks_join.go +++ b/src/k8s/pkg/k8sd/app/hooks_join.go @@ -9,6 +9,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/pki" "github.com/canonical/k8s/pkg/k8sd/setup" "github.com/canonical/k8s/pkg/utils" + "github.com/canonical/k8s/pkg/utils/experimental/snapdconfig" "github.com/canonical/microcluster/state" ) @@ -144,6 +145,10 @@ func (a *App) onPostJoin(s *state.State, initConfig map[string]string) error { return fmt.Errorf("failed to configure services: %w", err) } + if err := snapdconfig.SetSnapdFromK8sd(s.Context, cfg.ToUserFacing(), snap); err != nil { + return fmt.Errorf("failed to set snapd configuration from k8sd: %w", err) + } + // Start services if err := startControlPlaneServices(s.Context, snap, cfg.Datastore.GetType()); err != nil { return fmt.Errorf("failed to start services: %w", err)