control

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 23 Imported by: 9

Documentation

Overview

Package control is the package to perform the real update actions for K8S objects through APIServer; all clientSet actions should be arranged here to provide a unified behavior for dry-run and testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CNCControl

type CNCControl interface {
	// CreateCNC is used to create new CNC obj
	CreateCNC(ctx context.Context, cnc *v1alpha1.CustomNodeConfig,
		opts metav1.CreateOptions) (*v1alpha1.CustomNodeConfig, error)

	// DeleteCNC is used to delete CNC obj
	DeleteCNC(ctx context.Context, cncName string,
		opts metav1.DeleteOptions) error

	// PatchCNC is used to update the changes for CNC spec and metadata contents
	PatchCNC(ctx context.Context, cncName string, oldCNC,
		newCNC *v1alpha1.CustomNodeConfig) (*v1alpha1.CustomNodeConfig, error)

	// PatchCNCStatus is used to update the changes for CNC status contents
	PatchCNCStatus(ctx context.Context, cncName string, oldCNC,
		newCNC *v1alpha1.CustomNodeConfig) (*v1alpha1.CustomNodeConfig, error)
}

CNCControl is used to update CustomNodeConfig todo: use patch instead of update to avoid conflict

type CNRControl

type CNRControl interface {
	// CreateCNR creates CNR from APIServer
	CreateCNR(ctx context.Context, cnr *v1alpha1.CustomNodeResource) (*v1alpha1.CustomNodeResource, error)

	// DeleteCNR deletes CNR from APIServer
	DeleteCNR(ctx context.Context, cnrName string) error

	// PatchCNRSpecAndMetadata is used to update the changes for CNR Spec contents
	PatchCNRSpecAndMetadata(ctx context.Context, cnrName string, oldCNR, newCNR *v1alpha1.CustomNodeResource) (*v1alpha1.CustomNodeResource, error)

	// PatchCNRStatus is used to update the changes for CNR Status contents
	PatchCNRStatus(ctx context.Context, cnrName string, oldCNR, newCNR *v1alpha1.CustomNodeResource) (*v1alpha1.CustomNodeResource, error)
}

CNRControl is used to update CNR

type CNRControlImpl

type CNRControlImpl struct {
	// contains filtered or unexported fields
}

func NewCNRControlImpl

func NewCNRControlImpl(client clientset.Interface) *CNRControlImpl

func (*CNRControlImpl) CreateCNR

func (*CNRControlImpl) DeleteCNR

func (c *CNRControlImpl) DeleteCNR(ctx context.Context, cnrName string) error

func (*CNRControlImpl) PatchCNRSpecAndMetadata

func (c *CNRControlImpl) PatchCNRSpecAndMetadata(ctx context.Context, cnrName string, oldCNR, newCNR *v1alpha1.CustomNodeResource) (*v1alpha1.CustomNodeResource, error)

func (*CNRControlImpl) PatchCNRStatus

func (c *CNRControlImpl) PatchCNRStatus(ctx context.Context, cnrName string, oldCNR, newCNR *v1alpha1.CustomNodeResource) (*v1alpha1.CustomNodeResource, error)

type DummyCNCControl

type DummyCNCControl struct{}

func (DummyCNCControl) DeleteCNC

func (DummyCNCControl) PatchCNC

func (DummyCNCControl) PatchCNCStatus

type DummyCNRControl

type DummyCNRControl struct{}

func (DummyCNRControl) DeleteCNR

func (d DummyCNRControl) DeleteCNR(_ context.Context, _ string) error

func (DummyCNRControl) PatchCNRSpecAndMetadata

func (DummyCNRControl) PatchCNRStatus

type DummyKCCControl

type DummyKCCControl struct{}

type DummyPodEjector

type DummyPodEjector struct{}

func (DummyPodEjector) DeletePod

func (DummyPodEjector) EvictPod

func (d DummyPodEjector) EvictPod(_ context.Context, _ *policy.Eviction) error

type DummyPodUpdater

type DummyPodUpdater struct{}

