Merge pull request #28728 from aluzzardi/swarmkit-revendor-53fcdeba083627b1a2616612a103019b73c6d5ce

revendor swarmkit to 53fcdeba083627b1a2616612a103019b73c6d5ce
This commit is contained in:
Alexander Morozov 2016-11-23 09:24:23 -08:00 committed by GitHub
commit 1640bb23b1
14 changed files with 245 additions and 266 deletions

View File

@ -100,7 +100,7 @@ github.com/docker/containerd 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4 github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4
# cluster # cluster
github.com/docker/swarmkit 9bca23b0de42a9ebcc71622a30d646afa1e2b564 github.com/docker/swarmkit 53fcdeba083627b1a2616612a103019b73c6d5ce
github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9 github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
github.com/gogo/protobuf v0.3 github.com/gogo/protobuf v0.3
github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a

View File

@ -193,11 +193,12 @@ func (_m *MockLogPublisherProvider) EXPECT() *_MockLogPublisherProviderRecorder
return _m.recorder return _m.recorder
} }
func (_m *MockLogPublisherProvider) Publisher(ctx context.Context, subscriptionID string) (LogPublisher, error) { func (_m *MockLogPublisherProvider) Publisher(ctx context.Context, subscriptionID string) (LogPublisher, func(), error) {
ret := _m.ctrl.Call(_m, "Publisher", ctx, subscriptionID) ret := _m.ctrl.Call(_m, "Publisher", ctx, subscriptionID)
ret0, _ := ret[0].(LogPublisher) ret0, _ := ret[0].(LogPublisher)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(func())
return ret0, ret1 ret2, _ := ret[2].(error)
return ret0, ret1, ret2
} }
func (_mr *_MockLogPublisherProviderRecorder) Publisher(arg0, arg1 interface{}) *gomock.Call { func (_mr *_MockLogPublisherProviderRecorder) Publisher(arg0, arg1 interface{}) *gomock.Call {

View File

@ -59,6 +59,8 @@ type IssueNodeCertificateRequest struct {
// Token represents a user-provided string that is necessary for new // Token represents a user-provided string that is necessary for new
// nodes to join the cluster // nodes to join the cluster
Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
// Availability allows a user to control the current scheduling status of a node
Availability NodeSpec_Availability `protobuf:"varint,4,opt,name=availability,proto3,enum=docker.swarmkit.v1.NodeSpec_Availability" json:"availability,omitempty"`
} }
func (m *IssueNodeCertificateRequest) Reset() { *m = IssueNodeCertificateRequest{} } func (m *IssueNodeCertificateRequest) Reset() { *m = IssueNodeCertificateRequest{} }
@ -194,9 +196,10 @@ func (m *IssueNodeCertificateRequest) Copy() *IssueNodeCertificateRequest {
} }
o := &IssueNodeCertificateRequest{ o := &IssueNodeCertificateRequest{
Role: m.Role, Role: m.Role,
CSR: m.CSR, CSR: m.CSR,
Token: m.Token, Token: m.Token,
Availability: m.Availability,
} }
return o return o
@ -289,11 +292,12 @@ func (this *IssueNodeCertificateRequest) GoString() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
s := make([]string, 0, 7) s := make([]string, 0, 8)
s = append(s, "&api.IssueNodeCertificateRequest{") s = append(s, "&api.IssueNodeCertificateRequest{")
s = append(s, "Role: "+fmt.Sprintf("%#v", this.Role)+",\n") s = append(s, "Role: "+fmt.Sprintf("%#v", this.Role)+",\n")
s = append(s, "CSR: "+fmt.Sprintf("%#v", this.CSR)+",\n") s = append(s, "CSR: "+fmt.Sprintf("%#v", this.CSR)+",\n")
s = append(s, "Token: "+fmt.Sprintf("%#v", this.Token)+",\n") s = append(s, "Token: "+fmt.Sprintf("%#v", this.Token)+",\n")
s = append(s, "Availability: "+fmt.Sprintf("%#v", this.Availability)+",\n")
s = append(s, "}") s = append(s, "}")
return strings.Join(s, "") return strings.Join(s, "")
} }
@ -674,6 +678,11 @@ func (m *IssueNodeCertificateRequest) MarshalTo(data []byte) (int, error) {
i = encodeVarintCa(data, i, uint64(len(m.Token))) i = encodeVarintCa(data, i, uint64(len(m.Token)))
i += copy(data[i:], m.Token) i += copy(data[i:], m.Token)
} }
if m.Availability != 0 {
data[i] = 0x20
i++
i = encodeVarintCa(data, i, uint64(m.Availability))
}
return i, nil return i, nil
} }
@ -1120,6 +1129,9 @@ func (m *IssueNodeCertificateRequest) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovCa(uint64(l)) n += 1 + l + sovCa(uint64(l))
} }
if m.Availability != 0 {
n += 1 + sovCa(uint64(m.Availability))
}
return n return n
} }
@ -1212,6 +1224,7 @@ func (this *IssueNodeCertificateRequest) String() string {
`Role:` + fmt.Sprintf("%v", this.Role) + `,`, `Role:` + fmt.Sprintf("%v", this.Role) + `,`,
`CSR:` + fmt.Sprintf("%v", this.CSR) + `,`, `CSR:` + fmt.Sprintf("%v", this.CSR) + `,`,
`Token:` + fmt.Sprintf("%v", this.Token) + `,`, `Token:` + fmt.Sprintf("%v", this.Token) + `,`,
`Availability:` + fmt.Sprintf("%v", this.Availability) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -1577,6 +1590,25 @@ func (m *IssueNodeCertificateRequest) Unmarshal(data []byte) error {
} }
m.Token = string(data[iNdEx:postIndex]) m.Token = string(data[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Availability", wireType)
}
m.Availability = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCa
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
m.Availability |= (NodeSpec_Availability(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipCa(data[iNdEx:]) skippy, err := skipCa(data[iNdEx:])
@ -2096,42 +2128,44 @@ var (
func init() { proto.RegisterFile("ca.proto", fileDescriptorCa) } func init() { proto.RegisterFile("ca.proto", fileDescriptorCa) }
var fileDescriptorCa = []byte{ var fileDescriptorCa = []byte{
// 586 bytes of a gzipped FileDescriptorProto // 615 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x54, 0xcb, 0x6e, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xd3, 0x4c,
0x14, 0xcd, 0x38, 0x25, 0x69, 0x6f, 0x42, 0x8a, 0xa6, 0x89, 0x14, 0xf2, 0x70, 0x2a, 0xb3, 0x68, 0x14, 0xed, 0xb8, 0xfd, 0xd2, 0xf6, 0x26, 0x5f, 0x8b, 0xa6, 0xad, 0x14, 0xd2, 0xd4, 0xa9, 0xcc,
0x37, 0x38, 0x6d, 0x60, 0x05, 0x1b, 0x92, 0x20, 0x55, 0x11, 0x02, 0x21, 0x47, 0xb0, 0xad, 0x5c, 0xa2, 0x65, 0x81, 0xd3, 0x06, 0x56, 0xb0, 0x21, 0x09, 0x52, 0x15, 0xa1, 0x22, 0x34, 0x11, 0x6c,
0x67, 0x08, 0x56, 0x12, 0x8f, 0xf1, 0x8c, 0x0b, 0xd9, 0x21, 0x51, 0xf1, 0x07, 0x08, 0x56, 0x7c, 0x2b, 0xc7, 0x19, 0x82, 0x15, 0xc7, 0x63, 0x3c, 0xe3, 0x40, 0x76, 0x48, 0x20, 0xde, 0x00, 0xc1,
0x02, 0xdf, 0x11, 0xb1, 0x62, 0xc9, 0x2a, 0x22, 0xfe, 0x00, 0xc4, 0x27, 0x20, 0x8f, 0x6d, 0x9a, 0x8a, 0x47, 0xe0, 0x39, 0x22, 0x56, 0x48, 0x6c, 0x58, 0x45, 0xc4, 0x0f, 0x80, 0x78, 0x04, 0xe4,
0x87, 0x13, 0xda, 0x55, 0x3c, 0x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x56, 0x2c, 0xf9, 0x2b,
0xcc, 0xe4, 0xc4, 0xcf, 0x99, 0x9c, 0xf8, 0x33, 0x93, 0xd1, 0x7b, 0x4f, 0x46, 0x13, 0x4f, 0x46, 0xd3, 0xad, 0x58, 0x36, 0xf0, 0x13, 0x56, 0xbc, 0x43, 0xb0, 0x97, 0xfa, 0x24, 0xe1, 0x93, 0x45,
0x3f, 0x3c, 0x19, 0xfd, 0xf2, 0x64, 0x74, 0x96, 0x12, 0xd7, 0xe6, 0xbd, 0xbf, 0x01, 0x00, 0x00, 0x63, 0xbd, 0xe8, 0x0d, 0x2c, 0x9c, 0xfe, 0x03, 0x63, 0xb6, 0x90, 0x5a, 0x71, 0x38, 0x56, 0x57,
0xff, 0xff, 0xe7, 0x80, 0x3b, 0x00, 0x9b, 0x05, 0x00, 0x00, 0xbe, 0x8f, 0xd5, 0x95, 0x5f, 0x63, 0x15, 0xbd, 0x0e, 0x54, 0x34, 0x0c, 0x54, 0xf4, 0x35, 0x50,
0xd1, 0x8f, 0x40, 0x45, 0xad, 0x8c, 0x7c, 0x85, 0x6f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xcf,
0xc4, 0x68, 0xc2, 0xea, 0x05, 0x00, 0x00,
} }

View File

@ -48,6 +48,9 @@ message IssueNodeCertificateRequest {
// Token represents a user-provided string that is necessary for new // Token represents a user-provided string that is necessary for new
// nodes to join the cluster // nodes to join the cluster
string token = 3; string token = 3;
// Availability allows a user to control the current scheduling status of a node
NodeSpec.Availability availability = 4;
} }
message IssueNodeCertificateResponse { message IssueNodeCertificateResponse {

View File

@ -254,15 +254,8 @@ type Secret struct {
// Spec contains the actual secret data, as well as any context around the // Spec contains the actual secret data, as well as any context around the
// secret data that the user provides. // secret data that the user provides.
Spec SecretSpec `protobuf:"bytes,3,opt,name=spec" json:"spec"` Spec SecretSpec `protobuf:"bytes,3,opt,name=spec" json:"spec"`
// Digest represents the cryptographic digest of the secret data, and follows
// the form "<algorithm>:<digest>": for example "sha256:DEADBEEF...". It
// is calculated from the data contained in `Secret.Spec.data`.
Digest string `protobuf:"bytes,4,opt,name=digest,proto3" json:"digest,omitempty"`
// SecretSize represents the size (number of bytes) of the secret data, and is
// calculated from the data contained in `Secret.Spec.data`.
SecretSize int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"`
// Whether the secret is an internal secret (not set by a user) or not. // Whether the secret is an internal secret (not set by a user) or not.
Internal bool `protobuf:"varint,6,opt,name=internal,proto3" json:"internal,omitempty"` Internal bool `protobuf:"varint,4,opt,name=internal,proto3" json:"internal,omitempty"`
} }
func (m *Secret) Reset() { *m = Secret{} } func (m *Secret) Reset() { *m = Secret{} }
@ -482,12 +475,10 @@ func (m *Secret) Copy() *Secret {
} }
o := &Secret{ o := &Secret{
ID: m.ID, ID: m.ID,
Meta: *m.Meta.Copy(), Meta: *m.Meta.Copy(),
Spec: *m.Spec.Copy(), Spec: *m.Spec.Copy(),
Digest: m.Digest, Internal: m.Internal,
SecretSize: m.SecretSize,
Internal: m.Internal,
} }
return o return o
@ -679,13 +670,11 @@ func (this *Secret) GoString() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
s := make([]string, 0, 10) s := make([]string, 0, 8)
s = append(s, "&api.Secret{") s = append(s, "&api.Secret{")
s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n") s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n")
s = append(s, "Meta: "+strings.Replace(this.Meta.GoString(), `&`, ``, 1)+",\n") s = append(s, "Meta: "+strings.Replace(this.Meta.GoString(), `&`, ``, 1)+",\n")
s = append(s, "Spec: "+strings.Replace(this.Spec.GoString(), `&`, ``, 1)+",\n") s = append(s, "Spec: "+strings.Replace(this.Spec.GoString(), `&`, ``, 1)+",\n")
s = append(s, "Digest: "+fmt.Sprintf("%#v", this.Digest)+",\n")
s = append(s, "SecretSize: "+fmt.Sprintf("%#v", this.SecretSize)+",\n")
s = append(s, "Internal: "+fmt.Sprintf("%#v", this.Internal)+",\n") s = append(s, "Internal: "+fmt.Sprintf("%#v", this.Internal)+",\n")
s = append(s, "}") s = append(s, "}")
return strings.Join(s, "") return strings.Join(s, "")
@ -1378,19 +1367,8 @@ func (m *Secret) MarshalTo(data []byte) (int, error) {
return 0, err return 0, err
} }
i += n34 i += n34
if len(m.Digest) > 0 {
data[i] = 0x22
i++
i = encodeVarintObjects(data, i, uint64(len(m.Digest)))
i += copy(data[i:], m.Digest)
}
if m.SecretSize != 0 {
data[i] = 0x28
i++
i = encodeVarintObjects(data, i, uint64(m.SecretSize))
}
if m.Internal { if m.Internal {
data[i] = 0x30 data[i] = 0x20
i++ i++
if m.Internal { if m.Internal {
data[i] = 1 data[i] = 1
@ -1685,13 +1663,6 @@ func (m *Secret) Size() (n int) {
n += 1 + l + sovObjects(uint64(l)) n += 1 + l + sovObjects(uint64(l))
l = m.Spec.Size() l = m.Spec.Size()
n += 1 + l + sovObjects(uint64(l)) n += 1 + l + sovObjects(uint64(l))
l = len(m.Digest)
if l > 0 {
n += 1 + l + sovObjects(uint64(l))
}
if m.SecretSize != 0 {
n += 1 + sovObjects(uint64(m.SecretSize))
}
if m.Internal { if m.Internal {
n += 2 n += 2
} }
@ -1861,8 +1832,6 @@ func (this *Secret) String() string {
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`,
`Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "SecretSpec", "SecretSpec", 1), `&`, ``, 1) + `,`, `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "SecretSpec", "SecretSpec", 1), `&`, ``, 1) + `,`,
`Digest:` + fmt.Sprintf("%v", this.Digest) + `,`,
`SecretSize:` + fmt.Sprintf("%v", this.SecretSize) + `,`,
`Internal:` + fmt.Sprintf("%v", this.Internal) + `,`, `Internal:` + fmt.Sprintf("%v", this.Internal) + `,`,
`}`, `}`,
}, "") }, "")
@ -4069,54 +4038,6 @@ func (m *Secret) Unmarshal(data []byte) error {
} }
iNdEx = postIndex iNdEx = postIndex
case 4: case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Digest", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObjects
}
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 ErrInvalidLengthObjects
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Digest = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field SecretSize", wireType)
}
m.SecretSize = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObjects
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
m.SecretSize |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 6:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Internal", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Internal", wireType)
} }
@ -4265,80 +4186,78 @@ var (
func init() { proto.RegisterFile("objects.proto", fileDescriptorObjects) } func init() { proto.RegisterFile("objects.proto", fileDescriptorObjects) }
var fileDescriptorObjects = []byte{ var fileDescriptorObjects = []byte{
// 1192 bytes of a gzipped FileDescriptorProto // 1161 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0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fd, 0xca, 0x5f, 0xa7,
0x9b, 0x97, 0x82, 0x55, 0x88, 0x9e, 0x51, 0xac, 0xd7, 0xd0, 0x36, 0xd4, 0xa2, 0x44, 0x52, 0x9e, 0xf5, 0x2b, 0xff, 0x9e, 0xd6, 0xad, 0x1f, 0x96, 0x75, 0xeb, 0x64, 0x59, 0xb7, 0xfe, 0x58, 0xd6,
0x90, 0x58, 0x5b, 0xa5, 0x86, 0x97, 0xf3, 0xde, 0xce, 0xf3, 0x17, 0xcd, 0x0b, 0x7f, 0xbe, 0x68, 0xad, 0xbf, 0x97, 0x75, 0xeb, 0xb8, 0xa0, 0xff, 0x02, 0x7d, 0xf8, 0x5f, 0x00, 0x00, 0x00, 0xff,
0x5e, 0xf8, 0xf7, 0x45, 0xd3, 0xf9, 0x61, 0xd1, 0x74, 0x9e, 0x2f, 0x9a, 0xce, 0xef, 0x8b, 0xa6, 0xff, 0x38, 0xf8, 0x23, 0xac, 0x72, 0x0d, 0x00, 0x00,
0xf3, 0xd7, 0xa2, 0xe9, 0x1c, 0x56, 0xf4, 0xdf, 0xa7, 0x0f, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff,
0x49, 0x8f, 0xcd, 0x22, 0xae, 0x0d, 0x00, 0x00,
} }

View File

@ -252,15 +252,6 @@ message Secret {
// secret data that the user provides. // secret data that the user provides.
SecretSpec spec = 3 [(gogoproto.nullable) = false]; SecretSpec spec = 3 [(gogoproto.nullable) = false];
// Digest represents the cryptographic digest of the secret data, and follows
// the form "<algorithm>:<digest>": for example "sha256:DEADBEEF...". It
// is calculated from the data contained in `Secret.Spec.data`.
string digest = 4;
// SecretSize represents the size (number of bytes) of the secret data, and is
// calculated from the data contained in `Secret.Spec.data`.
int64 size = 5 [(gogoproto.customname) = "SecretSize"];
// Whether the secret is an internal secret (not set by a user) or not. // Whether the secret is an internal secret (not set by a user) or not.
bool internal = 6; bool internal = 4;
} }

View File

@ -568,7 +568,7 @@ func GetRemoteSignedCertificate(ctx context.Context, csr []byte, rootCAPool *x50
caClient := api.NewNodeCAClient(conn) caClient := api.NewNodeCAClient(conn)
// Send the Request and retrieve the request token // Send the Request and retrieve the request token
issueRequest := &api.IssueNodeCertificateRequest{CSR: csr, Token: config.Token} issueRequest := &api.IssueNodeCertificateRequest{CSR: csr, Token: config.Token, Availability: config.Availability}
issueResponse, err := caClient.IssueNodeCertificate(ctx, issueRequest) issueResponse, err := caClient.IssueNodeCertificate(ctx, issueRequest)
if err != nil { if err != nil {
config.Remotes.Observe(peer, -remotes.DefaultObservationWeight) config.Remotes.Observe(peer, -remotes.DefaultObservationWeight)

View File

@ -311,6 +311,8 @@ func LoadSecurityConfig(ctx context.Context, rootCA RootCA, krw *KeyReadWriter)
type CertificateRequestConfig struct { type CertificateRequestConfig struct {
// Token is the join token that authenticates us with the CA. // Token is the join token that authenticates us with the CA.
Token string Token string
// Availability allows a user to control the current scheduling status of a node
Availability api.NodeSpec_Availability
// Remotes is the set of remote CAs. // Remotes is the set of remote CAs.
Remotes remotes.Remotes Remotes remotes.Remotes
// Credentials provides transport credentials for communicating with the // Credentials provides transport credentials for communicating with the

View File

@ -260,8 +260,9 @@ func (s *Server) IssueNodeCertificate(ctx context.Context, request *api.IssueNod
}, },
}, },
Spec: api.NodeSpec{ Spec: api.NodeSpec{
Role: role, Role: role,
Membership: api.NodeMembershipAccepted, Membership: api.NodeMembershipAccepted,
Availability: request.Availability,
}, },
} }

View File

@ -6,7 +6,6 @@ import (
"strings" "strings"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/distribution/digest"
"github.com/docker/swarmkit/api" "github.com/docker/swarmkit/api"
"github.com/docker/swarmkit/identity" "github.com/docker/swarmkit/identity"
"github.com/docker/swarmkit/log" "github.com/docker/swarmkit/log"
@ -26,10 +25,8 @@ var validSecretNameRegexp = regexp.MustCompile(`^[a-zA-Z0-9]+(?:[a-zA-Z0-9-_.]*[
// assumes spec is not nil // assumes spec is not nil
func secretFromSecretSpec(spec *api.SecretSpec) *api.Secret { func secretFromSecretSpec(spec *api.SecretSpec) *api.Secret {
return &api.Secret{ return &api.Secret{
ID: identity.NewID(), ID: identity.NewID(),
Spec: *spec, Spec: *spec,
SecretSize: int64(len(spec.Data)),
Digest: digest.FromBytes(spec.Data).String(),
} }
} }

View File

@ -99,6 +99,9 @@ type Config struct {
// bootstrapping a cluster for the first time (it's a cluster-wide setting), // bootstrapping a cluster for the first time (it's a cluster-wide setting),
// and also when loading up any raft data on disk (as a KEK for the raft DEK). // and also when loading up any raft data on disk (as a KEK for the raft DEK).
UnlockKey []byte UnlockKey []byte
// Availability allows a user to control the current scheduling status of a node
Availability api.NodeSpec_Availability
} }
// Manager is the cluster manager for Swarm. // Manager is the cluster manager for Swarm.
@ -745,7 +748,7 @@ func (m *Manager) becomeLeader(ctx context.Context) {
rootCA)) rootCA))
// Add Node entry for ourself, if one // Add Node entry for ourself, if one
// doesn't exist already. // doesn't exist already.
store.CreateNode(tx, managerNode(nodeID)) store.CreateNode(tx, managerNode(nodeID, m.config.Availability))
return nil return nil
}) })
@ -909,7 +912,7 @@ func defaultClusterObject(
} }
// managerNode creates a new node with NodeRoleManager role. // managerNode creates a new node with NodeRoleManager role.
func managerNode(nodeID string) *api.Node { func managerNode(nodeID string, availability api.NodeSpec_Availability) *api.Node {
return &api.Node{ return &api.Node{
ID: nodeID, ID: nodeID,
Certificate: api.Certificate{ Certificate: api.Certificate{
@ -920,8 +923,9 @@ func managerNode(nodeID string) *api.Node {
}, },
}, },
Spec: api.NodeSpec{ Spec: api.NodeSpec{
Role: api.NodeRoleManager, Role: api.NodeRoleManager,
Membership: api.NodeMembershipAccepted, Membership: api.NodeMembershipAccepted,
Availability: availability,
}, },
} }
} }

