scheduler开发实战(三):带自定义配置文件版

如果文章对你有用,可以点赞、好评、转发
文章是在公司写的,代码都被加密了,也不能上传github,所以就不上传源代码了,按照文章内容一步一步就行。
建议全屏阅读,因为有些代码行比较长

我们先缕一下:

我们有一个KubeSchedulerConfiguration.yaml文件,这是scheduler的配置文件,决定了那些插件要开启等等,
然后KubeSchedulerConfiguration.yaml文件的profiles.pluginConfig.args字段用来给插件传递参数,
但是如果我们的程序需要非常多非常多的参数,都写在puginConfig.args这个字段里可能比较麻烦,
所以我们可以另起一个配置文件,把我们的插件程序所需要的参数都写里面,比如我们需要写大量的prometheus拉取规则,我们把拉取规则都写到配置文件里,我们可以把这个配置文件叫做Policy
然后在profiles.pluginConfig.args里把配置文件的路径传给我们的Dynamic插件,
然后在程序里我们手动去加载、解析这个配置文件,把他转换成我们自己定义的SchedulerPolicy对象

三:在第二版的基础上,带自定义配置文件版本

不再是由k8s自动加载,因为k8s根本就不知道,这里由我们手动加载我们自己的配置文件。流程和第二版一样,只是pair不同以及注册的scheme不同

X:修改NewDynamicScheduler函数,在函数里手动加载配置文件
X:新增loadDynamicSchedulerPolicyFromFile函数来从加载配置文件,并且把它转换成DynamicSchedulerPolicy对象
X:把所有版本的DynamicSchedulerPolicy的pair/defaulter/convert注册到k8s自带的scheme中
X:创建我们自定义的DynamicSchedulerPolicy结构体,流程和DynamicArgs一模一样,只是注册时pair所用的gv和注册的scheme不同
X:创建doc
X:创建types,必须,用来声明结构体
X:创建defaults,可选
X:创建register,必须,就是手动把pair(gvk,struct)到全新的scheme,并且根据整个scheme来创建编码解码器,我们可以用来手动加载配置文件

