extender

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 30 Imported by: 1

README

How to build and deploy scheduler extender

  1. Build binary and push image (if you don't change extender' code you don't have to rebuild binary and image):

        make build-extener
        make image-extender
        make push-extender
    
  2. On node where kubernetes scheduler pod is run create folder /etc/kubernetes/scheduler e.g.

ssh root@provo-goop mkdir -p /etc/kubernetes/scheduler
  1. Copy files config.yaml and policy.yaml from pkg/scheduler folder to the /etc/kubernetes/scheduler on the node. e.g.
scp policy.yaml config.yaml root@provo-goop:/etc/kubernetes/scheduler
  1. Install extender chart:

    helm install se charts/scheduler-extender --set log.level=debug --set image.tag=`make version`
    
  2. Modify kube-scheduler manifest on the node. Config file is located in /etc/kubernetes/manifests/kube-scheduler.yaml

    • add next volumes in .spec:
    - name: scheduler-config
      hostPath:
        path: /etc/kubernetes/scheduler/config.yaml
        type: File
    - name: scheduler-policy
      hostPath:
        path: /etc/kubernetes/scheduler/policy.yaml
        type: File
    
    • add volume mounts in .spec.containers[0].volumeMounts:
    - mountPath: /etc/kubernetes/scheduler/config.yaml
      name: scheduler-config
      readOnly: true
    - mountPath: /etc/kubernetes/scheduler/policy.yaml
      name: scheduler-policy
      readOnly: true
    
    • add next params for kube-scheduler entrypoint in .spec.containers[0].command:
    - --config=/etc/kubernetes/scheduler/config.yaml
    

    After you save changes in kube-scheduler.yaml kubernetes will restart scheduler.

  3. Apply some pod manifest

  4. Run

    kubectl logs -f -n %NAMESPACE_NAME% `kubectl get pods -n %NAMESPACE_NAME% --selector=app=csi-baremetal-se --no-headers | awk '{print $1}'`
    

    and observe as scheduler extender works

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extender

type Extender struct {
	sync.Mutex
	// contains filtered or unexported fields

} // if a new field is added, add field to extender_test.go also.

Extender holds http handlers for scheduler extender endpoints and implements logic for nodes filtering based on pod volumes requirements and Available Capacities

func NewExtender

func NewExtender(logger *logrus.Logger, kubeClient *k8s.KubeClient,
	kubeCache *k8s.KubeCache, provisioner string, featureConf fc.FeatureChecker, annotationKey, nodeselector string) (*Extender, error)

NewExtender returns new instance of Extender struct

func (*Extender) BindHandler

func (e *Extender) BindHandler(w http.ResponseWriter, req *http.Request)

BindHandler does bind of a pod to specific node

func (*Extender) FilterHandler

func (e *Extender) FilterHandler(w http.ResponseWriter, req *http.Request)

FilterHandler extracts ExtenderArgs struct from req and writes ExtenderFilterResult to the w

func (*Extender) PrioritizeHandler

func (e *Extender) PrioritizeHandler(w http.ResponseWriter, req *http.Request)

PrioritizeHandler helps with even distribution of the volumes across the nodes. It will set priority based on the formula: rank of node X = max number of volumes - number of volume on node X.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL