Skip to content

Commit

Permalink
chores: refactor some pkg dir names (koordinator-sh#43)
Browse files Browse the repository at this point in the history
Signed-off-by: 佑祎 <[email protected]>
  • Loading branch information
zwzhang0107 authored Oct 25, 2023
1 parent 2d18d35 commit 8e3b56e
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cmd/yarn-copilot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager/signals"

"github.com/koordinator-sh/goyarn/cmd/yarn-copilot/options"
"github.com/koordinator-sh/goyarn/pkg/yarn/copilot/nm"
"github.com/koordinator-sh/goyarn/pkg/yarn/copilot/server"
"github.com/koordinator-sh/goyarn/pkg/copilot/nm"
"github.com/koordinator-sh/goyarn/pkg/copilot/server"
)

func main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package noderesource
package metrics

import (
"github.com/prometheus/client_golang/prometheus"

"github.com/koordinator-sh/goyarn/pkg/yarn/cache"
)

const (
yarnNodeCPUResource = "yarn_node_cpu_resource"
yarnNodeMemoryResource = "yarn_node_memory_resource"
yarnNodeCPUAllocatedResource = "yarn_node_cpu_allocated_resource"
yarnNodeMemoryAllocatedResource = "yarn_node_memory_allocated_resource"
)

var (
yarnNodeCPUMetric = prometheus.NewDesc(
yarnNodeCPUResource,
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/noderesource/resource_sync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/metrics"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

yarnmetrics "github.com/koordinator-sh/goyarn/pkg/controller/metrics"
"github.com/koordinator-sh/goyarn/pkg/yarn/apis/proto/hadoopyarn"
yarnserver "github.com/koordinator-sh/goyarn/pkg/yarn/apis/proto/hadoopyarn/server"
"github.com/koordinator-sh/goyarn/pkg/yarn/cache"
Expand Down Expand Up @@ -192,7 +193,7 @@ func Add(mgr ctrl.Manager) error {
}
yarnNodesSyncer := cache.NewNodesSyncer(clients)
go yarnNodesSyncer.Sync()
coll := NewYarnMetricCollector(yarnNodesSyncer)
coll := yarnmetrics.NewYarnMetricCollector(yarnNodesSyncer)
if err = metrics.Registry.Register(coll); err != nil {
return err
}
Expand Down
7 changes: 0 additions & 7 deletions pkg/controller/noderesource/yarn_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ const (
nodeOriginAllocatableAnnotationKey = "node.koordinator.sh/originAllocatable"
)

const (
yarnNodeCPUResource = "yarn_node_cpu_resource"
yarnNodeMemoryResource = "yarn_node_memory_resource"
yarnNodeCPUAllocatedResource = "yarn_node_cpu_allocated_resource"
yarnNodeMemoryAllocatedResource = "yarn_node_memory_allocated_resource"
)

func calculate(batchCPU resource.Quantity, batchMemory resource.Quantity) (int64, int64) {
// TODO multiple ratio as buffer
return batchCPU.ScaledValue(resource.Kilo), batchMemory.ScaledValue(resource.Mega)
Expand Down
2 changes: 1 addition & 1 deletion pkg/yarn/copilot/nm/nm.go → pkg/copilot/nm/nm.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/koordinator-sh/koordinator/pkg/koordlet/util/system"
"k8s.io/klog/v2"

"github.com/koordinator-sh/goyarn/pkg/yarn/copilot/utils"
"github.com/koordinator-sh/goyarn/pkg/copilot/utils"
)

const (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"

"github.com/koordinator-sh/goyarn/pkg/yarn/copilot/nm"
"github.com/koordinator-sh/goyarn/pkg/copilot/nm"
)

func ParseContainerInfo(yarnContainer *nm.YarnContainer, op *nm.NodeMangerOperator) *ContainerInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"

"github.com/koordinator-sh/goyarn/pkg/yarn/copilot/nm"
"github.com/koordinator-sh/goyarn/pkg/copilot/nm"
)

type YarnCopilotServer struct {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8e3b56e

Please sign in to comment.