From 23c0ac2eb39b5d5e6f75b950d9b306477d18c6e4 Mon Sep 17 00:00:00 2001 From: "longwenlu@gmail.com" Date: Tue, 22 Nov 2016 18:05:19 +0800 Subject: [PATCH 01/11] QCOS-0 FIX a typo --- kirksdk/account_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kirksdk/account_client.go b/kirksdk/account_client.go index 5548126..59496ac 100644 --- a/kirksdk/account_client.go +++ b/kirksdk/account_client.go @@ -190,7 +190,7 @@ func (p *accountClientImp) GetQcosClient(ctx context.Context, appURI string) (cl keyChan <- result }() - // Get qocos end point + // Get qcos end point go func() { var result endpointResult appInfos, err := p.ListApps(ctx) From 1bb8f9049f33ea03110e67f0f996263dc54d55d3 Mon Sep 17 00:00:00 2001 From: Yi Tao Date: Thu, 24 Nov 2016 19:09:27 +0800 Subject: [PATCH 02/11] QCOS-3141 add ap type outward_ip --- CHANGELOG.md | 1 + kirksdk/qcos_api.go | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df698e..9e41238 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # vNext +- 添加outward IP类型接入点 # Release 1.1.0 - AccountClient 相关 API 使用 appd V3 接口 diff --git a/kirksdk/qcos_api.go b/kirksdk/qcos_api.go index d960585..571c383 100644 --- a/kirksdk/qcos_api.go +++ b/kirksdk/qcos_api.go @@ -328,6 +328,7 @@ const ( ApTypePublicIPStr = "PUBLIC_IP" ApTypePrivateIPStr = "INTERNAL_IP" ApTypeDomainStr = "DOMAIN" + ApTypeOutwardIPStr = "OUTWARD_IP" ) type Status string From c093ba5cfc9ed77044a271a6e563df9b76fdb6f8 Mon Sep 17 00:00:00 2001 From: Yi Tao Date: Sun, 27 Nov 2016 02:52:00 +0800 Subject: [PATCH 03/11] QCOS-3192 add enable/disable AP port in SDK --- CHANGELOG.md | 2 ++ kirksdk/qcos_api.go | 17 +++++++++++++++++ kirksdk/qcos_client.go | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e41238..ae91c65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # vNext - 添加outward IP类型接入点 +- 添加禁用/启用AP端口的API,并在查看/搜索AP的API返回的端口信息中返回端口的启用状态(启用/禁用)。 + # Release 1.1.0 - AccountClient 相关 API 使用 appd V3 接口 diff --git a/kirksdk/qcos_api.go b/kirksdk/qcos_api.go index 571c383..01fb75c 100644 --- a/kirksdk/qcos_api.go +++ b/kirksdk/qcos_api.go @@ -228,6 +228,22 @@ type QcosClient interface { DeleteApPortRange( ctx context.Context, apid string, fromPort string, toPort string) (err error) + // POST /v3/aps///enable + EnableApPort( + ctx context.Context, apid string, port string) (err error) + + // POST /v3/aps///disable + DisableApPort( + ctx context.Context, apid string, port string) (err error) + + // POST /v3/aps//portrange///enable + EnableApPortRange( + ctx context.Context, apid string, fromPort string, toPort string) (err error) + + // POST /v3/aps//portrange///disable + DisableApPortRange( + ctx context.Context, apid string, fromPort string, toPort string) (err error) + // DELETE /v3/aps/ DeleteAp(ctx context.Context, apid string) (err error) @@ -584,6 +600,7 @@ type ApPortInfo struct { SessionTmoSec int `json:"sessionTimeoutSec"` ProxyOpts ApProxyOpts `json:"proxyOptions"` HealthCheckOpts ApHealthCheckOpts `json:"healthCheck"` + Enabled bool `json:"enabled"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Backends []struct { diff --git a/kirksdk/qcos_client.go b/kirksdk/qcos_client.go index f96fcc4..6c6eea3 100644 --- a/kirksdk/qcos_client.go +++ b/kirksdk/qcos_client.go @@ -1065,6 +1065,38 @@ func (p *qcosClientImp) DeleteApPortRange( return } +// POST /v3/aps///enable +func (p *qcosClientImp) EnableApPort( + ctx context.Context, apid string, port string) (err error) { + url := fmt.Sprintf("%s/v3/aps/%s/%s/enable", p.host, apid, port) + err = p.client.CallWithJson(ctx, nil, "POST", url, nil) + return +} + +// POST /v3/aps///disable +func (p *qcosClientImp) DisableApPort( + ctx context.Context, apid string, port string) (err error) { + url := fmt.Sprintf("%s/v3/aps/%s/%s/disable", p.host, apid, port) + err = p.client.CallWithJson(ctx, nil, "POST", url, nil) + return +} + +// POST /v3/aps//portrange///enable +func (p *qcosClientImp) EnableApPortRange( + ctx context.Context, apid string, fromPort string, toPort string) (err error) { + url := fmt.Sprintf("%s/v3/aps/%s/portrange/%s/%s/enable", p.host, apid, fromPort, toPort) + err = p.client.CallWithJson(ctx, nil, "POST", url, nil) + return +} + +// POST /v3/aps//portrange///disable +func (p *qcosClientImp) DisableApPortRange( + ctx context.Context, apid string, fromPort string, toPort string) (err error) { + url := fmt.Sprintf("%s/v3/aps/%s/portrange/%s/%s/disable", p.host, apid, fromPort, toPort) + err = p.client.CallWithJson(ctx, nil, "POST", url, nil) + return +} + // GET /v3/aps///healthcheck func (p *qcosClientImp) GetHealthcheck(ctx context.Context, apid string, port string) (ret map[string]string, err error) { url := fmt.Sprintf("%s/v3/aps/%s/%s/healthcheck", p.host, apid, port) From 3f6f691a5f3edc5b3cb1a92d6f03dfcd04ac5b1c Mon Sep 17 00:00:00 2001 From: Yi Tao Date: Fri, 2 Dec 2016 11:12:04 +0800 Subject: [PATCH 04/11] QCOS-3233 show ap ports related to service when inspect service --- CHANGELOG.md | 2 +- kirksdk/qcos_api.go | 14 ++++++++++++++ kirksdk/qcos_client_test.go | 24 +++++++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae91c65..4c2d304 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # vNext - 添加outward IP类型接入点 - 添加禁用/启用AP端口的API,并在查看/搜索AP的API返回的端口信息中返回端口的启用状态(启用/禁用)。 - +- 查看服务时,给出与该服务关联的AP端口信息。 # Release 1.1.0 - AccountClient 相关 API 使用 appd V3 接口 diff --git a/kirksdk/qcos_api.go b/kirksdk/qcos_api.go index 01fb75c..9915d64 100644 --- a/kirksdk/qcos_api.go +++ b/kirksdk/qcos_api.go @@ -404,6 +404,7 @@ type ServiceInfo struct { UpdatingProgress int `json:"updatingProgress"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` + ApPorts []ServiceApPort `json:"apPorts"` } type ServiceExportInfo struct { @@ -541,6 +542,19 @@ type StartContainerExecArgs struct { Mode string `json:"mode"` } +// AP ports related to a service. +type ServiceApPort struct { + ApID string `json:"apId"` + Type string `json:"type"` + IP string `json:"ip,omitempty"` + Domain string `json:"domain,omitempty"` + UserDomains []string `json:"userDomains,omitempty"` + FrontendPort string `json:"frontendPort"` + BackendPort string `json:"backendPort"` + Proto string `json:"proto"` + Enabled bool `json:"enabled"` +} + type CreateApArgs struct { Type string `json:"type"` Provider string `json:"provider"` diff --git a/kirksdk/qcos_client_test.go b/kirksdk/qcos_client_test.go index afbebba..f733264 100644 --- a/kirksdk/qcos_client_test.go +++ b/kirksdk/qcos_client_test.go @@ -248,6 +248,18 @@ func TestServicesInspect(t *testing.T) { Name: "v2", }, }, + ApPorts: []ServiceApPort{ + ServiceApPort{ + ApID: "1000001", + Type: "DOMAIN", + Domain: "abcd1234", + UserDomains: []string{"www.aa.com"}, + FrontendPort: "80", + BackendPort: "8080", + Proto: "HTTP", + Enabled: true, + }, + }, } ret := `{ "containerIps": [ @@ -350,7 +362,17 @@ func TestServicesInspect(t *testing.T) { "name": "v2", "unitType": "SSD1_16G" } - ] + ], + "apPorts": [{ + "apId": "1000001", + "type": "DOMAIN", + "domain": "abcd1234", + "userDomains": ["www.aa.com"], + "frontendPort": "80", + "backendPort": "8080", + "proto": "HTTP", + "enabled": true + }] }` ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, expectedUrl, r.URL.Path) From 29674d8c72fc78a68d14f47e1bb5206cac7f24f2 Mon Sep 17 00:00:00 2001 From: leiiwang Date: Fri, 2 Dec 2016 15:59:12 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E4=B8=BAindexd=E5=88=97=E4=B8=BEtag?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + kirksdk/index_api.go | 1 + kirksdk/index_client.go | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e06d86..73e8b9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # vNext - 为 Service 以及 Job 增加 Confs 域 - 增加 ConfigService 相关 V3 接口 +- 为indexd列举tag增加分页接口 # Release 1.1.0 - AccountClient 相关 API 使用 appd V3 接口 diff --git a/kirksdk/index_api.go b/kirksdk/index_api.go index 0d2f92a..fe210ec 100644 --- a/kirksdk/index_api.go +++ b/kirksdk/index_api.go @@ -14,6 +14,7 @@ type IndexAuthClient interface { type IndexClient interface { ListRepo(ctx context.Context, username string) (repos []*Repo, err error) ListRepoTags(ctx context.Context, username, repo string) (tags []*Tag, err error) + ListRepoTagsPage(ctx context.Context, username, repo string, start, size int) (tags []*Tag, err error) GetImageConfig(ctx context.Context, username, repo, reference string) (res *ImageConfig, err error) DeleteRepoTag(ctx context.Context, username, repo, reference string) error CreateTagFromRepo(ctx context.Context, username, repo, tag string, from *ImageSpec) (result *ImageSpec, err error) diff --git a/kirksdk/index_client.go b/kirksdk/index_client.go index 74cf247..6203fa6 100644 --- a/kirksdk/index_client.go +++ b/kirksdk/index_client.go @@ -47,6 +47,12 @@ func (p *indexClientImp) ListRepoTags(ctx context.Context, username, repo string return } +func (p *indexClientImp) ListRepoTagsPage(ctx context.Context, username, repo string, start, size int) (tags []*Tag, err error) { + err = p.client.Call(ctx, &tags, "GET", fmt.Sprintf("%s/api/%s/%s/tags?start=%d&size=%d", + p.host, username, repo, start, size)) + return +} + func (p *indexClientImp) GetImageConfig(ctx context.Context, username, repo, reference string) (res *ImageConfig, err error) { err = p.client.Call(ctx, &res, "GET", fmt.Sprintf("%s/api/%s/%s/repo/%s", p.host, username, repo, reference)) return From 9b5fddbb27b9fa84a387242fdac98a8f3292598a Mon Sep 17 00:00:00 2001 From: Qin Xiao Date: Fri, 2 Dec 2016 20:26:59 +0800 Subject: [PATCH 06/11] add CHANGELOG.md merge=union --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a19ade0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +CHANGELOG.md merge=union From bb597d1cbdacdbae1f50f2a19d4f556b7ad5fdaa Mon Sep 17 00:00:00 2001 From: leiiwang Date: Tue, 6 Dec 2016 11:14:00 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E4=B8=BAindexd=E5=88=97=E4=B8=BEtag?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2450069..2961f23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ - 添加outward IP类型接入点 - 添加禁用/启用AP端口的API,并在查看/搜索AP的API返回的端口信息中返回端口的启用状态(启用/禁用)。 - 查看服务时,给出与该服务关联的AP端口信息。 +- 为 Service 以及 Job 增加 Confs 域 +- 增加 ConfigService 相关 V3 接口 - 为indexd列举tag增加分页接口 # Release 1.1.0 From 4a5c6e2807e46c0a8a2d2f80aa4d554ba3058000 Mon Sep 17 00:00:00 2001 From: leiiwang Date: Tue, 6 Dec 2016 11:17:21 +0800 Subject: [PATCH 08/11] mod change log --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2961f23..28be0d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,6 @@ - 查看服务时,给出与该服务关联的AP端口信息。 - 为 Service 以及 Job 增加 Confs 域 - 增加 ConfigService 相关 V3 接口 -- 为indexd列举tag增加分页接口 # Release 1.1.0 - AccountClient 相关 API 使用 appd V3 接口 From 0a5d32b7c8b9dda8a8de45b8da490a2add29dd1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=AB=20H=C7=8Ei?= Date: Tue, 6 Dec 2016 14:09:54 +0800 Subject: [PATCH 09/11] QCOS-3248 add config-service delete api --- kirksdk/qcos_api.go | 3 +++ kirksdk/qcos_client.go | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/kirksdk/qcos_api.go b/kirksdk/qcos_api.go index 78ef6b2..ebf581b 100644 --- a/kirksdk/qcos_api.go +++ b/kirksdk/qcos_api.go @@ -330,6 +330,9 @@ type QcosClient interface { // POST /v3/configservices/ UpdateConfigServiceSpec(ctx context.Context, namespace string, args UpdateConfigServiceSpecArgs) (err error) + + // DELETE /v3/configservices/ + DeleteConfigServiceSpec(ctx context.Context, namespace string) (err error) } const ( diff --git a/kirksdk/qcos_client.go b/kirksdk/qcos_client.go index 6af3393..8514548 100644 --- a/kirksdk/qcos_client.go +++ b/kirksdk/qcos_client.go @@ -1312,6 +1312,13 @@ func (p *qcosClientImp) UpdateConfigServiceSpec(ctx context.Context, namespace s return } +// DELETE /v3/configservices/ +func (p *qcosClientImp) DeleteConfigServiceSpec(ctx context.Context, namespace string) (err error) { + url := fmt.Sprintf("%s/v3/configservices/%s", p.host, namespace) + err = p.client.Call(ctx, nil, "DELETE", url) + return +} + func (p *qcosClientImp) wait4StackRunning(stackName string, timeout time.Duration) (err error) { if stackName == "" { stackName = DefaultStack From ac6b9d8c8927ed62557a4426c10710d1b12cb704 Mon Sep 17 00:00:00 2001 From: leiiwang Date: Tue, 6 Dec 2016 16:08:22 +0800 Subject: [PATCH 10/11] QCOS-3242 add `created` for tag struct --- kirksdk/index_api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kirksdk/index_api.go b/kirksdk/index_api.go index 0d2f92a..4ea12e2 100644 --- a/kirksdk/index_api.go +++ b/kirksdk/index_api.go @@ -36,7 +36,8 @@ type Repo struct { } type Tag struct { - Name string `json:"name"` + Name string `json:"name"` + Created time.Time `json:"created"` } type ImageConfig struct { From b6ae5c579c0b1a862ca6e7ea7cd4f4ff779a68ef Mon Sep 17 00:00:00 2001 From: "longwenlu@gmail.com" Date: Tue, 6 Dec 2016 16:45:23 +0800 Subject: [PATCH 11/11] QCOS-0 Prepare for 1.2.0 release --- CHANGELOG.md | 4 +++- kirksdk/kirksdk.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28be0d2..e16ab97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ # vNext -- 添加outward IP类型接入点 + +# Release 1.2.0 - 添加禁用/启用AP端口的API,并在查看/搜索AP的API返回的端口信息中返回端口的启用状态(启用/禁用)。 - 查看服务时,给出与该服务关联的AP端口信息。 - 为 Service 以及 Job 增加 Confs 域 - 增加 ConfigService 相关 V3 接口 +- 为 index 列取tag 接口增加排序,分页和时间参数 # Release 1.1.0 - AccountClient 相关 API 使用 appd V3 接口 diff --git a/kirksdk/kirksdk.go b/kirksdk/kirksdk.go index c0f82bd..aaa479b 100644 --- a/kirksdk/kirksdk.go +++ b/kirksdk/kirksdk.go @@ -1,3 +1,3 @@ package kirksdk -const Version = "1.1.0" +const Version = "1.2.0"