Merge pull request #948 from crosbymichael/client-tty
Add client terminal support for IO
This commit is contained in:
commit
71575bf413
@ -178,6 +178,10 @@ type StateResponse struct {
|
|||||||
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
|
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
|
||||||
Status containerd_v1_types1.Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"`
|
Status containerd_v1_types1.Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"`
|
||||||
Processes []*containerd_v1_types1.Process `protobuf:"bytes,5,rep,name=processes" json:"processes,omitempty"`
|
Processes []*containerd_v1_types1.Process `protobuf:"bytes,5,rep,name=processes" json:"processes,omitempty"`
|
||||||
|
Stdin string `protobuf:"bytes,6,opt,name=stdin,proto3" json:"stdin,omitempty"`
|
||||||
|
Stdout string `protobuf:"bytes,7,opt,name=stdout,proto3" json:"stdout,omitempty"`
|
||||||
|
Stderr string `protobuf:"bytes,8,opt,name=stderr,proto3" json:"stderr,omitempty"`
|
||||||
|
Terminal bool `protobuf:"varint,9,opt,name=terminal,proto3" json:"terminal,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *StateResponse) Reset() { *m = StateResponse{} }
|
func (m *StateResponse) Reset() { *m = StateResponse{} }
|
||||||
@ -1229,6 +1233,34 @@ func (m *StateResponse) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
i += n
|
i += n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(m.Stdin) > 0 {
|
||||||
|
dAtA[i] = 0x32
|
||||||
|
i++
|
||||||
|
i = encodeVarintShim(dAtA, i, uint64(len(m.Stdin)))
|
||||||
|
i += copy(dAtA[i:], m.Stdin)
|
||||||
|
}
|
||||||
|
if len(m.Stdout) > 0 {
|
||||||
|
dAtA[i] = 0x3a
|
||||||
|
i++
|
||||||
|
i = encodeVarintShim(dAtA, i, uint64(len(m.Stdout)))
|
||||||
|
i += copy(dAtA[i:], m.Stdout)
|
||||||
|
}
|
||||||
|
if len(m.Stderr) > 0 {
|
||||||
|
dAtA[i] = 0x42
|
||||||
|
i++
|
||||||
|
i = encodeVarintShim(dAtA, i, uint64(len(m.Stderr)))
|
||||||
|
i += copy(dAtA[i:], m.Stderr)
|
||||||
|
}
|
||||||
|
if m.Terminal {
|
||||||
|
dAtA[i] = 0x48
|
||||||
|
i++
|
||||||
|
if m.Terminal {
|
||||||
|
dAtA[i] = 1
|
||||||
|
} else {
|
||||||
|
dAtA[i] = 0
|
||||||
|
}
|
||||||
|
i++
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1702,6 +1734,21 @@ func (m *StateResponse) Size() (n int) {
|
|||||||
n += 1 + l + sovShim(uint64(l))
|
n += 1 + l + sovShim(uint64(l))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
l = len(m.Stdin)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovShim(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Stdout)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovShim(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Stderr)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovShim(uint64(l))
|
||||||
|
}
|
||||||
|
if m.Terminal {
|
||||||
|
n += 2
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1949,6 +1996,10 @@ func (this *StateResponse) String() string {
|
|||||||
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
|
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
|
||||||
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
|
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
|
||||||
`Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "containerd_v1_types1.Process", 1) + `,`,
|
`Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "containerd_v1_types1.Process", 1) + `,`,
|
||||||
|
`Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`,
|
||||||
|
`Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`,
|
||||||
|
`Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`,
|
||||||
|
`Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@ -3425,6 +3476,113 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 6:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowShim
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthShim
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Stdin = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 7:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowShim
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthShim
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Stdout = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 8:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowShim
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthShim
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Stderr = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 9:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType)
|
||||||
|
}
|
||||||
|
var v int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowShim
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
v |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.Terminal = bool(v != 0)
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipShim(dAtA[iNdEx:])
|
skippy, err := skipShim(dAtA[iNdEx:])
|
||||||
@ -4251,76 +4409,77 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptorShim = []byte{
|
var fileDescriptorShim = []byte{
|
||||||
// 1136 bytes of a gzipped FileDescriptorProto
|
// 1149 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcb, 0x72, 0xe3, 0x44,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xe3, 0x44,
|
||||||
0x17, 0x1e, 0xd9, 0x8e, 0x63, 0x1f, 0x8f, 0x9d, 0xa4, 0x2b, 0x95, 0xd2, 0x38, 0xff, 0xef, 0x04,
|
0x14, 0x5f, 0x27, 0x69, 0x36, 0x79, 0xd9, 0xa4, 0xed, 0xa8, 0xaa, 0xbc, 0x29, 0xa4, 0xc5, 0xd2,
|
||||||
0x55, 0x4d, 0x8d, 0x93, 0x01, 0x19, 0x32, 0xbb, 0x29, 0x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, 0xcb, 0x7a, 0x63, 0x3f, 0xd5, 0x3b, 0x0e, 0x34, 0x92,
|
0x8e, 0xbc, 0x98, 0x84, 0xa2, 0x37, 0x01, 0xab, 0x29, 0xd8, 0x92, 0x3e, 0xd8, 0x4b, 0xe5, 0x8e,
|
||||||
0xc4, 0xf2, 0x88, 0x85, 0x9c, 0xa0, 0x65, 0x28, 0x46, 0x26, 0xb5, 0x75, 0x2c, 0x97, 0x4e, 0x03,
|
0x03, 0x8d, 0x24, 0xb0, 0x3c, 0x62, 0x21, 0x27, 0x68, 0x09, 0x8a, 0x91, 0x09, 0x6d, 0x1d, 0xcb,
|
||||||
0x9e, 0x1e, 0x0b, 0x2f, 0x16, 0x26, 0xf7, 0xce, 0x07, 0x50, 0x3f, 0x20, 0x01, 0xc9, 0x8a, 0x71,
|
0xa5, 0xd3, 0x80, 0x27, 0x47, 0xc2, 0x8b, 0x85, 0x89, 0xbd, 0xf3, 0x01, 0xd4, 0xf7, 0x49, 0x40,
|
||||||
0xf7, 0x88, 0x80, 0x46, 0x02, 0x31, 0x66, 0x37, 0xa0, 0x46, 0x2e, 0xa9, 0xe8, 0x71, 0xe1, 0x89,
|
0x32, 0x32, 0x6e, 0x5f, 0x11, 0xd0, 0x48, 0x20, 0x46, 0xed, 0x3a, 0xd4, 0xc8, 0x05, 0x15, 0x3d,
|
||||||
0x31, 0x37, 0x58, 0x90, 0xaa, 0x63, 0xa5, 0x41, 0xbb, 0x50, 0x95, 0x12, 0xe9, 0xf7, 0x3c, 0xa1,
|
0x2e, 0x3c, 0x31, 0xe6, 0x06, 0x0b, 0x52, 0x74, 0xa4, 0x24, 0x68, 0x07, 0xaa, 0x72, 0x47, 0xfa,
|
||||||
0x8a, 0x27, 0xb3, 0xa1, 0x1b, 0xc3, 0x4d, 0x1a, 0xc3, 0x3d, 0x49, 0x1a, 0x63, 0xaf, 0x72, 0xfd,
|
0x3d, 0x4f, 0x28, 0xf2, 0x64, 0x34, 0x74, 0x62, 0xb8, 0x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, 0xc2, 0x53, 0x1d, 0x60, 0x6e, 0xb1,
|
0xab, 0xb5, 0x94, 0x71, 0x76, 0xaa, 0x2d, 0x29, 0x61, 0xb5, 0x76, 0x36, 0xe0, 0x89, 0x76, 0x30,
|
||||||
0x8e, 0x00, 0xba, 0xe2, 0x2a, 0xb7, 0x32, 0x32, 0xee, 0xb7, 0xb4, 0x2f, 0x86, 0xea, 0xaa, 0x3a,
|
0x97, 0xac, 0x43, 0x80, 0xae, 0xb8, 0xcc, 0x65, 0x46, 0xfa, 0xfd, 0x86, 0xf6, 0xc5, 0x50, 0x3d,
|
||||||
0xd6, 0x82, 0x8c, 0x6f, 0x48, 0xe8, 0x60, 0xa8, 0x6f, 0xab, 0x63, 0x23, 0x39, 0x4b, 0x50, 0x3f,
|
0x55, 0xc7, 0x7a, 0x23, 0xfd, 0x1b, 0x12, 0x3a, 0x18, 0xea, 0xd7, 0xea, 0xd8, 0xec, 0x9c, 0x45,
|
||||||
0xbc, 0x20, 0xa1, 0xe0, 0x49, 0xed, 0x75, 0x2f, 0xa4, 0xa5, 0x77, 0xfe, 0xb0, 0xa0, 0x6e, 0x14,
|
0xa8, 0x1f, 0x9c, 0x93, 0x50, 0xf0, 0x84, 0x7b, 0x9d, 0x0b, 0x29, 0xf5, 0xce, 0xef, 0x05, 0xa8,
|
||||||
0xc6, 0xa5, 0xc7, 0x4e, 0xa6, 0x71, 0xb1, 0x98, 0xb9, 0xf8, 0x4a, 0x26, 0x5b, 0x75, 0x89, 0x4c,
|
0x1b, 0x81, 0x31, 0xe9, 0xa1, 0x95, 0x69, 0x4c, 0x2c, 0x66, 0x26, 0xbe, 0x94, 0xc1, 0x56, 0x59,
|
||||||
0x76, 0x63, 0x67, 0xfd, 0xde, 0xa1, 0xd0, 0x6d, 0x83, 0x0d, 0x14, 0xbd, 0x86, 0x6a, 0x14, 0x33,
|
0x22, 0x83, 0xdd, 0xd8, 0x5e, 0xbb, 0xb3, 0x28, 0x74, 0xda, 0x60, 0x03, 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 0xf3, 0xd4, 0x24, 0x3d, 0x37, 0xd7, 0xee, 0xb0,
|
0x77, 0xc6, 0x8f, 0x80, 0x3b, 0x35, 0x1b, 0x9b, 0x2f, 0xee, 0x85, 0x35, 0xb4, 0x7d, 0x09, 0x0b,
|
||||||
0xd0, 0xa1, 0x0c, 0x55, 0xba, 0xab, 0x39, 0x79, 0x8e, 0xbb, 0x53, 0xdc, 0x3e, 0xc7, 0xdd, 0x5b,
|
0xaa, 0xb9, 0xa3, 0xcd, 0x99, 0xb7, 0x26, 0x07, 0x40, 0x73, 0xf5, 0x56, 0x9f, 0x3b, 0x90, 0xae,
|
||||||
0x24, 0xff, 0x83, 0x72, 0x57, 0x90, 0xf9, 0xee, 0x66, 0x17, 0x6c, 0x3f, 0x04, 0x6a, 0xec, 0xff,
|
0x4a, 0x73, 0x75, 0xd7, 0x9f, 0x63, 0xee, 0xd4, 0xf4, 0x98, 0x63, 0xee, 0x8d, 0x31, 0xf2, 0x83,
|
||||||
0x08, 0xd5, 0xb4, 0xb5, 0xd1, 0x47, 0x33, 0x0f, 0xde, 0x1e, 0x97, 0xa6, 0xfb, 0x50, 0x78, 0x96,
|
0x32, 0x57, 0x90, 0xf9, 0xe6, 0x66, 0x0f, 0x6c, 0xdd, 0x07, 0x6a, 0xf4, 0xff, 0x08, 0xd5, 0x34,
|
||||||
0x7a, 0x45, 0x0a, 0x73, 0x62, 0x99, 0x24, 0x8e, 0xdc, 0xd4, 0x1f, 0x41, 0x59, 0x13, 0xca, 0x9c,
|
0xb5, 0xd1, 0x47, 0x33, 0x2f, 0xde, 0x2c, 0x97, 0xa6, 0x7b, 0x5f, 0x78, 0x16, 0x7a, 0xd5, 0x14,
|
||||||
0xd4, 0x4f, 0xb1, 0x4e, 0xae, 0xb5, 0x13, 0x80, 0x6c, 0x1c, 0xd1, 0xec, 0xb8, 0xee, 0xcc, 0x6d,
|
0xe6, 0xf8, 0x32, 0xd9, 0x38, 0x72, 0x43, 0x7f, 0x08, 0x65, 0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a, 0xf2, 0xf7, 0xfb, 0xd6, 0x93, 0x9f, 0x6f,
|
0xec, 0x94, 0x49, 0xff, 0x00, 0x66, 0x52, 0x9c, 0x8e, 0x85, 0x79, 0x14, 0xdf, 0x9c, 0x1f, 0x79,
|
||||||
0x5a, 0xd6, 0xf5, 0x4d, 0xcb, 0xfa, 0xf3, 0xa6, 0x65, 0xfd, 0x7b, 0xd3, 0xb2, 0x4e, 0xcb, 0x0a,
|
0x5a, 0x77, 0xed, 0xab, 0x77, 0xad, 0x47, 0x7f, 0xbf, 0x6b, 0x3d, 0xfa, 0xf9, 0xba, 0x65, 0x5d,
|
||||||
0xf9, 0xea, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x81, 0x12, 0xdb, 0xb6, 0xae, 0x0c, 0x00, 0x00,
|
0x5d, 0xb7, 0xac, 0x3f, 0xaf, 0x5b, 0xd6, 0xbf, 0xd7, 0x2d, 0xeb, 0xa4, 0xac, 0x90, 0x2f, 0xff,
|
||||||
|
0x0b, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x64, 0xea, 0xc1, 0x10, 0x0d, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,10 @@ message StateResponse {
|
|||||||
uint32 pid = 3;
|
uint32 pid = 3;
|
||||||
containerd.v1.types.Status status = 4;
|
containerd.v1.types.Status status = 4;
|
||||||
repeated containerd.v1.types.Process processes = 5;
|
repeated containerd.v1.types.Process processes = 5;
|
||||||
|
string stdin = 6;
|
||||||
|
string stdout = 7;
|
||||||
|
string stderr = 8;
|
||||||
|
bool terminal = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PauseRequest {
|
message PauseRequest {
|
||||||
|
@ -113,6 +113,10 @@ type Task struct {
|
|||||||
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
|
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
|
||||||
Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"`
|
Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"`
|
||||||
Spec *google_protobuf1.Any `protobuf:"bytes,5,opt,name=spec" json:"spec,omitempty"`
|
Spec *google_protobuf1.Any `protobuf:"bytes,5,opt,name=spec" json:"spec,omitempty"`
|
||||||
|
Stdin string `protobuf:"bytes,6,opt,name=stdin,proto3" json:"stdin,omitempty"`
|
||||||
|
Stdout string `protobuf:"bytes,7,opt,name=stdout,proto3" json:"stdout,omitempty"`
|
||||||
|
Stderr string `protobuf:"bytes,8,opt,name=stderr,proto3" json:"stderr,omitempty"`
|
||||||
|
Terminal bool `protobuf:"varint,9,opt,name=terminal,proto3" json:"terminal,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Task) Reset() { *m = Task{} }
|
func (m *Task) Reset() { *m = Task{} }
|
||||||
@ -129,6 +133,9 @@ type Process struct {
|
|||||||
ExitStatus uint32 `protobuf:"varint,7,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
|
ExitStatus uint32 `protobuf:"varint,7,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
|
||||||
Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"`
|
Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"`
|
||||||
RuntimeData *google_protobuf1.Any `protobuf:"bytes,9,opt,name=runtime_data,json=runtimeData" json:"runtime_data,omitempty"`
|
RuntimeData *google_protobuf1.Any `protobuf:"bytes,9,opt,name=runtime_data,json=runtimeData" json:"runtime_data,omitempty"`
|
||||||
|
Stdin string `protobuf:"bytes,10,opt,name=stdin,proto3" json:"stdin,omitempty"`
|
||||||
|
Stdout string `protobuf:"bytes,11,opt,name=stdout,proto3" json:"stdout,omitempty"`
|
||||||
|
Stderr string `protobuf:"bytes,12,opt,name=stderr,proto3" json:"stderr,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Process) Reset() { *m = Process{} }
|
func (m *Process) Reset() { *m = Process{} }
|
||||||
@ -212,6 +219,34 @@ func (m *Task) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
i += n1
|
i += n1
|
||||||
}
|
}
|
||||||
|
if len(m.Stdin) > 0 {
|
||||||
|
dAtA[i] = 0x32
|
||||||
|
i++
|
||||||
|
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdin)))
|
||||||
|
i += copy(dAtA[i:], m.Stdin)
|
||||||
|
}
|
||||||
|
if len(m.Stdout) > 0 {
|
||||||
|
dAtA[i] = 0x3a
|
||||||
|
i++
|
||||||
|
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdout)))
|
||||||
|
i += copy(dAtA[i:], m.Stdout)
|
||||||
|
}
|
||||||
|
if len(m.Stderr) > 0 {
|
||||||
|
dAtA[i] = 0x42
|
||||||
|
i++
|
||||||
|
i = encodeVarintTask(dAtA, i, uint64(len(m.Stderr)))
|
||||||
|
i += copy(dAtA[i:], m.Stderr)
|
||||||
|
}
|
||||||
|
if m.Terminal {
|
||||||
|
dAtA[i] = 0x48
|
||||||
|
i++
|
||||||
|
if m.Terminal {
|
||||||
|
dAtA[i] = 1
|
||||||
|
} else {
|
||||||
|
dAtA[i] = 0
|
||||||
|
}
|
||||||
|
i++
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,6 +346,24 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
i += n3
|
i += n3
|
||||||
}
|
}
|
||||||
|
if len(m.Stdin) > 0 {
|
||||||
|
dAtA[i] = 0x52
|
||||||
|
i++
|
||||||
|
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdin)))
|
||||||
|
i += copy(dAtA[i:], m.Stdin)
|
||||||
|
}
|
||||||
|
if len(m.Stdout) > 0 {
|
||||||
|
dAtA[i] = 0x5a
|
||||||
|
i++
|
||||||
|
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdout)))
|
||||||
|
i += copy(dAtA[i:], m.Stdout)
|
||||||
|
}
|
||||||
|
if len(m.Stderr) > 0 {
|
||||||
|
dAtA[i] = 0x62
|
||||||
|
i++
|
||||||
|
i = encodeVarintTask(dAtA, i, uint64(len(m.Stderr)))
|
||||||
|
i += copy(dAtA[i:], m.Stderr)
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,6 +507,21 @@ func (m *Task) Size() (n int) {
|
|||||||
l = m.Spec.Size()
|
l = m.Spec.Size()
|
||||||
n += 1 + l + sovTask(uint64(l))
|
n += 1 + l + sovTask(uint64(l))
|
||||||
}
|
}
|
||||||
|
l = len(m.Stdin)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTask(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Stdout)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTask(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Stderr)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTask(uint64(l))
|
||||||
|
}
|
||||||
|
if m.Terminal {
|
||||||
|
n += 2
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,6 +564,18 @@ func (m *Process) Size() (n int) {
|
|||||||
l = m.RuntimeData.Size()
|
l = m.RuntimeData.Size()
|
||||||
n += 1 + l + sovTask(uint64(l))
|
n += 1 + l + sovTask(uint64(l))
|
||||||
}
|
}
|
||||||
|
l = len(m.Stdin)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTask(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Stdout)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTask(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Stderr)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTask(uint64(l))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,6 +642,10 @@ func (this *Task) String() string {
|
|||||||
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
|
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
|
||||||
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
|
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
|
||||||
`Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`,
|
`Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`,
|
||||||
|
`Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`,
|
||||||
|
`Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`,
|
||||||
|
`Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`,
|
||||||
|
`Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@ -580,6 +664,9 @@ func (this *Process) String() string {
|
|||||||
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
|
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
|
||||||
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
|
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
|
||||||
`RuntimeData:` + strings.Replace(fmt.Sprintf("%v", this.RuntimeData), "Any", "google_protobuf1.Any", 1) + `,`,
|
`RuntimeData:` + strings.Replace(fmt.Sprintf("%v", this.RuntimeData), "Any", "google_protobuf1.Any", 1) + `,`,
|
||||||
|
`Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`,
|
||||||
|
`Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`,
|
||||||
|
`Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@ -776,6 +863,113 @@ func (m *Task) Unmarshal(dAtA []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 6:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTask
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthTask
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Stdin = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 7:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTask
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthTask
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Stdout = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 8:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTask
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthTask
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Stderr = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 9:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType)
|
||||||
|
}
|
||||||
|
var v int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTask
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
v |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.Terminal = bool(v != 0)
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipTask(dAtA[iNdEx:])
|
skippy, err := skipTask(dAtA[iNdEx:])
|
||||||
@ -1056,6 +1250,93 @@ func (m *Process) Unmarshal(dAtA []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 10:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTask
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthTask
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Stdin = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 11:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTask
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthTask
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Stdout = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 12:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTask
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthTask
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Stderr = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipTask(dAtA[iNdEx:])
|
skippy, err := skipTask(dAtA[iNdEx:])
|
||||||
@ -1503,50 +1784,54 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptorTask = []byte{
|
var fileDescriptorTask = []byte{
|
||||||
// 718 bytes of a gzipped FileDescriptorProto
|
// 775 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xbf, 0x6f, 0xf3, 0x44,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x6f, 0xe3, 0x44,
|
||||||
0x18, 0xce, 0x39, 0xce, 0xaf, 0x4b, 0x93, 0xcf, 0x1c, 0x9f, 0x90, 0xbf, 0x80, 0x1c, 0x2b, 0x42,
|
0x18, 0x8e, 0x1d, 0xe7, 0x6b, 0xd2, 0x66, 0xcd, 0x50, 0xad, 0xbc, 0x01, 0x39, 0x56, 0x84, 0x44,
|
||||||
0x22, 0x42, 0xc2, 0x11, 0xe9, 0x00, 0x62, 0x4b, 0x63, 0xab, 0x8a, 0x10, 0x49, 0xb8, 0x38, 0xa2,
|
0x84, 0x84, 0x23, 0xb2, 0x07, 0x10, 0xb7, 0xb4, 0xb6, 0x56, 0x11, 0x22, 0x0d, 0x13, 0x47, 0xec,
|
||||||
0x5b, 0x74, 0xcd, 0x1d, 0xe6, 0xd4, 0xc6, 0xb6, 0xec, 0x73, 0x4b, 0x36, 0x46, 0xd4, 0x89, 0x7f,
|
0x2d, 0x9a, 0x66, 0x06, 0x33, 0x6a, 0x3b, 0xb6, 0x3c, 0xe3, 0x2e, 0xbd, 0x71, 0x44, 0x7b, 0xe2,
|
||||||
0xa0, 0x0b, 0xb0, 0xb2, 0x32, 0xb0, 0xb2, 0x74, 0x64, 0x64, 0x2a, 0x34, 0x7f, 0x09, 0xf2, 0xd9,
|
0x0f, 0xec, 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 0x87, 0x8d, 0x01, 0xfe, 0xd8, 0x18, 0xe0, 0xef, 0x8d, 0x01, 0x2e, 0xcb, 0x32, 0xcd, 0xd3,
|
0x3c, 0x56, 0xf8, 0x3c, 0x3a, 0x9d, 0xcd, 0xc2, 0xc0, 0xae, 0xee, 0xe2, 0x73, 0x99, 0xa4, 0x29,
|
||||||
0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x51, 0xea, 0x99, 0x62, 0xee, 0x04, 0x00, 0x00,
|
0x25, 0xf0, 0xc3, 0x8d, 0x2c, 0xab, 0x6b, 0xbf, 0x7c, 0xe5, 0x1d, 0x14, 0xf0, 0x0c, 0xe7, 0x82,
|
||||||
|
0x92, 0x6e, 0xe7, 0xa7, 0x5f, 0xdd, 0xca, 0x9f, 0xbf, 0xb9, 0xa5, 0xda, 0x63, 0xe7, 0xe6, 0xb5,
|
||||||
|
0x5b, 0xf9, 0xfb, 0xb5, 0x5b, 0xf9, 0x71, 0xed, 0x1a, 0x37, 0x6b, 0xd7, 0xf8, 0x6b, 0xed, 0x1a,
|
||||||
|
0xff, 0xae, 0x5d, 0xe3, 0xac, 0xae, 0xdd, 0x7c, 0xfa, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48,
|
||||||
|
0xcc, 0xfd, 0x9a, 0x96, 0x05, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,10 @@ message Task {
|
|||||||
uint32 pid = 3;
|
uint32 pid = 3;
|
||||||
Status status = 4;
|
Status status = 4;
|
||||||
google.protobuf.Any spec = 5;
|
google.protobuf.Any spec = 5;
|
||||||
|
string stdin = 6;
|
||||||
|
string stdout = 7;
|
||||||
|
string stderr = 8;
|
||||||
|
bool terminal = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Process {
|
message Process {
|
||||||
@ -35,6 +39,9 @@ message Process {
|
|||||||
uint32 exit_status = 7;
|
uint32 exit_status = 7;
|
||||||
Status status = 8;
|
Status status = 8;
|
||||||
google.protobuf.Any runtime_data = 9;
|
google.protobuf.Any runtime_data = 9;
|
||||||
|
string stdin = 10;
|
||||||
|
string stdout = 11;
|
||||||
|
string stderr = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
message User {
|
message User {
|
||||||
|
10
client.go
10
client.go
@ -203,6 +203,16 @@ func (c *Client) NewContainer(ctx context.Context, id string, spec *specs.Spec,
|
|||||||
return containerFromProto(c, r.Container), nil
|
return containerFromProto(c, r.Container), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) LoadContainer(ctx context.Context, id string) (Container, error) {
|
||||||
|
response, err := c.ContainerService().Get(ctx, &containers.GetContainerRequest{
|
||||||
|
ID: id,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return containerFromProto(c, response.Container), nil
|
||||||
|
}
|
||||||
|
|
||||||
type RemoteOpts func(*Client, *RemoteContext) error
|
type RemoteOpts func(*Client, *RemoteContext) error
|
||||||
|
|
||||||
// RemoteContext is used to configure object resolutions and transfers with
|
// RemoteContext is used to configure object resolutions and transfers with
|
||||||
|
46
container.go
46
container.go
@ -3,6 +3,7 @@ package containerd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/containerd/containerd/api/services/containers"
|
"github.com/containerd/containerd/api/services/containers"
|
||||||
"github.com/containerd/containerd/api/services/execution"
|
"github.com/containerd/containerd/api/services/execution"
|
||||||
@ -16,6 +17,7 @@ type Container interface {
|
|||||||
NewTask(context.Context, IOCreation) (Task, error)
|
NewTask(context.Context, IOCreation) (Task, error)
|
||||||
Spec() (*specs.Spec, error)
|
Spec() (*specs.Spec, error)
|
||||||
Task() Task
|
Task() Task
|
||||||
|
LoadTask(context.Context, IOAttach) (Task, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func containerFromProto(client *Client, c containers.Container) *container {
|
func containerFromProto(client *Client, c containers.Container) *container {
|
||||||
@ -108,3 +110,47 @@ func (c *container) NewTask(ctx context.Context, ioCreate IOCreation) (Task, err
|
|||||||
c.task = t
|
c.task = t
|
||||||
return t, nil
|
return t, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *container) LoadTask(ctx context.Context, ioAttach IOAttach) (Task, error) {
|
||||||
|
response, err := c.client.TaskService().Info(ctx, &execution.InfoRequest{
|
||||||
|
ContainerID: c.c.ID,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// get the existing fifo paths from the task information stored by the daemon
|
||||||
|
paths := &FifoSet{
|
||||||
|
Dir: getFifoDir([]string{
|
||||||
|
response.Task.Stdin,
|
||||||
|
response.Task.Stdout,
|
||||||
|
response.Task.Stderr,
|
||||||
|
}),
|
||||||
|
In: response.Task.Stdin,
|
||||||
|
Out: response.Task.Stdout,
|
||||||
|
Err: response.Task.Stderr,
|
||||||
|
Terminal: response.Task.Terminal,
|
||||||
|
}
|
||||||
|
i, err := ioAttach(paths)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
t := &task{
|
||||||
|
client: c.client,
|
||||||
|
io: i,
|
||||||
|
containerID: response.Task.ContainerID,
|
||||||
|
pid: response.Task.Pid,
|
||||||
|
}
|
||||||
|
c.task = t
|
||||||
|
return t, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// getFifoDir looks for any non-empty path for a stdio fifo
|
||||||
|
// and returns the dir for where it is located
|
||||||
|
func getFifoDir(paths []string) string {
|
||||||
|
for _, p := range paths {
|
||||||
|
if p != "" {
|
||||||
|
return filepath.Dir(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
@ -3,12 +3,18 @@ package containerd
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func empty() IOCreation {
|
func empty() IOCreation {
|
||||||
return BufferedIO(bytes.NewBuffer(nil), bytes.NewBuffer(nil), bytes.NewBuffer(nil))
|
null := ioutil.Discard
|
||||||
|
return NewIO(bytes.NewBuffer(nil), null, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContainerList(t *testing.T) {
|
func TestContainerList(t *testing.T) {
|
||||||
@ -167,7 +173,7 @@ func TestContainerOutput(t *testing.T) {
|
|||||||
defer container.Delete(ctx)
|
defer container.Delete(ctx)
|
||||||
|
|
||||||
stdout := bytes.NewBuffer(nil)
|
stdout := bytes.NewBuffer(nil)
|
||||||
task, err := container.NewTask(ctx, BufferedIO(bytes.NewBuffer(nil), stdout, bytes.NewBuffer(nil)))
|
task, err := container.NewTask(ctx, NewIO(bytes.NewBuffer(nil), stdout, bytes.NewBuffer(nil)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
return
|
return
|
||||||
@ -360,3 +366,208 @@ func TestContainerProcesses(t *testing.T) {
|
|||||||
}
|
}
|
||||||
<-statusC
|
<-statusC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestContainerCloseStdin(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.Skip()
|
||||||
|
}
|
||||||
|
client, err := New(address)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer client.Close()
|
||||||
|
|
||||||
|
var (
|
||||||
|
ctx = context.Background()
|
||||||
|
id = "ContainerCloseStdin"
|
||||||
|
)
|
||||||
|
image, err := client.GetImage(ctx, testImage)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
spec, err := GenerateSpec(WithImageConfig(ctx, image), WithProcessArgs("cat"))
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
container, err := client.NewContainer(ctx, id, spec, WithImage(image), WithNewRootFS(id, image))
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer container.Delete(ctx)
|
||||||
|
|
||||||
|
const expected = "hello\n"
|
||||||
|
stdout := bytes.NewBuffer(nil)
|
||||||
|
|
||||||
|
r, w, err := os.Pipe()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
task, err := container.NewTask(ctx, NewIO(r, stdout, ioutil.Discard))
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer task.Delete(ctx)
|
||||||
|
|
||||||
|
statusC := make(chan uint32, 1)
|
||||||
|
go func() {
|
||||||
|
status, err := task.Wait(ctx)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
statusC <- status
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := task.Start(ctx); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := fmt.Fprint(w, expected); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
w.Close()
|
||||||
|
if err := task.CloseStdin(ctx); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
<-statusC
|
||||||
|
|
||||||
|
if _, err := task.Delete(ctx); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
output := stdout.String()
|
||||||
|
|
||||||
|
if output != expected {
|
||||||
|
t.Errorf("expected output %q but received %q", expected, output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestContainerAttach(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.Skip()
|
||||||
|
}
|
||||||
|
client, err := New(address)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer client.Close()
|
||||||
|
|
||||||
|
var (
|
||||||
|
ctx = context.Background()
|
||||||
|
id = "ContainerAttach"
|
||||||
|
)
|
||||||
|
image, err := client.GetImage(ctx, testImage)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
spec, err := GenerateSpec(WithImageConfig(ctx, image), WithProcessArgs("cat"))
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
container, err := client.NewContainer(ctx, id, spec, WithImage(image), WithNewRootFS(id, image))
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer container.Delete(ctx)
|
||||||
|
|
||||||
|
expected := "hello\n"
|
||||||
|
stdout := bytes.NewBuffer(nil)
|
||||||
|
|
||||||
|
r, w, err := os.Pipe()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
or, ow, err := os.Pipe()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
wg := &sync.WaitGroup{}
|
||||||
|
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
io.Copy(stdout, or)
|
||||||
|
wg.Done()
|
||||||
|
}()
|
||||||
|
|
||||||
|
task, err := container.NewTask(ctx, NewIO(r, ow, ioutil.Discard))
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer task.Delete(ctx)
|
||||||
|
originalIO := task.IO()
|
||||||
|
|
||||||
|
statusC := make(chan uint32, 1)
|
||||||
|
go func() {
|
||||||
|
status, err := task.Wait(ctx)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
statusC <- status
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := task.Start(ctx); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := fmt.Fprint(w, expected); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
w.Close()
|
||||||
|
|
||||||
|
// load the container and re-load the task
|
||||||
|
if container, err = client.LoadContainer(ctx, id); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// create new IO for the loaded task
|
||||||
|
if r, w, err = os.Pipe(); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if task, err = container.LoadTask(ctx, WithAttach(r, ow, ioutil.Discard)); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := fmt.Fprint(w, expected); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
w.Close()
|
||||||
|
|
||||||
|
if err := task.CloseStdin(ctx); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
<-statusC
|
||||||
|
|
||||||
|
originalIO.Close()
|
||||||
|
if _, err := task.Delete(ctx); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
ow.Close()
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
output := stdout.String()
|
||||||
|
|
||||||
|
// we wrote the same thing after attach
|
||||||
|
expected = expected + expected
|
||||||
|
if output != expected {
|
||||||
|
t.Errorf("expected output %q but received %q", expected, output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
97
io.go
97
io.go
@ -1,7 +1,7 @@
|
|||||||
package containerd
|
package containerd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -27,25 +27,56 @@ func (i *IO) Close() error {
|
|||||||
|
|
||||||
type IOCreation func() (*IO, error)
|
type IOCreation func() (*IO, error)
|
||||||
|
|
||||||
// BufferedIO returns IO that will be logged to an in memory buffer
|
type IOAttach func(*FifoSet) (*IO, error)
|
||||||
func BufferedIO(stdin, stdout, stderr *bytes.Buffer) IOCreation {
|
|
||||||
|
func NewIO(stdin io.Reader, stdout, stderr io.Writer) IOCreation {
|
||||||
|
return NewIOWithTerminal(stdin, stdout, stderr, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIOWithTerminal(stdin io.Reader, stdout, stderr io.Writer, terminal bool) IOCreation {
|
||||||
return func() (*IO, error) {
|
return func() (*IO, error) {
|
||||||
paths, err := fifoPaths()
|
paths, err := NewFifos()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
i := &IO{
|
i := &IO{
|
||||||
Terminal: false,
|
Terminal: terminal,
|
||||||
Stdout: paths.out,
|
Stdout: paths.Out,
|
||||||
Stderr: paths.err,
|
Stderr: paths.Err,
|
||||||
Stdin: paths.in,
|
Stdin: paths.In,
|
||||||
}
|
}
|
||||||
set := &ioSet{
|
set := &ioSet{
|
||||||
in: stdin,
|
in: stdin,
|
||||||
out: stdout,
|
out: stdout,
|
||||||
err: stderr,
|
err: stderr,
|
||||||
}
|
}
|
||||||
closer, err := copyIO(paths, set, false)
|
closer, err := copyIO(paths, set, i.Terminal)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
i.closer = closer
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithAttach(stdin io.Reader, stdout, stderr io.Writer) IOAttach {
|
||||||
|
return func(paths *FifoSet) (*IO, error) {
|
||||||
|
if paths == nil {
|
||||||
|
return nil, fmt.Errorf("cannot attach to existing fifos")
|
||||||
|
}
|
||||||
|
i := &IO{
|
||||||
|
Terminal: paths.Terminal,
|
||||||
|
Stdout: paths.Out,
|
||||||
|
Stderr: paths.Err,
|
||||||
|
Stdin: paths.In,
|
||||||
|
}
|
||||||
|
set := &ioSet{
|
||||||
|
in: stdin,
|
||||||
|
out: stdout,
|
||||||
|
err: stderr,
|
||||||
|
}
|
||||||
|
closer, err := copyIO(paths, set, i.Terminal)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -57,29 +88,16 @@ func BufferedIO(stdin, stdout, stderr *bytes.Buffer) IOCreation {
|
|||||||
// Stdio returns an IO implementation to be used for a task
|
// Stdio returns an IO implementation to be used for a task
|
||||||
// that outputs the container's IO as the current processes Stdio
|
// that outputs the container's IO as the current processes Stdio
|
||||||
func Stdio() (*IO, error) {
|
func Stdio() (*IO, error) {
|
||||||
paths, err := fifoPaths()
|
return NewIO(os.Stdin, os.Stdout, os.Stderr)()
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
set := &ioSet{
|
|
||||||
in: os.Stdin,
|
|
||||||
out: os.Stdout,
|
|
||||||
err: os.Stderr,
|
|
||||||
}
|
|
||||||
closer, err := copyIO(paths, set, false)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &IO{
|
|
||||||
Terminal: false,
|
|
||||||
Stdin: paths.in,
|
|
||||||
Stdout: paths.out,
|
|
||||||
Stderr: paths.err,
|
|
||||||
closer: closer,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func fifoPaths() (*fifoSet, error) {
|
// StdioTerminal will setup the IO for the task to use a terminal
|
||||||
|
func StdioTerminal() (*IO, error) {
|
||||||
|
return NewIOWithTerminal(os.Stdin, os.Stdout, os.Stderr, true)()
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFifos returns a new set of fifos for the task
|
||||||
|
func NewFifos() (*FifoSet, error) {
|
||||||
root := filepath.Join(os.TempDir(), "containerd")
|
root := filepath.Join(os.TempDir(), "containerd")
|
||||||
if err := os.MkdirAll(root, 0700); err != nil {
|
if err := os.MkdirAll(root, 0700); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -88,18 +106,19 @@ func fifoPaths() (*fifoSet, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &fifoSet{
|
return &FifoSet{
|
||||||
dir: dir,
|
Dir: dir,
|
||||||
in: filepath.Join(dir, "stdin"),
|
In: filepath.Join(dir, "stdin"),
|
||||||
out: filepath.Join(dir, "stdout"),
|
Out: filepath.Join(dir, "stdout"),
|
||||||
err: filepath.Join(dir, "stderr"),
|
Err: filepath.Join(dir, "stderr"),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type fifoSet struct {
|
type FifoSet struct {
|
||||||
// dir is the directory holding the task fifos
|
// Dir is the directory holding the task fifos
|
||||||
dir string
|
Dir string
|
||||||
in, out, err string
|
In, Out, Err string
|
||||||
|
Terminal bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type ioSet struct {
|
type ioSet struct {
|
||||||
|
10
io_unix.go
10
io_unix.go
@ -11,14 +11,14 @@ import (
|
|||||||
"github.com/containerd/fifo"
|
"github.com/containerd/fifo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error) {
|
func copyIO(fifos *FifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error) {
|
||||||
var (
|
var (
|
||||||
f io.ReadWriteCloser
|
f io.ReadWriteCloser
|
||||||
ctx = context.Background()
|
ctx = context.Background()
|
||||||
wg = &sync.WaitGroup{}
|
wg = &sync.WaitGroup{}
|
||||||
)
|
)
|
||||||
|
|
||||||
if f, err = fifo.OpenFifo(ctx, fifos.in, syscall.O_WRONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); err != nil {
|
if f, err = fifo.OpenFifo(ctx, fifos.In, syscall.O_WRONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer func(c io.Closer) {
|
defer func(c io.Closer) {
|
||||||
@ -31,7 +31,7 @@ func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error
|
|||||||
w.Close()
|
w.Close()
|
||||||
}(f)
|
}(f)
|
||||||
|
|
||||||
if f, err = fifo.OpenFifo(ctx, fifos.out, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); err != nil {
|
if f, err = fifo.OpenFifo(ctx, fifos.Out, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer func(c io.Closer) {
|
defer func(c io.Closer) {
|
||||||
@ -46,7 +46,7 @@ func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error
|
|||||||
wg.Done()
|
wg.Done()
|
||||||
}(f)
|
}(f)
|
||||||
|
|
||||||
if f, err = fifo.OpenFifo(ctx, fifos.err, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); err != nil {
|
if f, err = fifo.OpenFifo(ctx, fifos.Err, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer func(c io.Closer) {
|
defer func(c io.Closer) {
|
||||||
@ -66,6 +66,6 @@ func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error
|
|||||||
|
|
||||||
return &wgCloser{
|
return &wgCloser{
|
||||||
wg: wg,
|
wg: wg,
|
||||||
dir: fifos.dir,
|
dir: fifos.Dir,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,13 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error) {
|
func copyIO(fifos *FifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
if fifos.in != "" {
|
if fifos.In != "" {
|
||||||
l, err := winio.ListenPipe(fifos.in, nil)
|
l, err := winio.ListenPipe(fifos.In, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to create stdin pipe %s", fifos.in)
|
return nil, errors.Wrapf(err, "failed to create stdin pipe %s", fifos.In)
|
||||||
}
|
}
|
||||||
defer func(l net.Listener) {
|
defer func(l net.Listener) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -27,7 +27,7 @@ func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error
|
|||||||
go func() {
|
go func() {
|
||||||
c, err := l.Accept()
|
c, err := l.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.L.WithError(err).Errorf("failed to accept stdin connection on %s", fifos.in)
|
log.L.WithError(err).Errorf("failed to accept stdin connection on %s", fifos.In)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
io.Copy(c, ioset.in)
|
io.Copy(c, ioset.in)
|
||||||
@ -36,10 +36,10 @@ func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
if fifos.out != "" {
|
if fifos.Out != "" {
|
||||||
l, err := winio.ListenPipe(fifos.out, nil)
|
l, err := winio.ListenPipe(fifos.Out, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to create stdin pipe %s", fifos.out)
|
return nil, errors.Wrapf(err, "failed to create stdin pipe %s", fifos.Out)
|
||||||
}
|
}
|
||||||
defer func(l net.Listener) {
|
defer func(l net.Listener) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -52,7 +52,7 @@ func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
c, err := l.Accept()
|
c, err := l.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.L.WithError(err).Errorf("failed to accept stdout connection on %s", fifos.out)
|
log.L.WithError(err).Errorf("failed to accept stdout connection on %s", fifos.Out)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
io.Copy(ioset.out, c)
|
io.Copy(ioset.out, c)
|
||||||
@ -61,10 +61,10 @@ func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
if !tty && fifos.err != "" {
|
if !tty && fifos.Err != "" {
|
||||||
l, err := winio.ListenPipe(fifos.err, nil)
|
l, err := winio.ListenPipe(fifos.Err, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to create stderr pipe %s", fifos.err)
|
return nil, errors.Wrapf(err, "failed to create stderr pipe %s", fifos.Err)
|
||||||
}
|
}
|
||||||
defer func(l net.Listener) {
|
defer func(l net.Listener) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -77,7 +77,7 @@ func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
c, err := l.Accept()
|
c, err := l.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.L.WithError(err).Errorf("failed to accept stderr connection on %s", fifos.err)
|
log.L.WithError(err).Errorf("failed to accept stderr connection on %s", fifos.Err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
io.Copy(ioset.err, c)
|
io.Copy(ioset.err, c)
|
||||||
@ -88,6 +88,6 @@ func copyIO(fifos *fifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error
|
|||||||
|
|
||||||
return &wgCloser{
|
return &wgCloser{
|
||||||
wg: &wg,
|
wg: &wg,
|
||||||
dir: fifos.dir,
|
dir: fifos.Dir,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -35,12 +35,21 @@ type execProcess struct {
|
|||||||
stdin io.Closer
|
stdin io.Closer
|
||||||
|
|
||||||
parent *initProcess
|
parent *initProcess
|
||||||
|
|
||||||
|
stdinPath string
|
||||||
|
stdoutPath string
|
||||||
|
stderrPath string
|
||||||
|
terminal bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newExecProcess(context context.Context, path string, r *shimapi.ExecRequest, parent *initProcess, id int) (process, error) {
|
func newExecProcess(context context.Context, path string, r *shimapi.ExecRequest, parent *initProcess, id int) (process, error) {
|
||||||
e := &execProcess{
|
e := &execProcess{
|
||||||
id: id,
|
id: id,
|
||||||
parent: parent,
|
parent: parent,
|
||||||
|
stdinPath: r.Stdin,
|
||||||
|
stdoutPath: r.Stdout,
|
||||||
|
stderrPath: r.Stderr,
|
||||||
|
terminal: r.Terminal,
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
|
@ -31,6 +31,7 @@ type initProcess struct {
|
|||||||
// This is the case within the shim implementation as it makes use of
|
// This is the case within the shim implementation as it makes use of
|
||||||
// the reaper interface.
|
// the reaper interface.
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
|
|
||||||
id string
|
id string
|
||||||
bundle string
|
bundle string
|
||||||
console console.Console
|
console console.Console
|
||||||
@ -41,6 +42,11 @@ type initProcess struct {
|
|||||||
pid int
|
pid int
|
||||||
closers []io.Closer
|
closers []io.Closer
|
||||||
stdin io.Closer
|
stdin io.Closer
|
||||||
|
|
||||||
|
stdinPath string
|
||||||
|
stdoutPath string
|
||||||
|
stderrPath string
|
||||||
|
terminal bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newInitProcess(context context.Context, path string, r *shimapi.CreateRequest) (*initProcess, error) {
|
func newInitProcess(context context.Context, path string, r *shimapi.CreateRequest) (*initProcess, error) {
|
||||||
@ -64,6 +70,10 @@ func newInitProcess(context context.Context, path string, r *shimapi.CreateReque
|
|||||||
id: r.ID,
|
id: r.ID,
|
||||||
bundle: r.Bundle,
|
bundle: r.Bundle,
|
||||||
runc: runtime,
|
runc: runtime,
|
||||||
|
stdinPath: r.Stdin,
|
||||||
|
stdoutPath: r.Stdout,
|
||||||
|
stderrPath: r.Stderr,
|
||||||
|
terminal: r.Terminal,
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
|
@ -192,6 +192,9 @@ func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.
|
|||||||
Pid: uint32(s.initProcess.Pid()),
|
Pid: uint32(s.initProcess.Pid()),
|
||||||
Status: status,
|
Status: status,
|
||||||
Processes: []*task.Process{},
|
Processes: []*task.Process{},
|
||||||
|
Stdin: s.initProcess.stdinPath,
|
||||||
|
Stdout: s.initProcess.stdoutPath,
|
||||||
|
Stderr: s.initProcess.stderrPath,
|
||||||
}
|
}
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
@ -203,10 +206,16 @@ func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.
|
|||||||
}
|
}
|
||||||
status = task.StatusStopped
|
status = task.StatusStopped
|
||||||
}
|
}
|
||||||
o.Processes = append(o.Processes, &task.Process{
|
pp := &task.Process{
|
||||||
Pid: uint32(p.Pid()),
|
Pid: uint32(p.Pid()),
|
||||||
Status: status,
|
Status: status,
|
||||||
})
|
}
|
||||||
|
if ep, ok := p.(*execProcess); ok {
|
||||||
|
pp.Stdin = ep.stdinPath
|
||||||
|
pp.Stdout = ep.stdoutPath
|
||||||
|
pp.Stderr = ep.stderrPath
|
||||||
|
}
|
||||||
|
o.Processes = append(o.Processes, pp)
|
||||||
}
|
}
|
||||||
return o, nil
|
return o, nil
|
||||||
}
|
}
|
||||||
@ -270,7 +279,6 @@ func (s *Service) Processes(ctx context.Context, r *shimapi.ProcessesRequest) (*
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ps := []*task.Process{}
|
ps := []*task.Process{}
|
||||||
for _, pid := range pids {
|
for _, pid := range pids {
|
||||||
ps = append(ps, &task.Process{
|
ps = append(ps, &task.Process{
|
||||||
@ -280,9 +288,7 @@ func (s *Service) Processes(ctx context.Context, r *shimapi.ProcessesRequest) (*
|
|||||||
resp := &shimapi.ProcessesResponse{
|
resp := &shimapi.ProcessesResponse{
|
||||||
Processes: ps,
|
Processes: ps,
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) CloseStdin(ctx context.Context, r *shimapi.CloseStdinRequest) (*google_protobuf.Empty, error) {
|
func (s *Service) CloseStdin(ctx context.Context, r *shimapi.CloseStdinRequest) (*google_protobuf.Empty, error) {
|
||||||
|
@ -12,19 +12,6 @@ import (
|
|||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
type State struct {
|
|
||||||
pid uint32
|
|
||||||
status plugin.Status
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s State) Pid() uint32 {
|
|
||||||
return s.pid
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s State) Status() plugin.Status {
|
|
||||||
return s.status
|
|
||||||
}
|
|
||||||
|
|
||||||
type Task struct {
|
type Task struct {
|
||||||
containerID string
|
containerID string
|
||||||
spec []byte
|
spec []byte
|
||||||
@ -56,7 +43,7 @@ func (c *Task) Start(ctx context.Context) error {
|
|||||||
func (c *Task) State(ctx context.Context) (plugin.State, error) {
|
func (c *Task) State(ctx context.Context) (plugin.State, error) {
|
||||||
response, err := c.shim.State(ctx, &shim.StateRequest{})
|
response, err := c.shim.State(ctx, &shim.StateRequest{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return plugin.State{}, err
|
||||||
}
|
}
|
||||||
var status plugin.Status
|
var status plugin.Status
|
||||||
switch response.Status {
|
switch response.Status {
|
||||||
@ -70,9 +57,13 @@ func (c *Task) State(ctx context.Context) (plugin.State, error) {
|
|||||||
status = plugin.PausedStatus
|
status = plugin.PausedStatus
|
||||||
// TODO: containerd.DeletedStatus
|
// TODO: containerd.DeletedStatus
|
||||||
}
|
}
|
||||||
return &State{
|
return plugin.State{
|
||||||
pid: response.Pid,
|
Pid: response.Pid,
|
||||||
status: status,
|
Status: status,
|
||||||
|
Stdin: response.Stdin,
|
||||||
|
Stdout: response.Stdout,
|
||||||
|
Stderr: response.Stderr,
|
||||||
|
Terminal: response.Terminal,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,8 +172,8 @@ func (p *Process) State(ctx context.Context) (plugin.State, error) {
|
|||||||
// use the container status for the status of the process
|
// use the container status for the status of the process
|
||||||
state, err := p.c.State(ctx)
|
state, err := p.c.State(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return state, err
|
||||||
}
|
}
|
||||||
state.(*State).pid = uint32(p.pid)
|
state.Pid = uint32(p.pid)
|
||||||
return state, nil
|
return state, nil
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ func (m *cgroupsMonitor) Monitor(c plugin.Task) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
cg, err := cgroups.Load(cgroups.V1, cgroups.PidPath(int(state.Pid())))
|
cg, err := cgroups.Load(cgroups.V1, cgroups.PidPath(int(state.Pid)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -71,9 +71,13 @@ const (
|
|||||||
PausedStatus
|
PausedStatus
|
||||||
)
|
)
|
||||||
|
|
||||||
type State interface {
|
type State struct {
|
||||||
// Status is the current status of the container
|
// Status is the current status of the container
|
||||||
Status() Status
|
Status Status
|
||||||
// Pid is the main process id for the container
|
// Pid is the main process id for the container
|
||||||
Pid() uint32
|
Pid uint32
|
||||||
|
Stdin string
|
||||||
|
Stdout string
|
||||||
|
Stderr string
|
||||||
|
Terminal bool
|
||||||
}
|
}
|
||||||
|
22
process.go
22
process.go
@ -88,3 +88,25 @@ func (p *process) Wait(ctx context.Context) (uint32, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *process) CloseStdin(ctx context.Context) error {
|
||||||
|
_, err := p.task.client.TaskService().CloseStdin(ctx, &execution.CloseStdinRequest{
|
||||||
|
ContainerID: p.task.containerID,
|
||||||
|
Pid: p.pid,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *process) IO() *IO {
|
||||||
|
return p.io
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *process) Resize(ctx context.Context, w, h uint32) error {
|
||||||
|
_, err := p.task.client.TaskService().Pty(ctx, &execution.PtyRequest{
|
||||||
|
ContainerID: p.task.containerID,
|
||||||
|
Width: w,
|
||||||
|
Height: h,
|
||||||
|
Pid: p.pid,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
@ -164,7 +164,7 @@ func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.Create
|
|||||||
}
|
}
|
||||||
return &api.CreateResponse{
|
return &api.CreateResponse{
|
||||||
ContainerID: r.ContainerID,
|
ContainerID: r.ContainerID,
|
||||||
Pid: state.Pid(),
|
Pid: state.Pid,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ func taskFromContainerd(ctx context.Context, c plugin.Task) (*task.Task, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var status task.Status
|
var status task.Status
|
||||||
switch state.Status() {
|
switch state.Status {
|
||||||
case plugin.CreatedStatus:
|
case plugin.CreatedStatus:
|
||||||
status = task.StatusCreated
|
status = task.StatusCreated
|
||||||
case plugin.RunningStatus:
|
case plugin.RunningStatus:
|
||||||
@ -218,17 +218,21 @@ func taskFromContainerd(ctx context.Context, c plugin.Task) (*task.Task, error)
|
|||||||
case plugin.PausedStatus:
|
case plugin.PausedStatus:
|
||||||
status = task.StatusPaused
|
status = task.StatusPaused
|
||||||
default:
|
default:
|
||||||
log.G(ctx).WithField("status", state.Status()).Warn("unknown status")
|
log.G(ctx).WithField("status", state.Status).Warn("unknown status")
|
||||||
}
|
}
|
||||||
return &task.Task{
|
return &task.Task{
|
||||||
ID: c.Info().ID,
|
ID: c.Info().ID,
|
||||||
ContainerID: c.Info().ContainerID,
|
ContainerID: c.Info().ContainerID,
|
||||||
Pid: state.Pid(),
|
Pid: state.Pid,
|
||||||
Status: status,
|
Status: status,
|
||||||
Spec: &protobuf.Any{
|
Spec: &protobuf.Any{
|
||||||
TypeUrl: specs.Version,
|
TypeUrl: specs.Version,
|
||||||
Value: c.Info().Spec,
|
Value: c.Info().Spec,
|
||||||
},
|
},
|
||||||
|
Stdin: state.Stdin,
|
||||||
|
Stdout: state.Stdout,
|
||||||
|
Stderr: state.Stderr,
|
||||||
|
Terminal: state.Terminal,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +363,7 @@ func (s *Service) Exec(ctx context.Context, r *api.ExecRequest) (*api.ExecRespon
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &api.ExecResponse{
|
return &api.ExecResponse{
|
||||||
Pid: state.Pid(),
|
Pid: state.Pid,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
task.go
28
task.go
@ -32,6 +32,9 @@ type Task interface {
|
|||||||
Wait(context.Context) (uint32, error)
|
Wait(context.Context) (uint32, error)
|
||||||
Exec(context.Context, *specs.Process, IOCreation) (Process, error)
|
Exec(context.Context, *specs.Process, IOCreation) (Process, error)
|
||||||
Processes(context.Context) ([]uint32, error)
|
Processes(context.Context) ([]uint32, error)
|
||||||
|
CloseStdin(context.Context) error
|
||||||
|
Resize(ctx context.Context, w, h uint32) error
|
||||||
|
IO() *IO
|
||||||
}
|
}
|
||||||
|
|
||||||
type Process interface {
|
type Process interface {
|
||||||
@ -39,6 +42,9 @@ type Process interface {
|
|||||||
Start(context.Context) error
|
Start(context.Context) error
|
||||||
Kill(context.Context, syscall.Signal) error
|
Kill(context.Context, syscall.Signal) error
|
||||||
Wait(context.Context) (uint32, error)
|
Wait(context.Context) (uint32, error)
|
||||||
|
CloseStdin(context.Context) error
|
||||||
|
Resize(ctx context.Context, w, h uint32) error
|
||||||
|
IO() *IO
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (Task)(&task{})
|
var _ = (Task)(&task{})
|
||||||
@ -158,3 +164,25 @@ func (t *task) Processes(ctx context.Context) ([]uint32, error) {
|
|||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *task) CloseStdin(ctx context.Context) error {
|
||||||
|
_, err := t.client.TaskService().CloseStdin(ctx, &execution.CloseStdinRequest{
|
||||||
|
ContainerID: t.containerID,
|
||||||
|
Pid: t.pid,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *task) IO() *IO {
|
||||||
|
return t.io
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *task) Resize(ctx context.Context, w, h uint32) error {
|
||||||
|
_, err := t.client.TaskService().Pty(ctx, &execution.PtyRequest{
|
||||||
|
ContainerID: t.containerID,
|
||||||
|
Width: w,
|
||||||
|
Height: h,
|
||||||
|
Pid: t.pid,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
@ -116,7 +116,10 @@ func (c *container) Resume(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *container) State(ctx context.Context) (plugin.State, error) {
|
func (c *container) State(ctx context.Context) (plugin.State, error) {
|
||||||
return c, nil
|
return plugin.State{
|
||||||
|
Pid: c.Pid(),
|
||||||
|
Status: c.Status(),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *container) Kill(ctx context.Context, signal uint32, pid uint32, all bool) error {
|
func (c *container) Kill(ctx context.Context, signal uint32, pid uint32, all bool) error {
|
||||||
|
@ -15,7 +15,10 @@ type process struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *process) State(ctx context.Context) (plugin.State, error) {
|
func (p *process) State(ctx context.Context) (plugin.State, error) {
|
||||||
return p, nil
|
return plugin.State{
|
||||||
|
Pid: p.Pid(),
|
||||||
|
Status: p.Status(),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *process) Kill(ctx context.Context, sig uint32, all bool) error {
|
func (p *process) Kill(ctx context.Context, sig uint32, all bool) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user