View File

@ -41,12 +41,8 @@ var (
ErrConfChangeRefused = errors.New("raft: propose configuration change refused") ErrConfChangeRefused = errors.New("raft: propose configuration change refused")
// ErrApplyNotSpecified is returned during the creation of a raft node when no apply method was provided // ErrApplyNotSpecified is returned during the creation of a raft node when no apply method was provided
ErrApplyNotSpecified = errors.New("raft: apply method was not specified") ErrApplyNotSpecified = errors.New("raft: apply method was not specified")
// ErrAppendEntry is thrown when the node fail to append an entry to the logs
ErrAppendEntry = errors.New("raft: failed to append entry to logs")
// ErrSetHardState is returned when the node fails to set the hard state // ErrSetHardState is returned when the node fails to set the hard state
ErrSetHardState = errors.New("raft: failed to set the hard state for log append entry") ErrSetHardState = errors.New("raft: failed to set the hard state for log append entry")
// ErrApplySnapshot is returned when the node fails to apply a snapshot
ErrApplySnapshot = errors.New("raft: failed to apply snapshot on raft node")
// ErrStopped is returned when an operation was submitted but the node was stopped in the meantime // ErrStopped is returned when an operation was submitted but the node was stopped in the meantime
ErrStopped = errors.New("raft: failed to process the request: node is stopped") ErrStopped = errors.New("raft: failed to process the request: node is stopped")
// ErrLostLeadership is returned when an operation was submitted but the node lost leader status before it became committed // ErrLostLeadership is returned when an operation was submitted but the node lost leader status before it became committed
@ -112,6 +108,7 @@ type Node struct {
confState raftpb.ConfState confState raftpb.ConfState
appliedIndex uint64 appliedIndex uint64
snapshotIndex uint64 snapshotIndex uint64
writtenIndex uint64
ticker clock.Ticker ticker clock.Ticker
doneCh chan struct{} doneCh chan struct{}
@ -133,10 +130,11 @@ type Node struct {
// to stop. // to stop.
stopped chan struct{} stopped chan struct{}
lastSendToMember map[uint64]chan struct{} lastSendToMember map[uint64]chan struct{}
raftLogger *storage.EncryptedRaftLogger raftLogger *storage.EncryptedRaftLogger
keyRotator EncryptionKeyRotator keyRotator EncryptionKeyRotator
rotationQueued bool rotationQueued bool
waitForAppliedIndex uint64
} }
// NodeOptions provides node-level options. // NodeOptions provides node-level options.
@ -269,6 +267,7 @@ func (n *Node) JoinAndStart(ctx context.Context) (err error) {
n.confState = snapshot.Metadata.ConfState n.confState = snapshot.Metadata.ConfState
n.appliedIndex = snapshot.Metadata.Index n.appliedIndex = snapshot.Metadata.Index
n.snapshotIndex = snapshot.Metadata.Index n.snapshotIndex = snapshot.Metadata.Index
n.writtenIndex, _ = n.raftStore.LastIndex() // lastIndex always returns nil as an error
if loadAndStartErr == storage.ErrNoWAL { if loadAndStartErr == storage.ErrNoWAL {
if n.opts.JoinAddr != "" { if n.opts.JoinAddr != "" {
@ -471,9 +470,12 @@ func (n *Node) Run(ctx context.Context) error {
} }
} }
// in case the previous attempt to update the key failed
n.maybeMarkRotationFinished(ctx)
// Trigger a snapshot every once in awhile // Trigger a snapshot every once in awhile
if n.snapshotInProgress == nil && if n.snapshotInProgress == nil &&
(n.keyRotator.NeedsRotation() || raftConfig.SnapshotInterval > 0 && (n.needsSnapshot() || raftConfig.SnapshotInterval > 0 &&
n.appliedIndex-n.snapshotIndex >= raftConfig.SnapshotInterval) { n.appliedIndex-n.snapshotIndex >= raftConfig.SnapshotInterval) {
n.doSnapshot(ctx, raftConfig) n.doSnapshot(ctx, raftConfig)
} }
@ -510,13 +512,15 @@ func (n *Node) Run(ctx context.Context) error {
n.snapshotIndex = snapshotIndex n.snapshotIndex = snapshotIndex
} }
n.snapshotInProgress = nil n.snapshotInProgress = nil
if n.rotationQueued { n.maybeMarkRotationFinished(ctx)
if n.rotationQueued && n.needsSnapshot() {
// there was a key rotation that took place before while the snapshot // there was a key rotation that took place before while the snapshot
// was in progress - we have to take another snapshot and encrypt with the new key // was in progress - we have to take another snapshot and encrypt with the new key
n.rotationQueued = false
n.doSnapshot(ctx, n.getCurrentRaftConfig()) n.doSnapshot(ctx, n.getCurrentRaftConfig())
} }
case <-n.keyRotator.RotationNotify(): case <-n.keyRotator.RotationNotify():
// There are 2 separate checks: rotationQueued, and keyRotator.NeedsRotation(). // There are 2 separate checks: rotationQueued, and n.needsSnapshot().
// We set rotationQueued so that when we are notified of a rotation, we try to // We set rotationQueued so that when we are notified of a rotation, we try to
// do a snapshot as soon as possible. However, if there is an error while doing // do a snapshot as soon as possible. However, if there is an error while doing
// the snapshot, we don't want to hammer the node attempting to do snapshots over // the snapshot, we don't want to hammer the node attempting to do snapshots over
@ -525,7 +529,7 @@ func (n *Node) Run(ctx context.Context) error {
switch { switch {
case n.snapshotInProgress != nil: case n.snapshotInProgress != nil:
n.rotationQueued = true n.rotationQueued = true
case n.keyRotator.NeedsRotation(): case n.needsSnapshot():
n.doSnapshot(ctx, n.getCurrentRaftConfig()) n.doSnapshot(ctx, n.getCurrentRaftConfig())
} }
case <-n.removeRaftCh: case <-n.removeRaftCh:
@ -540,6 +544,35 @@ func (n *Node) Run(ctx context.Context) error {
} }
} }
func (n *Node) needsSnapshot() bool {
if n.waitForAppliedIndex == 0 && n.keyRotator.NeedsRotation() {
keys := n.keyRotator.GetKeys()
if keys.PendingDEK != nil {
n.raftLogger.RotateEncryptionKey(keys.PendingDEK)
// we want to wait for the last index written with the old DEK to be commited, else a snapshot taken
// may have an index less than the index of a WAL written with an old DEK. We want the next snapshot
// written with the new key to supercede any WAL written with an old DEK.
n.waitForAppliedIndex = n.writtenIndex
// if there is already a snapshot at this index, bump the index up one, because we want the next snapshot
if n.waitForAppliedIndex == n.snapshotIndex {
n.waitForAppliedIndex++
}
}
}
return n.waitForAppliedIndex > 0 && n.waitForAppliedIndex <= n.appliedIndex
}
func (n *Node) maybeMarkRotationFinished(ctx context.Context) {
if n.waitForAppliedIndex > 0 && n.waitForAppliedIndex <= n.snapshotIndex {
// this means we tried to rotate - so finish the rotation
if err := n.keyRotator.UpdateKeys(EncryptionKeys{CurrentDEK: n.raftLogger.EncryptionKey}); err != nil {
log.G(ctx).WithError(err).Error("failed to update encryption keys after a successful rotation")
} else {
n.waitForAppliedIndex = 0
}
}
}
func (n *Node) getCurrentRaftConfig() api.RaftConfig { func (n *Node) getCurrentRaftConfig() api.RaftConfig {
raftConfig := DefaultRaftConfig() raftConfig := DefaultRaftConfig()
n.memoryStore.View(func(readTx store.ReadTx) { n.memoryStore.View(func(readTx store.ReadTx) {
@ -1174,24 +1207,31 @@ func (n *Node) saveToStorage(
if !raft.IsEmptySnap(snapshot) { if !raft.IsEmptySnap(snapshot) {
if err := n.raftLogger.SaveSnapshot(snapshot); err != nil { if err := n.raftLogger.SaveSnapshot(snapshot); err != nil {
return ErrApplySnapshot return errors.Wrap(err, "failed to save snapshot")
} }
if err := n.raftLogger.GC(snapshot.Metadata.Index, snapshot.Metadata.Term, raftConfig.KeepOldSnapshots); err != nil { if err := n.raftLogger.GC(snapshot.Metadata.Index, snapshot.Metadata.Term, raftConfig.KeepOldSnapshots); err != nil {
log.G(ctx).WithError(err).Error("unable to clean old snapshots and WALs") log.G(ctx).WithError(err).Error("unable to clean old snapshots and WALs")
} }
if err = n.raftStore.ApplySnapshot(snapshot); err != nil { if err = n.raftStore.ApplySnapshot(snapshot); err != nil {
return ErrApplySnapshot return errors.Wrap(err, "failed to apply snapshot on raft node")
} }
} }
if err := n.raftLogger.SaveEntries(hardState, entries); err != nil { if err := n.raftLogger.SaveEntries(hardState, entries); err != nil {
// TODO(aaronl): These error types should really wrap more // TODO(aaronl): These error types should really wrap more
// detailed errors. // detailed errors.
return ErrApplySnapshot return errors.Wrap(err, "failed to save raft log entries")
}
if len(entries) > 0 {
lastIndex := entries[len(entries)-1].Index
if lastIndex > n.writtenIndex {
n.writtenIndex = lastIndex
}
} }
if err = n.raftStore.Append(entries); err != nil { if err = n.raftStore.Append(entries); err != nil {
return ErrAppendEntry return errors.Wrap(err, "failed to append raft log entries")
} }
return nil return nil

View File

@ -165,17 +165,6 @@ func (n *Node) doSnapshot(ctx context.Context, raftConfig api.RaftConfig) {
} }
snapshot.Membership.Removed = n.cluster.Removed() snapshot.Membership.Removed = n.cluster.Removed()
// maybe start rotation
n.rotationQueued = false
var newEncryptionKeys *EncryptionKeys
if n.keyRotator.NeedsRotation() {
keys := n.keyRotator.GetKeys()
if keys.PendingDEK != nil {
n.raftLogger.RotateEncryptionKey(keys.PendingDEK)
newEncryptionKeys = &EncryptionKeys{CurrentDEK: keys.PendingDEK}
}
}
viewStarted := make(chan struct{}) viewStarted := make(chan struct{})
n.asyncTasks.Add(1) n.asyncTasks.Add(1)
n.snapshotInProgress = make(chan uint64, 1) // buffered in case Shutdown is called during the snapshot n.snapshotInProgress = make(chan uint64, 1) // buffered in case Shutdown is called during the snapshot
@ -209,13 +198,6 @@ func (n *Node) doSnapshot(ctx context.Context, raftConfig api.RaftConfig) {
return return
} }
snapshotIndex = appliedIndex snapshotIndex = appliedIndex
if newEncryptionKeys != nil {
// this means we tried to rotate - so finish the rotation
if err := n.keyRotator.UpdateKeys(*newEncryptionKeys); err != nil {
log.G(ctx).WithError(err).Error(
"failed to update encryption keys after a rotation - will wait for the next snapshot")
}
}
if appliedIndex > raftConfig.LogEntriesForSlowFollowers { if appliedIndex > raftConfig.LogEntriesForSlowFollowers {
err := n.raftStore.Compact(appliedIndex - raftConfig.LogEntriesForSlowFollowers) err := n.raftStore.Compact(appliedIndex - raftConfig.LogEntriesForSlowFollowers)

View File

@ -94,6 +94,9 @@ type Config struct {
// UnlockKey is the key to unlock a node - used for decrypting at rest. This // UnlockKey is the key to unlock a node - used for decrypting at rest. This
// only applies to nodes that have already joined a cluster. // only applies to nodes that have already joined a cluster.
UnlockKey []byte UnlockKey []byte
// Availability allows a user to control the current scheduling status of a node
Availability api.NodeSpec_Availability
} }
// Node implements the primary node functionality for a member of a swarm // Node implements the primary node functionality for a member of a swarm
@ -540,8 +543,9 @@ func (n *Node) loadSecurityConfig(ctx context.Context) (*ca.SecurityConfig, erro
log.G(ctx).WithError(err).Debugf("no node credentials found in: %s", krw.Target()) log.G(ctx).WithError(err).Debugf("no node credentials found in: %s", krw.Target())
securityConfig, err = rootCA.CreateSecurityConfig(ctx, krw, ca.CertificateRequestConfig{ securityConfig, err = rootCA.CreateSecurityConfig(ctx, krw, ca.CertificateRequestConfig{
Token: n.config.JoinToken, Token: n.config.JoinToken,
Remotes: n.remotes, Availability: n.config.Availability,
Remotes: n.remotes,
}) })
if err != nil { if err != nil {
@ -643,6 +647,7 @@ func (n *Node) runManager(ctx context.Context, securityConfig *ca.SecurityConfig
ElectionTick: n.config.ElectionTick, ElectionTick: n.config.ElectionTick,
AutoLockManagers: n.config.AutoLockManagers, AutoLockManagers: n.config.AutoLockManagers,
UnlockKey: n.unlockKey, UnlockKey: n.unlockKey,
Availability: n.config.Availability,
}) })
if err != nil { if err != nil {
return err return err