func (*DummyPodUpdater) PatchPod

func (d *DummyPodUpdater) PatchPod(_ context.Context, _, _ *core.Pod) error

func (*DummyPodUpdater) PatchPodStatus

func (d *DummyPodUpdater) PatchPodStatus(_ context.Context, _, _ *core.Pod) error

func (*DummyPodUpdater) UpdatePod

func (d *DummyPodUpdater) UpdatePod(_ context.Context, _ *core.Pod, _ metav1.UpdateOptions) (*core.Pod, error)

func (*DummyPodUpdater) UpdatePodStatus

func (d *DummyPodUpdater) UpdatePodStatus(_ context.Context, _ *core.Pod, _ metav1.UpdateOptions) (*core.Pod, error)

type DummySPDControl

type DummySPDControl struct{}

func (*DummySPDControl) DeleteSPD

type DummyUnstructuredControl

type DummyUnstructuredControl struct{}

func (DummyUnstructuredControl) GetUnstructured

func (DummyUnstructuredControl) PatchUnstructured

func (DummyUnstructuredControl) PatchUnstructuredStatus

type DummyVPARecommendationUpdater

type DummyVPARecommendationUpdater struct{}

func (*DummyVPARecommendationUpdater) DeleteVPARecommendation

func (*DummyVPARecommendationUpdater) PatchVPARecommendation

func (d *DummyVPARecommendationUpdater) PatchVPARecommendation(ctx context.Context, oldVparec, newVparec *apis.VerticalPodAutoscalerRecommendation) error

func (*DummyVPARecommendationUpdater) PatchVPARecommendationStatus

func (d *DummyVPARecommendationUpdater) PatchVPARecommendationStatus(ctx context.Context, oldVparec, newVparec *apis.VerticalPodAutoscalerRecommendation) error

type KCCControl

type KCCControl interface {
	// UpdateKCC is used to update the changes for KCC spec and metadata contents
	UpdateKCC(ctx context.Context, kcc *v1alpha1.KatalystCustomConfig,
		opts metav1.UpdateOptions) (*v1alpha1.KatalystCustomConfig, error)

	// UpdateKCCStatus is used to update the change for KCC status
	UpdateKCCStatus(ctx context.Context, kcc *v1alpha1.KatalystCustomConfig,
		opts metav1.UpdateOptions) (*v1alpha1.KatalystCustomConfig, error)
}

KCCControl is used to update KatalystCustomConfig todo: use patch instead of update to avoid conflict

type PodEjector