X:code-gen创建defaulter,可选,用来在初始化一个对象后对对象进行处理
X:code-gen创建deppcopy函数,必须,因为DynamicSchedulerPolicy必须实现runtime.Object接口
X:code-gen创建converter函数,必须,用于在不同的版本之间转换资源,可以用convertion-gen工具自动生成(如果有特殊需要可以删除对应的自动实现的函数,
并在同一个包下手动实现一份新的函数,推荐在另一个文件中实现,因为convertion-gen每次生成时都会清空旧文件

X:配置policy文件,并在KubeSchedulerConfiguration.yaml中profiles.plugConfig.args.PolicyConfigPath字段中配置policy文件的地址

下面我们就开始实现第三版调度器,由于创建DynamicSchedulerPolicy的流程和DynamicArgs的流程基本一样,所以许多地方就直接贴代码了,不懂的地方可以看代码注释

1:修改NewDynamicScheduler函数

import (
    ......
    config "pkg/apis/plugins/config
    ......
)
func NewDynamicScheduler(plArgs runtime.Object, h framework.Handle) (framework.Plugin, error) { //插件工厂函数,用来创建插件对象
  
   /*
     1:这个config是我们项目自己创建的包,不是k8s自带的config包
     只要我们的自定义对象DynamicArgs正确实现了types,正确实现了convert,正确regist到k8s内建的schme中,k8s系统就可以把kubeSchedulerconfiguration.yaml
     中profiles.puginConfig.args转换成指定的对象,当plargs传递到这里时他已经被k8s自动转换成了内部版本,如果k8s无法正确识别或转换我们的DynamicArgs,那么这里指针强转就会失败
     plArgs此时的实际类型会为runtime.Unknow,如果正确识别转换,那么plArgs此时的实际类型就是DynamicArgs。
     2:这个DynamicArgs类型名字不是随便取的,如果我们的插件叫做Dynamic(profiles.puginConfig.name字段指定的),那么这个参数对象就必须叫做DynamicArgs,也就是说k8s他是这么做的:在读取
     配置文件的时候,如果profiles.puginConfig.name叫做XXXX,那么k8s就会尝试把profiles.puginConfig.args解析成一个v1beta2版本的XXXXArgs对象,这个Args后缀是k8s代码里写死的,
     如果kubescheduler.config.k8s.io组下面没有一个v1beta2版本的叫做DynamicArgs的struct,那么就会转换失败,那么plArgs就会是runtime.Unknow
     3:k8s会把kubeSchedulerconfiguration.yaml文件解析成一个KubeSchedulerConfiguration对象,配置文件中的apiVersion字段是kubescheduler.config.k8s.io/v1beta2,
     说明k8s会把配置文件解析成kubescheduler.config.k8s.io组下面v1beta2版本的KubeSchedulerConfiguration对象,但是因为K8s他是这么做的:在内部统一使用一个叫做__internal版本的对象,
     只有在输入输出的时候才会使用到非__internal版本,我们叫做外部版本,如上面的v1beta2就是外部版本,因为我们读取配置文件时生成的KubeSchedulerConfiguration对象和DynamicArgs对象
     都是外部版本(kubescheduler.config.k8s.io/v1beta2),所以我们需要一个转换函数,把它转换成内部版本(kubescheduler.config.k8s.io/__internal)
     因为我们的profiles.puginConfig.args因为它是配置文件中的一个内嵌对象,所以profiles.puginConfig.args会被转换成kubescheduler.config.k8s.io/v1beta2版本的DynamicArgs,
     即group和version(即gv)与配置文件的apiVersion字段保持一致,如果转换失败,那么plArgs的类型也会是runtime.Unknow
   */
  
	args, ok := plArgs.(*config.DynamicArgs)   //一个强转就行了,如果强转失败,说明出了问题,主要有三种可能:
                                               //1:没有注册到k8s内建的scheme中 
                                               //2:没有实现kubescheduler.config.k8s.io/v1beta2和kubescheduler.config.k8s.io/__internal两个版本的DynamicArgs对象
                                               //3:没有实现convert函数,导致DynamicArgs从v1beta2版本转换成__internal版本的时候转换失败
	if !ok {
		return nil, fmt.Errorf("error3")
	}
    fmt.Println("plArgs.PolicyConfigPath",args.PolicyConfigPath)
    fmt.Println("plArgs.PromAddr",args.PromeAddr)
    fmt.Println("plArgs.MetricsUpdatePeriodBySeconds",args.MetricsUpdatePeriodBySeconds)
    fmt.Println("plArgs.ClusterName",args.ClusterName)

    //下面是新代码
	schedulerPolicy, err := loadDynamicSchedulerPolicyFromFile(args.PolicyConfigPath)
	if err != nil {
		return nil, fmt.Errorf("error4:" + err.Error())
	}
	fmt.Println("loadPolicyFromFile ok,and policy is :")
	for idx := range schedulerPolicy.Spec.SyncPeriod {
		fmt.Println("\t", schedulerPolicy.Spec.SyncPeriod[idx])
	}

 
    //下面是旧代码,没变
	fmt.Println("I am NewDynamicScheduler")
	state := &SchedulerState{
		Value: 20240217,
	}
	go DoSomethingWithState(state) //一个线程去不断更新这个状态
	return &DynamicScheduler{
		Handle:         h,     //保存k8s传给我们的handler,我们可以用这个来获取nodes信息等信息
		SchedulerState: state, //scheduler则通过这个指针去读取最新的状态
	}, nil
}

2:创建loadDynamicSchedulerPolicyFromFile函数

package dynamic

import (
    ......
    policyscheme "awesomeProject5/pkg/apis/plugins/policy"
    ......

)
func loadDynamicSchedulerPolicyFromFile(file string) (*policy.DynamicSchedulerPolicy, error) {
	data, err := ioutil.ReadFile(file)
	if err != nil {
		return nil, err
	}

	return loadPolicy(data)
}

func loadPolicy(data []byte) (*policy.DynamicSchedulerPolicy, error) {

	/*
	   这个PolicyCodecs来源于一个全新的scheme,这个scheme只有我们自己知道
	   也就是说k8s一切都帮我们弄好了,我们只需要把对应的类型的pair/defaulter/convert注册到某个scheme里面,然后从这个scheme创建一个codec,
	   那么我们就可以直接这个codec来从文件加载我们自定义的policy对象了
       我们在这里手动调用policyCodec,所以在此之前,policyCodec对应的文件里的init就会执行,也就是在此之前就会完成注册
	*/
	obj, gvk, err := policyscheme.PolicyCodec.UniversalDecoder().Decode(data, nil, nil) //读取文件,然后返回__internal版本的对象,即版本转换这个Decode函数自动帮我们做了
	if err != nil {
		return nil, err
	}

	if policyObj, ok := obj.(*policy.DynamicSchedulerPolicy); ok {
		return policyObj, nil
	}

	return nil, fmt.Errorf("couldn't decode as DynamicSchedulerPolicy, got %s: ", gvk)
}

3:注册DynamicSchedulerPolicy对象到一个scheme

注册DynamicSchedulerPolicy对象的gvk/convert/defaulter到全新的scheme,然后再从这个scheme创建一个PolicyCodec编解码器

创建一个awesomeProject5/pkg/apis/plugins/policy/scheme/scheme.go

package scheme

import (
	"awesomeProject5/pkg/apis/plugins/policy"
	"awesomeProject5/pkg/apis/plugins/policy/myv1"
	"fmt"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/serializer"
	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)

var (

	PolicyScheme = runtime.NewScheme()      //因为policy是我们的程序需要,而k8s不需要,所以我们可以使用一个全新的scheme,我们就是注册到这个scheme里
                                            //再次说明:需要k8s自动加载我们的对象我们才需要注册到k8s内建的scheme中,如果不需要,我们直接注册到新的scheme中,然后有我们自己手动加载

	PolicyCodec = serializer.NewCodecFactory(PolicyScheme, serializer.EnableStrict) //解码器需要知道pair(gvk,struct)/convert 才能解码,而这些信息我们都注册到PolicyScheme里了
                                                                                    //所以只需要从policyScheme中创建一个PolicyCodec就可以了
                                                                                    //EnableStrict表示配置文件中的字段必须和DynamicSchedulerPolicy对象的字段一模一样,
                                                                                    //不能多也不能少(是json字段名,如果没有json注释,则默认是字段名)
                                                                                    //因为我们会手动调用PolicyCodec,也就是说此文件会被加载,init会被执行,就不需要变量A了
)

func init() {
	AddToScheme(PolicyScheme) //注册到policyScheme
}

// AddToScheme builds the kubescheduler scheme using all known versions of the kubescheduler api.
func AddToScheme(scheme *runtime.Scheme) {
	utilruntime.Must(policy.AddToScheme(scheme)) //调用__internal版本的AddToScheme,并执行该文件里面的init
	utilruntime.Must(myv1.AddToScheme(scheme))   //调用myv1版本的AddToScheme,并执行该文件里面的init
	fmt.Println("load DynamicSchedulerPolicy policy and myv1 ok")
}

4:创建DynamicSchedulerPolicy对象

需要创建一个外部版本和内部版本,我们随便取组名为mypolicy,外部版本名为myv1,流程和创建DynamicArgs一模一样

4.1:创建myv1版本

4.1.1:awesomeProject5/pkg/apis/plugins/policy/myv1/types.go

package myv1

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type DynamicSchedulerPolicy struct {
	metav1.TypeMeta `json:",inline"`
	Spec            PolicySpec `json:"spec"`
}
type PolicySpec struct {
	SyncPeriod []SyncPolicy `json:"syncPolicy"`
}
type SyncPolicy struct {
	Name   string          `json:"name"`
	Period metav1.Duration `json:"period"`
}

4.1.2:awesomeProject5/pkg/apis/plugins/policy/myv1/registry.go

package myv1

import (
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/klog/v2"
)

var SchemeGroupVersion = schema.GroupVersion{Group: "mypolicy", Version: "myv1"}

var (
	SchemeBuilder = runtime.NewSchemeBuilder()
	AddToScheme   = SchemeBuilder.AddToScheme
)

// addKnownTypes registers known types to the given scheme
func addKnownTypes(scheme *runtime.Scheme) error {
	scheme.AddKnownTypes(SchemeGroupVersion,
		&DynamicSchedulerPolicy{},
	)
	return nil
}
func init() {
	SchemeBuilder.Register(addKnownTypes)
	SchemeBuilder.Register(RegisterConversions)
	SchemeBuilder.Register(RegisterDefaults)
	klog.V(4).Info("load DynamicSchedulerPolicy myv1")
}

4.1.3 awesomeProject5/pkg/apis/plugins/policy/myv1/zz_generated.conversion.go

//go:build !ignore_autogenerated
// +build !ignore_autogenerated

// Code generated by conversion-gen. DO NOT EDIT.

package myv1

import (
	policy "awesomeProject5/pkg/apis/plugins/policy"
	unsafe "unsafe"

	conversion "k8s.io/apimachinery/pkg/conversion"
	runtime "k8s.io/apimachinery/pkg/runtime"
)


// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(s *runtime.Scheme) error {
	if err := s.AddGeneratedConversionFunc((*DynamicSchedulerPolicy)(nil), (*policy.DynamicSchedulerPolicy)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_myv1_DynamicSchedulerPolicy_To_policy_DynamicSchedulerPolicy(a.(*DynamicSchedulerPolicy), b.(*policy.DynamicSchedulerPolicy), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*policy.DynamicSchedulerPolicy)(nil), (*DynamicSchedulerPolicy)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_policy_DynamicSchedulerPolicy_To_myv1_DynamicSchedulerPolicy(a.(*policy.DynamicSchedulerPolicy), b.(*DynamicSchedulerPolicy), scope)
	}); err != nil {
		return err
	}

	return nil
}

