diff --git a/src/k8s/api/v1/version.go b/src/k8s/api/v1/version.go index 6aa4f7227..3640152b3 100644 --- a/src/k8s/api/v1/version.go +++ b/src/k8s/api/v1/version.go @@ -1,6 +1,6 @@ package apiv1 -import "github.com/canonical/microcluster/rest/types" +import "github.com/canonical/microcluster/v2/rest/types" const ( // K8sdAPIVersion is the path prefix that will be used for the k8sd endpoints for this api version. diff --git a/src/k8s/go.mod b/src/k8s/go.mod index 1eaa1fe97..6fa66bd98 100644 --- a/src/k8s/go.mod +++ b/src/k8s/go.mod @@ -4,8 +4,8 @@ go 1.22.5 require ( github.com/canonical/go-dqlite v1.22.0 - github.com/canonical/lxd v0.0.0-20240709081608-9df996e36bac - github.com/canonical/microcluster v0.0.0-20240725000112-da36ecbd845e + github.com/canonical/lxd v0.0.0-20240730172021-8e39e5d4f55f + github.com/canonical/microcluster/v2 v2.0.2 github.com/go-logr/logr v1.4.2 github.com/mitchellh/mapstructure v1.5.0 github.com/moby/sys/mountinfo v0.7.1 @@ -63,7 +63,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-errors/errors v1.4.2 // indirect github.com/go-gorp/gorp/v3 v3.1.0 // indirect - github.com/go-jose/go-jose/v4 v4.0.2 // indirect + github.com/go-jose/go-jose/v4 v4.0.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect @@ -102,7 +102,7 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect @@ -121,7 +121,7 @@ require ( github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pkg/sftp v1.13.6 // indirect - github.com/pkg/xattr v0.4.9 // indirect + github.com/pkg/xattr v0.4.10 // indirect github.com/prometheus/client_golang v1.19.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.54.0 // indirect @@ -140,7 +140,7 @@ require ( github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xlab/treeprint v1.2.0 // indirect github.com/zitadel/logging v0.6.0 // indirect - github.com/zitadel/oidc/v3 v3.25.1 // indirect + github.com/zitadel/oidc/v3 v3.26.0 // indirect github.com/zitadel/schema v1.3.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect @@ -148,15 +148,15 @@ require ( go.opentelemetry.io/otel/trace v1.28.0 // indirect go.starlark.net v0.0.0-20240520160348-046347dcd104 // indirect golang.org/x/crypto v0.25.0 // indirect - golang.org/x/exp v0.0.0-20240707233637-46b078467d37 // indirect + golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/term v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 // indirect - google.golang.org/grpc v1.64.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect + google.golang.org/grpc v1.65.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -166,7 +166,7 @@ require ( k8s.io/component-base v0.30.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect k8s.io/kubectl v0.30.0 // indirect - k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 // indirect + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect oras.land/oras-go v1.2.5 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect diff --git a/src/k8s/go.sum b/src/k8s/go.sum index f02720c45..4145cf235 100644 --- a/src/k8s/go.sum +++ b/src/k8s/go.sum @@ -97,10 +97,10 @@ github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXe github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/canonical/go-dqlite v1.22.0 h1:DuJmfcREl4gkQJyvZzjl2GHFZROhbPyfdjDRQXpkOyw= github.com/canonical/go-dqlite v1.22.0/go.mod h1:Uvy943N8R4CFUAs59A1NVaziWY9nJ686lScY7ywurfg= -github.com/canonical/lxd v0.0.0-20240709081608-9df996e36bac h1:WqXeS0uyAAmFB9aflCucb/pPZzIdivO9uG4tWw7CEAw= -github.com/canonical/lxd v0.0.0-20240709081608-9df996e36bac/go.mod h1:S2MXobHv9Wh6cpr3biLo2Kq0vqK2/PxpFuE/8ZsNDic= -github.com/canonical/microcluster v0.0.0-20240725000112-da36ecbd845e h1:a/YDYYSWFO/Z1AJAKnfkVLBunLLSauuCBRU23Jzd/Do= -github.com/canonical/microcluster v0.0.0-20240725000112-da36ecbd845e/go.mod h1:lNqWvK6yu9NZuZs7kvYsRlpK/lmOTEJsOxplgfzyais= +github.com/canonical/lxd v0.0.0-20240730172021-8e39e5d4f55f h1:bTaF5FmQk66wI8ILr+pzelTY6iNLXE9c2Ks2HG4Sp5U= +github.com/canonical/lxd v0.0.0-20240730172021-8e39e5d4f55f/go.mod h1:BVyKLSsJLTLX3o6WW0f5YDOO+J5HE3Np2WwYVrug0sY= +github.com/canonical/microcluster/v2 v2.0.2 h1:T0Bc3EQTdR17nAhKlAmGORL4y7FPcgAR09fWj/WlQck= +github.com/canonical/microcluster/v2 v2.0.2/go.mod h1:09N/J8tuijpAJdOER+e8IVWpn9cjzw9KzZvIunii/pA= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -194,8 +194,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs= github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw= -github.com/go-jose/go-jose/v4 v4.0.2 h1:R3l3kkBds16bO7ZFAEEcofK0MkrAJt3jlJznWZG0nvk= -github.com/go-jose/go-jose/v4 v4.0.2/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY= +github.com/go-jose/go-jose/v4 v4.0.4 h1:VsjPI33J0SB9vQM6PLmNjoHqMQNGPiZ0rHL7Ni7Q6/E= +github.com/go-jose/go-jose/v4 v4.0.4/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= @@ -428,8 +428,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= -github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= @@ -507,8 +507,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo= github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk= -github.com/pkg/xattr v0.4.9 h1:5883YPCtkSd8LFbs13nXplj9g9tlrwoJRjgpgMu1/fE= -github.com/pkg/xattr v0.4.9/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU= +github.com/pkg/xattr v0.4.10 h1:Qe0mtiNFHQZ296vRgUjRCoPHPqH7VdTOrZx3g0T+pGA= +github.com/pkg/xattr v0.4.10/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -615,8 +615,8 @@ github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f h1 github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= github.com/zitadel/logging v0.6.0 h1:t5Nnt//r+m2ZhhoTmoPX+c96pbMarqJvW1Vq6xFTank= github.com/zitadel/logging v0.6.0/go.mod h1:Y4CyAXHpl3Mig6JOszcV5Rqqsojj+3n7y2F591Mp/ow= -github.com/zitadel/oidc/v3 v3.25.1 h1:mkGimTWzbb8wARUewIqr6LhTPZnZeL6WOeXWy+iz1aI= -github.com/zitadel/oidc/v3 v3.25.1/go.mod h1:UDwD+PRFbUBzabyPd9JORrakty3/wec7VpKZYi9Ahh0= +github.com/zitadel/oidc/v3 v3.26.0 h1:BG3OUK+JpuKz7YHJIyUxL5Sl2JV6ePkG42UP4Xv3J2w= +github.com/zitadel/oidc/v3 v3.26.0/go.mod h1:Cx6AYPTJO5q2mjqF3jaknbKOUjpq1Xui0SYvVhkKuXU= github.com/zitadel/schema v1.3.0 h1:kQ9W9tvIwZICCKWcMvCEweXET1OcOyGEuFbHs4o5kg0= github.com/zitadel/schema v1.3.0/go.mod h1:NptN6mkBDFvERUCvZHlvWmmME+gmZ44xzwRXwhzsbtc= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= @@ -673,8 +673,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240707233637-46b078467d37 h1:uLDX+AfeFCct3a2C7uIWBKMJIR3CJMhcgfrUAqjRK6w= -golang.org/x/exp v0.0.0-20240707233637-46b078467d37/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -982,8 +982,8 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 h1:Di6ANFilr+S60a4S61ZM00vLdw0IrQOSMS2/6mrnOU0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1004,8 +1004,8 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1073,8 +1073,8 @@ k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7F k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= k8s.io/kubectl v0.30.0 h1:xbPvzagbJ6RNYVMVuiHArC1grrV5vSmmIcSZuCdzRyk= k8s.io/kubectl v0.30.0/go.mod h1:zgolRw2MQXLPwmic2l/+iHs239L49fhSeICuMhQQXTI= -k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCIXHaathvJg1C3ak= -k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= oras.land/oras-go v1.2.5 h1:XpYuAwAb0DfQsunIyMfeET92emK8km3W4yEzZvUbsTo= oras.land/oras-go v1.2.5/go.mod h1:PuAwRShRZCsZb7g8Ar3jKKQR/2A/qN+pkYxIOd/FAoo= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/src/k8s/pkg/client/k8sd/k8sd.go b/src/k8s/pkg/client/k8sd/k8sd.go index 2b750f562..c2e5c6f67 100644 --- a/src/k8s/pkg/client/k8sd/k8sd.go +++ b/src/k8s/pkg/client/k8sd/k8sd.go @@ -3,8 +3,8 @@ package k8sd import ( "fmt" - "github.com/canonical/microcluster/client" - "github.com/canonical/microcluster/microcluster" + "github.com/canonical/microcluster/v2/client" + "github.com/canonical/microcluster/v2/microcluster" ) // k8sd implements Client. diff --git a/src/k8s/pkg/k8sd/api/capi_access_handler.go b/src/k8s/pkg/k8sd/api/capi_access_handler.go index 01cc9f39d..c83733ecc 100644 --- a/src/k8s/pkg/k8sd/api/capi_access_handler.go +++ b/src/k8s/pkg/k8sd/api/capi_access_handler.go @@ -8,7 +8,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/database" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func ValidateCAPIAuthTokenAccessHandler(tokenHeaderName string) func(s state.State, r *http.Request) (bool, response.Response) { diff --git a/src/k8s/pkg/k8sd/api/capi_auth.go b/src/k8s/pkg/k8sd/api/capi_auth.go index de54fecb9..4f8550ae6 100644 --- a/src/k8s/pkg/k8sd/api/capi_auth.go +++ b/src/k8s/pkg/k8sd/api/capi_auth.go @@ -10,7 +10,7 @@ import ( apiv1 "github.com/canonical/k8s/api/v1" "github.com/canonical/k8s/pkg/k8sd/database" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) postSetClusterAPIAuthToken(s state.State, r *http.Request) response.Response { diff --git a/src/k8s/pkg/k8sd/api/cluster.go b/src/k8s/pkg/k8sd/api/cluster.go index a257e96bf..ae899961b 100644 --- a/src/k8s/pkg/k8sd/api/cluster.go +++ b/src/k8s/pkg/k8sd/api/cluster.go @@ -12,7 +12,7 @@ import ( databaseutil "github.com/canonical/k8s/pkg/k8sd/database/util" "github.com/canonical/k8s/pkg/k8sd/types" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) getClusterStatus(s state.State, r *http.Request) response.Response { diff --git a/src/k8s/pkg/k8sd/api/cluster_bootstrap.go b/src/k8s/pkg/k8sd/api/cluster_bootstrap.go index 5c6a18536..8ea12f59e 100644 --- a/src/k8s/pkg/k8sd/api/cluster_bootstrap.go +++ b/src/k8s/pkg/k8sd/api/cluster_bootstrap.go @@ -9,7 +9,7 @@ import ( apiv1 "github.com/canonical/k8s/api/v1" "github.com/canonical/k8s/pkg/utils" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) postClusterBootstrap(_ state.State, r *http.Request) response.Response { diff --git a/src/k8s/pkg/k8sd/api/cluster_config.go b/src/k8s/pkg/k8sd/api/cluster_config.go index 8a7b2e223..f61f4a7c1 100644 --- a/src/k8s/pkg/k8sd/api/cluster_config.go +++ b/src/k8s/pkg/k8sd/api/cluster_config.go @@ -12,7 +12,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/types" "github.com/canonical/k8s/pkg/utils" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) putClusterConfig(s state.State, r *http.Request) response.Response { diff --git a/src/k8s/pkg/k8sd/api/cluster_join.go b/src/k8s/pkg/k8sd/api/cluster_join.go index 469f506a0..5abc2552b 100644 --- a/src/k8s/pkg/k8sd/api/cluster_join.go +++ b/src/k8s/pkg/k8sd/api/cluster_join.go @@ -10,7 +10,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/types" "github.com/canonical/k8s/pkg/utils" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) postClusterJoin(s state.State, r *http.Request) response.Response { diff --git a/src/k8s/pkg/k8sd/api/cluster_remove.go b/src/k8s/pkg/k8sd/api/cluster_remove.go index b44c26b94..1979ea92f 100644 --- a/src/k8s/pkg/k8sd/api/cluster_remove.go +++ b/src/k8s/pkg/k8sd/api/cluster_remove.go @@ -13,8 +13,8 @@ import ( "github.com/canonical/k8s/pkg/utils/control" nodeutil "github.com/canonical/k8s/pkg/utils/node" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/cluster" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/cluster" + "github.com/canonical/microcluster/v2/state" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/src/k8s/pkg/k8sd/api/cluster_tokens.go b/src/k8s/pkg/k8sd/api/cluster_tokens.go index 107469741..4d39863ad 100644 --- a/src/k8s/pkg/k8sd/api/cluster_tokens.go +++ b/src/k8s/pkg/k8sd/api/cluster_tokens.go @@ -5,14 +5,15 @@ import ( "database/sql" "fmt" "net/http" + "time" apiv1 "github.com/canonical/k8s/api/v1" "github.com/canonical/k8s/pkg/k8sd/database" "github.com/canonical/k8s/pkg/k8sd/types" "github.com/canonical/k8s/pkg/utils" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/microcluster" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/microcluster" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) postClusterJoinTokens(s state.State, r *http.Request) response.Response { @@ -54,7 +55,8 @@ func getOrCreateJoinToken(ctx context.Context, m *microcluster.MicroCluster, tok } // if token does not exist, create a new one - token, err := m.NewJoinToken(ctx, tokenName) + // TODO(ben): make token expiry configurable + token, err := m.NewJoinToken(ctx, tokenName, 24*time.Hour) if err != nil { return "", fmt.Errorf("failed to generate a new microcluster join token: %w", err) } diff --git a/src/k8s/pkg/k8sd/api/endpoints.go b/src/k8s/pkg/k8sd/api/endpoints.go index ea798cc36..f7255b8c2 100644 --- a/src/k8s/pkg/k8sd/api/endpoints.go +++ b/src/k8s/pkg/k8sd/api/endpoints.go @@ -5,7 +5,7 @@ import ( "context" apiv1 "github.com/canonical/k8s/api/v1" - "github.com/canonical/microcluster/rest" + "github.com/canonical/microcluster/v2/rest" ) type Endpoints struct { diff --git a/src/k8s/pkg/k8sd/api/impl/k8sd.go b/src/k8s/pkg/k8sd/api/impl/k8sd.go index 165b1ce78..23d8c0914 100644 --- a/src/k8s/pkg/k8sd/api/impl/k8sd.go +++ b/src/k8s/pkg/k8sd/api/impl/k8sd.go @@ -8,7 +8,7 @@ import ( "github.com/canonical/k8s/pkg/snap" snaputil "github.com/canonical/k8s/pkg/snap/util" nodeutil "github.com/canonical/k8s/pkg/utils/node" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) // GetClusterMembers retrieves information about the members of the cluster. diff --git a/src/k8s/pkg/k8sd/api/kubeconfig.go b/src/k8s/pkg/k8sd/api/kubeconfig.go index c12905b2d..607ac234a 100644 --- a/src/k8s/pkg/k8sd/api/kubeconfig.go +++ b/src/k8s/pkg/k8sd/api/kubeconfig.go @@ -9,7 +9,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/setup" "github.com/canonical/k8s/pkg/utils" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) getKubeconfig(s state.State, r *http.Request) response.Response { diff --git a/src/k8s/pkg/k8sd/api/kubernetes_auth_tokens.go b/src/k8s/pkg/k8sd/api/kubernetes_auth_tokens.go index 5e492ab44..cbedb9966 100644 --- a/src/k8s/pkg/k8sd/api/kubernetes_auth_tokens.go +++ b/src/k8s/pkg/k8sd/api/kubernetes_auth_tokens.go @@ -13,7 +13,7 @@ import ( databaseutil "github.com/canonical/k8s/pkg/k8sd/database/util" "github.com/canonical/k8s/pkg/utils" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) getKubernetesAuthTokens(s state.State, r *http.Request) response.Response { diff --git a/src/k8s/pkg/k8sd/api/node.go b/src/k8s/pkg/k8sd/api/node.go index 0d6bae9a4..9f6d23004 100644 --- a/src/k8s/pkg/k8sd/api/node.go +++ b/src/k8s/pkg/k8sd/api/node.go @@ -6,7 +6,7 @@ import ( apiv1 "github.com/canonical/k8s/api/v1" "github.com/canonical/k8s/pkg/k8sd/api/impl" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) getNodeStatus(s state.State, r *http.Request) response.Response { diff --git a/src/k8s/pkg/k8sd/api/provider.go b/src/k8s/pkg/k8sd/api/provider.go index 8e4172d21..b7f66f249 100644 --- a/src/k8s/pkg/k8sd/api/provider.go +++ b/src/k8s/pkg/k8sd/api/provider.go @@ -2,7 +2,7 @@ package api import ( "github.com/canonical/k8s/pkg/snap" - "github.com/canonical/microcluster/microcluster" + "github.com/canonical/microcluster/v2/microcluster" ) // Provider is an interface for state that the API endpoints need access to. diff --git a/src/k8s/pkg/k8sd/api/worker.go b/src/k8s/pkg/k8sd/api/worker.go index 565d2fe4d..d902e3ea3 100644 --- a/src/k8s/pkg/k8sd/api/worker.go +++ b/src/k8s/pkg/k8sd/api/worker.go @@ -13,7 +13,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/pki" "github.com/canonical/k8s/pkg/utils" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) postWorkerInfo(s state.State, r *http.Request) response.Response { diff --git a/src/k8s/pkg/k8sd/api/worker_access_handler.go b/src/k8s/pkg/k8sd/api/worker_access_handler.go index 446a4d0b5..43ebe5e73 100644 --- a/src/k8s/pkg/k8sd/api/worker_access_handler.go +++ b/src/k8s/pkg/k8sd/api/worker_access_handler.go @@ -10,7 +10,7 @@ import ( snaputil "github.com/canonical/k8s/pkg/snap/util" "github.com/canonical/k8s/pkg/utils" "github.com/canonical/lxd/lxd/response" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (e *Endpoints) restrictWorkers(s state.State, r *http.Request) (bool, response.Response) { diff --git a/src/k8s/pkg/k8sd/app/app.go b/src/k8s/pkg/k8sd/app/app.go index 182c55414..62a286027 100644 --- a/src/k8s/pkg/k8sd/app/app.go +++ b/src/k8s/pkg/k8sd/app/app.go @@ -15,9 +15,9 @@ import ( "github.com/canonical/k8s/pkg/k8sd/database" "github.com/canonical/k8s/pkg/log" "github.com/canonical/k8s/pkg/snap" - "github.com/canonical/microcluster/client" - "github.com/canonical/microcluster/microcluster" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/client" + "github.com/canonical/microcluster/v2/microcluster" + "github.com/canonical/microcluster/v2/state" ) // Config defines configuration for the k8sd app. @@ -46,6 +46,7 @@ type Config struct { // App is the k8sd microcluster instance. type App struct { + config Config cluster *microcluster.MicroCluster client *client.Client snap snap.Snap @@ -81,9 +82,6 @@ func New(cfg Config) (*App, error) { cfg.StateDir = cfg.Snap.K8sdStateDir() } cluster, err := microcluster.App(microcluster.Args{ - Version: string(apiv1.K8sdAPIVersion), - Verbose: cfg.Verbose, - Debug: cfg.Debug, StateDir: cfg.StateDir, }) if err != nil { @@ -95,6 +93,7 @@ func New(cfg Config) (*App, error) { } app := &App{ + config: cfg, cluster: cluster, client: client, snap: cfg.Snap, @@ -215,9 +214,14 @@ func (a *App) Run(ctx context.Context, customHooks *state.Hooks) error { }() } - a.cluster.AddServers(api.New(ctx, a)) - - err := a.cluster.Start(ctx, database.SchemaExtensions, []string{}, hooks) + 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, + }) if err != nil { return fmt.Errorf("failed to run microcluster: %w", err) } diff --git a/src/k8s/pkg/k8sd/app/cluster_util.go b/src/k8s/pkg/k8sd/app/cluster_util.go index f964b2067..580038372 100644 --- a/src/k8s/pkg/k8sd/app/cluster_util.go +++ b/src/k8s/pkg/k8sd/app/cluster_util.go @@ -9,7 +9,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/setup" "github.com/canonical/k8s/pkg/snap" snaputil "github.com/canonical/k8s/pkg/snap/util" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func setupKubeconfigs(s state.State, kubeConfigDir string, securePort int, pki pki.ControlPlanePKI) error { diff --git a/src/k8s/pkg/k8sd/app/hooks_bootstrap.go b/src/k8s/pkg/k8sd/app/hooks_bootstrap.go index 78c4d1e92..6353ebdfa 100644 --- a/src/k8s/pkg/k8sd/app/hooks_bootstrap.go +++ b/src/k8s/pkg/k8sd/app/hooks_bootstrap.go @@ -20,7 +20,7 @@ import ( 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" + "github.com/canonical/microcluster/v2/state" ) // onBootstrap is called after we bootstrap the first cluster node. diff --git a/src/k8s/pkg/k8sd/app/hooks_join.go b/src/k8s/pkg/k8sd/app/hooks_join.go index 9f444ac0c..b78653cbf 100644 --- a/src/k8s/pkg/k8sd/app/hooks_join.go +++ b/src/k8s/pkg/k8sd/app/hooks_join.go @@ -11,7 +11,7 @@ import ( "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" + "github.com/canonical/microcluster/v2/state" ) // onPostJoin is called when a control plane node joins the cluster. diff --git a/src/k8s/pkg/k8sd/app/hooks_remove.go b/src/k8s/pkg/k8sd/app/hooks_remove.go index d025f3bb7..7b28bdcb8 100644 --- a/src/k8s/pkg/k8sd/app/hooks_remove.go +++ b/src/k8s/pkg/k8sd/app/hooks_remove.go @@ -14,8 +14,8 @@ import ( "github.com/canonical/k8s/pkg/log" snaputil "github.com/canonical/k8s/pkg/snap/util" "github.com/canonical/k8s/pkg/utils/control" - "github.com/canonical/microcluster/cluster" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/cluster" + "github.com/canonical/microcluster/v2/state" ) // NOTE(ben): the pre-remove performs a series of cleanup steps on a best-effort basis. diff --git a/src/k8s/pkg/k8sd/app/hooks_start.go b/src/k8s/pkg/k8sd/app/hooks_start.go index 47c7140a2..6ae775ec2 100644 --- a/src/k8s/pkg/k8sd/app/hooks_start.go +++ b/src/k8s/pkg/k8sd/app/hooks_start.go @@ -12,7 +12,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/types" "github.com/canonical/k8s/pkg/utils" pkiutil "github.com/canonical/k8s/pkg/utils/pki" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) func (a *App) onStart(ctx context.Context, s state.State) error { diff --git a/src/k8s/pkg/k8sd/app/provider.go b/src/k8s/pkg/k8sd/app/provider.go index 95fe1e636..9fb267467 100644 --- a/src/k8s/pkg/k8sd/app/provider.go +++ b/src/k8s/pkg/k8sd/app/provider.go @@ -4,7 +4,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/api" "github.com/canonical/k8s/pkg/snap" "github.com/canonical/k8s/pkg/utils" - "github.com/canonical/microcluster/microcluster" + "github.com/canonical/microcluster/v2/microcluster" ) func (a *App) MicroCluster() *microcluster.MicroCluster { diff --git a/src/k8s/pkg/k8sd/database/capi_auth.go b/src/k8s/pkg/k8sd/database/capi_auth.go index a29757f84..6f89148b9 100644 --- a/src/k8s/pkg/k8sd/database/capi_auth.go +++ b/src/k8s/pkg/k8sd/database/capi_auth.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/canonical/microcluster/cluster" + "github.com/canonical/microcluster/v2/cluster" ) var ( diff --git a/src/k8s/pkg/k8sd/database/cluster_config.go b/src/k8s/pkg/k8sd/database/cluster_config.go index ed66ced8b..74ed89edf 100644 --- a/src/k8s/pkg/k8sd/database/cluster_config.go +++ b/src/k8s/pkg/k8sd/database/cluster_config.go @@ -7,7 +7,7 @@ import ( "fmt" "github.com/canonical/k8s/pkg/k8sd/types" - "github.com/canonical/microcluster/cluster" + "github.com/canonical/microcluster/v2/cluster" ) var ( diff --git a/src/k8s/pkg/k8sd/database/feature_status.go b/src/k8s/pkg/k8sd/database/feature_status.go index c31ac6322..26b77d8f9 100644 --- a/src/k8s/pkg/k8sd/database/feature_status.go +++ b/src/k8s/pkg/k8sd/database/feature_status.go @@ -8,7 +8,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/types" "github.com/canonical/k8s/pkg/log" - "github.com/canonical/microcluster/cluster" + "github.com/canonical/microcluster/v2/cluster" ) var featureStatusStmts = map[string]int{ diff --git a/src/k8s/pkg/k8sd/database/kubernetes_auth_tokens.go b/src/k8s/pkg/k8sd/database/kubernetes_auth_tokens.go index 5d4f548b7..0a61fd327 100644 --- a/src/k8s/pkg/k8sd/database/kubernetes_auth_tokens.go +++ b/src/k8s/pkg/k8sd/database/kubernetes_auth_tokens.go @@ -10,7 +10,7 @@ import ( "sort" "strings" - "github.com/canonical/microcluster/cluster" + "github.com/canonical/microcluster/v2/cluster" ) var ( diff --git a/src/k8s/pkg/k8sd/database/schema.go b/src/k8s/pkg/k8sd/database/schema.go index ec7c8669a..9af57845f 100644 --- a/src/k8s/pkg/k8sd/database/schema.go +++ b/src/k8s/pkg/k8sd/database/schema.go @@ -8,7 +8,7 @@ import ( "path/filepath" "github.com/canonical/lxd/lxd/db/schema" - "github.com/canonical/microcluster/cluster" + "github.com/canonical/microcluster/v2/cluster" ) var ( diff --git a/src/k8s/pkg/k8sd/database/util/cluster.go b/src/k8s/pkg/k8sd/database/util/cluster.go index 4a54b616b..bf27c758e 100644 --- a/src/k8s/pkg/k8sd/database/util/cluster.go +++ b/src/k8s/pkg/k8sd/database/util/cluster.go @@ -7,7 +7,7 @@ import ( "github.com/canonical/k8s/pkg/k8sd/database" "github.com/canonical/k8s/pkg/k8sd/types" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) // GetClusterConfig is a convenience wrapper around the database call to get the cluster config. diff --git a/src/k8s/pkg/k8sd/database/util/kubernetes_auth_tokens.go b/src/k8s/pkg/k8sd/database/util/kubernetes_auth_tokens.go index 35d6bd7e0..d283e254e 100644 --- a/src/k8s/pkg/k8sd/database/util/kubernetes_auth_tokens.go +++ b/src/k8s/pkg/k8sd/database/util/kubernetes_auth_tokens.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/canonical/k8s/pkg/k8sd/database" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) // GetOrCreateAuthToken returns a k8s auth token based on the provided username/groups. diff --git a/src/k8s/pkg/k8sd/database/util_test.go b/src/k8s/pkg/k8sd/database/util_test.go index 8126c8aab..3e9053dcf 100644 --- a/src/k8s/pkg/k8sd/database/util_test.go +++ b/src/k8s/pkg/k8sd/database/util_test.go @@ -8,7 +8,7 @@ import ( "time" "github.com/canonical/k8s/pkg/k8sd/app" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) const ( diff --git a/src/k8s/pkg/k8sd/database/worker.go b/src/k8s/pkg/k8sd/database/worker.go index 67db000e5..69629f07a 100644 --- a/src/k8s/pkg/k8sd/database/worker.go +++ b/src/k8s/pkg/k8sd/database/worker.go @@ -8,7 +8,7 @@ import ( "encoding/hex" "fmt" - "github.com/canonical/microcluster/cluster" + "github.com/canonical/microcluster/v2/cluster" ) var ( diff --git a/src/k8s/pkg/utils/node/node.go b/src/k8s/pkg/utils/node/node.go index f79e451b3..ff26b3749 100644 --- a/src/k8s/pkg/utils/node/node.go +++ b/src/k8s/pkg/utils/node/node.go @@ -5,7 +5,7 @@ import ( "fmt" apiv1 "github.com/canonical/k8s/api/v1" - "github.com/canonical/microcluster/state" + "github.com/canonical/microcluster/v2/state" ) // GetControlPlaneNode returns the node information if the given node name