Skip to content

Commit

Permalink
chore(qrm): NetworkManager add run interface
Browse files Browse the repository at this point in the history
  • Loading branch information
luomingmeng committed Feb 11, 2025
1 parent d3ee958 commit 22012fb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/metaserver/external/manager_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (m *externalManagerImpl) Run(ctx context.Context) {
m.start = true

go m.CgroupIDManager.Run(ctx)
go m.NetworkManager.Run(ctx)

m.mutex.Unlock()
<-ctx.Done()
Expand Down
5 changes: 5 additions & 0 deletions pkg/util/external/network/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package network

import (
"context"
"sync"

"github.com/kubewharf/katalyst-core/pkg/util/cgroup/common"
Expand All @@ -33,6 +34,8 @@ type NetworkManager interface {
ClearNetClass(cgroupID uint64) error
// ApplyNetworkGroups apply parameters for network groups.
ApplyNetworkGroups(map[string]*qrmgeneral.NetworkGroup) error
// Run runs the network manager.
Run(ctx context.Context)
}

type NetworkManagerStub struct {
Expand Down Expand Up @@ -81,3 +84,5 @@ func (n *NetworkManagerStub) ClearNetClass(cgroupID uint64) error {
func (n *NetworkManagerStub) ApplyNetworkGroups(map[string]*qrmgeneral.NetworkGroup) error {
return nil
}

func (n *NetworkManagerStub) Run(ctx context.Context) {}
5 changes: 4 additions & 1 deletion pkg/util/external/network/manager_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ limitations under the License.
package network

import (
"context"
"errors"

"github.com/kubewharf/katalyst-core/pkg/util/cgroup/common"
Expand All @@ -40,7 +41,7 @@ func (*defaultNetworkManager) ApplyNetClass(podUID, containerId string, data *co
}

// ListNetClass lists the net class config for all containers managed by kubernetes.
func (m *defaultNetworkManager) ListNetClass() ([]*common.NetClsData, error) {
func (n *defaultNetworkManager) ListNetClass() ([]*common.NetClsData, error) {
// TODO: implement traffic tagging by using eBPF
return nil, errors.New("not implemented yet")
}
Expand All @@ -55,3 +56,5 @@ func (*defaultNetworkManager) ClearNetClass(cgroupID uint64) error {
func (n *defaultNetworkManager) ApplyNetworkGroups(map[string]*qrmgeneral.NetworkGroup) error {
return nil
}

func (n *defaultNetworkManager) Run(ctx context.Context) {}
4 changes: 4 additions & 0 deletions pkg/util/external/network/manager_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ limitations under the License.
package network

import (
"context"

"github.com/kubewharf/katalyst-core/pkg/util/cgroup/common"
)

Expand All @@ -44,3 +46,5 @@ func (*unsupportedNetworkManager) ListNetClass() ([]*common.NetClsData, error) {
func (*unsupportedNetworkManager) ClearNetClass(cgroupID uint64) error {
return nil
}

func (*unsupportedNetworkManager) Run(ctx context.Context) {}

0 comments on commit 22012fb

Please sign in to comment.