Skip to content

Commit

Permalink
feat: update COSI runtime and add support for tail in the Talos gRPC
Browse files Browse the repository at this point in the history
Updated protobufs to expose tail length option.

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
  • Loading branch information
Unix4ever authored and talos-bot committed Jun 3, 2021
1 parent a71053f commit 14e696d
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 48 deletions.
1 change: 1 addition & 0 deletions api/resource/resource.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ message WatchRequest {
string namespace = 1;
string type = 2;
string id = 3;
uint32 tail_events = 4;
}

enum EventType {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/containernetworking/plugins v0.9.1
github.com/coreos/go-iptables v0.6.0
github.com/coreos/go-semver v0.3.0
github.com/cosi-project/runtime v0.0.0-20210601163656-105af5e15a53
github.com/cosi-project/runtime v0.0.0-20210603165903-ca95c7538d17
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker v20.10.6+incompatible
github.com/docker/go-connections v0.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ github.com/coreos/go-systemd/v22 v22.3.1 h1:7OO2CXWMYNDdaAzP51t4lCCZWwpQHmvPbm9s
github.com/coreos/go-systemd/v22 v22.3.1/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosi-project/runtime v0.0.0-20210601163656-105af5e15a53 h1:EMRKjb1dDUrzHa8m+Fwf3mkusVb7ve4H9V+ZgIs6kGM=
github.com/cosi-project/runtime v0.0.0-20210601163656-105af5e15a53/go.mod h1:v/3MIWNuuOSdXXMl3QgCSwZrAk1fTOmQHEnTAfvDqP4=
github.com/cosi-project/runtime v0.0.0-20210603165903-ca95c7538d17 h1:Ub3PoblBG/YVcaJ+2Pj8hzQm0Zz76VrTuAmcKHhrxTk=
github.com/cosi-project/runtime v0.0.0-20210603165903-ca95c7538d17/go.mod h1:v/3MIWNuuOSdXXMl3QgCSwZrAk1fTOmQHEnTAfvDqP4=
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,23 @@ func (s *ResourceServer) Watch(in *resourceapi.WatchRequest, srv resourceapi.Res
md := resource.NewMetadata(kind.Namespace, kind.Type, in.GetId(), resource.VersionUndefined)

if in.GetId() == "" {
err = resources.WatchKind(ctx, md, eventCh, state.WithBootstrapContents(true))
opts := []state.WatchKindOption{
state.WithBootstrapContents(true),
}

if in.TailEvents > 0 {
opts = append(opts, state.WithKindTailEvents(int(in.TailEvents)))
}

err = resources.WatchKind(ctx, md, eventCh, opts...)
} else {
err = resources.Watch(ctx, md, eventCh)
opts := []state.WatchOption{}

if in.TailEvents > 0 {
opts = append(opts, state.WithTailEvents(int(in.TailEvents)))
}

err = resources.Watch(ctx, md, eventCh, opts...)
}

if err != nil {
Expand Down
90 changes: 50 additions & 40 deletions pkg/machinery/api/resource/resource.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/machinery/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/containerd/go-cni v1.0.2
github.com/containernetworking/cni v0.8.1 // indirect
github.com/cosi-project/runtime v0.0.0-20210601163656-105af5e15a53
github.com/cosi-project/runtime v0.0.0-20210603165903-ca95c7538d17
github.com/dustin/go-humanize v1.0.0
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/ghodss/yaml v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions pkg/machinery/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb
github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
github.com/containernetworking/cni v0.8.1 h1:7zpDnQ3T3s4ucOuJ/ZCLrYBxzkg0AELFfII3Epo9TmI=
github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
github.com/cosi-project/runtime v0.0.0-20210601163656-105af5e15a53 h1:EMRKjb1dDUrzHa8m+Fwf3mkusVb7ve4H9V+ZgIs6kGM=
github.com/cosi-project/runtime v0.0.0-20210601163656-105af5e15a53/go.mod h1:v/3MIWNuuOSdXXMl3QgCSwZrAk1fTOmQHEnTAfvDqP4=
github.com/cosi-project/runtime v0.0.0-20210603165903-ca95c7538d17 h1:Ub3PoblBG/YVcaJ+2Pj8hzQm0Zz76VrTuAmcKHhrxTk=
github.com/cosi-project/runtime v0.0.0-20210603165903-ca95c7538d17/go.mod h1:v/3MIWNuuOSdXXMl3QgCSwZrAk1fTOmQHEnTAfvDqP4=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
1 change: 1 addition & 0 deletions website/content/docs/v0.11/Reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3306,6 +3306,7 @@ The WatchResponse message contains the Resource returned.
| namespace | [string](#string) | | |
| type | [string](#string) | | |
| id | [string](#string) | | |
| tail_events | [uint32](#uint32) | | |



Expand Down

0 comments on commit 14e696d

Please sign in to comment.