parent
3543b275e0
commit
e803fb0855
@ -184,7 +184,8 @@ func (r *runtime) Create(s *Service, opts ...CreateOption) error {
|
||||
}
|
||||
|
||||
if len(options.Command) == 0 {
|
||||
options.Command = []string{"go", "run", "."}
|
||||
options.Command = []string{"go", "run"}
|
||||
options.Args = []string{"."}
|
||||
}
|
||||
|
||||
// create new service
|
||||
|
@ -2,8 +2,6 @@
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -250,11 +248,6 @@ func (k *kubernetes) Init(opts ...runtime.Option) error {
|
||||
o(&k.options)
|
||||
}
|
||||
|
||||
// trim the source prefix if its a git url
|
||||
if strings.HasPrefix(k.options.Source, "github.com") {
|
||||
k.options.Source = strings.TrimPrefix(k.options.Source, "github.com/")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -270,14 +263,20 @@ func (k *kubernetes) Create(s *runtime.Service, opts ...runtime.CreateOption) er
|
||||
o(&options)
|
||||
}
|
||||
|
||||
// hackish
|
||||
// default type if it doesn't exist
|
||||
if len(options.Type) == 0 {
|
||||
options.Type = k.options.Type
|
||||
}
|
||||
|
||||
// determine the full source for this service
|
||||
options.Source = k.sourceForService(s.Name)
|
||||
// default the source if it doesn't exist
|
||||
if len(s.Source) == 0 {
|
||||
s.Source = k.options.Source
|
||||
}
|
||||
|
||||
// determine the image from the source and options
|
||||
options.Image = k.getImage(s, options)
|
||||
|
||||
// create new service
|
||||
service := newService(s, options)
|
||||
|
||||
// start the service
|
||||
@ -334,10 +333,15 @@ func (k *kubernetes) List() ([]*runtime.Service, error) {
|
||||
// Update the service in place
|
||||
func (k *kubernetes) Update(s *runtime.Service) error {
|
||||
// create new kubernetes micro service
|
||||
service := newService(s, runtime.CreateOptions{
|
||||
Type: k.options.Type,
|
||||
Source: k.sourceForService(s.Name),
|
||||
})
|
||||
opts := runtime.CreateOptions{
|
||||
Type: k.options.Type,
|
||||
}
|
||||
|
||||
// set image
|
||||
opts.Image = k.getImage(s, opts)
|
||||
|
||||
// new pseudo service
|
||||
service := newService(s, opts)
|
||||
|
||||
// update build time annotation
|
||||
service.kdeploy.Spec.Template.Metadata.Annotations["build"] = time.Now().Format(time.RFC3339)
|
||||
@ -442,14 +446,15 @@ func NewRuntime(opts ...runtime.Option) runtime.Runtime {
|
||||
}
|
||||
}
|
||||
|
||||
// sourceForService determines the nested package name for github
|
||||
// e.g src: docker.pkg.github.com/micro/services an srv: users/api
|
||||
// would become docker.pkg.github.com/micro/services/users-api
|
||||
func (k *kubernetes) sourceForService(name string) string {
|
||||
if !strings.HasPrefix(k.options.Source, "docker.pkg.github.com") {
|
||||
return k.options.Source
|
||||
func (k *kubernetes) getImage(s *runtime.Service, options runtime.CreateOptions) string {
|
||||
// use the image when its specified
|
||||
if len(options.Image) > 0 {
|
||||
return options.Image
|
||||
}
|
||||
|
||||
formattedName := strings.ReplaceAll(name, "/", "-")
|
||||
return fmt.Sprintf("%v/%v", k.options.Source, formattedName)
|
||||
if len(k.options.Image) > 0 {
|
||||
return k.options.Image
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
@ -54,14 +54,12 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
|
||||
kdeploy.Metadata.Annotations["group"] = "micro"
|
||||
|
||||
// update the deployment is a custom source is provided
|
||||
if len(c.Source) > 0 {
|
||||
if len(c.Image) > 0 {
|
||||
for i := range kdeploy.Spec.Template.PodSpec.Containers {
|
||||
kdeploy.Spec.Template.PodSpec.Containers[i].Image = c.Source
|
||||
kdeploy.Spec.Template.PodSpec.Containers[i].Image = c.Image
|
||||
kdeploy.Spec.Template.PodSpec.Containers[i].Command = []string{}
|
||||
kdeploy.Spec.Template.PodSpec.Containers[i].Args = []string{name}
|
||||
kdeploy.Spec.Template.PodSpec.Containers[i].Args = []string{}
|
||||
}
|
||||
|
||||
kdeploy.Metadata.Annotations["source"] = c.Source
|
||||
}
|
||||
|
||||
// define the environment values used by the container
|
||||
@ -76,11 +74,15 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
|
||||
kdeploy.Spec.Template.PodSpec.Containers[0].Env = append(kdeploy.Spec.Template.PodSpec.Containers[0].Env, env...)
|
||||
}
|
||||
|
||||
// specify the command to exec
|
||||
if strings.HasPrefix(c.Source, "github.com") && len(c.Command) > 0 {
|
||||
// set the command if specified
|
||||
if len(c.Command) > 0 {
|
||||
kdeploy.Spec.Template.PodSpec.Containers[0].Command = c.Command
|
||||
}
|
||||
|
||||
if len(c.Args) > 0 {
|
||||
kdeploy.Spec.Template.PodSpec.Containers[0].Args = c.Args
|
||||
}
|
||||
|
||||
return &service{
|
||||
Service: s,
|
||||
kservice: kservice,
|
||||
|
@ -14,6 +14,8 @@ type Options struct {
|
||||
Type string
|
||||
// Source of the services repository
|
||||
Source string
|
||||
// Base image to use
|
||||
Image string
|
||||
}
|
||||
|
||||
// WithSource sets the base image / repository
|
||||
@ -37,14 +39,23 @@ func WithType(t string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithImage sets the image to use
|
||||
func WithImage(t string) Option {
|
||||
return func(o *Options) {
|
||||
o.Image = t
|
||||
}
|
||||
}
|
||||
|
||||
type CreateOption func(o *CreateOptions)
|
||||
|
||||
type ReadOption func(o *ReadOptions)
|
||||
|
||||
// CreateOptions configure runtime services
|
||||
type CreateOptions struct {
|
||||
// command to execute including args
|
||||
// Command to execut
|
||||
Command []string
|
||||
// Args to pass into command
|
||||
Args []string
|
||||
// Environment to configure
|
||||
Env []string
|
||||
// Log output
|
||||
@ -53,8 +64,8 @@ type CreateOptions struct {
|
||||
Type string
|
||||
// Retries before failing deploy
|
||||
Retries int
|
||||
// Source of the service
|
||||
Source string
|
||||
// Specify the image to use
|
||||
Image string
|
||||
}
|
||||
|
||||
// ReadOptions queries runtime services
|
||||
@ -74,18 +85,26 @@ func CreateType(t string) CreateOption {
|
||||
}
|
||||
}
|
||||
|
||||
// CreateSource sets the source of service to create
|
||||
func CreateSource(t string) CreateOption {
|
||||
// CreateImage sets the image to use
|
||||
func CreateImage(img string) CreateOption {
|
||||
return func(o *CreateOptions) {
|
||||
o.Source = t
|
||||
o.Image = img
|
||||
}
|
||||
}
|
||||
|
||||
// WithCommand specifies the command to execute
|
||||
func WithCommand(args ...string) CreateOption {
|
||||
func WithCommand(cmd ...string) CreateOption {
|
||||
return func(o *CreateOptions) {
|
||||
// set command
|
||||
o.Command = args
|
||||
o.Command = cmd
|
||||
}
|
||||
}
|
||||
|
||||
// WithArgs specifies the command to execute
|
||||
func WithArgs(args ...string) CreateOption {
|
||||
return func(o *CreateOptions) {
|
||||
// set command
|
||||
o.Args = args
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package runtime
|
||||
import (
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -41,11 +42,8 @@ func newService(s *Service, c CreateOptions) *service {
|
||||
var args []string
|
||||
|
||||
// set command
|
||||
exec = c.Command[0]
|
||||
// set args
|
||||
if len(c.Command) > 1 {
|
||||
args = c.Command[1:]
|
||||
}
|
||||
exec = strings.Join(c.Command, " ")
|
||||
args = c.Args
|
||||
|
||||
return &service{
|
||||
Service: s,
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: runtime/service/proto/runtime.proto
|
||||
// source: github.com/micro/go-micro/runtime/service/proto/runtime.proto
|
||||
|
||||
package go_micro_runtime
|
||||
|
||||
@ -38,7 +38,7 @@ func (m *Service) Reset() { *m = Service{} }
|
||||
func (m *Service) String() string { return proto.CompactTextString(m) }
|
||||
func (*Service) ProtoMessage() {}
|
||||
func (*Service) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{0}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{0}
|
||||
}
|
||||
|
||||
func (m *Service) XXX_Unmarshal(b []byte) error {
|
||||
@ -101,7 +101,7 @@ func (m *Event) Reset() { *m = Event{} }
|
||||
func (m *Event) String() string { return proto.CompactTextString(m) }
|
||||
func (*Event) ProtoMessage() {}
|
||||
func (*Event) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{1}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{1}
|
||||
}
|
||||
|
||||
func (m *Event) XXX_Unmarshal(b []byte) error {
|
||||
@ -153,10 +153,16 @@ func (m *Event) GetVersion() string {
|
||||
type CreateOptions struct {
|
||||
// command to pass in
|
||||
Command []string `protobuf:"bytes,1,rep,name=command,proto3" json:"command,omitempty"`
|
||||
// args to pass into command
|
||||
Args []string `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"`
|
||||
// environment to pass in
|
||||
Env []string `protobuf:"bytes,2,rep,name=env,proto3" json:"env,omitempty"`
|
||||
Env []string `protobuf:"bytes,3,rep,name=env,proto3" json:"env,omitempty"`
|
||||
// output to send to
|
||||
Output string `protobuf:"bytes,3,opt,name=output,proto3" json:"output,omitempty"`
|
||||
Output string `protobuf:"bytes,4,opt,name=output,proto3" json:"output,omitempty"`
|
||||
// create type of service
|
||||
Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// image to use
|
||||
Image string `protobuf:"bytes,6,opt,name=image,proto3" json:"image,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -166,7 +172,7 @@ func (m *CreateOptions) Reset() { *m = CreateOptions{} }
|
||||
func (m *CreateOptions) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateOptions) ProtoMessage() {}
|
||||
func (*CreateOptions) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{2}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{2}
|
||||
}
|
||||
|
||||
func (m *CreateOptions) XXX_Unmarshal(b []byte) error {
|
||||
@ -194,6 +200,13 @@ func (m *CreateOptions) GetCommand() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateOptions) GetArgs() []string {
|
||||
if m != nil {
|
||||
return m.Args
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateOptions) GetEnv() []string {
|
||||
if m != nil {
|
||||
return m.Env
|
||||
@ -208,6 +221,20 @@ func (m *CreateOptions) GetOutput() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateOptions) GetType() string {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateOptions) GetImage() string {
|
||||
if m != nil {
|
||||
return m.Image
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateRequest struct {
|
||||
Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
|
||||
Options *CreateOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
|
||||
@ -220,7 +247,7 @@ func (m *CreateRequest) Reset() { *m = CreateRequest{} }
|
||||
func (m *CreateRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateRequest) ProtoMessage() {}
|
||||
func (*CreateRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{3}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{3}
|
||||
}
|
||||
|
||||
func (m *CreateRequest) XXX_Unmarshal(b []byte) error {
|
||||
@ -265,7 +292,7 @@ func (m *CreateResponse) Reset() { *m = CreateResponse{} }
|
||||
func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateResponse) ProtoMessage() {}
|
||||
func (*CreateResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{4}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{4}
|
||||
}
|
||||
|
||||
func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
|
||||
@ -302,7 +329,7 @@ func (m *ReadOptions) Reset() { *m = ReadOptions{} }
|
||||
func (m *ReadOptions) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReadOptions) ProtoMessage() {}
|
||||
func (*ReadOptions) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{5}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{5}
|
||||
}
|
||||
|
||||
func (m *ReadOptions) XXX_Unmarshal(b []byte) error {
|
||||
@ -355,7 +382,7 @@ func (m *ReadRequest) Reset() { *m = ReadRequest{} }
|
||||
func (m *ReadRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReadRequest) ProtoMessage() {}
|
||||
func (*ReadRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{6}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{6}
|
||||
}
|
||||
|
||||
func (m *ReadRequest) XXX_Unmarshal(b []byte) error {
|
||||
@ -394,7 +421,7 @@ func (m *ReadResponse) Reset() { *m = ReadResponse{} }
|
||||
func (m *ReadResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReadResponse) ProtoMessage() {}
|
||||
func (*ReadResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{7}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{7}
|
||||
}
|
||||
|
||||
func (m *ReadResponse) XXX_Unmarshal(b []byte) error {
|
||||
@ -433,7 +460,7 @@ func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
|
||||
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteRequest) ProtoMessage() {}
|
||||
func (*DeleteRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{8}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{8}
|
||||
}
|
||||
|
||||
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
|
||||
@ -471,7 +498,7 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
|
||||
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteResponse) ProtoMessage() {}
|
||||
func (*DeleteResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{9}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{9}
|
||||
}
|
||||
|
||||
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
|
||||
@ -503,7 +530,7 @@ func (m *UpdateRequest) Reset() { *m = UpdateRequest{} }
|
||||
func (m *UpdateRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*UpdateRequest) ProtoMessage() {}
|
||||
func (*UpdateRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{10}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{10}
|
||||
}
|
||||
|
||||
func (m *UpdateRequest) XXX_Unmarshal(b []byte) error {
|
||||
@ -541,7 +568,7 @@ func (m *UpdateResponse) Reset() { *m = UpdateResponse{} }
|
||||
func (m *UpdateResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*UpdateResponse) ProtoMessage() {}
|
||||
func (*UpdateResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{11}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{11}
|
||||
}
|
||||
|
||||
func (m *UpdateResponse) XXX_Unmarshal(b []byte) error {
|
||||
@ -572,7 +599,7 @@ func (m *ListRequest) Reset() { *m = ListRequest{} }
|
||||
func (m *ListRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListRequest) ProtoMessage() {}
|
||||
func (*ListRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{12}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{12}
|
||||
}
|
||||
|
||||
func (m *ListRequest) XXX_Unmarshal(b []byte) error {
|
||||
@ -604,7 +631,7 @@ func (m *ListResponse) Reset() { *m = ListResponse{} }
|
||||
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListResponse) ProtoMessage() {}
|
||||
func (*ListResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2434d8152598889b, []int{13}
|
||||
return fileDescriptor_976fccef828ab1f0, []int{13}
|
||||
}
|
||||
|
||||
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
|
||||
@ -651,42 +678,45 @@ func init() {
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("runtime/service/proto/runtime.proto", fileDescriptor_2434d8152598889b)
|
||||
proto.RegisterFile("github.com/micro/go-micro/runtime/service/proto/runtime.proto", fileDescriptor_976fccef828ab1f0)
|
||||
}
|
||||
|
||||
var fileDescriptor_2434d8152598889b = []byte{
|
||||
// 521 bytes of a gzipped FileDescriptorProto
|
||||
var fileDescriptor_976fccef828ab1f0 = []byte{
|
||||
// 563 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4b, 0x6f, 0xd3, 0x40,
|
||||
0x10, 0xae, 0xeb, 0x34, 0x69, 0xc7, 0x18, 0x45, 0x2b, 0x84, 0x4c, 0xc5, 0x23, 0x32, 0x07, 0x7a,
|
||||
0x72, 0xa4, 0x54, 0x88, 0xd7, 0xb1, 0x09, 0x5c, 0x88, 0x90, 0x5c, 0xf5, 0x07, 0x2c, 0xc9, 0x08,
|
||||
0x59, 0xd4, 0xbb, 0xc6, 0xbb, 0xb6, 0x94, 0x13, 0x57, 0xfe, 0x1e, 0xff, 0x08, 0xed, 0x2b, 0xb6,
|
||||
0x53, 0x9b, 0x4b, 0x6e, 0x3b, 0xb3, 0x33, 0x9f, 0xbf, 0xc7, 0xca, 0xf0, 0xba, 0xac, 0x98, 0xcc,
|
||||
0x72, 0x9c, 0x0b, 0x2c, 0xeb, 0x6c, 0x83, 0xf3, 0xa2, 0xe4, 0x92, 0xcf, 0x6d, 0x37, 0xd1, 0x15,
|
||||
0x99, 0xfe, 0xe0, 0x49, 0x9e, 0x6d, 0x4a, 0x9e, 0xd8, 0x7e, 0xfc, 0xd7, 0x83, 0xc9, 0xad, 0xd9,
|
||||
0x20, 0x04, 0x46, 0x8c, 0xe6, 0x18, 0x79, 0x33, 0xef, 0xea, 0x22, 0xd5, 0x67, 0x12, 0xc1, 0xa4,
|
||||
0xc6, 0x52, 0x64, 0x9c, 0x45, 0xa7, 0xba, 0xed, 0x4a, 0xf2, 0x14, 0xc6, 0x82, 0x57, 0xe5, 0x06,
|
||||
0x23, 0x5f, 0x5f, 0xd8, 0x8a, 0xdc, 0xc0, 0x79, 0x8e, 0x92, 0x6e, 0xa9, 0xa4, 0xd1, 0x68, 0xe6,
|
||||
0x5f, 0x05, 0x8b, 0x37, 0xc9, 0xe1, 0x67, 0x13, 0xfb, 0xc9, 0x64, 0x6d, 0x27, 0x57, 0x4c, 0x96,
|
||||
0xbb, 0x74, 0xbf, 0x78, 0xf9, 0x09, 0xc2, 0xce, 0x15, 0x99, 0x82, 0xff, 0x13, 0x77, 0x96, 0x9a,
|
||||
0x3a, 0x92, 0x27, 0x70, 0x56, 0xd3, 0xfb, 0x0a, 0x2d, 0x2f, 0x53, 0x7c, 0x3c, 0x7d, 0xef, 0xc5,
|
||||
0x39, 0x9c, 0xad, 0x6a, 0x64, 0x52, 0x09, 0x92, 0xbb, 0x62, 0x2f, 0x48, 0x9d, 0xc9, 0x73, 0xb8,
|
||||
0x50, 0x0c, 0x84, 0xa4, 0x79, 0xa1, 0x57, 0xfd, 0xb4, 0x69, 0x28, 0xb9, 0xd6, 0x3f, 0xab, 0xca,
|
||||
0x95, 0x6d, 0x23, 0x46, 0x1d, 0x23, 0xe2, 0x5b, 0x08, 0x6f, 0x4a, 0xa4, 0x12, 0xbf, 0x15, 0x32,
|
||||
0xe3, 0x4c, 0xa8, 0xd1, 0x0d, 0xcf, 0x73, 0xca, 0xb6, 0x91, 0x37, 0xf3, 0xd5, 0xa8,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, 0x67, 0xc3, 0x03, 0x96, 0xee,
|
||||
0x09, 0xf9, 0x02, 0x23, 0x95, 0x13, 0x19, 0xc8, 0xd5, 0x41, 0xbd, 0x1c, 0xba, 0xde, 0x03, 0xad,
|
||||
0x61, 0x6c, 0x3c, 0xee, 0xe3, 0xd5, 0xc9, 0xb0, 0x8f, 0xd7, 0x41, 0x3c, 0x1a, 0xce, 0x58, 0xdb,
|
||||
0x07, 0xd7, 0x89, 0xae, 0x0f, 0xee, 0x20, 0x15, 0x2d, 0x53, 0x05, 0xd1, 0x27, 0xb3, 0x95, 0x57,
|
||||
0x9f, 0xcc, 0x76, 0x7e, 0xf1, 0xc9, 0xf7, 0xb1, 0xfe, 0x75, 0x5f, 0xff, 0x0b, 0x00, 0x00, 0xff,
|
||||
0xff, 0x43, 0x9c, 0x97, 0x62, 0xe1, 0x05, 0x00, 0x00,
|
||||
0x10, 0xae, 0xe3, 0x3c, 0xda, 0x09, 0x41, 0xd1, 0xaa, 0x42, 0xa6, 0xe2, 0x11, 0xf9, 0x42, 0x2f,
|
||||
0x38, 0x52, 0x2a, 0xc4, 0x4b, 0x9c, 0x9a, 0xc0, 0x85, 0x08, 0xc9, 0xa8, 0x3f, 0x60, 0x9b, 0x8c,
|
||||
0x82, 0x45, 0xd7, 0x6b, 0xbc, 0xeb, 0x48, 0x39, 0x71, 0xe5, 0xca, 0x4f, 0xe3, 0x1f, 0xa1, 0x7d,
|
||||
0xd9, 0x4e, 0x6a, 0xf7, 0x92, 0xdb, 0xcc, 0xec, 0xec, 0xb7, 0xdf, 0xc3, 0x32, 0x7c, 0xda, 0x24,
|
||||
0xf2, 0x47, 0x71, 0x1b, 0xad, 0x38, 0x9b, 0xb2, 0x64, 0x95, 0xf3, 0xe9, 0x86, 0xbf, 0x36, 0x45,
|
||||
0x5e, 0xa4, 0x32, 0x61, 0x38, 0x15, 0x98, 0x6f, 0x93, 0x15, 0x4e, 0xb3, 0x9c, 0xcb, 0x72, 0x1a,
|
||||
0xe9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0xb9, 0x60,
|
||||
0xda, 0xa3, 0x5c, 0x98, 0xfd, 0xf1, 0x61, 0x10, 0x9b, 0x53, 0xb2, 0x84, 0xbe, 0xf9, 0x12, 0x48,
|
||||
0xeb, 0xd7, 0x63, 0x5f, 0xbf, 0x98, 0xb4, 0x2f, 0x58, 0xba, 0x27, 0xe4, 0x0b, 0x74, 0x55, 0x4e,
|
||||
0xa4, 0x25, 0x57, 0x07, 0xf5, 0xa2, 0xed, 0xb8, 0x04, 0x5a, 0x42, 0xdf, 0x78, 0xdc, 0xc4, 0x6b,
|
||||
0x2f, 0xc3, 0x26, 0x5e, 0x07, 0xf1, 0x68, 0x38, 0x63, 0x6d, 0x13, 0xdc, 0x5e, 0x74, 0x4d, 0x70,
|
||||
0x07, 0xa9, 0x68, 0x99, 0x2a, 0x88, 0x26, 0x99, 0xb5, 0xbc, 0x9a, 0x64, 0xd6, 0xf3, 0x0b, 0x4f,
|
||||
0x6e, 0xfb, 0xfa, 0xcf, 0x7f, 0xf5, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x14, 0xdd, 0xee, 0x9f, 0x3a,
|
||||
0x06, 0x00, 0x00,
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||
// source: runtime/service/proto/runtime.proto
|
||||
// source: github.com/micro/go-micro/runtime/service/proto/runtime.proto
|
||||
|
||||
package go_micro_runtime
|
||||
|
||||
|
@ -31,10 +31,16 @@ message Event {
|
||||
message CreateOptions {
|
||||
// command to pass in
|
||||
repeated string command = 1;
|
||||
// args to pass into command
|
||||
repeated string args = 2;
|
||||
// environment to pass in
|
||||
repeated string env = 2;
|
||||
repeated string env = 3;
|
||||
// output to send to
|
||||
string output = 3;
|
||||
string output = 4;
|
||||
// create type of service
|
||||
string type = 5;
|
||||
// image to use
|
||||
string image = 6;
|
||||
}
|
||||
|
||||
message CreateRequest {
|
||||
|
@ -50,7 +50,10 @@ func (s *svc) Create(svc *runtime.Service, opts ...runtime.CreateOption) error {
|
||||
},
|
||||
Options: &pb.CreateOptions{
|
||||
Command: options.Command,
|
||||
Args: options.Args,
|
||||
Env: options.Env,
|
||||
Type: options.Type,
|
||||
Image: options.Image,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
cryptotls "crypto/tls"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/v2/store"
|
||||
"github.com/coreos/etcd/clientv3"
|
||||
"github.com/micro/go-micro/v2/store"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/v2/store"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/coreos/etcd/clientv3"
|
||||
"github.com/coreos/etcd/clientv3/namespace"
|
||||
"github.com/micro/go-micro/v2/store"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type etcdStore struct {
|
||||
|
@ -271,7 +271,7 @@ func NewDeployment(name, version, typ string) *Deployment {
|
||||
Name: name,
|
||||
Image: DefaultImage,
|
||||
Env: []EnvVar{env},
|
||||
Command: []string{"go", "run", "main.go"},
|
||||
Command: []string{"go", "run", "."},
|
||||
Ports: []ContainerPort{{
|
||||
Name: "service-port",
|
||||
ContainerPort: 8080,
|
||||
|
Loading…
x
Reference in New Issue
Block a user