func autoConvert_myv1_DynamicSchedulerPolicy_To_policy_DynamicSchedulerPolicy(in *DynamicSchedulerPolicy, out *policy.DynamicSchedulerPolicy, s conversion.Scope) error {
	if err := Convert_myv1_PolicySpec_To_policy_PolicySpec(&in.Spec, &out.Spec, s); err != nil {
		return err
	}
	return nil
}

// Convert_myv1_DynamicSchedulerPolicy_To_policy_DynamicSchedulerPolicy is an autogenerated conversion function.
func Convert_myv1_DynamicSchedulerPolicy_To_policy_DynamicSchedulerPolicy(in *DynamicSchedulerPolicy, out *policy.DynamicSchedulerPolicy, s conversion.Scope) error {
	return autoConvert_myv1_DynamicSchedulerPolicy_To_policy_DynamicSchedulerPolicy(in, out, s)
}

func autoConvert_policy_DynamicSchedulerPolicy_To_myv1_DynamicSchedulerPolicy(in *policy.DynamicSchedulerPolicy, out *DynamicSchedulerPolicy, s conversion.Scope) error {
	if err := Convert_policy_PolicySpec_To_myv1_PolicySpec(&in.Spec, &out.Spec, s); err != nil {
		return err
	}
	return nil
}

