Skip to content

Commit

Permalink
fix: bring in new versions of COSI runtime and state-etcd
Browse files Browse the repository at this point in the history
This brings in watch restarts for controller-runtime.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Dec 27, 2024
1 parent 82da2f4 commit 3ba096a
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/adrg/xdg v0.5.3
github.com/blang/semver v3.5.1+incompatible
github.com/blang/semver/v4 v4.0.0
github.com/cosi-project/runtime v0.8.1
github.com/cosi-project/runtime v0.9.0
github.com/dustin/go-humanize v1.0.1
github.com/fatih/color v1.18.0
github.com/gertd/go-pluralize v0.2.1
Expand Down
4 changes: 2 additions & 2 deletions client/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ github.com/containerd/go-cni v1.1.10 h1:c2U73nld7spSWfiJwSh/8W9DK+/qQwYM2rngIhCy
github.com/containerd/go-cni v1.1.10/go.mod h1:/Y/sL8yqYQn1ZG1om1OncJB1W4zN3YmjfP/ShCzG/OY=
github.com/containernetworking/cni v1.2.3 h1:hhOcjNVUQTnzdRJ6alC5XF+wd9mfGIUaj8FuJbEslXM=
github.com/containernetworking/cni v1.2.3/go.mod h1:DuLgF+aPd3DzcTQTtp/Nvl1Kim23oFKdm2okJzBQA5M=
github.com/cosi-project/runtime v0.8.1 h1:zM5g3cOhvN8HjZ6iBtWwwP4KWmpXSTfMXo3QUZiRjhI=
github.com/cosi-project/runtime v0.8.1/go.mod h1:sNqLK/aBb8862xGS4HLAcwTloDuH0TeU3N1+qr3TmAs=
github.com/cosi-project/runtime v0.9.0 h1:xcyuK0zzNI6vUBNBJXtMg60vkvp9fRYV7LGJGSlKKFc=
github.com/cosi-project/runtime v0.9.0/go.mod h1:sNqLK/aBb8862xGS4HLAcwTloDuH0TeU3N1+qr3TmAs=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down
2 changes: 1 addition & 1 deletion client/pkg/omnictl/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func deleteResources(cmd *cobra.Command, args []string) func(ctx context.Context

fmt.Printf("destroyed %s %s\n", rd.TypedSpec().Type, event.Resource.Metadata().ID())
}
case state.Bootstrapped:
case state.Bootstrapped, state.Noop:
// ignore
case state.Errored:
return fmt.Errorf("error watching for resource deletion: %w", event.Error)
Expand Down
2 changes: 1 addition & 1 deletion client/pkg/omnictl/output/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (table *Table) WriteResource(r resource.Resource, event state.EventType) er
label = "-"
case state.Updated:
label = " "
case state.Errored, state.Bootstrapped: // ignored
case state.Errored, state.Bootstrapped, state.Noop: // ignored
}

