-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: observe cnr numa exclusive anomaly metric
Signed-off-by: zhy76 <958474674@qq.com>
- Loading branch information
Showing
15 changed files
with
690 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package controller | ||
|
||
import ( | ||
"context" | ||
|
||
"k8s.io/klog/v2" | ||
|
||
katalystbase "github.com/kubewharf/katalyst-core/cmd/base" | ||
"github.com/kubewharf/katalyst-core/pkg/config" | ||
"github.com/kubewharf/katalyst-core/pkg/controller/cnr" | ||
) | ||
|
||
const ( | ||
CNRControllerName = "cnr" | ||
) | ||
|
||
func StartCNRController(ctx context.Context, controlCtx *katalystbase.GenericContext, | ||
conf *config.Configuration, _ interface{}, _ string) (bool, error) { | ||
var ( | ||
cnrController *cnr.CNRController | ||
err error | ||
) | ||
|
||
if conf.CNRConfig.EnableCNR { | ||
cnrController, err = cnr.NewCNRController(ctx, | ||
conf.GenericConfiguration, | ||
conf.GenericControllerConfiguration, | ||
controlCtx.Client, | ||
controlCtx.KubeInformerFactory.Core().V1().Pods(), | ||
controlCtx.InternalInformerFactory.Node().V1alpha1().CustomNodeResources(), | ||
controlCtx.EmitterPool.GetDefaultMetricsEmitter(), | ||
) | ||
if err != nil { | ||
klog.Errorf("failed to new CNR controller") | ||
return false, err | ||
} | ||
} | ||
|
||
if cnrController != nil { | ||
go cnrController.Run() | ||
} | ||
|
||
return true, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package options | ||
|
||
import ( | ||
cliflag "k8s.io/component-base/cli/flag" | ||
|
||
"github.com/kubewharf/katalyst-core/pkg/config/controller" | ||
) | ||
|
||
type CNROptions struct { | ||
// EnableCNR is a flag to enable CNR controller | ||
EnableCNR bool | ||
} | ||
|
||
func NewCNROptions() *CNROptions { | ||
return &CNROptions{ | ||
EnableCNR: true, | ||
} | ||
} | ||
|
||
// AddFlags adds flags to the specified FlagSet. | ||
func (o *CNROptions) AddFlags(fss *cliflag.NamedFlagSets) { | ||
fs := fss.FlagSet("cnr") | ||
|
||
fs.BoolVar(&o.EnableCNR, "cnr-enable", o.EnableCNR, | ||
"whether to enable the cnr controller") | ||
} | ||
|
||
// ApplyTo fills up config with options | ||
func (o *CNROptions) ApplyTo(c *controller.CNRConfig) error { | ||
c.EnableCNR = o.EnableCNR | ||
return nil | ||
} | ||
|
||
func (o *CNROptions) Config() (*controller.CNRConfig, error) { | ||
c := controller.NewCNRConfig() | ||
if err := o.ApplyTo(c); err != nil { | ||
return nil, err | ||
} | ||
return c, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
pkg/agent/qrm-plugins/cpu/dynamicpolicy/cpuadvisor/cpu.pb_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package controller | ||
|
||
type CNRConfig struct { | ||
// EnableCNR is a flag to enable CNR controller | ||
EnableCNR bool | ||
} | ||
|
||
func NewCNRConfig() *CNRConfig { | ||
return &CNRConfig{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.