// Convert_policy_DynamicSchedulerPolicy_To_myv1_DynamicSchedulerPolicy is an autogenerated conversion function.
func Convert_policy_DynamicSchedulerPolicy_To_myv1_DynamicSchedulerPolicy(in *policy.DynamicSchedulerPolicy, out *DynamicSchedulerPolicy, s conversion.Scope) error {
	return autoConvert_policy_DynamicSchedulerPolicy_To_myv1_DynamicSchedulerPolicy(in, out, s)
}


func autoConvert_myv1_PolicySpec_To_policy_PolicySpec(in *PolicySpec, out *policy.PolicySpec, s conversion.Scope) error {
	out.SyncPeriod = *(*[]policy.SyncPolicy)(unsafe.Pointer(&in.SyncPeriod))
	return nil
}

// Convert_myv1_PolicySpec_To_policy_PolicySpec is an autogenerated conversion function.
func Convert_myv1_PolicySpec_To_policy_PolicySpec(in *PolicySpec, out *policy.PolicySpec, s conversion.Scope) error {
	return autoConvert_myv1_PolicySpec_To_policy_PolicySpec(in, out, s)
}

func autoConvert_policy_PolicySpec_To_myv1_PolicySpec(in *policy.PolicySpec, out *PolicySpec, s conversion.Scope) error {
	out.SyncPeriod = *(*[]SyncPolicy)(unsafe.Pointer(&in.SyncPeriod))
	return nil
}

