Skip to content

Commit

Permalink
chore: update tools, use new generators
Browse files Browse the repository at this point in the history
To stay current.

Signed-off-by: Alexey Palazhchenko <alexey.palazhchenko@gmail.com>
  • Loading branch information
AlekSi authored and talos-bot committed Mar 16, 2021
1 parent e31790f commit 0dbaeb9
Show file tree
Hide file tree
Showing 30 changed files with 3,026 additions and 2,847 deletions.
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,25 @@ FROM build AS generate-build
# Common needs to be at or near the top to satisfy the subsequent imports
COPY ./api/vendor/ /api/vendor/
COPY ./api/common/common.proto /api/common/common.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api common/common.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api common/common.proto
COPY ./api/health/health.proto /api/health/health.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api health/health.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api health/health.proto
COPY ./api/security/security.proto /api/security/security.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api security/security.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api security/security.proto
COPY ./api/storage/storage.proto /api/storage/storage.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api storage/storage.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api storage/storage.proto
COPY ./api/machine/machine.proto /api/machine/machine.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api machine/machine.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api machine/machine.proto
COPY ./api/time/time.proto /api/time/time.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api time/time.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api time/time.proto
COPY ./api/network/network.proto /api/network/network.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api network/network.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api network/network.proto
COPY ./api/cluster/cluster.proto /api/cluster/cluster.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api cluster/cluster.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api cluster/cluster.proto
COPY ./api/resource/resource.proto /api/resource/resource.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api resource/resource.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api resource/resource.proto
COPY ./api/inspect/inspect.proto /api/inspect/inspect.proto
RUN protoc -I/api -I/api/vendor/ --go_out=plugins=grpc,paths=source_relative:/api inspect/inspect.proto
RUN protoc -I/api -I/api/vendor/ --go_out=paths=source_relative:/api --go-grpc_out=paths=source_relative:/api inspect/inspect.proto
# Gofumports generated files to adjust import order
RUN gofumports -w -local github.com/talos-systems/talos /api/

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ REGISTRY_AND_USERNAME := $(IMAGE_REGISTRY)/$(USERNAME)
DOCKER_LOGIN_ENABLED ?= true

ARTIFACTS := _out
TOOLS ?= ghcr.io/talos-systems/tools:v0.5.0-alpha.0
TOOLS ?= ghcr.io/talos-systems/tools:v0.5.0-alpha.0-1-gbcf3380
PKGS ?= v0.5.0-alpha.0-2-g35f9b6f
EXTRAS ?= v0.3.0-alpha.0
GO_VERSION ?= 1.16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (

// InspectServer implements InspectService API.
type InspectServer struct {
inspectapi.UnimplementedInspectServiceServer

server *Server
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (

// ResourceServer implements ResourceService API.
type ResourceServer struct {
resourceapi.UnimplementedResourceServiceServer

server *Server
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ const MinimumEtcdUpgradeLeaseLockSeconds = 60
// OSPathSeparator is the string version of the os.PathSeparator.
const OSPathSeparator = string(os.PathSeparator)

// Server implements the gRPC service server.
// Server implements ClusterService and MachineService APIs
// and is also responsible for registering ResourceServer and InspectServer.
type Server struct {
cluster.UnimplementedClusterServiceServer
machine.UnimplementedMachineServiceServer

Controller runtime.Controller

server *grpc.Server
Expand Down
21 changes: 14 additions & 7 deletions internal/app/maintenance/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ import (
v1alpha1machine "github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
)

// Server implements machine.MachineService.
// Server implements machine.MachineService, network.NetworkService, and storage.StorageService.
type Server struct {
storage.UnimplementedStorageServiceServer
machine.UnimplementedMachineServiceServer
network.UnimplementedNetworkServiceServer
storaged.Server
runtime runtime.Runtime
cfgCh chan []byte
logger *log.Logger
server *grpc.Server

runtime runtime.Runtime
logger *log.Logger
cfgCh chan []byte
server *grpc.Server
storaged storaged.Server
}

// New initializes and returns a `Server`.
func New(r runtime.Runtime, logger *log.Logger, cfgCh chan []byte) *Server {
return &Server{
logger: logger,
runtime: r,
logger: logger,
cfgCh: cfgCh,
}
}
Expand All @@ -52,6 +54,11 @@ func (s *Server) Register(obj *grpc.Server) {
network.RegisterNetworkServiceServer(obj, s)
}

// Disks implements storage.StorageService.
func (s *Server) Disks(ctx context.Context, in *empty.Empty) (reply *storage.DisksResponse, err error) {
return s.storaged.Disks(ctx, in)
}

// ApplyConfiguration implements machine.MachineService.
func (s *Server) ApplyConfiguration(ctx context.Context, in *machine.ApplyConfigurationRequest) (reply *machine.ApplyConfigurationResponse, err error) {
if in.OnReboot {
Expand Down
5 changes: 4 additions & 1 deletion internal/app/networkd/pkg/reg/reg.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ import (
)

// Registrator is the concrete type that implements the factory.Registrator and
// networkapi.NetworkServer interfaces.
// healthapi.HealthServer and networkapi.NetworkServiceServer interfaces.
type Registrator struct {
healthapi.UnimplementedHealthServer
networkapi.UnimplementedNetworkServiceServer

Networkd *networkd.Networkd
Conn *rtnetlink.Conn

Expand Down
2 changes: 1 addition & 1 deletion internal/app/storaged/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
// TODO: this is not a full blown service yet, it's used as the common base in the machine and the maintenance services.
type Server struct{}

// Disks implements machine.MaintenanceService.
// Disks implements storage.StorageService.
func (s *Server) Disks(ctx context.Context, in *empty.Empty) (reply *storage.DisksResponse, err error) {
disks, err := util.GetDisks()
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion internal/app/timed/pkg/reg/reg.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ import (
)

// Registrator is the concrete type that implements the factory.Registrator and
// timeapi.Init interfaces.
// healthapi.HealthServer and timeapi.TimeServiceServer interfaces.
type Registrator struct {
healthapi.UnimplementedHealthServer
timeapi.UnimplementedTimeServiceServer

Timed *ntp.NTP
}

Expand All @@ -32,6 +35,8 @@ func NewRegistrator(n *ntp.NTP) *Registrator {
}

// Register implements the factory.Registrator interface.
//
//nolint:interfacer
func (r *Registrator) Register(s *grpc.Server) {
timeapi.RegisterTimeServiceServer(s, r)
healthapi.RegisterHealthServer(s, r)
Expand Down
6 changes: 5 additions & 1 deletion internal/app/trustd/internal/reg/reg.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ import (
)

// Registrator is the concrete type that implements the factory.Registrator and
// securityapi.SecurityServer interfaces.
// securityapi.SecurityServiceServer interfaces.
type Registrator struct {
securityapi.UnimplementedSecurityServiceServer

Config config.Provider
}

// Register implements the factory.Registrator interface.
//
//nolint:interfacer
func (r *Registrator) Register(s *grpc.Server) {
securityapi.RegisterSecurityServiceServer(s, r)
}
Expand Down
117 changes: 2 additions & 115 deletions pkg/machinery/api/cluster/cluster.pb.go

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

Loading

0 comments on commit 0dbaeb9

Please sign in to comment.