values = append([]string{label}, values...)
Expand Down
1 change: 1 addition & 0 deletions client/pkg/template/operations/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func statusTemplate(ctx context.Context, tmpl *template.Template, out io.Writer,
switch event.Type {
case state.Errored:
return fmt.Errorf("watch failed: %w", event.Error)
case state.Noop: // ignored
case state.Bootstrapped:
pendingBootstraps--
case state.Created, state.Updated:
Expand Down
2 changes: 1 addition & 1 deletion client/pkg/template/operations/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func syncDeleteResources(ctx context.Context, toDelete []resource.Resource, out

yellow.Fprintf(out, "* destroyed%s %s\n", dryRun, boldFunc(utils.Describe(event.Resource))) //nolint:errcheck
}
case state.Bootstrapped:
case state.Bootstrapped, state.Noop:
// ignore
case state.Errored:
return event.Error
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ require (
github.com/blang/semver v3.5.1+incompatible
github.com/blang/semver/v4 v4.0.0
github.com/containers/image/v5 v5.33.0
github.com/cosi-project/runtime v0.8.1
github.com/cosi-project/state-etcd v0.4.1
github.com/cosi-project/runtime v0.9.0
github.com/cosi-project/state-etcd v0.5.0
github.com/crewjam/saml v0.4.14
github.com/dustin/go-humanize v1.0.1
github.com/emicklei/dot v1.6.4
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cosi-project/runtime v0.8.1 h1:zM5g3cOhvN8HjZ6iBtWwwP4KWmpXSTfMXo3QUZiRjhI=
github.com/cosi-project/runtime v0.8.1/go.mod h1:sNqLK/aBb8862xGS4HLAcwTloDuH0TeU3N1+qr3TmAs=
github.com/cosi-project/state-etcd v0.4.1 h1:WNSl8CFR+dv4DP3W6GwRyszjvofMEPNk89aB4r6sEbY=
github.com/cosi-project/state-etcd v0.4.1/go.mod h1:RVakFrVCR3bwt/3C2UxZC7EP25d+Zq1lIT4Uyrsfk9I=
github.com/cosi-project/runtime v0.9.0 h1:xcyuK0zzNI6vUBNBJXtMg60vkvp9fRYV7LGJGSlKKFc=
github.com/cosi-project/runtime v0.9.0/go.mod h1:sNqLK/aBb8862xGS4HLAcwTloDuH0TeU3N1+qr3TmAs=
github.com/cosi-project/state-etcd v0.5.0 h1:C0dPYWNc9dIVYvOp0xnfu3EUFMSYfetvY6NNBB4dCP8=
github.com/cosi-project/state-etcd v0.5.0/go.mod h1:TulE8Jy1ksmfUntKuWqfWm/aZXhX0rnF0O6+82jf2aY=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down
2 changes: 1 addition & 1 deletion internal/backend/dns/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (d *Service) Start(ctx context.Context) error {
switch ev.Type {
case state.Errored:
return fmt.Errorf("dns service received an error event: %w", ev.Error)
case state.Bootstrapped:
case state.Bootstrapped, state.Noop:
// ignore
case state.Destroyed:
if ev.Resource == nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/backend/grpc/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func (r *Router) ResourceWatcher(ctx context.Context, s state.State, logger *zap
switch e.Type {
case state.Errored:
return fmt.Errorf("talos backend cluster watch failed: %w", e.Error)
case state.Bootstrapped:
case state.Bootstrapped, state.Noop:
// ignore
case state.Created, state.Updated, state.Destroyed:
if e.Resource.Metadata().Type() == omni.MachineType {
Expand Down
3 changes: 2 additions & 1 deletion internal/backend/runtime/cosi/cosi.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func WatchLegacy(ctx context.Context, st state.State, md resource.Metadata, out
}

channel.SendWithContext(ctx, out, responseFromResource(ev, r))
case state.Bootstrapped:
case state.Bootstrapped, state.Noop:
// ignored, see Watch() below
case state.Errored:
return fmt.Errorf("watch error: %w", msg.Error)
Expand Down Expand Up @@ -273,6 +273,7 @@ func Watch(ctx context.Context, st state.State, md resource.Metadata, out chan<-
channel.SendWithContext(ctx, out, NewResponse(msg.Resource.Metadata().ID(), msg.Resource.Metadata().Namespace(), ev, msg.Resource))
case state.Bootstrapped:
bootstrapOnce.Do(bootstrapEvent)
case state.Noop: // ignore
case state.Errored:
return fmt.Errorf("watch error: %w", msg.Error)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (spec IdentityCollectorTaskSpec) RunTask(ctx context.Context, logger *zap.L
switch event.Type {
case state.Errored:
return fmt.Errorf("watch failed: %w", event.Error)
case state.Bootstrapped, state.Destroyed:
case state.Bootstrapped, state.Destroyed, state.Noop:
// ignore
case state.Created, state.Updated:
switch r := event.Resource.(type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (spec CollectTaskSpec) RunTask(ctx context.Context, logger *zap.Logger, not
switch event.Type {
case state.Errored:
return fmt.Errorf("error watching COSI resource: %w", event.Error)
case state.Bootstrapped:
case state.Bootstrapped, state.Noop:
// ignore
case state.Created, state.Updated, state.Destroyed:
// poll machine version on each machine status update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (spec CollectTaskSpec) RunTask(ctx context.Context, _ *zap.Logger, notifyCh
switch event.Type {
case state.Errored:
return fmt.Errorf("error watching COSI resource: %w", event.Error)
case state.Bootstrapped, state.Destroyed:
case state.Bootstrapped, state.Destroyed, state.Noop:
// ignore
case state.Created, state.Updated:
snapshot := omni.NewMachineStatusSnapshot(resources.DefaultNamespace, spec.MachineID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (suite *MachineRequestSetStatusSuite) reconcileLabels(ctx context.Context)
return nil
case event := <-ch:
switch event.Type {
case state.Bootstrapped:
case state.Bootstrapped, state.Noop:
case state.Errored:
return event.Error
case state.Destroyed:
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/siderolink/loghandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (h *LogHandler) Start(ctx context.Context) error {
return nil
case event := <-eventCh:
switch event.Type {
case state.Created, state.Updated, state.Bootstrapped:
case state.Created, state.Updated, state.Bootstrapped, state.Noop:
// ignore
case state.Errored:
return fmt.Errorf("error watching machines: %w", event.Error)
Expand Down

0 comments on commit 3ba096a

Please sign in to comment.