feat(pre-deploy): add support for pre-deploy hook containers in service management, sync *all* containers to store

This commit is contained in:
Pasha Sviderski
2026-04-08 19:16:28 +10:00
parent cef047221c
commit 1c8b77054a
11 changed files with 508 additions and 298 deletions
+298 -214
View File
@@ -21,6 +21,55 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
// ContainerType specifies the purpose of the container being created.
type CreateServiceContainerRequest_ContainerType int32
const (
// SERVICE is the default type for long-running service containers.
CreateServiceContainerRequest_SERVICE CreateServiceContainerRequest_ContainerType = 0
// PRE_DEPLOY is a one-shot container for a pre-deploy hook to run before service deployment.
CreateServiceContainerRequest_PRE_DEPLOY CreateServiceContainerRequest_ContainerType = 1
)
// Enum value maps for CreateServiceContainerRequest_ContainerType.
var (
CreateServiceContainerRequest_ContainerType_name = map[int32]string{
0: "SERVICE",
1: "PRE_DEPLOY",
}
CreateServiceContainerRequest_ContainerType_value = map[string]int32{
"SERVICE": 0,
"PRE_DEPLOY": 1,
}
)
func (x CreateServiceContainerRequest_ContainerType) Enum() *CreateServiceContainerRequest_ContainerType {
p := new(CreateServiceContainerRequest_ContainerType)
*p = x
return p
}
func (x CreateServiceContainerRequest_ContainerType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (CreateServiceContainerRequest_ContainerType) Descriptor() protoreflect.EnumDescriptor {
return file_internal_machine_api_pb_docker_proto_enumTypes[0].Descriptor()
}
func (CreateServiceContainerRequest_ContainerType) Type() protoreflect.EnumType {
return &file_internal_machine_api_pb_docker_proto_enumTypes[0]
}
func (x CreateServiceContainerRequest_ContainerType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use CreateServiceContainerRequest_ContainerType.Descriptor instead.
func (CreateServiceContainerRequest_ContainerType) EnumDescriptor() ([]byte, []int) {
return file_internal_machine_api_pb_docker_proto_rawDescGZIP(), []int{31, 0}
}
type CreateContainerRequest struct { type CreateContainerRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -1778,6 +1827,7 @@ type CreateServiceContainerRequest struct {
// JSON serialised api.ServiceSpec. // JSON serialised api.ServiceSpec.
ServiceSpec []byte `protobuf:"bytes,2,opt,name=service_spec,json=serviceSpec,proto3" json:"service_spec,omitempty"` ServiceSpec []byte `protobuf:"bytes,2,opt,name=service_spec,json=serviceSpec,proto3" json:"service_spec,omitempty"`
ContainerName string `protobuf:"bytes,3,opt,name=container_name,json=containerName,proto3" json:"container_name,omitempty"` ContainerName string `protobuf:"bytes,3,opt,name=container_name,json=containerName,proto3" json:"container_name,omitempty"`
ContainerType CreateServiceContainerRequest_ContainerType `protobuf:"varint,4,opt,name=container_type,json=containerType,proto3,enum=api.CreateServiceContainerRequest_ContainerType" json:"container_type,omitempty"`
} }
func (x *CreateServiceContainerRequest) Reset() { func (x *CreateServiceContainerRequest) Reset() {
@@ -1833,6 +1883,13 @@ func (x *CreateServiceContainerRequest) GetContainerName() string {
return "" return ""
} }
func (x *CreateServiceContainerRequest) GetContainerType() CreateServiceContainerRequest_ContainerType {
if x != nil {
return x.ContainerType
}
return CreateServiceContainerRequest_SERVICE
}
type ServiceContainer struct { type ServiceContainer struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -2002,6 +2059,8 @@ type MachineServiceContainers struct {
Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
Containers []*ServiceContainer `protobuf:"bytes,2,rep,name=containers,proto3" json:"containers,omitempty"` Containers []*ServiceContainer `protobuf:"bytes,2,rep,name=containers,proto3" json:"containers,omitempty"`
// One-shot containers for deployment hooks (e.g. pre-deploy).
HookContainers []*ServiceContainer `protobuf:"bytes,3,rep,name=hook_containers,json=hookContainers,proto3" json:"hook_containers,omitempty"`
} }
func (x *MachineServiceContainers) Reset() { func (x *MachineServiceContainers) Reset() {
@@ -2050,6 +2109,13 @@ func (x *MachineServiceContainers) GetContainers() []*ServiceContainer {
return nil return nil
} }
func (x *MachineServiceContainers) GetHookContainers() []*ServiceContainer {
if x != nil {
return x.HookContainers
}
return nil
}
var File_internal_machine_api_pb_docker_proto protoreflect.FileDescriptor var File_internal_machine_api_pb_docker_proto protoreflect.FileDescriptor
var file_internal_machine_api_pb_docker_proto_rawDesc = []byte{ var file_internal_machine_api_pb_docker_proto_rawDesc = []byte{
@@ -2204,7 +2270,7 @@ var file_internal_machine_api_pb_docker_proto_rawDesc = []byte{
0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x08, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x1d, 0x43, 0x72, 0x28, 0x08, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x22, 0x8f, 0x02, 0x0a, 0x1d, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61,
0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
@@ -2213,123 +2279,136 @@ var file_internal_machine_api_pb_docker_proto_rawDesc = []byte{
0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x70, 0x65, 0x63, 0x12, 0x25, 0x0a, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x70, 0x65, 0x63, 0x12, 0x25, 0x0a,
0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x4e, 0x61, 0x6d, 0x65, 0x22, 0x53, 0x0a, 0x10, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x57, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x61,
0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0d,
0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x70, 0x65, 0x63, 0x22, 0x57, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2c, 0x0a,
0x0d, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b,
0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x50,
0x52, 0x45, 0x5f, 0x44, 0x45, 0x50, 0x4c, 0x4f, 0x59, 0x10, 0x01, 0x22, 0x53, 0x0a, 0x10, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12,
0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a,
0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x70, 0x65, 0x63,
0x22, 0x57, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12,
0x18, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x5a, 0x0a, 0x1d, 0x4c, 0x69, 0x73,
0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x6d, 0x65,
0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x70, 0x69, 0x2e, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x08, 0x6d, 0x65, 0x73,
0x6e, 0x73, 0x22, 0x5a, 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0xbc, 0x01, 0x0a, 0x18, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e,
0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x72, 0x73, 0x12, 0x29, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x61, 0x63, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x69, 0x6e, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x35, 0x0a,
0x6e, 0x65, 0x72, 0x73, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x7c, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
0x0a, 0x18, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43,
0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x12, 0x29, 0x0a, 0x08, 0x6d, 0x65, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x6e, 0x65, 0x72, 0x73, 0x12, 0x3e, 0x0a, 0x0f, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x63, 0x6f, 0x6e,
0x70, 0x69, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e,
0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x35, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61,
0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x0e, 0x68, 0x6f, 0x6f, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x6e, 0x65, 0x72, 0x73, 0x32, 0xfb, 0x0a, 0x0a, 0x06, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x12,
0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x32, 0xfb, 0x0a, 0x0a, 0x4c, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x06, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43,
0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x10, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74,
0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e,
0x73, 0x70, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x43,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53,
0x74, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0d,
0x53, 0x74, 0x6f, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
0x12, 0x49, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x73, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0f, 0x52,
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1b,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61,
0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
0x70, 0x74, 0x79, 0x12, 0x4a, 0x0a, 0x0d, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x61,
0x69, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x43,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74,
0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x12, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a,
0x32, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x73, 0x10, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x12, 0x10, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x43,
0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x79, 0x30, 0x01, 0x12, 0x36, 0x0a, 0x09, 0x50, 0x75, 0x6c, 0x6c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e,
0x12, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x75, 0x6c, 0x6c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4a, 0x53, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x4f, 0x4e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x0c, 0x49, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74,
0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67,
0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0d, 0x53, 0x74, 0x6f, 0x70, 0x43, 0x6f, 0x6e, 0x74,
0x65, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x70,
0x12, 0x55, 0x0a, 0x12, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x49, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69,
0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73,
0x6d, 0x61, 0x67, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x49, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6e,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d,
0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4a, 0x0a, 0x0d, 0x45,
0x78, 0x65, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x78,
0x65, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x12, 0x32, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x74, 0x61,
0x69, 0x6e, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x10, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c,
0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x30, 0x01, 0x12, 0x36, 0x0a, 0x09, 0x50,
0x75, 0x6c, 0x6c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50,
0x75, 0x6c, 0x6c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x10, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x0c, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x49, 0x6d,
0x61, 0x67, 0x65, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63,
0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x12, 0x49, 0x6e, 0x73, 0x70,
0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1e,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, 0x6f,
0x74, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6d, 0x6f,
0x74, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x3d, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x12, 0x16, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74,
0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43,
0x61, 0x74, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x18,
0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x6f, 0x6c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d,
0x75, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0b, 0x4c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43,
0x69, 0x73, 0x74, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x6f, 0x6c, 0x75, 0x6d,
0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x6f, 0x65, 0x73, 0x12, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x6f, 0x6c,
0x6c, 0x75, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x75, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x70,
0x0c, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x18, 0x2e, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73,
0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d, 0x6f,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x76, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x5a, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x5a, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74,
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x72, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65,
0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65,
0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, 0x17, 0x49, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61,
0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, 0x17, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x53, 0x65,
0x70, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1c,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74,
0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x5e, 0x0a, 0x15, 0x4c, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61,
0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69,
0x6e, 0x65, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x6e, 0x65, 0x72, 0x12, 0x5e, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x61,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f,
0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x16, 0x52, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72,
0x76, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1b, 0x2e,
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x73, 0x76, 0x69, 0x64, 0x65, 0x72, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70,
0x73, 0x6b, 0x69, 0x2f, 0x75, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x74, 0x79, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x73, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x6b, 0x69, 0x2f, 0x75, 0x6e, 0x63, 0x6c,
0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6f, 0x75, 0x64, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6d, 0x61, 0x63,
0x68, 0x69, 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
} }
var ( var (
@@ -2344,108 +2423,112 @@ func file_internal_machine_api_pb_docker_proto_rawDescGZIP() []byte {
return file_internal_machine_api_pb_docker_proto_rawDescData return file_internal_machine_api_pb_docker_proto_rawDescData
} }
var file_internal_machine_api_pb_docker_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_internal_machine_api_pb_docker_proto_msgTypes = make([]protoimpl.MessageInfo, 36) var file_internal_machine_api_pb_docker_proto_msgTypes = make([]protoimpl.MessageInfo, 36)
var file_internal_machine_api_pb_docker_proto_goTypes = []any{ var file_internal_machine_api_pb_docker_proto_goTypes = []any{
(*CreateContainerRequest)(nil), // 0: api.CreateContainerRequest (CreateServiceContainerRequest_ContainerType)(0), // 0: api.CreateServiceContainerRequest.ContainerType
(*CreateContainerResponse)(nil), // 1: api.CreateContainerResponse (*CreateContainerRequest)(nil), // 1: api.CreateContainerRequest
(*InspectContainerRequest)(nil), // 2: api.InspectContainerRequest (*CreateContainerResponse)(nil), // 2: api.CreateContainerResponse
(*InspectContainerResponse)(nil), // 3: api.InspectContainerResponse (*InspectContainerRequest)(nil), // 3: api.InspectContainerRequest
(*StartContainerRequest)(nil), // 4: api.StartContainerRequest (*InspectContainerResponse)(nil), // 4: api.InspectContainerResponse
(*StopContainerRequest)(nil), // 5: api.StopContainerRequest (*StartContainerRequest)(nil), // 5: api.StartContainerRequest
(*ListContainersRequest)(nil), // 6: api.ListContainersRequest (*StopContainerRequest)(nil), // 6: api.StopContainerRequest
(*ListContainersResponse)(nil), // 7: api.ListContainersResponse (*ListContainersRequest)(nil), // 7: api.ListContainersRequest
(*MachineContainers)(nil), // 8: api.MachineContainers (*ListContainersResponse)(nil), // 8: api.ListContainersResponse
(*RemoveContainerRequest)(nil), // 9: api.RemoveContainerRequest (*MachineContainers)(nil), // 9: api.MachineContainers
(*ExecContainerRequest)(nil), // 10: api.ExecContainerRequest (*RemoveContainerRequest)(nil), // 10: api.RemoveContainerRequest
(*ExecConfig)(nil), // 11: api.ExecConfig (*ExecContainerRequest)(nil), // 11: api.ExecContainerRequest
(*ResizeEvent)(nil), // 12: api.ResizeEvent (*ExecConfig)(nil), // 12: api.ExecConfig
(*ExecContainerResponse)(nil), // 13: api.ExecContainerResponse (*ResizeEvent)(nil), // 13: api.ResizeEvent
(*PullImageRequest)(nil), // 14: api.PullImageRequest (*ExecContainerResponse)(nil), // 14: api.ExecContainerResponse
(*JSONMessage)(nil), // 15: api.JSONMessage (*PullImageRequest)(nil), // 15: api.PullImageRequest
(*InspectImageRequest)(nil), // 16: api.InspectImageRequest (*JSONMessage)(nil), // 16: api.JSONMessage
(*InspectImageResponse)(nil), // 17: api.InspectImageResponse (*InspectImageRequest)(nil), // 17: api.InspectImageRequest
(*Image)(nil), // 18: api.Image (*InspectImageResponse)(nil), // 18: api.InspectImageResponse
(*InspectRemoteImageRequest)(nil), // 19: api.InspectRemoteImageRequest (*Image)(nil), // 19: api.Image
(*InspectRemoteImageResponse)(nil), // 20: api.InspectRemoteImageResponse (*InspectRemoteImageRequest)(nil), // 20: api.InspectRemoteImageRequest
(*RemoteImage)(nil), // 21: api.RemoteImage (*InspectRemoteImageResponse)(nil), // 21: api.InspectRemoteImageResponse
(*ListImagesRequest)(nil), // 22: api.ListImagesRequest (*RemoteImage)(nil), // 22: api.RemoteImage
(*ListImagesResponse)(nil), // 23: api.ListImagesResponse (*ListImagesRequest)(nil), // 23: api.ListImagesRequest
(*MachineImages)(nil), // 24: api.MachineImages (*ListImagesResponse)(nil), // 24: api.ListImagesResponse
(*CreateVolumeRequest)(nil), // 25: api.CreateVolumeRequest (*MachineImages)(nil), // 25: api.MachineImages
(*CreateVolumeResponse)(nil), // 26: api.CreateVolumeResponse (*CreateVolumeRequest)(nil), // 26: api.CreateVolumeRequest
(*ListVolumesRequest)(nil), // 27: api.ListVolumesRequest (*CreateVolumeResponse)(nil), // 27: api.CreateVolumeResponse
(*ListVolumesResponse)(nil), // 28: api.ListVolumesResponse (*ListVolumesRequest)(nil), // 28: api.ListVolumesRequest
(*MachineVolumes)(nil), // 29: api.MachineVolumes (*ListVolumesResponse)(nil), // 29: api.ListVolumesResponse
(*RemoveVolumeRequest)(nil), // 30: api.RemoveVolumeRequest (*MachineVolumes)(nil), // 30: api.MachineVolumes
(*CreateServiceContainerRequest)(nil), // 31: api.CreateServiceContainerRequest (*RemoveVolumeRequest)(nil), // 31: api.RemoveVolumeRequest
(*ServiceContainer)(nil), // 32: api.ServiceContainer (*CreateServiceContainerRequest)(nil), // 32: api.CreateServiceContainerRequest
(*ListServiceContainersRequest)(nil), // 33: api.ListServiceContainersRequest (*ServiceContainer)(nil), // 33: api.ServiceContainer
(*ListServiceContainersResponse)(nil), // 34: api.ListServiceContainersResponse (*ListServiceContainersRequest)(nil), // 34: api.ListServiceContainersRequest
(*MachineServiceContainers)(nil), // 35: api.MachineServiceContainers (*ListServiceContainersResponse)(nil), // 35: api.ListServiceContainersResponse
(*Metadata)(nil), // 36: api.Metadata (*MachineServiceContainers)(nil), // 36: api.MachineServiceContainers
(*LogsRequest)(nil), // 37: api.LogsRequest (*Metadata)(nil), // 37: api.Metadata
(*emptypb.Empty)(nil), // 38: google.protobuf.Empty (*LogsRequest)(nil), // 38: api.LogsRequest
(*LogEntry)(nil), // 39: api.LogEntry (*emptypb.Empty)(nil), // 39: google.protobuf.Empty
(*LogEntry)(nil), // 40: api.LogEntry
} }
var file_internal_machine_api_pb_docker_proto_depIdxs = []int32{ var file_internal_machine_api_pb_docker_proto_depIdxs = []int32{
8, // 0: api.ListContainersResponse.messages:type_name -> api.MachineContainers 9, // 0: api.ListContainersResponse.messages:type_name -> api.MachineContainers
36, // 1: api.MachineContainers.metadata:type_name -> api.Metadata 37, // 1: api.MachineContainers.metadata:type_name -> api.Metadata
11, // 2: api.ExecContainerRequest.config:type_name -> api.ExecConfig 12, // 2: api.ExecContainerRequest.config:type_name -> api.ExecConfig
12, // 3: api.ExecContainerRequest.resize:type_name -> api.ResizeEvent 13, // 3: api.ExecContainerRequest.resize:type_name -> api.ResizeEvent
18, // 4: api.InspectImageResponse.messages:type_name -> api.Image 19, // 4: api.InspectImageResponse.messages:type_name -> api.Image
36, // 5: api.Image.metadata:type_name -> api.Metadata 37, // 5: api.Image.metadata:type_name -> api.Metadata
21, // 6: api.InspectRemoteImageResponse.messages:type_name -> api.RemoteImage 22, // 6: api.InspectRemoteImageResponse.messages:type_name -> api.RemoteImage
36, // 7: api.RemoteImage.metadata:type_name -> api.Metadata 37, // 7: api.RemoteImage.metadata:type_name -> api.Metadata
24, // 8: api.ListImagesResponse.messages:type_name -> api.MachineImages 25, // 8: api.ListImagesResponse.messages:type_name -> api.MachineImages
36, // 9: api.MachineImages.metadata:type_name -> api.Metadata 37, // 9: api.MachineImages.metadata:type_name -> api.Metadata
29, // 10: api.ListVolumesResponse.messages:type_name -> api.MachineVolumes 30, // 10: api.ListVolumesResponse.messages:type_name -> api.MachineVolumes
36, // 11: api.MachineVolumes.metadata:type_name -> api.Metadata 37, // 11: api.MachineVolumes.metadata:type_name -> api.Metadata
35, // 12: api.ListServiceContainersResponse.messages:type_name -> api.MachineServiceContainers 0, // 12: api.CreateServiceContainerRequest.container_type:type_name -> api.CreateServiceContainerRequest.ContainerType
36, // 13: api.MachineServiceContainers.metadata:type_name -> api.Metadata 36, // 13: api.ListServiceContainersResponse.messages:type_name -> api.MachineServiceContainers
32, // 14: api.MachineServiceContainers.containers:type_name -> api.ServiceContainer 37, // 14: api.MachineServiceContainers.metadata:type_name -> api.Metadata
0, // 15: api.Docker.CreateContainer:input_type -> api.CreateContainerRequest 33, // 15: api.MachineServiceContainers.containers:type_name -> api.ServiceContainer
2, // 16: api.Docker.InspectContainer:input_type -> api.InspectContainerRequest 33, // 16: api.MachineServiceContainers.hook_containers:type_name -> api.ServiceContainer
4, // 17: api.Docker.StartContainer:input_type -> api.StartContainerRequest 1, // 17: api.Docker.CreateContainer:input_type -> api.CreateContainerRequest
5, // 18: api.Docker.StopContainer:input_type -> api.StopContainerRequest 3, // 18: api.Docker.InspectContainer:input_type -> api.InspectContainerRequest
6, // 19: api.Docker.ListContainers:input_type -> api.ListContainersRequest 5, // 19: api.Docker.StartContainer:input_type -> api.StartContainerRequest
9, // 20: api.Docker.RemoveContainer:input_type -> api.RemoveContainerRequest 6, // 20: api.Docker.StopContainer:input_type -> api.StopContainerRequest
10, // 21: api.Docker.ExecContainer:input_type -> api.ExecContainerRequest 7, // 21: api.Docker.ListContainers:input_type -> api.ListContainersRequest
37, // 22: api.Docker.ContainerLogs:input_type -> api.LogsRequest 10, // 22: api.Docker.RemoveContainer:input_type -> api.RemoveContainerRequest
14, // 23: api.Docker.PullImage:input_type -> api.PullImageRequest 11, // 23: api.Docker.ExecContainer:input_type -> api.ExecContainerRequest
16, // 24: api.Docker.InspectImage:input_type -> api.InspectImageRequest 38, // 24: api.Docker.ContainerLogs:input_type -> api.LogsRequest
19, // 25: api.Docker.InspectRemoteImage:input_type -> api.InspectRemoteImageRequest 15, // 25: api.Docker.PullImage:input_type -> api.PullImageRequest
22, // 26: api.Docker.ListImages:input_type -> api.ListImagesRequest 17, // 26: api.Docker.InspectImage:input_type -> api.InspectImageRequest
25, // 27: api.Docker.CreateVolume:input_type -> api.CreateVolumeRequest 20, // 27: api.Docker.InspectRemoteImage:input_type -> api.InspectRemoteImageRequest
27, // 28: api.Docker.ListVolumes:input_type -> api.ListVolumesRequest 23, // 28: api.Docker.ListImages:input_type -> api.ListImagesRequest
30, // 29: api.Docker.RemoveVolume:input_type -> api.RemoveVolumeRequest 26, // 29: api.Docker.CreateVolume:input_type -> api.CreateVolumeRequest
31, // 30: api.Docker.CreateServiceContainer:input_type -> api.CreateServiceContainerRequest 28, // 30: api.Docker.ListVolumes:input_type -> api.ListVolumesRequest
2, // 31: api.Docker.InspectServiceContainer:input_type -> api.InspectContainerRequest 31, // 31: api.Docker.RemoveVolume:input_type -> api.RemoveVolumeRequest
33, // 32: api.Docker.ListServiceContainers:input_type -> api.ListServiceContainersRequest 32, // 32: api.Docker.CreateServiceContainer:input_type -> api.CreateServiceContainerRequest
9, // 33: api.Docker.RemoveServiceContainer:input_type -> api.RemoveContainerRequest 3, // 33: api.Docker.InspectServiceContainer:input_type -> api.InspectContainerRequest
1, // 34: api.Docker.CreateContainer:output_type -> api.CreateContainerResponse 34, // 34: api.Docker.ListServiceContainers:input_type -> api.ListServiceContainersRequest
3, // 35: api.Docker.InspectContainer:output_type -> api.InspectContainerResponse 10, // 35: api.Docker.RemoveServiceContainer:input_type -> api.RemoveContainerRequest
38, // 36: api.Docker.StartContainer:output_type -> google.protobuf.Empty 2, // 36: api.Docker.CreateContainer:output_type -> api.CreateContainerResponse
38, // 37: api.Docker.StopContainer:output_type -> google.protobuf.Empty 4, // 37: api.Docker.InspectContainer:output_type -> api.InspectContainerResponse
7, // 38: api.Docker.ListContainers:output_type -> api.ListContainersResponse 39, // 38: api.Docker.StartContainer:output_type -> google.protobuf.Empty
38, // 39: api.Docker.RemoveContainer:output_type -> google.protobuf.Empty 39, // 39: api.Docker.StopContainer:output_type -> google.protobuf.Empty
13, // 40: api.Docker.ExecContainer:output_type -> api.ExecContainerResponse 8, // 40: api.Docker.ListContainers:output_type -> api.ListContainersResponse
39, // 41: api.Docker.ContainerLogs:output_type -> api.LogEntry 39, // 41: api.Docker.RemoveContainer:output_type -> google.protobuf.Empty
15, // 42: api.Docker.PullImage:output_type -> api.JSONMessage 14, // 42: api.Docker.ExecContainer:output_type -> api.ExecContainerResponse
17, // 43: api.Docker.InspectImage:output_type -> api.InspectImageResponse 40, // 43: api.Docker.ContainerLogs:output_type -> api.LogEntry
20, // 44: api.Docker.InspectRemoteImage:output_type -> api.InspectRemoteImageResponse 16, // 44: api.Docker.PullImage:output_type -> api.JSONMessage
23, // 45: api.Docker.ListImages:output_type -> api.ListImagesResponse 18, // 45: api.Docker.InspectImage:output_type -> api.InspectImageResponse
26, // 46: api.Docker.CreateVolume:output_type -> api.CreateVolumeResponse 21, // 46: api.Docker.InspectRemoteImage:output_type -> api.InspectRemoteImageResponse
28, // 47: api.Docker.ListVolumes:output_type -> api.ListVolumesResponse 24, // 47: api.Docker.ListImages:output_type -> api.ListImagesResponse
38, // 48: api.Docker.RemoveVolume:output_type -> google.protobuf.Empty 27, // 48: api.Docker.CreateVolume:output_type -> api.CreateVolumeResponse
1, // 49: api.Docker.CreateServiceContainer:output_type -> api.CreateContainerResponse 29, // 49: api.Docker.ListVolumes:output_type -> api.ListVolumesResponse
32, // 50: api.Docker.InspectServiceContainer:output_type -> api.ServiceContainer 39, // 50: api.Docker.RemoveVolume:output_type -> google.protobuf.Empty
34, // 51: api.Docker.ListServiceContainers:output_type -> api.ListServiceContainersResponse 2, // 51: api.Docker.CreateServiceContainer:output_type -> api.CreateContainerResponse
38, // 52: api.Docker.RemoveServiceContainer:output_type -> google.protobuf.Empty 33, // 52: api.Docker.InspectServiceContainer:output_type -> api.ServiceContainer
34, // [34:53] is the sub-list for method output_type 35, // 53: api.Docker.ListServiceContainers:output_type -> api.ListServiceContainersResponse
15, // [15:34] is the sub-list for method input_type 39, // 54: api.Docker.RemoveServiceContainer:output_type -> google.protobuf.Empty
15, // [15:15] is the sub-list for extension type_name 36, // [36:55] is the sub-list for method output_type
15, // [15:15] is the sub-list for extension extendee 17, // [17:36] is the sub-list for method input_type
0, // [0:15] is the sub-list for field type_name 17, // [17:17] is the sub-list for extension type_name
17, // [17:17] is the sub-list for extension extendee
0, // [0:17] is the sub-list for field type_name
} }
func init() { file_internal_machine_api_pb_docker_proto_init() } func init() { file_internal_machine_api_pb_docker_proto_init() }
@@ -2904,13 +2987,14 @@ func file_internal_machine_api_pb_docker_proto_init() {
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_internal_machine_api_pb_docker_proto_rawDesc, RawDescriptor: file_internal_machine_api_pb_docker_proto_rawDesc,
NumEnums: 0, NumEnums: 1,
NumMessages: 36, NumMessages: 36,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },
GoTypes: file_internal_machine_api_pb_docker_proto_goTypes, GoTypes: file_internal_machine_api_pb_docker_proto_goTypes,
DependencyIndexes: file_internal_machine_api_pb_docker_proto_depIdxs, DependencyIndexes: file_internal_machine_api_pb_docker_proto_depIdxs,
EnumInfos: file_internal_machine_api_pb_docker_proto_enumTypes,
MessageInfos: file_internal_machine_api_pb_docker_proto_msgTypes, MessageInfos: file_internal_machine_api_pb_docker_proto_msgTypes,
}.Build() }.Build()
File_internal_machine_api_pb_docker_proto = out.File File_internal_machine_api_pb_docker_proto = out.File
+11
View File
@@ -228,6 +228,15 @@ message CreateServiceContainerRequest {
// JSON serialised api.ServiceSpec. // JSON serialised api.ServiceSpec.
bytes service_spec = 2; bytes service_spec = 2;
string container_name = 3; string container_name = 3;
// ContainerType specifies the purpose of the container being created.
enum ContainerType {
// SERVICE is the default type for long-running service containers.
SERVICE = 0;
// PRE_DEPLOY is a one-shot container for a pre-deploy hook to run before service deployment.
PRE_DEPLOY = 1;
}
ContainerType container_type = 4;
} }
message ServiceContainer { message ServiceContainer {
@@ -252,4 +261,6 @@ message ListServiceContainersResponse {
message MachineServiceContainers { message MachineServiceContainers {
Metadata metadata = 1; Metadata metadata = 1;
repeated ServiceContainer containers = 2; repeated ServiceContainer containers = 2;
// One-shot containers for deployment hooks (e.g. pre-deploy).
repeated ServiceContainer hook_containers = 3;
} }
+23 -37
View File
@@ -420,34 +420,6 @@ func (c *Client) RemoveVolume(ctx context.Context, id string, force bool) error
return err return err
} }
// CreateServiceContainer creates a new container for the service with the given specifications.
func (c *Client) CreateServiceContainer(
ctx context.Context, serviceID string, spec api.ServiceSpec, containerName string,
) (container.CreateResponse, error) {
var resp container.CreateResponse
specBytes, err := json.Marshal(spec)
if err != nil {
return resp, fmt.Errorf("marshal service spec: %w", err)
}
grpcResp, err := c.GRPCClient.CreateServiceContainer(ctx, &pb.CreateServiceContainerRequest{
ServiceId: serviceID,
ServiceSpec: specBytes,
ContainerName: containerName,
})
if err != nil {
if status.Convert(err).Code() == codes.NotFound {
return resp, errdefs.NotFound(err)
}
return resp, err
}
if err = json.Unmarshal(grpcResp.Response, &resp); err != nil {
return resp, fmt.Errorf("unmarshal gRPC response: %w", err)
}
return resp, nil
}
// InspectServiceContainer returns the container information and service specification that was used to create the // InspectServiceContainer returns the container information and service specification that was used to create the
// container with the given ID. // container with the given ID.
func (c *Client) InspectServiceContainer(ctx context.Context, id string) (api.ServiceContainer, error) { func (c *Client) InspectServiceContainer(ctx context.Context, id string) (api.ServiceContainer, error) {
@@ -474,10 +446,13 @@ func (c *Client) InspectServiceContainer(ctx context.Context, id string) (api.Se
type MachineServiceContainers struct { type MachineServiceContainers struct {
Metadata *pb.Metadata Metadata *pb.Metadata
Containers []api.ServiceContainer Containers []api.ServiceContainer
// HookContainers are one-shot containers for deployment hooks (e.g. pre-deploy).
HookContainers []api.ServiceContainer
} }
// ListServiceContainers returns all containers on requested machines that belong to the service with the given // ListServiceContainers returns all containers on requested machines that belong to the service with the given
// name or ID. If serviceNameOrID is empty, all service containers are returned. // name or ID. If serviceNameOrID is empty, all service containers are returned.
// Set opts.All to true to include hook containers.
func (c *Client) ListServiceContainers( func (c *Client) ListServiceContainers(
ctx context.Context, serviceNameOrID string, opts container.ListOptions, ctx context.Context, serviceNameOrID string, opts container.ListOptions,
) ([]MachineServiceContainers, error) { ) ([]MachineServiceContainers, error) {
@@ -501,22 +476,33 @@ func (c *Client) ListServiceContainers(
continue continue
} }
containers := make([]api.ServiceContainer, len(msg.Containers)) machineContainers[i].Containers, err = serviceContainersFromProto(msg.Containers)
for j, sc := range msg.Containers { if err != nil {
if err = json.Unmarshal(sc.Container, &containers[j].Container); err != nil { return nil, err
return nil, fmt.Errorf("unmarshal container: %w", err)
} }
if err = json.Unmarshal(sc.ServiceSpec, &containers[j].ServiceSpec); err != nil { machineContainers[i].HookContainers, err = serviceContainersFromProto(msg.HookContainers)
return nil, fmt.Errorf("unmarshal service spec: %w", err) if err != nil {
return nil, err
} }
} }
machineContainers[i].Containers = containers
}
return machineContainers, nil return machineContainers, nil
} }
// serviceContainersFromProto converts a slice of protobuf service containers to api.ServiceContainer.
func serviceContainersFromProto(pbContainers []*pb.ServiceContainer) ([]api.ServiceContainer, error) {
containers := make([]api.ServiceContainer, len(pbContainers))
for i, sc := range pbContainers {
if err := json.Unmarshal(sc.Container, &containers[i].Container); err != nil {
return nil, fmt.Errorf("unmarshal container: %w", err)
}
if err := json.Unmarshal(sc.ServiceSpec, &containers[i].ServiceSpec); err != nil {
return nil, fmt.Errorf("unmarshal service spec: %w", err)
}
}
return containers, nil
}
// RemoveServiceContainer stops (kills after grace period) and removes a service container with the given ID. // RemoveServiceContainer stops (kills after grace period) and removes a service container with the given ID.
// A service container is a container that has been created with CreateServiceContainer. // A service container is a container that has been created with CreateServiceContainer.
func (c *Client) RemoveServiceContainer(ctx context.Context, id string, opts container.RemoveOptions) error { func (c *Client) RemoveServiceContainer(ctx context.Context, id string, opts container.RemoveOptions) error {
+5 -1
View File
@@ -152,12 +152,16 @@ func (c *Controller) syncContainersToStore(ctx context.Context) error {
return fmt.Errorf("list containers from store: %w", err) return fmt.Errorf("list containers from store: %w", err)
} }
containers, err := c.service.ListServiceContainers(ctx, "", container.ListOptions{}) // List containers for all services, including stopped ones and deployment hooks.
result, err := c.service.ListServiceContainers(ctx, "", container.ListOptions{All: true})
if err != nil { if err != nil {
// TODO: mark all containers as outdated in the store. // TODO: mark all containers as outdated in the store.
return fmt.Errorf("list service containers: %w", err) return fmt.Errorf("list service containers: %w", err)
} }
// Sync both regular and one-off hook containers to the store.
containers := append(result.Containers, result.HookContainers...)
// Delete containers from the store that are no longer present in the Docker daemon. // Delete containers from the store that are no longer present in the Docker daemon.
var deleteIDs []string var deleteIDs []string
for _, sc := range storeContainers { for _, sc := range storeContainers {
+60 -15
View File
@@ -664,6 +664,39 @@ func (s *Server) CreateServiceContainer(
} }
} }
// Strip the container configuration that doesn't make sense for the pre-deploy hook and apply its overrides.
if spec.PreDeploy != nil && req.ContainerType == pb.CreateServiceContainerRequest_PRE_DEPLOY {
config.Labels = map[string]string{
api.LabelServiceID: req.ServiceId,
api.LabelServiceName: spec.Name,
api.LabelHook: api.LabelHookPreDeploy,
api.LabelManaged: "",
}
config.Healthcheck = &container.HealthConfig{
Test: []string{"NONE"},
}
hostConfig.PortBindings = nil
hostConfig.RestartPolicy = container.RestartPolicy{
Name: container.RestartPolicyDisabled,
}
// Apply the pre-deploy hook overrides.
config.Cmd = spec.PreDeploy.Command
for k, v := range spec.PreDeploy.Env {
envVars[k] = v
}
envVars["UNCLOUD_HOOK_PRE_DEPLOY"] = "true"
config.Env = envVars.ToSlice()
if spec.PreDeploy.Privileged != nil {
hostConfig.Privileged = *spec.PreDeploy.Privileged
}
if spec.PreDeploy.User != "" {
config.User = spec.PreDeploy.User
}
}
networkConfig := &network.NetworkingConfig{ networkConfig := &network.NetworkingConfig{
EndpointsConfig: map[string]*network.EndpointSettings{ EndpointsConfig: map[string]*network.EndpointSettings{
NetworkName: {}, NetworkName: {},
@@ -1009,39 +1042,51 @@ func (s *Server) ListServiceContainers(
} }
} }
containers, err := s.service.ListServiceContainers(ctx, req.ServiceId, opts) result, err := s.service.ListServiceContainers(ctx, req.ServiceId, opts)
if err != nil { if err != nil {
return nil, status.Error(codes.Internal, err.Error()) return nil, status.Error(codes.Internal, err.Error())
} }
// Convert to protobuf format. pbContainers, err := serviceContainersToProto(result.Containers)
pbContainers := make([]*pb.ServiceContainer, 0, len(containers))
for _, ctr := range containers {
ctrBytes, err := json.Marshal(ctr.Container)
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "marshal container: %v", err) return nil, err
} }
pbHookContainers, err := serviceContainersToProto(result.HookContainers)
specBytes, err := json.Marshal(ctr.ServiceSpec)
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "marshal service spec: %v", err) return nil, err
}
pbContainers = append(pbContainers, &pb.ServiceContainer{
Container: ctrBytes,
ServiceSpec: specBytes,
})
} }
return &pb.ListServiceContainersResponse{ return &pb.ListServiceContainersResponse{
Messages: []*pb.MachineServiceContainers{ Messages: []*pb.MachineServiceContainers{
{ {
Containers: pbContainers, Containers: pbContainers,
HookContainers: pbHookContainers,
}, },
}, },
}, nil }, nil
} }
// serviceContainersToProto converts a slice of service containers to protobuf format.
func serviceContainersToProto(containers []api.ServiceContainer) ([]*pb.ServiceContainer, error) {
pbContainers := make([]*pb.ServiceContainer, 0, len(containers))
for _, ctr := range containers {
ctrBytes, err := json.Marshal(ctr.Container)
if err != nil {
return nil, status.Errorf(codes.Internal, "marshal container: %v", err)
}
specBytes, err := json.Marshal(ctr.ServiceSpec)
if err != nil {
return nil, status.Errorf(codes.Internal, "marshal service spec: %v", err)
}
pbContainers = append(pbContainers, &pb.ServiceContainer{
Container: ctrBytes,
ServiceSpec: specBytes,
})
}
return pbContainers, nil
}
// RemoveServiceContainer stops (kills after grace period) and removes a service container with the given ID. // RemoveServiceContainer stops (kills after grace period) and removes a service container with the given ID.
// The difference between this method and RemoveContainer is that it also removes the container from the machine // The difference between this method and RemoveContainer is that it also removes the container from the machine
// database. // database.
+18 -5
View File
@@ -74,11 +74,20 @@ func (s *Service) InspectServiceContainer(ctx context.Context, nameOrID string)
return serviceCtr, nil return serviceCtr, nil
} }
// ListServiceContainersResult holds the result of listing service containers, split into regular
// service containers and one-off hook containers.
type ListServiceContainersResult struct {
Containers []api.ServiceContainer
HookContainers []api.ServiceContainer
}
// ListServiceContainers lists Docker containers that belong to the service with the given name or ID. // ListServiceContainers lists Docker containers that belong to the service with the given name or ID.
// If serviceIDOrName is empty, all service containers are returned. The opts parameter allows additional filtering. // If serviceIDOrName is empty, all service containers are returned. The opts parameter allows additional filtering.
func (s *Service) ListServiceContainers( func (s *Service) ListServiceContainers(
ctx context.Context, serviceNameOrID string, opts container.ListOptions, ctx context.Context, serviceNameOrID string, opts container.ListOptions,
) ([]api.ServiceContainer, error) { ) (ListServiceContainersResult, error) {
var result ListServiceContainersResult
if opts.Filters.Len() == 0 { if opts.Filters.Len() == 0 {
opts.Filters = filters.NewArgs() opts.Filters = filters.NewArgs()
} }
@@ -88,10 +97,9 @@ func (s *Service) ListServiceContainers(
containerSummaries, err := s.Client.ContainerList(ctx, opts) containerSummaries, err := s.Client.ContainerList(ctx, opts)
if err != nil { if err != nil {
return nil, err return result, err
} }
var containers []api.ServiceContainer
for _, cs := range containerSummaries { for _, cs := range containerSummaries {
// Filter by service name or ID if provided. // Filter by service name or ID if provided.
if serviceNameOrID != "" && if serviceNameOrID != "" &&
@@ -106,10 +114,15 @@ func (s *Service) ListServiceContainers(
slog.Error("Failed to inspect service container.", "service", serviceNameOrID, "id", cs.ID, "err", err) slog.Error("Failed to inspect service container.", "service", serviceNameOrID, "id", cs.ID, "err", err)
continue continue
} }
containers = append(containers, ctr)
if ctr.IsHook() {
result.HookContainers = append(result.HookContainers, ctr)
} else {
result.Containers = append(result.Containers, ctr)
}
} }
return containers, nil return result, nil
} }
// IsContainerdImageStoreEnabled checks if Docker is configured to use the containerd image store: // IsContainerdImageStoreEnabled checks if Docker is configured to use the containerd image store:
+3
View File
@@ -21,6 +21,9 @@ type ContainerClient interface {
CreateContainer( CreateContainer(
ctx context.Context, serviceID string, spec ServiceSpec, machineID string, ctx context.Context, serviceID string, spec ServiceSpec, machineID string,
) (container.CreateResponse, error) ) (container.CreateResponse, error)
CreatePreDeployHookContainer(
ctx context.Context, serviceID string, spec ServiceSpec, machineID string,
) (container.CreateResponse, error)
ExecContainer(ctx context.Context, serviceNameOrID, containerNameOrID string, config ExecOptions) (int, error) ExecContainer(ctx context.Context, serviceNameOrID, containerNameOrID string, config ExecOptions) (int, error)
InspectContainer(ctx context.Context, serviceNameOrID, containerNameOrID string) (MachineServiceContainer, error) InspectContainer(ctx context.Context, serviceNameOrID, containerNameOrID string) (MachineServiceContainer, error)
StartContainer(ctx context.Context, serviceNameOrID, containerNameOrID string) error StartContainer(ctx context.Context, serviceNameOrID, containerNameOrID string) error
+13 -1
View File
@@ -18,11 +18,16 @@ const (
// DockerNetworkName is the name of the Docker network used by uncloud. Keep the value in sync with NetworkName // DockerNetworkName is the name of the Docker network used by uncloud. Keep the value in sync with NetworkName
// in internal/machine/docker/manager.go. // in internal/machine/docker/manager.go.
DockerNetworkName = "uncloud" DockerNetworkName = "uncloud"
LabelManaged = "uncloud.managed" LabelManaged = "uncloud.managed"
LabelServiceID = "uncloud.service.id" LabelServiceID = "uncloud.service.id"
LabelServiceName = "uncloud.service.name" LabelServiceName = "uncloud.service.name"
LabelServiceMode = "uncloud.service.mode" LabelServiceMode = "uncloud.service.mode"
LabelServicePorts = "uncloud.service.ports" LabelServicePorts = "uncloud.service.ports"
// LabelHook marks a container as a deployment hook. The value indicates the hook type (e.g. LabelHookPreDeploy).
LabelHook = "uncloud.service.hook"
// LabelHookPreDeploy indicates that the container is a pre-deploy hook that runs before deploying the service.
LabelHookPreDeploy = "pre-deploy"
) )
type Container struct { type Container struct {
@@ -181,10 +186,17 @@ func (c *ServiceContainer) ServiceName() string {
// ServiceMode returns the replication mode of the service this container belongs to. // ServiceMode returns the replication mode of the service this container belongs to.
func (c *ServiceContainer) ServiceMode() string { func (c *ServiceContainer) ServiceMode() string {
return c.Config.Labels[LabelServiceMode] return c.ServiceSpec.Mode
}
// IsHook returns true if the container is a deployment hook (e.g. pre-deploy).
func (c *ServiceContainer) IsHook() bool {
_, ok := c.Config.Labels[LabelHook]
return ok
} }
// ServicePorts returns the ports this container publishes as part of its service. // ServicePorts returns the ports this container publishes as part of its service.
// TODO: return ports from ServiceSpec to allow updating ingress ports without recreating containers.
func (c *ServiceContainer) ServicePorts() ([]PortSpec, error) { func (c *ServiceContainer) ServicePorts() ([]PortSpec, error) {
encoded, ok := c.Config.Labels[LabelServicePorts] encoded, ok := c.Config.Labels[LabelServicePorts]
if !ok { if !ok {
+5 -2
View File
@@ -454,8 +454,8 @@ type PreDeployHook struct {
Command []string Command []string
// Env defines additional environment variables for the container, merged with the service's environment variables. // Env defines additional environment variables for the container, merged with the service's environment variables.
Env EnvVars `json:",omitempty"` Env EnvVars `json:",omitempty"`
// Privileged gives extended privileges to the container. // Privileged overrides the container's privileged mode. nil means inherit from the service.
Privileged bool `json:",omitempty"` Privileged *bool `json:",omitempty"`
// Timeout is the maximum duration to wait for the command to complete. On timeout, the container is stopped // Timeout is the maximum duration to wait for the command to complete. On timeout, the container is stopped
// and the deployment fails. If nil, a default timeout is used. // and the deployment fails. If nil, a default timeout is used.
Timeout *time.Duration `json:",omitempty"` Timeout *time.Duration `json:",omitempty"`
@@ -508,7 +508,10 @@ type Service struct {
ID string ID string
Name string Name string
Mode string Mode string
// Containers is the regular long-running service containers.
Containers []MachineServiceContainer Containers []MachineServiceContainer
// HookContainers are one-shot containers for deployment hooks (e.g. pre-deploy).
HookContainers []MachineServiceContainer
} }
type MachineServiceContainer struct { type MachineServiceContainer struct {
+46 -4
View File
@@ -7,14 +7,17 @@ import (
"strings" "strings"
"time" "time"
"github.com/containerd/errdefs" "encoding/json"
"github.com/docker/compose/v2/pkg/progress" "github.com/docker/compose/v2/pkg/progress"
"github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/container"
"github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/pkg/jsonmessage"
"github.com/psviderski/uncloud/internal/docker" "github.com/psviderski/uncloud/internal/docker"
"github.com/psviderski/uncloud/internal/machine/api/pb"
machinedocker "github.com/psviderski/uncloud/internal/machine/docker" machinedocker "github.com/psviderski/uncloud/internal/machine/docker"
"github.com/psviderski/uncloud/internal/secret" "github.com/psviderski/uncloud/internal/secret"
"github.com/psviderski/uncloud/pkg/api" "github.com/psviderski/uncloud/pkg/api"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
) )
@@ -24,6 +27,27 @@ import (
// CreateContainer creates a new container for the given service on the specified machine. // CreateContainer creates a new container for the given service on the specified machine.
func (cli *Client) CreateContainer( func (cli *Client) CreateContainer(
ctx context.Context, serviceID string, spec api.ServiceSpec, machineID string, ctx context.Context, serviceID string, spec api.ServiceSpec, machineID string,
) (container.CreateResponse, error) {
return cli.createServiceContainerWithPull(ctx, serviceID, spec, machineID, pb.CreateServiceContainerRequest_SERVICE)
}
// CreatePreDeployHookContainer creates a one-shot container for a pre-deploy hook for the given service
// on the specified machine.
func (cli *Client) CreatePreDeployHookContainer(
ctx context.Context, serviceID string, spec api.ServiceSpec, machineID string,
) (container.CreateResponse, error) {
return cli.createServiceContainerWithPull(
ctx, serviceID, spec, machineID, pb.CreateServiceContainerRequest_PRE_DEPLOY)
}
// createServiceContainerWithPull creates a regular or deployment hook container for the service
// on the specified machine, pulling the image if needed.
func (cli *Client) createServiceContainerWithPull(
ctx context.Context,
serviceID string,
spec api.ServiceSpec,
machineID string,
containerType pb.CreateServiceContainerRequest_ContainerType,
) (container.CreateResponse, error) { ) (container.CreateResponse, error) {
var resp container.CreateResponse var resp container.CreateResponse
@@ -43,6 +67,9 @@ func (cli *Client) CreateContainer(
return resp, fmt.Errorf("generate random suffix: %w", err) return resp, fmt.Errorf("generate random suffix: %w", err)
} }
containerName := fmt.Sprintf("%s-%s", spec.Name, suffix) containerName := fmt.Sprintf("%s-%s", spec.Name, suffix)
if containerType == pb.CreateServiceContainerRequest_PRE_DEPLOY {
containerName = fmt.Sprintf("%s-%s-%s", spec.Name, api.LabelHookPreDeploy, suffix)
}
// Proxy Docker gRPC requests to the selected machine. // Proxy Docker gRPC requests to the selected machine.
ctx = proxyToMachine(ctx, machine.Machine) ctx = proxyToMachine(ctx, machine.Machine)
@@ -57,7 +84,18 @@ func (cli *Client) CreateContainer(
} }
} }
resp, err = cli.Docker.CreateServiceContainer(ctx, serviceID, spec, containerName) specBytes, err := json.Marshal(spec)
if err != nil {
return resp, fmt.Errorf("marshal service spec: %w", err)
}
req := &pb.CreateServiceContainerRequest{
ServiceId: serviceID,
ServiceSpec: specBytes,
ContainerName: containerName,
ContainerType: containerType,
}
grpcResp, err := cli.Docker.GRPCClient.CreateServiceContainer(ctx, req)
if err != nil { if err != nil {
switch spec.Container.PullPolicy { switch spec.Container.PullPolicy {
case api.PullPolicyAlways, api.PullPolicyNever: case api.PullPolicyAlways, api.PullPolicyNever:
@@ -68,7 +106,7 @@ func (cli *Client) CreateContainer(
} }
// NotFound (No such image) error is expected if the image is missing. // NotFound (No such image) error is expected if the image is missing.
if !errdefs.IsNotFound(err) || !strings.Contains(err.Error(), "No such image") { if status.Code(err) != codes.NotFound || !strings.Contains(err.Error(), "No such image") {
return resp, err return resp, err
} }
@@ -76,10 +114,14 @@ func (cli *Client) CreateContainer(
if err = cli.pullImageWithProgress(ctx, spec.Container.Image, machine.Machine.Name, eventID); err != nil { if err = cli.pullImageWithProgress(ctx, spec.Container.Image, machine.Machine.Name, eventID); err != nil {
return resp, err return resp, err
} }
if resp, err = cli.Docker.CreateServiceContainer(ctx, serviceID, spec, containerName); err != nil { if grpcResp, err = cli.Docker.GRPCClient.CreateServiceContainer(ctx, req); err != nil {
return resp, err return resp, err
} }
} }
if err = json.Unmarshal(grpcResp.Response, &resp); err != nil {
return resp, fmt.Errorf("unmarshal gRPC response: %w", err)
}
pw.Event(progress.CreatedEvent(eventID)) pw.Event(progress.CreatedEvent(eventID))
return resp, nil return resp, nil
+15 -8
View File
@@ -109,7 +109,7 @@ func (cli *Client) InspectService(ctx context.Context, nameOrID string) (api.Ser
} }
listCtx := metadata.NewOutgoingContext(ctx, md) listCtx := metadata.NewOutgoingContext(ctx, md)
// List all service containers including stopped ones. // List all service containers including stopped ones and deployment hooks.
opts := container.ListOptions{All: true} opts := container.ListOptions{All: true}
machineContainers, err := cli.Docker.ListServiceContainers(listCtx, nameOrID, opts) machineContainers, err := cli.Docker.ListServiceContainers(listCtx, nameOrID, opts)
if err != nil { if err != nil {
@@ -146,8 +146,8 @@ func (cli *Client) InspectService(ctx context.Context, nameOrID string) (api.Ser
} }
} }
for _, ctr := range mc.Containers { // Collect both regular and hook containers for the service.
if ctr.ServiceID() == nameOrID || ctr.ServiceName() == nameOrID { for _, ctr := range append(mc.Containers, mc.HookContainers...) {
containers = append(containers, api.MachineServiceContainer{ containers = append(containers, api.MachineServiceContainer{
MachineID: machineID, MachineID: machineID,
Container: ctr, Container: ctr,
@@ -158,7 +158,6 @@ func (cli *Client) InspectService(ctx context.Context, nameOrID string) (api.Ser
} }
} }
} }
}
if len(containers) == 0 { if len(containers) == 0 {
return svc, api.ErrNotFound return svc, api.ErrNotFound
@@ -181,14 +180,22 @@ func (cli *Client) InspectService(ctx context.Context, nameOrID string) (api.Ser
} }
} }
// Partition containers into regular service containers and hook containers.
var serviceContainers, hookContainers []api.MachineServiceContainer
for _, mc := range containers {
if mc.Container.IsHook() {
hookContainers = append(hookContainers, mc)
} else {
serviceContainers = append(serviceContainers, mc)
}
}
svc = api.Service{ svc = api.Service{
ID: containers[0].Container.ServiceID(), ID: containers[0].Container.ServiceID(),
Name: containers[0].Container.ServiceName(), Name: containers[0].Container.ServiceName(),
Mode: containers[0].Container.ServiceMode(), Mode: containers[0].Container.ServiceMode(),
Containers: containers, Containers: serviceContainers,
} HookContainers: hookContainers,
if svc.Mode == "" {
svc.Mode = api.ServiceModeReplicated
} }
return svc, nil return svc, nil