protocol

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HooksProtocolBuilder = hooksProtocolBuilder{
	KubeQOS: func(kubeQOS corev1.PodQOSClass) HooksProtocol {
		k := &KubeQOSContext{}
		k.FromReconciler(kubeQOS)
		return k
	},
	Pod: func(podMeta *statesinformer.PodMeta) HooksProtocol {
		p := &PodContext{}
		p.FromReconciler(podMeta)
		return p
	},
	Sandbox: func(podMeta *statesinformer.PodMeta) HooksProtocol {
		p := &ContainerContext{}
		p.FromReconciler(podMeta, "", true)
		return p
	},
	Container: func(podMeta *statesinformer.PodMeta, containerName string) HooksProtocol {
		c := &ContainerContext{}
		c.FromReconciler(podMeta, containerName, false)
		return c
	},
	HostApp: func(hostAppSpec *slov1alpha1.HostApplicationSpec) HooksProtocol {
		c := &HostAppContext{}
		c.FromReconciler(hostAppSpec)
		return c
	},
}

Functions

This section is empty.

Types

type ContainerContext

type ContainerContext struct {
	Request  ContainerRequest
	Response ContainerResponse
	// contains filtered or unexported fields
}

func (*ContainerContext) FromNri added in v1.3.0

func (c *ContainerContext) FromNri(pod *api.PodSandbox, container *api.Container)

func (*ContainerContext) FromProxy

func (*ContainerContext) FromReconciler

func (c *ContainerContext) FromReconciler(podMeta *statesinformer.PodMeta, containerName string, sandbox bool)

func (*ContainerContext) GetUpdaters added in v1.4.0

func (*ContainerContext) NriDone added in v1.3.0

func (*ContainerContext) ProxyDone

func (*ContainerContext) ReconcilerDone

func (c *ContainerContext) ReconcilerDone(executor resourceexecutor.ResourceUpdateExecutor)

func (*ContainerContext) ReconcilerProcess added in v1.4.0

func (c *ContainerContext) ReconcilerProcess(executor resourceexecutor.ResourceUpdateExecutor)

ReconcilerProcess generate the resource updaters but not do the update until the Update() is called.

func (*ContainerContext) Update added in v1.4.0

func (c *ContainerContext) Update()

type ContainerMeta

type ContainerMeta struct {
	Name string
	ID   string // docker://xxx; containerd://
	// is sandbox container
	Sandbox bool
}

func (*ContainerMeta) FromNri added in v1.3.0

func (c *ContainerMeta) FromNri(container *api.Container, podAnnotations map[string]string)

func (*ContainerMeta) FromProxy

func (c *ContainerMeta) FromProxy(containerMeta *runtimeapi.ContainerMetadata, podAnnotations map[string]string)

type ContainerRequest

type ContainerRequest struct {
	PodMeta           PodMeta
	ContainerMeta     ContainerMeta
	PodLabels         map[string]string
	PodAnnotations    map[string]string
	CgroupParent      string
	ContainerEnvs     map[string]string
	Resources         *Resources // TODO: support proxy & nri mode
	ExtendedResources *apiext.ExtendedResourceContainerSpec
}

func (*ContainerRequest) FromNri added in v1.3.0

func (c *ContainerRequest) FromNri(pod *api.PodSandbox, container *api.Container)

func (*ContainerRequest) FromProxy

func (*ContainerRequest) FromReconciler

func (c *ContainerRequest) FromReconciler(podMeta *statesinformer.PodMeta, containerName string, sandbox bool)

type ContainerResponse

type ContainerResponse struct {
	Resources        Resources
	AddContainerEnvs map[string]string
}

func (*ContainerResponse) ProxyDone

type HooksProtocol

type HooksProtocol interface {
	ReconcilerDone(executor resourceexecutor.ResourceUpdateExecutor)
	Update()
	GetUpdaters() []resourceexecutor.ResourceUpdater
}

type HostAppContext added in v1.4.0

type HostAppContext struct {
	Request  HostAppRequest
	Response HostAppResponse
	// contains filtered or unexported fields
}

func (*HostAppContext) FromReconciler added in v1.4.0

func (c *HostAppContext) FromReconciler(hostAppSpec *slov1alpha1.HostApplicationSpec)

func (*HostAppContext) GetUpdaters added in v1.4.0

func (c *HostAppContext) GetUpdaters() []resourceexecutor.ResourceUpdater

func (*HostAppContext) ReconcilerDone added in v1.4.0

func (c *HostAppContext) ReconcilerDone(executor resourceexecutor.ResourceUpdateExecutor)

func (*HostAppContext) ReconcilerProcess added in v1.4.0

func (c *HostAppContext) ReconcilerProcess(executor resourceexecutor.ResourceUpdateExecutor)

func (*HostAppContext) Update added in v1.4.0

func (c *HostAppContext) Update()

type HostAppRequest added in v1.4.0

type HostAppRequest struct {
	Name         string
	QOSClass     ext.QoSClass
	CgroupParent string
}

func (*HostAppRequest) FromReconciler added in v1.4.0

func (r *HostAppRequest) FromReconciler(hostAppSpec *slov1alpha1.HostApplicationSpec)

type HostAppResponse added in v1.4.0

type HostAppResponse struct {
	Resources Resources
}

type KubeQOSContext

type KubeQOSContext struct {
	Request  KubeQOSRequet
	Response KubeQOSResponse
	// contains filtered or unexported fields
}

func (*KubeQOSContext) FromReconciler

func (k *KubeQOSContext) FromReconciler(kubeQOS corev1.PodQOSClass)

func (*KubeQOSContext) GetUpdaters added in v1.4.0

func (k *KubeQOSContext) GetUpdaters() []resourceexecutor.ResourceUpdater

func (*KubeQOSContext) ReconcilerDone

func (k *KubeQOSContext) ReconcilerDone(executor resourceexecutor.ResourceUpdateExecutor)

func (*KubeQOSContext) ReconcilerProcess added in v1.4.0

func (k *KubeQOSContext) ReconcilerProcess(executor resourceexecutor.ResourceUpdateExecutor)

ReconcilerProcess generate the resource updaters but not do the update until the Update() is called.

func (*KubeQOSContext) Update added in v1.4.0

func (k *KubeQOSContext) Update()

type KubeQOSRequet

type KubeQOSRequet struct {
	KubeQOSClass corev1.PodQOSClass
	CgroupParent string
}

func (*KubeQOSRequet) FromReconciler

func (r *KubeQOSRequet) FromReconciler(kubeQOS corev1.PodQOSClass)

type KubeQOSResponse

type KubeQOSResponse struct {
	Resources Resources
}

type PodContext

type PodContext struct {
	Request  PodRequest
	Response PodResponse
	// contains filtered or unexported fields
}

func (*PodContext) FromNri added in v1.3.0

func (p *PodContext) FromNri(pod *api.PodSandbox)

func (*PodContext) FromProxy

func (p *PodContext) FromProxy(req *runtimeapi.PodSandboxHookRequest)

func (*PodContext) FromReconciler

func (p *PodContext) FromReconciler(podMeta *statesinformer.PodMeta)

func (*PodContext) GetUpdaters added in v1.4.0

func (p *PodContext) GetUpdaters() []resourceexecutor.ResourceUpdater

func (*PodContext) NriDone added in v1.3.0

func (p *PodContext) NriDone(executor resourceexecutor.ResourceUpdateExecutor)

func (*PodContext) ProxyDone

func (*PodContext) ReconcilerDone

func (p *PodContext) ReconcilerDone(executor resourceexecutor.ResourceUpdateExecutor)

func (*PodContext) ReconcilerProcess added in v1.4.0

func (p *PodContext) ReconcilerProcess(executor resourceexecutor.ResourceUpdateExecutor)

ReconcilerProcess generate the resource updaters but not do the update until the Update() is called.

func (*PodContext) Update added in v1.4.0

func (p *PodContext) Update()

type PodMeta

type PodMeta struct {
	Namespace string
	Name      string
	UID       string
}

func (*PodMeta) FromNri added in v1.3.0

func (p *PodMeta) FromNri(pod *api.PodSandbox)

func (*PodMeta) FromProxy

func (p *PodMeta) FromProxy(meta *runtimeapi.PodSandboxMetadata)

func (*PodMeta) FromReconciler

func (p *PodMeta) FromReconciler(meta metav1.ObjectMeta)

func (*PodMeta) String added in v1.3.0

func (p *PodMeta) String() string

type PodRequest

type PodRequest struct {
	PodMeta           PodMeta
	Labels            map[string]string
	Annotations       map[string]string
	CgroupParent      string
	Resources         *Resources // TODO: support proxy & nri mode
	ExtendedResources *apiext.ExtendedResourceSpec
}

func (*PodRequest) FromNri added in v1.3.0

func (p *PodRequest) FromNri(pod *api.PodSandbox)

func (*PodRequest) FromProxy

func (p *PodRequest) FromProxy(req *runtimeapi.PodSandboxHookRequest)

func (*PodRequest) FromReconciler

func (p *PodRequest) FromReconciler(podMeta *statesinformer.PodMeta)

type PodResponse

type PodResponse struct {
	Resources Resources
}

func (*PodResponse) ProxyDone

func (p *PodResponse) ProxyDone(resp *runtimeapi.PodSandboxHookResponse)

type Resources

type Resources struct {
	// origin resources
	CPUShares   *int64
	CFSQuota    *int64
	CPUSet      *string
	MemoryLimit *int64

	// extended resources
	CPUBvt  *int64
	CPUIdle *int64
}

func (*Resources) FromContainer added in v1.4.0

func (r *Resources) FromContainer(container *corev1.Container)

func (*Resources) FromPod added in v1.4.0

func (r *Resources) FromPod(pod *corev1.Pod)

func (*Resources) IsOriginResSet added in v0.7.0

func (r *Resources) IsOriginResSet() bool

Jump to

Keyboard shortcuts

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