Commit 26feb25c authored by Philip Laine's avatar Philip Laine Committed by Brad Davidson

Bump spegel to v0.0.18-k3s4

parent 88d30f94
...@@ -20,11 +20,13 @@ replace ( ...@@ -20,11 +20,13 @@ replace (
github.com/opencontainers/runc => github.com/k3s-io/runc v1.1.12-k3s1 github.com/opencontainers/runc => github.com/k3s-io/runc v1.1.12-k3s1
github.com/opencontainers/runtime-spec => github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78 github.com/opencontainers/runtime-spec => github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78
github.com/opencontainers/selinux => github.com/opencontainers/selinux v1.10.1 github.com/opencontainers/selinux => github.com/opencontainers/selinux v1.10.1
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.18.0
github.com/prometheus/common => github.com/prometheus/common v0.45.0
github.com/quic-go/qtls-go1-20 => github.com/quic-go/qtls-go1-20 v0.3.3 github.com/quic-go/qtls-go1-20 => github.com/quic-go/qtls-go1-20 v0.3.3
github.com/quic-go/quic-go => github.com/quic-go/quic-go v0.38.2 github.com/quic-go/quic-go => github.com/quic-go/quic-go v0.38.2
github.com/rancher/wrangler => github.com/rancher/wrangler v1.1.1-0.20230818201331-3604a6be798d github.com/rancher/wrangler => github.com/rancher/wrangler v1.1.1-0.20230818201331-3604a6be798d
github.com/ugorji/go => github.com/ugorji/go v1.2.11 github.com/ugorji/go => github.com/ugorji/go v1.2.11
github.com/xenitab/spegel => github.com/k3s-io/spegel v0.0.17-0.20240109004735-9466a5529330 // k3s-main github.com/xenitab/spegel => github.com/k3s-io/spegel v0.0.18-k3s4
go.etcd.io/etcd/api/v3 => github.com/k3s-io/etcd/api/v3 v3.5.9-k3s1 go.etcd.io/etcd/api/v3 => github.com/k3s-io/etcd/api/v3 v3.5.9-k3s1
go.etcd.io/etcd/client/pkg/v3 => github.com/k3s-io/etcd/client/pkg/v3 v3.5.9-k3s1 go.etcd.io/etcd/client/pkg/v3 => github.com/k3s-io/etcd/client/pkg/v3 v3.5.9-k3s1
go.etcd.io/etcd/client/v2 => github.com/k3s-io/etcd/client/v2 v2.305.9-k3s1 go.etcd.io/etcd/client/v2 => github.com/k3s-io/etcd/client/v2 v2.305.9-k3s1
...@@ -98,7 +100,7 @@ require ( ...@@ -98,7 +100,7 @@ require (
github.com/cloudnativelabs/kube-router/v2 v2.0.0-00010101000000-000000000000 github.com/cloudnativelabs/kube-router/v2 v2.0.0-00010101000000-000000000000
github.com/containerd/aufs v1.0.0 github.com/containerd/aufs v1.0.0
github.com/containerd/cgroups/v3 v3.0.2 github.com/containerd/cgroups/v3 v3.0.2
github.com/containerd/containerd v1.7.11 github.com/containerd/containerd v1.7.13
github.com/containerd/fuse-overlayfs-snapshotter v1.0.5 github.com/containerd/fuse-overlayfs-snapshotter v1.0.5
github.com/containerd/stargz-snapshotter v0.14.4-0.20230913082252-7275d45b185c github.com/containerd/stargz-snapshotter v0.14.4-0.20230913082252-7275d45b185c
github.com/containerd/zfs v1.1.0 github.com/containerd/zfs v1.1.0
...@@ -136,7 +138,7 @@ require ( ...@@ -136,7 +138,7 @@ require (
github.com/opencontainers/selinux v1.11.0 github.com/opencontainers/selinux v1.11.0
github.com/otiai10/copy v1.7.0 github.com/otiai10/copy v1.7.0
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/prometheus/common v0.45.0 github.com/prometheus/common v0.48.0
github.com/rancher/dynamiclistener v0.3.6 github.com/rancher/dynamiclistener v0.3.6
github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29 github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29
github.com/rancher/remotedialer v0.3.0 github.com/rancher/remotedialer v0.3.0
...@@ -149,7 +151,7 @@ require ( ...@@ -149,7 +151,7 @@ require (
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.8.4
github.com/urfave/cli v1.22.14 github.com/urfave/cli v1.22.14
github.com/vishvananda/netlink v1.2.1-beta.2 github.com/vishvananda/netlink v1.2.1-beta.2
github.com/xenitab/spegel v0.0.16 github.com/xenitab/spegel v1.0.18
github.com/yl2chen/cidranger v1.0.2 github.com/yl2chen/cidranger v1.0.2
go.etcd.io/etcd/api/v3 v3.5.10 go.etcd.io/etcd/api/v3 v3.5.10
go.etcd.io/etcd/client/pkg/v3 v3.5.10 go.etcd.io/etcd/client/pkg/v3 v3.5.10
...@@ -157,8 +159,8 @@ require ( ...@@ -157,8 +159,8 @@ require (
go.etcd.io/etcd/etcdutl/v3 v3.5.9 go.etcd.io/etcd/etcdutl/v3 v3.5.9
go.etcd.io/etcd/server/v3 v3.5.10 go.etcd.io/etcd/server/v3 v3.5.10
go.uber.org/zap v1.26.0 go.uber.org/zap v1.26.0
golang.org/x/crypto v0.17.0 golang.org/x/crypto v0.18.0
golang.org/x/net v0.19.0 golang.org/x/net v0.20.0
golang.org/x/sync v0.6.0 golang.org/x/sync v0.6.0
golang.org/x/sys v0.16.0 golang.org/x/sys v0.16.0
google.golang.org/grpc v1.60.1 google.golang.org/grpc v1.60.1
...@@ -336,7 +338,7 @@ require ( ...@@ -336,7 +338,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect
github.com/josharian/native v1.1.0 // indirect github.com/josharian/native v1.1.0 // indirect
github.com/karrick/godirwalk v1.17.0 // indirect github.com/karrick/godirwalk v1.17.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect github.com/koron/go-ssdp v0.0.4 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect
github.com/leodido/go-urn v1.2.4 // indirect github.com/leodido/go-urn v1.2.4 // indirect
...@@ -391,7 +393,7 @@ require ( ...@@ -391,7 +393,7 @@ require (
github.com/mrunalp/fileutils v0.5.1 // indirect github.com/mrunalp/fileutils v0.5.1 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.12.0 // indirect github.com/multiformats/go-multiaddr v0.12.2 // indirect
github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect
...@@ -420,12 +422,12 @@ require ( ...@@ -420,12 +422,12 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polydawn/refmt v0.89.0 // indirect github.com/polydawn/refmt v0.89.0 // indirect
github.com/pquerna/cachecontrol v0.1.0 // indirect github.com/pquerna/cachecontrol v0.1.0 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-20 v0.3.3 // indirect github.com/quic-go/qtls-go1-20 v0.3.3 // indirect
github.com/quic-go/quic-go v0.38.0 // indirect github.com/quic-go/quic-go v0.38.2 // indirect
github.com/quic-go/webtransport-go v0.5.3 // indirect github.com/quic-go/webtransport-go v0.5.3 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/rs/xid v1.5.0 // indirect github.com/rs/xid v1.5.0 // indirect
...@@ -481,8 +483,8 @@ require ( ...@@ -481,8 +483,8 @@ require (
golang.org/x/arch v0.3.0 // indirect golang.org/x/arch v0.3.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.14.0 // indirect golang.org/x/mod v0.14.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/term v0.15.0 // indirect golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.16.1 // indirect golang.org/x/tools v0.16.1 // indirect
...@@ -494,7 +496,7 @@ require ( ...@@ -494,7 +496,7 @@ require (
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/protobuf v1.31.0 // indirect google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/gcfg.v1 v1.2.3 // indirect gopkg.in/gcfg.v1 v1.2.3 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
......
...@@ -43,7 +43,7 @@ func (s *selfBootstrapper) Run(_ context.Context, id string) error { ...@@ -43,7 +43,7 @@ func (s *selfBootstrapper) Run(_ context.Context, id string) error {
return nil return nil
} }
func (s *selfBootstrapper) GetAddress() (*peer.AddrInfo, error) { func (s *selfBootstrapper) Get() (*peer.AddrInfo, error) {
return peer.AddrInfoFromString(s.id) return peer.AddrInfoFromString(s.id)
} }
...@@ -68,7 +68,7 @@ func (c *agentBootstrapper) Run(_ context.Context, _ string) error { ...@@ -68,7 +68,7 @@ func (c *agentBootstrapper) Run(_ context.Context, _ string) error {
return nil return nil
} }
func (c *agentBootstrapper) GetAddress() (*peer.AddrInfo, error) { func (c *agentBootstrapper) Get() (*peer.AddrInfo, error) {
if c.server == "" || c.token == "" { if c.server == "" || c.token == "" {
return nil, errors.New("cannot get addresses without server and token") return nil, errors.New("cannot get addresses without server and token")
} }
...@@ -131,7 +131,7 @@ func (s *serverBootstrapper) Run(_ context.Context, id string) error { ...@@ -131,7 +131,7 @@ func (s *serverBootstrapper) Run(_ context.Context, id string) error {
return nil return nil
} }
func (s *serverBootstrapper) GetAddress() (addrInfo *peer.AddrInfo, err error) { func (s *serverBootstrapper) Get() (addrInfo *peer.AddrInfo, err error) {
if s.controlConfig.Runtime.Core == nil { if s.controlConfig.Runtime.Core == nil {
return nil, errors.New("runtime core not ready") return nil, errors.New("runtime core not ready")
} }
...@@ -187,10 +187,10 @@ func (c *chainingBootstrapper) Run(ctx context.Context, id string) error { ...@@ -187,10 +187,10 @@ func (c *chainingBootstrapper) Run(ctx context.Context, id string) error {
return merr.NewErrors(errs...) return merr.NewErrors(errs...)
} }
func (c *chainingBootstrapper) GetAddress() (*peer.AddrInfo, error) { func (c *chainingBootstrapper) Get() (*peer.AddrInfo, error) {
errs := merr.Errors{} errs := merr.Errors{}
for _, b := range c.bootstrappers { for _, b := range c.bootstrappers {
addr, err := b.GetAddress() addr, err := b.Get()
if err == nil { if err == nil {
return addr, nil return addr, nil
} }
......
...@@ -96,7 +96,6 @@ const ( ...@@ -96,7 +96,6 @@ const (
resolveLatestTag = false resolveLatestTag = false
resolveRetries = 0 resolveRetries = 0
resolveTimeout = time.Second * 5 resolveTimeout = time.Second * 5
registryScheme = "https"
registryNamespace = "k8s.io" registryNamespace = "k8s.io"
defaultRouterPort = "5001" defaultRouterPort = "5001"
) )
...@@ -188,12 +187,12 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error { ...@@ -188,12 +187,12 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error {
libp2p.Identity(p2pKey), libp2p.Identity(p2pKey),
libp2p.Peerstore(ps), libp2p.Peerstore(ps),
libp2p.PrivateNetwork(c.PSK), libp2p.PrivateNetwork(c.PSK),
libp2p.PrometheusRegisterer(metrics.DefaultRegisterer),
} }
router, err := routing.NewP2PRouter(ctx, routerAddr, c.Bootstrapper, c.RegistryPort, registryScheme, opts...) router, err := routing.NewP2PRouter(ctx, routerAddr, c.Bootstrapper, c.RegistryPort, opts...)
if err != nil { if err != nil {
return errors.Wrap(err, "failed to create p2p router") return errors.Wrap(err, "failed to create p2p router")
} }
go router.Run(ctx)
caCert, err := os.ReadFile(c.ServerCAFile) caCert, err := os.ReadFile(c.ServerCAFile)
if err != nil { if err != nil {
...@@ -202,7 +201,14 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error { ...@@ -202,7 +201,14 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error {
localAddr := net.JoinHostPort(c.InternalAddress, c.RegistryPort) localAddr := net.JoinHostPort(c.InternalAddress, c.RegistryPort)
client := clientaccess.GetHTTPClient(caCert, c.ClientCertFile, c.ClientKeyFile) client := clientaccess.GetHTTPClient(caCert, c.ClientCertFile, c.ClientKeyFile)
metrics.Register() metrics.Register()
reg := registry.NewRegistry(ociClient, router, localAddr, resolveRetries, resolveTimeout, resolveLatestTag, client.Transport) registryOpts := []registry.Option{
registry.WithLocalAddress(localAddr),
registry.WithResolveLatestTag(resolveLatestTag),
registry.WithResolveRetries(resolveRetries),
registry.WithResolveTimeout(resolveTimeout),
registry.WithTransport(client.Transport),
}
reg := registry.NewRegistry(ociClient, router, registryOpts...)
regSvr := reg.Server(":"+c.RegistryPort, logr.FromContextOrDiscard(ctx)) regSvr := reg.Server(":"+c.RegistryPort, logr.FromContextOrDiscard(ctx))
// Close router on shutdown // Close router on shutdown
...@@ -225,7 +231,7 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error { ...@@ -225,7 +231,7 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error {
// Wait up to 5 seconds for the p2p network to find peers. This will return // Wait up to 5 seconds for the p2p network to find peers. This will return
// immediately if the node is bootstrapping from itself. // immediately if the node is bootstrapping from itself.
wait.PollImmediateWithContext(ctx, time.Second, resolveTimeout, func(_ context.Context) (bool, error) { wait.PollImmediateWithContext(ctx, time.Second, resolveTimeout, func(_ context.Context) (bool, error) {
return router.HasMirrors() return router.Ready()
}) })
return nil return nil
...@@ -235,7 +241,7 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error { ...@@ -235,7 +241,7 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error {
func (c *Config) peerInfo() http.HandlerFunc { func (c *Config) peerInfo() http.HandlerFunc {
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
client, _, _ := net.SplitHostPort(req.RemoteAddr) client, _, _ := net.SplitHostPort(req.RemoteAddr)
info, err := c.Bootstrapper.GetAddress() info, err := c.Bootstrapper.Get()
if err != nil { if err != nil {
http.Error(resp, "Internal Error", http.StatusInternalServerError) http.Error(resp, "Internal Error", http.StatusInternalServerError)
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment