diff --git a/src/k8s/go.mod b/src/k8s/go.mod index 80e012c0b..713332d7d 100644 --- a/src/k8s/go.mod +++ b/src/k8s/go.mod @@ -17,7 +17,7 @@ require ( golang.org/x/mod v0.21.0 golang.org/x/net v0.30.0 golang.org/x/sync v0.8.0 - golang.org/x/sys v0.27.0 + golang.org/x/sys v0.28.0 gopkg.in/yaml.v2 v2.4.0 helm.sh/helm/v3 v3.15.3 k8s.io/api v0.31.3 @@ -181,3 +181,5 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) + +replace github.com/canonical/microcluster/v2 => github.com/claudiubelu/microcluster/v2 v2.0.0-20241211230101-f5ddb1da2a47 diff --git a/src/k8s/go.sum b/src/k8s/go.sum index 973d2517e..8ec30f412 100644 --- a/src/k8s/go.sum +++ b/src/k8s/go.sum @@ -57,12 +57,12 @@ github.com/canonical/k8s-snap-api v1.0.15 h1:uhEJiEhrK93tJAly+quuAayanMhT/5vpePl github.com/canonical/k8s-snap-api v1.0.15/go.mod h1:LDPoIYCeYnfgOFrwVPJ/4edGU264w7BB7g0GsVi36AY= github.com/canonical/lxd v0.0.0-20241106165613-4aab50ec18c3 h1:1OAWxun8+xS5vQta/GTSIVoTP6uDP4uD9eR93UbTWiw= github.com/canonical/lxd v0.0.0-20241106165613-4aab50ec18c3/go.mod h1:ORoLmeSj+tQmUgh10kLA9eMtRnbBZPT6X10V2I4cTGs= -github.com/canonical/microcluster/v2 v2.1.0 h1:jEycvk2vu8XH5SaT4GatqymCOmY7Bhj/mOM4d8XN13c= -github.com/canonical/microcluster/v2 v2.1.0/go.mod h1:Aofp11LCtIpIm8OdkQRpl7RWXYtLMTE+B+SOE0gcyAE= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chai2010/gettext-go v1.0.2 h1:1Lwwip6Q2QGsAdl/ZKPCwTe9fe0CjlUbqj5bFNSjIRk= github.com/chai2010/gettext-go v1.0.2/go.mod h1:y+wnP2cHYaVj19NZhYKAwEMH2CI1gNHeQQ+5AjwawxA= +github.com/claudiubelu/microcluster/v2 v2.0.0-20241211230101-f5ddb1da2a47 h1:y76FVyXL2OQJs6CSCN6KikUcsLukMk65lBz/0IoVv2Y= +github.com/claudiubelu/microcluster/v2 v2.0.0-20241211230101-f5ddb1da2a47/go.mod h1:wG2DsOefwQOaYffOUJsKp6XLUdpjHIpyF6cQ6gJHndU= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/containerd v1.7.13 h1:wPYKIeGMN8vaggSKuV1X0wZulpMz4CrgEsZdaCyB6Is= @@ -519,8 +519,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= diff --git a/src/k8s/pkg/k8sd/api/endpoints.go b/src/k8s/pkg/k8sd/api/endpoints.go index d761ed2b7..d99054b7e 100644 --- a/src/k8s/pkg/k8sd/api/endpoints.go +++ b/src/k8s/pkg/k8sd/api/endpoints.go @@ -3,6 +3,7 @@ package api import ( "context" + "time" apiv1 "github.com/canonical/k8s-snap-api/api/v1" "github.com/canonical/microcluster/v2/rest" @@ -31,6 +32,7 @@ func New(ctx context.Context, provider Provider) map[string]rest.Server { Endpoints: k8sd.Endpoints(), }, }, + DrainConnectionsTimeout: 10 * time.Second, }, } } diff --git a/src/k8s/pkg/k8sd/app/app.go b/src/k8s/pkg/k8sd/app/app.go index ecd11188c..b68073214 100644 --- a/src/k8s/pkg/k8sd/app/app.go +++ b/src/k8s/pkg/k8sd/app/app.go @@ -220,12 +220,13 @@ func (a *App) Run(ctx context.Context, customHooks *state.Hooks) error { } err := a.cluster.Start(ctx, microcluster.DaemonArgs{ - Version: string(apiv1.K8sdAPIVersion), - Verbose: a.config.Verbose, - Debug: a.config.Debug, - Hooks: hooks, - ExtensionServers: api.New(ctx, a), - ExtensionsSchema: database.SchemaExtensions, + Version: string(apiv1.K8sdAPIVersion), + Verbose: a.config.Verbose, + Debug: a.config.Debug, + Hooks: hooks, + ExtensionServers: api.New(ctx, a), + ExtensionsSchema: database.SchemaExtensions, + DrainConnectionsTimeout: 10 * time.Second, }) if err != nil { return fmt.Errorf("failed to run microcluster: %w", err)