Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

tls: use tls in list-member (#1045) #1050

Merged
merged 2 commits into from
Sep 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions dm/master/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1838,9 +1838,16 @@ func (s *Server) listMemberMaster(ctx context.Context, names []string) (*pb.Memb

etcdMembers := memberList.Members
masters := make([]*pb.MasterInfo, 0, len(etcdMembers))
client := http.Client{
Timeout: 1 * time.Second,

client := &http.Client{}
if len(s.cfg.SSLCA) != 0 {
inner, err := toolutils.ToTLSConfigWithVerify(s.cfg.SSLCA, s.cfg.SSLCert, s.cfg.SSLKey, s.cfg.CertAllowedCN)
if err != nil {
return resp, err
}
client = toolutils.ClientWithTLS(inner)
}
client.Timeout = 1 * time.Second

for _, etcdMember := range etcdMembers {
if !all && !set[etcdMember.Name] {
Expand Down
5 changes: 5 additions & 0 deletions tests/tls/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ function run() {
"\"result\": true" 2 \
"\"source\": \"$SOURCE_ID1\"" 1

echo "check master alive"
run_dm_ctl_with_tls $WORK_DIR "127.0.0.1:$MASTER_PORT" $cur/conf/ca.pem $cur/conf/dm.pem $cur/conf/dm.key \
"list-member" \
"\"alive\": true" 3

echo "start task and check stage"
run_dm_ctl_with_tls $WORK_DIR "127.0.0.1:$MASTER_PORT" $cur/conf/ca.pem $cur/conf/dm.pem $cur/conf/dm.key \
"start-task $WORK_DIR/dm-task.yaml" \
Expand Down