Skip to content

Commit

Permalink
Sync snapd from k8sd and set meta.orb by default after bootstrap/jo…
Browse files Browse the repository at this point in the history
…in (#444)
  • Loading branch information
berkayoz authored May 28, 2024
1 parent 4b253b5 commit c9453c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/k8s/pkg/k8sd/app/hooks_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/k8s/pkg/k8sd/app/hooks_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c9453c2

Please sign in to comment.