type PodEjector interface {
	DeletePod(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error
	EvictPod(ctx context.Context, eviction *policy.Eviction) error
}

PodEjector is used to evict Pods

type PodUpdater

type PodUpdater interface {
	UpdatePod(ctx context.Context, pod *core.Pod, opts metav1.UpdateOptions) (*core.Pod, error)
	UpdatePodStatus(ctx context.Context, pod *core.Pod, opts metav1.UpdateOptions) (*core.Pod, error)
	PatchPod(ctx context.Context, oldPod, newPod *core.Pod) error
	PatchPodStatus(ctx context.Context, oldPod, newPod *core.Pod) error
}

PodUpdater is used to update Pod

type RealCNCControl

type RealCNCControl struct {
	// contains filtered or unexported fields
}

func NewRealCNCControl

func NewRealCNCControl(client clientset.Interface) *RealCNCControl

func (*RealCNCControl) CreateCNC

func (*RealCNCControl) DeleteCNC

func (r *RealCNCControl) DeleteCNC(ctx context.Context, cncName string, opts metav1.DeleteOptions) error

func (*RealCNCControl) PatchCNC

func (r *RealCNCControl) PatchCNC(ctx context.Context, cncName string, oldCNC, newCNC *v1alpha1.CustomNodeConfig) (*v1alpha1.CustomNodeConfig, error)

func (*RealCNCControl) PatchCNCStatus

func (r *RealCNCControl) PatchCNCStatus(ctx context.Context, cncName string, oldCNC, newCNC *v1alpha1.CustomNodeConfig) (*v1alpha1.CustomNodeConfig, error)

type RealKCCControl

type RealKCCControl struct {
	// contains filtered or unexported fields
}

func NewRealKCCControl

func NewRealKCCControl(client clientset.Interface) *RealKCCControl

type RealPodEjector

type RealPodEjector struct {
	// contains filtered or unexported fields
}

func NewRealPodEjector

func NewRealPodEjector(client kubernetes.Interface) *RealPodEjector

func (*RealPodEjector) DeletePod

func (d *RealPodEjector) DeletePod(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*RealPodEjector) EvictPod

func (d *RealPodEjector) EvictPod(ctx context.Context, eviction *policy.Eviction) error

type RealPodEjectorWithMetric

type RealPodEjectorWithMetric struct {
	RealPodUpdater
	// contains filtered or unexported fields
}

RealPodEjectorWithMetric todo: implement with emitting metrics on updating

type RealPodUpdater

type RealPodUpdater struct {
	// contains filtered or unexported fields
}

func NewRealPodUpdater

func NewRealPodUpdater(client kubernetes.Interface) *RealPodUpdater

func (*RealPodUpdater) PatchPod

func (r *RealPodUpdater) PatchPod(ctx context.Context, oldPod, newPod *core.Pod) error

func (*RealPodUpdater) PatchPodStatus

func (r *RealPodUpdater) PatchPodStatus(_ context.Context, oldPod, newPod *core.Pod) error

func (*RealPodUpdater) UpdatePod

func (r *RealPodUpdater) UpdatePod(ctx context.Context, pod *core.Pod, opts metav1.UpdateOptions) (*core.Pod, error)

func (*RealPodUpdater) UpdatePodStatus

func (r *RealPodUpdater) UpdatePodStatus(ctx context.Context, pod *core.Pod, opts metav1.UpdateOptions) (*core.Pod, error)

type RealPodUpdaterWithMetric

type RealPodUpdaterWithMetric struct {
	RealPodUpdater
	// contains filtered or unexported fields
}

RealPodUpdaterWithMetric todo: implement with emitting metrics on updating

type RealUnstructuredControl

type RealUnstructuredControl struct {
	// contains filtered or unexported fields
}

func NewRealUnstructuredControl

func NewRealUnstructuredControl(client dynamic.Interface) *RealUnstructuredControl

func (*RealUnstructuredControl) DeleteUnstructured

func (*RealUnstructuredControl) GetUnstructured

func (*RealUnstructuredControl) PatchUnstructured

func (*RealUnstructuredControl) PatchUnstructuredStatus

func (*RealUnstructuredControl) UpdateUnstructuredStatus

type RealVPARecommendationUpdater

type RealVPARecommendationUpdater struct {
	// contains filtered or unexported fields
}

func NewRealVPARecommendationUpdater

func NewRealVPARecommendationUpdater(client clientset.Interface) *RealVPARecommendationUpdater

func (*RealVPARecommendationUpdater) DeleteVPARecommendation

func (*RealVPARecommendationUpdater) PatchVPARecommendation

func (r *RealVPARecommendationUpdater) PatchVPARecommendation(ctx context.Context, oldVpaRec, newVpaRec *apis.VerticalPodAutoscalerRecommendation) error

func (*RealVPARecommendationUpdater) PatchVPARecommendationStatus

func (r *RealVPARecommendationUpdater) PatchVPARecommendationStatus(ctx context.Context, oldVpaRec, newVpaRec *apis.VerticalPodAutoscalerRecommendation) error

type RealVPARecommendationUpdaterWithMetric

type RealVPARecommendationUpdaterWithMetric struct {
	RealVPARecommendationUpdater
	// contains filtered or unexported fields
}

RealVPARecommendationUpdaterWithMetric todo: implement with emitting metrics on updating

type RealVPAUpdater

type RealVPAUpdater struct {
	// contains filtered or unexported fields
}

func (*RealVPAUpdater) PatchVPA

func (*RealVPAUpdater) PatchVPAStatus

type RealVPAUpdaterWithMetric

type RealVPAUpdaterWithMetric struct {
	RealVPAUpdater
	// contains filtered or unexported fields
}

RealVPAUpdaterWithMetric todo: implement with emitting metrics on updating

type SPDControlImp

type SPDControlImp struct {
	// contains filtered or unexported fields
}

func NewSPDControlImp

func NewSPDControlImp(client clientset.Interface) *SPDControlImp

func (*SPDControlImp) DeleteSPD

type ServiceProfileControl

ServiceProfileControl is used to update ServiceProfileDescriptor CR todo: use patch instead of update to avoid conflict

type UnstructuredControl

type UnstructuredControl interface {
	// CreateUnstructured is used to create unstructured obj
	CreateUnstructured(ctx context.Context, gvr metav1.GroupVersionResource,
		obj *unstructured.Unstructured, opts metav1.CreateOptions) (*unstructured.Unstructured, error)

	// GetUnstructured is used to get unstructured obj
	GetUnstructured(ctx context.Context, gvr metav1.GroupVersionResource,
		namespace, name string, opts metav1.GetOptions) (*unstructured.Unstructured, error)

	// PatchUnstructured is to patch unstructured object spec and metadata
	PatchUnstructured(ctx context.Context, gvr metav1.GroupVersionResource,
		oldObj, newObj *unstructured.Unstructured) (*unstructured.Unstructured, error)

	// UpdateUnstructured is used to update unstructured obj spec and metadata
	UpdateUnstructured(ctx context.Context, gvr metav1.GroupVersionResource,
		obj *unstructured.Unstructured, opts metav1.UpdateOptions) (*unstructured.Unstructured, error)

	// UpdateUnstructuredStatus is used to update unstructured obj status
	UpdateUnstructuredStatus(ctx context.Context, gvr metav1.GroupVersionResource,
		obj *unstructured.Unstructured, opts metav1.UpdateOptions) (*unstructured.Unstructured, error)

	// PatchUnstructuredStatus is to patch unstructured object status
	PatchUnstructuredStatus(ctx context.Context, gvr metav1.GroupVersionResource,
		oldObj, newObj *unstructured.Unstructured) (*unstructured.Unstructured, error)

	// DeleteUnstructured is used to delete unstructured obj
	DeleteUnstructured(ctx context.Context, gvr metav1.GroupVersionResource,
		obj *unstructured.Unstructured, opts metav1.DeleteOptions) error
}

UnstructuredControl is used to update Unstructured obj todo: use patch instead of update to avoid conflict

type VPARecommendationUpdater

type VPARecommendationUpdater interface {
	UpdateVPARecommendation(ctx context.Context, vpaRec *apis.VerticalPodAutoscalerRecommendation,
		opts metav1.UpdateOptions) (*apis.VerticalPodAutoscalerRecommendation, error)
	UpdateVPARecommendationStatus(ctx context.Context, vpaRec *apis.VerticalPodAutoscalerRecommendation,
		opts metav1.UpdateOptions) (*apis.VerticalPodAutoscalerRecommendation, error)

	PatchVPARecommendation(ctx context.Context, oldVpaRec, newVpaRec *apis.VerticalPodAutoscalerRecommendation) error
	PatchVPARecommendationStatus(ctx context.Context, oldVpaRec, newVpaRec *apis.VerticalPodAutoscalerRecommendation) error

	CreateVPARecommendation(ctx context.Context, vpaRec *apis.VerticalPodAutoscalerRecommendation,
		opts metav1.CreateOptions) (*apis.VerticalPodAutoscalerRecommendation, error)
	DeleteVPARecommendation(ctx context.Context, vpaRec *apis.VerticalPodAutoscalerRecommendation, opts metav1.DeleteOptions) error
}

VPARecommendationUpdater is used to update VPARecommendation CR

type VPAUpdater

VPAUpdater is used to update VPA CR todo: use patch instead of update to avoid conflict

func NewRealVPAUpdater

func NewRealVPAUpdater(client clientset.Interface) VPAUpdater

Jump to

Keyboard shortcuts

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