Skip to content

Commit

Permalink
feat: Commit-Edge模式兼容独立集群模式 TencentBlueKing#2298
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoxuwan authored Jul 12, 2024
1 parent d606119 commit 6ef1065
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CommitEdgeCenterFsServiceImpl(
) {
override fun buildTNode(request: NodeCreateRequest): TNode {
val tNode = super.buildTNode(request)
tNode.clusterNames = setOf(SecurityUtils.getClusterName() ?: clusterProperties.self.name!!)
tNode.clusterNames = SecurityUtils.getClusterName()?.let { setOf(it) }
return tNode
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@

package com.tencent.bkrepo.repository.service.fs.impl.edge

import com.tencent.bkrepo.common.service.cluster.properties.ClusterProperties
import com.tencent.bkrepo.common.artifact.util.ClusterUtils.reportMetadataToCenter
import com.tencent.bkrepo.common.service.cluster.condition.CommitEdgeEdgeCondition
import com.tencent.bkrepo.common.service.cluster.properties.ClusterProperties
import com.tencent.bkrepo.common.service.feign.FeignClientFactory
import com.tencent.bkrepo.repository.api.cluster.ClusterFsNodeClient
import com.tencent.bkrepo.repository.dao.NodeDao
Expand All @@ -53,18 +54,28 @@ class EdgeFsServiceImpl(
by lazy { FeignClientFactory.create(clusterProperties.center, "repository", clusterProperties.self.name) }

override fun createNode(createRequest: NodeCreateRequest): NodeDetail {
centerNodeClient.createNode(createRequest)
return super.createNode(createRequest)
with(createRequest) {
if (reportMetadataToCenter(projectId, repoName)) {
centerNodeClient.createNode(this)
}
return super.createNode(this)
}
}

override fun setLength(setLengthRequest: NodeSetLengthRequest) {
centerNodeClient.setLength(setLengthRequest)
super.setLength(setLengthRequest)
with(setLengthRequest) {
if (reportMetadataToCenter(projectId, repoName)) {
centerNodeClient.setLength(this)
}
super.setLength(this)
}
}

override fun buildTNode(request: NodeCreateRequest): TNode {
val tNode = super.buildTNode(request)
tNode.clusterNames = setOf(clusterProperties.self.name!!)
if (reportMetadataToCenter(request.projectId, request.repoName)) {
tNode.clusterNames = setOf(clusterProperties.self.name!!)
}
return tNode
}
}

0 comments on commit 6ef1065

Please sign in to comment.