Skip to content

Commit

Permalink
fix: preheat tack id (dragonflyoss#1375)
Browse files Browse the repository at this point in the history
* fix: preheat with task id

Signed-off-by: Gaius <[email protected]>

* fix: add end time to seed piece

Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Jun 13, 2022
1 parent 60d78c6 commit 95c105a
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions client/daemon/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import (
var (
okHeader = []byte("HTTP/1.1 200 OK\r\n\r\n")

// represents proxy default biz value
bizTag = "d7y/proxy"
// Default biz value is empty.
bizTag = ""

schemaHTTPS = "https"

Expand Down
1 change: 1 addition & 0 deletions client/daemon/rpcserver/seeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,5 +318,6 @@ func (s *seedSynchronizer) compositePieceSeed(pp *base.PiecePacket, piece *base.
ContentLength: pp.ContentLength,
TotalPieceCount: pp.TotalPiece,
BeginTime: uint64(s.startNanoSecond),
EndTime: uint64(time.Now().UnixNano()),
}
}
4 changes: 2 additions & 2 deletions hack/gen-containerd-hosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# the register to pull image, like "docker.io", when pull image with "docker.io/library/alpine:latest"
registry=${1:-${REGISTRY}}

# the real server which serves image pulling, like "registry-1.docker.io"
# the real server which serves image pulling, like "index.docker.io"
# in normal case, registry_server is same with registry
registry_server=${REGISTRY_SERVER:-${registry}}

Expand All @@ -26,4 +26,4 @@ server = "https://${registry_server}"
capabilities = ["pull", "resolve"]
[host."${d7y_proxy}".header]
X-Dragonfly-Registry = ["https://${registry_server}"]
EOF
EOF
1 change: 0 additions & 1 deletion manager/job/preheat.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ func (p *preheat) parseLayers(resp *http.Response, url, tag, filter string, head
URL: layerURL(image.protocol, image.domain, image.name, digest),
Tag: tag,
Filter: filter,
Digest: digest,
Headers: httputils.HeaderToMap(header),
}

Expand Down
1 change: 0 additions & 1 deletion test/e2e/manager/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const (
managerService = "dragonfly-manager.dragonfly-system.svc"
managerPort = "8080"
preheatPath = "api/v1/jobs"
managerTag = "d7y/manager"

dragonflyNamespace = "dragonfly-system"
e2eNamespace = "dragonfly-e2e"
Expand Down
10 changes: 4 additions & 6 deletions test/e2e/manager/preheat.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ var _ = Describe("Preheat with manager", func() {
Args: types.PreheatArgs{
Type: "file",
URL: url,
Tag: managerTag,
},
})
Expect(err).NotTo(HaveOccurred())
Expand All @@ -80,7 +79,7 @@ var _ = Describe("Preheat with manager", func() {
Expect(done).Should(BeTrue())

// generate task_id, also the filename
seedPeerTaskID := idgen.TaskID(url, &base.UrlMeta{Tag: managerTag})
seedPeerTaskID := idgen.TaskID(url, &base.UrlMeta{})
fmt.Println(seedPeerTaskID)

sha256sum, err := checkPreheatResult(seedPeerPods, seedPeerTaskID)
Expand All @@ -90,13 +89,13 @@ var _ = Describe("Preheat with manager", func() {
})

It("preheat image should be ok", func() {
url := "https://registry-1.docker.io/v2/dragonflyoss/busybox/manifests/1.35.0"
url := "https://index.docker.io/v2/dragonflyoss/busybox/manifests/1.35.0"
fmt.Println("download image: " + url)

var (
seedPeerTaskIDs = []string{
"20ef8c24e608bbf6604e7b485037081f0a225dd585161c669ae727041bce3130",
"cfe7646d2c749e6e02ab7fec617c56e5fd11d2a1da0e1e39851cad27878064b6",
"b6922209dc9616f8736a860e93c3cd7288a4e801517f88eec3df514606d18cdf",
"c0dfae864ae65c285676063eb148d0a0064d5c6c39367fee0bcc1f3700c39c31",
}
sha256sum1 = []string{
"a711f05d33845e2e9deffcfcc5adf082d7c6e97e3e3a881d193d9aae38f092a8",
Expand All @@ -116,7 +115,6 @@ var _ = Describe("Preheat with manager", func() {
Args: types.PreheatArgs{
Type: "image",
URL: url,
Tag: managerTag,
},
})
Expect(err).NotTo(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/containerd/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ version = 2
restrict_oom_score_adj = false

# Mirrors use d7y.io instead of docker.io.
# when using docker.io to generate an endpoint, https://registry-1.docker.io will be returned by default.
# when using docker.io to generate an endpoint, https://index.docker.io will be returned by default.
# https://github.com/containerd/containerd/blob/main/pkg/cri/server/image_pull.go#L456
# https://github.com/containerd/containerd/blob/main/remotes/docker/resolver.go#L121
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."d7y.io"]
Expand Down

0 comments on commit 95c105a

Please sign in to comment.