Skip to content

Commit

Permalink
chore: update references to old protobuf package
Browse files Browse the repository at this point in the history
This simply uses new protobuf package instead of old one.

Old protobuf package is still in use by Talos dependencies.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
  • Loading branch information
smira authored and talos-bot committed Jul 8, 2021
1 parent 2ba8ac9 commit b969e77
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 62 deletions.
20 changes: 10 additions & 10 deletions cmd/talosctl/cmd/talos/dashboard/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"sync"
"time"

"github.com/golang/protobuf/ptypes/empty"
"golang.org/x/sync/errgroup"
"google.golang.org/protobuf/types/known/emptypb"

"github.com/talos-systems/talos/cmd/talosctl/cmd/talos/dashboard/data"
"github.com/talos-systems/talos/pkg/machinery/client"
Expand Down Expand Up @@ -86,7 +86,7 @@ func (source *APISource) gather() *data.Data {

gatherFuncs := []func() error{
func() error {
resp, err := source.MachineClient.Hostname(source.ctx, &empty.Empty{})
resp, err := source.MachineClient.Hostname(source.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand All @@ -107,7 +107,7 @@ func (source *APISource) gather() *data.Data {
return nil
},
func() error {
resp, err := source.MachineClient.LoadAvg(source.ctx, &empty.Empty{})
resp, err := source.MachineClient.LoadAvg(source.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand All @@ -128,7 +128,7 @@ func (source *APISource) gather() *data.Data {
return nil
},
func() error {
resp, err := source.MachineClient.Version(source.ctx, &empty.Empty{})
resp, err := source.MachineClient.Version(source.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand All @@ -149,7 +149,7 @@ func (source *APISource) gather() *data.Data {
return nil
},
func() error {
resp, err := source.MachineClient.Memory(source.ctx, &empty.Empty{})
resp, err := source.MachineClient.Memory(source.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand All @@ -170,7 +170,7 @@ func (source *APISource) gather() *data.Data {
return nil
},
func() error {
resp, err := source.MachineClient.SystemStat(source.ctx, &empty.Empty{})
resp, err := source.MachineClient.SystemStat(source.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand All @@ -191,7 +191,7 @@ func (source *APISource) gather() *data.Data {
return nil
},
func() error {
resp, err := source.MachineClient.CPUInfo(source.ctx, &empty.Empty{})
resp, err := source.MachineClient.CPUInfo(source.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand All @@ -212,7 +212,7 @@ func (source *APISource) gather() *data.Data {
return nil
},
func() error {
resp, err := source.MachineClient.NetworkDeviceStats(source.ctx, &empty.Empty{})
resp, err := source.MachineClient.NetworkDeviceStats(source.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand All @@ -233,7 +233,7 @@ func (source *APISource) gather() *data.Data {
return nil
},
func() error {
resp, err := source.MachineClient.DiskStats(source.ctx, &empty.Empty{})
resp, err := source.MachineClient.DiskStats(source.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand All @@ -254,7 +254,7 @@ func (source *APISource) gather() *data.Data {
return nil
},
func() error {
resp, err := source.MachineClient.Processes(source.ctx, &empty.Empty{})
resp, err := source.MachineClient.Processes(source.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ require (
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa
github.com/gdamore/tcell/v2 v2.3.11
github.com/gizak/termui/v3 v3.1.0
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.6
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"fmt"

"github.com/cosi-project/runtime/pkg/controller"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/protobuf/types/known/emptypb"

inspectapi "github.com/talos-systems/talos/pkg/machinery/api/inspect"
)
Expand All @@ -22,7 +22,7 @@ type InspectServer struct {
}

// ControllerRuntimeDependencies implements inspect.InspectService interface.
func (s *InspectServer) ControllerRuntimeDependencies(ctx context.Context, in *empty.Empty) (*inspectapi.ControllerRuntimeDependenciesResponse, error) {
func (s *InspectServer) ControllerRuntimeDependencies(ctx context.Context, in *emptypb.Empty) (*inspectapi.ControllerRuntimeDependenciesResponse, error) {
graph, err := s.server.Controller.V1Alpha2().DependencyGraph()
if err != nil {
return nil, fmt.Errorf("error fetching dependency graph: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
"strconv"
"strings"

"github.com/golang/protobuf/ptypes/empty"
"github.com/prometheus/procfs"
"google.golang.org/protobuf/types/known/emptypb"

"github.com/talos-systems/talos/pkg/machinery/api/machine"
)

// Hostname implements the machine.MachineServer interface.
func (s *Server) Hostname(ctx context.Context, in *empty.Empty) (*machine.HostnameResponse, error) {
func (s *Server) Hostname(ctx context.Context, in *emptypb.Empty) (*machine.HostnameResponse, error) {
hostname, err := os.Hostname()
if err != nil {
return nil, err
Expand All @@ -36,7 +36,7 @@ func (s *Server) Hostname(ctx context.Context, in *empty.Empty) (*machine.Hostna
}

// LoadAvg implements the machine.MachineServer interface.
func (s *Server) LoadAvg(ctx context.Context, in *empty.Empty) (*machine.LoadAvgResponse, error) {
func (s *Server) LoadAvg(ctx context.Context, in *emptypb.Empty) (*machine.LoadAvgResponse, error) {
fs, err := procfs.NewDefaultFS()
if err != nil {
return nil, err
Expand All @@ -61,7 +61,7 @@ func (s *Server) LoadAvg(ctx context.Context, in *empty.Empty) (*machine.LoadAvg
}

// SystemStat implements the machine.MachineServer interface.
func (s *Server) SystemStat(ctx context.Context, in *empty.Empty) (*machine.SystemStatResponse, error) {
func (s *Server) SystemStat(ctx context.Context, in *emptypb.Empty) (*machine.SystemStatResponse, error) {
fs, err := procfs.NewDefaultFS()
if err != nil {
return nil, err
Expand Down Expand Up @@ -134,7 +134,7 @@ func (s *Server) SystemStat(ctx context.Context, in *empty.Empty) (*machine.Syst
}

// CPUInfo implements the machine.MachineServer interface.
func (s *Server) CPUInfo(ctx context.Context, in *empty.Empty) (*machine.CPUInfoResponse, error) {
func (s *Server) CPUInfo(ctx context.Context, in *emptypb.Empty) (*machine.CPUInfoResponse, error) {
fs, err := procfs.NewDefaultFS()
if err != nil {
return nil, err
Expand Down Expand Up @@ -193,7 +193,7 @@ func (s *Server) CPUInfo(ctx context.Context, in *empty.Empty) (*machine.CPUInfo
}

// NetworkDeviceStats implements the machine.MachineServer interface.
func (s *Server) NetworkDeviceStats(ctx context.Context, in *empty.Empty) (*machine.NetworkDeviceStatsResponse, error) {
func (s *Server) NetworkDeviceStats(ctx context.Context, in *emptypb.Empty) (*machine.NetworkDeviceStatsResponse, error) {
fs, err := procfs.NewDefaultFS()
if err != nil {
return nil, err
Expand Down Expand Up @@ -248,7 +248,7 @@ func (s *Server) NetworkDeviceStats(ctx context.Context, in *empty.Empty) (*mach
}

// DiskStats implements the machine.MachineServer interface.
func (s *Server) DiskStats(ctx context.Context, in *empty.Empty) (*machine.DiskStatsResponse, error) {
func (s *Server) DiskStats(ctx context.Context, in *emptypb.Empty) (*machine.DiskStatsResponse, error) {
f, err := os.Open("/proc/diskstats")
if err != nil {
return nil, err
Expand Down
20 changes: 10 additions & 10 deletions internal/app/machined/internal/server/v1alpha1/v1alpha1_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/oci"
criconstants "github.com/containerd/cri/pkg/constants"
"github.com/golang/protobuf/ptypes/empty"
multierror "github.com/hashicorp/go-multierror"
"github.com/prometheus/procfs"
"github.com/rs/xid"
Expand All @@ -40,6 +39,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/emptypb"

installer "github.com/talos-systems/talos/cmd/installer/pkg/install"
"github.com/talos-systems/talos/internal/app/machined/internal/install"
Expand Down Expand Up @@ -210,7 +210,7 @@ func (s *Server) GenerateConfiguration(ctx context.Context, in *machine.Generate
// Reboot implements the machine.MachineServer interface.
//
//nolint:dupl
func (s *Server) Reboot(ctx context.Context, in *empty.Empty) (reply *machine.RebootResponse, err error) {
func (s *Server) Reboot(ctx context.Context, in *emptypb.Empty) (reply *machine.RebootResponse, err error) {
log.Printf("reboot via API received")

if err := s.checkSupported(runtime.Reboot); err != nil {
Expand Down Expand Up @@ -348,7 +348,7 @@ func (s *Server) Bootstrap(ctx context.Context, in *machine.BootstrapRequest) (r
// Shutdown implements the machine.MachineServer interface.
//
//nolint:dupl
func (s *Server) Shutdown(ctx context.Context, in *empty.Empty) (reply *machine.ShutdownResponse, err error) {
func (s *Server) Shutdown(ctx context.Context, in *emptypb.Empty) (reply *machine.ShutdownResponse, err error) {
log.Printf("shutdown via API received")

if err = s.checkSupported(runtime.Shutdown); err != nil {
Expand Down Expand Up @@ -596,7 +596,7 @@ func (s *Server) Reset(ctx context.Context, in *machine.ResetRequest) (reply *ma
}

// ServiceList returns list of the registered services and their status.
func (s *Server) ServiceList(ctx context.Context, in *empty.Empty) (result *machine.ServiceListResponse, err error) {
func (s *Server) ServiceList(ctx context.Context, in *emptypb.Empty) (result *machine.ServiceListResponse, err error) {
services := system.Services(s.Controller.Runtime()).List()

result = &machine.ServiceListResponse{
Expand Down Expand Up @@ -976,7 +976,7 @@ func (s *Server) DiskUsage(req *machine.DiskUsageRequest, obj machine.MachineSer
}

// Mounts implements the machine.MachineServer interface.
func (s *Server) Mounts(ctx context.Context, in *empty.Empty) (reply *machine.MountsResponse, err error) {
func (s *Server) Mounts(ctx context.Context, in *emptypb.Empty) (reply *machine.MountsResponse, err error) {
file, err := os.Open("/proc/mounts")
if err != nil {
return nil, err
Expand Down Expand Up @@ -1048,7 +1048,7 @@ func (s *Server) Mounts(ctx context.Context, in *empty.Empty) (reply *machine.Mo
}

// Version implements the machine.MachineServer interface.
func (s *Server) Version(ctx context.Context, in *empty.Empty) (reply *machine.VersionResponse, err error) {
func (s *Server) Version(ctx context.Context, in *emptypb.Empty) (reply *machine.VersionResponse, err error) {
var platform *machine.PlatformInfo

if s.Controller.Runtime().State().Platform() != nil {
Expand All @@ -1074,7 +1074,7 @@ func (s *Server) Version(ctx context.Context, in *empty.Empty) (reply *machine.V
}

// Kubeconfig implements the machine.MachineServer interface.
func (s *Server) Kubeconfig(empty *empty.Empty, obj machine.MachineService_KubeconfigServer) error {
func (s *Server) Kubeconfig(empty *emptypb.Empty, obj machine.MachineService_KubeconfigServer) error {
var b bytes.Buffer

if err := kubeconfig.GenerateAdmin(s.Controller.Runtime().Config().Cluster(), &b); err != nil {
Expand Down Expand Up @@ -1543,7 +1543,7 @@ func (s *Server) Dmesg(req *machine.DmesgRequest, srv machine.MachineService_Dme
}

// Processes implements the machine.MachineServer interface.
func (s *Server) Processes(ctx context.Context, in *empty.Empty) (reply *machine.ProcessesResponse, err error) {
func (s *Server) Processes(ctx context.Context, in *emptypb.Empty) (reply *machine.ProcessesResponse, err error) {
procs, err := procfs.AllProcs()
if err != nil {
return nil, err
Expand Down Expand Up @@ -1608,7 +1608,7 @@ func (s *Server) Processes(ctx context.Context, in *empty.Empty) (reply *machine
}

// Memory implements the machine.MachineServer interface.
func (s *Server) Memory(ctx context.Context, in *empty.Empty) (reply *machine.MemoryResponse, err error) {
func (s *Server) Memory(ctx context.Context, in *emptypb.Empty) (reply *machine.MemoryResponse, err error) {
proc, err := procfs.NewDefaultFS()
if err != nil {
return nil, err
Expand Down Expand Up @@ -1900,7 +1900,7 @@ func (s *Server) EtcdRecover(srv machine.MachineService_EtcdRecoverServer) error
//
// Temporary API only used when converting from self-hosted to Talos-managed control plane.
// This API can be removed once the conversion process is no longer needed (Talos 0.11?).
func (s *Server) RemoveBootkubeInitializedKey(ctx context.Context, in *empty.Empty) (*machine.RemoveBootkubeInitializedKeyResponse, error) {
func (s *Server) RemoveBootkubeInitializedKey(ctx context.Context, in *emptypb.Empty) (*machine.RemoveBootkubeInitializedKeyResponse, error) {
client, err := etcd.NewLocalClient()
if err != nil {
return nil, fmt.Errorf("failed to create etcd client: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"time"

"github.com/beevik/ntp"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
"google.golang.org/protobuf/types/known/timestamppb"

timeapi "github.com/talos-systems/talos/pkg/machinery/api/time"
Expand All @@ -36,7 +36,7 @@ func (r *TimeServer) Register(s *grpc.Server) {
}

// Time issues a query to the configured ntp server and displays the results.
func (r *TimeServer) Time(ctx context.Context, in *empty.Empty) (reply *timeapi.TimeResponse, err error) {
func (r *TimeServer) Time(ctx context.Context, in *emptypb.Empty) (reply *timeapi.TimeResponse, err error) {
timeServers := r.ConfigProvider.Config().Machine().Time().Servers()

if len(timeServers) == 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"os"
"testing"

"github.com/golang/protobuf/ptypes/empty"
"github.com/stretchr/testify/suite"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"

runtime "github.com/talos-systems/talos/internal/app/machined/internal/server/v1alpha1"
"github.com/talos-systems/talos/pkg/grpc/dialer"
Expand Down Expand Up @@ -75,7 +75,7 @@ func (suite *TimedSuite) TestTime() {
suite.Require().NoError(err)

nClient := timeapi.NewTimeServiceClient(conn)
reply, err := nClient.Time(context.Background(), &empty.Empty{})
reply, err := nClient.Time(context.Background(), &emptypb.Empty{})
suite.Require().NoError(err)
suite.Assert().Equal(reply.Messages[0].Server, testServer)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/app/machined/pkg/runtime/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"fmt"
"time"

"github.com/golang/protobuf/ptypes/any"
"github.com/rs/xid"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"

"github.com/talos-systems/talos/pkg/machinery/api/machine"
)
Expand Down Expand Up @@ -107,7 +107,7 @@ func (event *Event) ToMachineEvent() (*machine.Event, error) {
}

return &machine.Event{
Data: &any.Any{
Data: &anypb.Any{
TypeUrl: event.TypeURL,
Value: value,
},
Expand Down
6 changes: 3 additions & 3 deletions internal/app/networkd/pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"log"
"net"

"github.com/golang/protobuf/ptypes/empty"
"github.com/jsimonetti/rtnetlink"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"

networkapi "github.com/talos-systems/talos/pkg/machinery/api/network"
)
Expand All @@ -29,7 +29,7 @@ func (r *NetworkServer) Register(s *grpc.Server) {
}

// Routes returns the hosts routing table.
func (r *NetworkServer) Routes(ctx context.Context, in *empty.Empty) (reply *networkapi.RoutesResponse, err error) {
func (r *NetworkServer) Routes(ctx context.Context, in *emptypb.Empty) (reply *networkapi.RoutesResponse, err error) {
conn, err := rtnetlink.Dial(nil)
if err != nil {
return nil, err
Expand Down Expand Up @@ -78,7 +78,7 @@ func (r *NetworkServer) Routes(ctx context.Context, in *empty.Empty) (reply *net
}

// Interfaces returns the hosts network interfaces and addresses.
func (r *NetworkServer) Interfaces(ctx context.Context, in *empty.Empty) (reply *networkapi.InterfacesResponse, err error) {
func (r *NetworkServer) Interfaces(ctx context.Context, in *emptypb.Empty) (reply *networkapi.InterfacesResponse, err error) {
ifaces, err := net.Interfaces()
if err != nil {
return reply, err
Expand Down
6 changes: 3 additions & 3 deletions internal/app/networkd/pkg/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"os"
"testing"

"github.com/golang/protobuf/ptypes/empty"
"github.com/stretchr/testify/suite"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"

"github.com/talos-systems/talos/internal/app/networkd/pkg/server"
"github.com/talos-systems/talos/pkg/grpc/dialer"
Expand Down Expand Up @@ -51,7 +51,7 @@ func (suite *NetworkSuite) TestRoutes() {
suite.Assert().NoError(err)

nClient := networkapi.NewNetworkServiceClient(conn)
resp, err := nClient.Routes(context.Background(), &empty.Empty{})
resp, err := nClient.Routes(context.Background(), &emptypb.Empty{})
suite.Assert().NoError(err)
suite.Assert().Greater(len(resp.Messages[0].Routes), 0)
}
Expand All @@ -76,7 +76,7 @@ func (suite *NetworkSuite) TestInterfaces() {
suite.Assert().NoError(err)

nClient := networkapi.NewNetworkServiceClient(conn)
resp, err := nClient.Interfaces(context.Background(), &empty.Empty{})
resp, err := nClient.Interfaces(context.Background(), &emptypb.Empty{})
suite.Assert().NoError(err)
suite.Assert().Greater(len(resp.Messages[0].Interfaces), 0)
}
Expand Down
Loading

0 comments on commit b969e77

Please sign in to comment.