// Convert_policy_PolicySpec_To_myv1_PolicySpec is an autogenerated conversion function.
func Convert_policy_PolicySpec_To_myv1_PolicySpec(in *policy.PolicySpec, out *PolicySpec, s conversion.Scope) error {
	return autoConvert_policy_PolicySpec_To_myv1_PolicySpec(in, out, s)
}

func autoConvert_myv1_SyncPolicy_To_policy_SyncPolicy(in *SyncPolicy, out *policy.SyncPolicy, s conversion.Scope) error {
	out.Name = in.Name
	out.Period = in.Period
	return nil
}

// Convert_myv1_SyncPolicy_To_policy_SyncPolicy is an autogenerated conversion function.
func Convert_myv1_SyncPolicy_To_policy_SyncPolicy(in *SyncPolicy, out *policy.SyncPolicy, s conversion.Scope) error {
	return autoConvert_myv1_SyncPolicy_To_policy_SyncPolicy(in, out, s)
}

func autoConvert_policy_SyncPolicy_To_myv1_SyncPolicy(in *policy.SyncPolicy, out *SyncPolicy, s conversion.Scope) error {
	out.Name = in.Name
	out.Period = in.Period
	return nil
}

// Convert_policy_SyncPolicy_To_myv1_SyncPolicy is an autogenerated conversion function.
func Convert_policy_SyncPolicy_To_myv1_SyncPolicy(in *policy.SyncPolicy, out *SyncPolicy, s conversion.Scope) error {
	return autoConvert_policy_SyncPolicy_To_myv1_SyncPolicy(in, out, s)
}

4.1.4:awesomeProject5/pkg/apis/plugins/policy/myv1/zz_generated.deepcopy.go

//go:build !ignore_autogenerated
// +build !ignore_autogenerated

// Code generated by deepcopy-gen. DO NOT EDIT.

package myv1

import (
	runtime "k8s.io/apimachinery/pkg/runtime"
)

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DynamicSchedulerPolicy) DeepCopyInto(out *DynamicSchedulerPolicy) {
	*out = *in
	out.TypeMeta = in.TypeMeta
	in.Spec.DeepCopyInto(&out.Spec)
	return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DynamicSchedulerPolicy.
func (in *DynamicSchedulerPolicy) DeepCopy() *DynamicSchedulerPolicy {
	if in == nil {
		return nil
	}
	out := new(DynamicSchedulerPolicy)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DynamicSchedulerPolicy) DeepCopyObject() runtime.Object {
	if c := in.DeepCopy(); c != nil {
		return c
	}
	return nil
}



// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicySpec) DeepCopyInto(out *PolicySpec) {
	*out = *in
	if in.SyncPeriod != nil {
		in, out := &in.SyncPeriod, &out.SyncPeriod
		*out = make([]SyncPolicy, len(*in))
		copy(*out, *in)
	}

	return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicySpec.
func (in *PolicySpec) DeepCopy() *PolicySpec {
	if in == nil {
		return nil
	}
	out := new(PolicySpec)
	in.DeepCopyInto(out)
	return out
}



// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SyncPolicy) DeepCopyInto(out *SyncPolicy) {
	*out = *in
	out.Period = in.Period
	return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncPolicy.
func (in *SyncPolicy) DeepCopy() *SyncPolicy {
	if in == nil {
		return nil
	}
	out := new(SyncPolicy)
	in.DeepCopyInto(out)
	return out
}

4.1.5 awesomeProject5/pkg/apis/plugins/policy/myv1/zz_generated.defaults.go

//go:build !ignore_autogenerated
// +build !ignore_autogenerated

// Code generated by defaulter-gen. DO NOT EDIT.

package myv1

import (
	runtime "k8s.io/apimachinery/pkg/runtime"
)

// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
	return nil
}

4.2:myv1版本的已经创建完了,接下来就创建__internal版本,同样,我们把它放到policy包下面

4.2.1 awesomeProject5/pkg/apis/plugins/policy/registry.go

package policy

import (
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/klog/v2"
)

var SchemeGroupVersion = schema.GroupVersion{Group: "mypolicy", Version: runtime.APIVersionInternal} //注意这里的version不再是myv1

var (  
	SchemeBuilder = runtime.NewSchemeBuilder()   //直接用一个全新的schemeBuilder就行,反正我们会注册到PolicyScheme中
	AddToScheme   = SchemeBuilder.AddToScheme
)

// addKnownTypes registers known types to the given scheme
func addKnownTypes(scheme *runtime.Scheme) error {
	scheme.AddKnownTypes(SchemeGroupVersion,
		&DynamicSchedulerPolicy{},
	)
	return nil
}
func init() {
	SchemeBuilder.Register(addKnownTypes)
	SchemeBuilder.Register(RegisterDefaults)
	klog.V(4).Info("load DynamicSchedulerPolicy policy")
}

4.2.2 awesomeProject5/pkg/apis/plugins/policy/types.go

同myv1/types.go,就把package myv1改成package policy

4.2.3 awesomeProject5/pkg/apis/plugins/policy/zz_generated.deepcopy.go

同myv1/zz_generated.deepcopy.go,就把package myv1改成package policy

4.2.3 awesomeProject5/pkg/apis/plugins/policy/zz_generated.defaults.go

同myv1/zz_generated.defaults.go,就把package myv1改成package policy

5:config/my-policy.yaml

整个文件先解析成一个myv1版本的DynamicSchedulerPolicy对象,然后再转换成__internal版本的DynamicSchedulerPolicy对象

apiVersion: mypolicy/myv1              #apiVersion=Group/Version
kind: DynamicSchedulerPolicy           # struct名字
spec:                                  # spec字段会被包装成一个Spec对象
  syncPolicy:                          #syncPolicy字段是一个SyncPolicy对象数组
    ##cpu usage               
    - name: cpu_usage_avg_5m           #name、period会被包装成一个SyncPolicy对象
      period: 3m
    - name: cpu_usage_max_avg_1h
      period: 15m
    - name: cpu_usage_max_avg_1d
      period: 3h
    ##memory usage
    - name: mem_usage_avg_5m
      period: 3m
    - name: mem_usage_max_avg_1h
      period: 15m
    - name: mem_usage_max_avg_1d
      period: 3h

至此,一切搞定,接下来编译运行,如果控制台出现下面的信息就ok了

......
load DynamicArgs config 
load DynamicSchedulerPolicy policy and myv1 ok
load DynamicArgs v1beta2                  
load myconfig and myv1beta2 ok            
W0218 16:08:32.170219   15656 authentication.go:340] No authentication-kubeconfig provided in order to lookup requestheader-client-ca-file in configmap/extension-api
server-authentication in kube-system, so request-header client certificate authentication won't work.
W0218 16:08:32.170219   15656 authorization.go:193] No authorization-kubeconfig provided, so SubjectAccessReview of authorization tokens won't work.
plArgs.PromAddr xxxxxxxxxxxxxxxxx          
plArgs.MetricsUpdatePeriodBySeconds {5m0s}   
plArgs.ClusterName xxxxxxx                 
loadPolicyFromFile ok,and policy is :           #这里就是打印我们的policy文件  
         {cpu_usage_avg_5m {3m0s}}         
         {cpu_usage_max_avg_1h {15m0s}}    
         {cpu_usage_max_avg_1d {3h0m0s}}   
         {mem_usage_avg_5m {3m0s}}         
         {mem_usage_max_avg_1h {15m0s}}
         {mem_usage_max_avg_1d {3h0m0s}}
I am NewDynamicScheduler
I0218 16:08:32.191952   15656 server.go:139] "Starting Kubernetes Scheduler" version="v0.0.0-master+$Format:%H$"
I0218 16:08:32.193469   15656 secure_serving.go:200] Serving securely on [::]:10259
......
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