trait

package
v0.0.0-...-ef63bee Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodUnavailableBudgetKind = "podunavailablebudget"
)
View Source
const (
	ServiceKind = "service"
)

Variables

View Source
var (
	Traits = map[string]Trait{}
)

Functions

func RegisterTrait

func RegisterTrait(kind string, t Trait)

register trait

Types

type Client

type Client struct {
	Kclient kclientset.Interface
	Rclient clientset.Interface
	Client  kubernetes.Interface
}

func NewClient

func NewClient(kclient kclientset.Interface, rclient clientset.Interface, client kubernetes.Interface) *Client

type EventType

type EventType string

EventType handler event type

const (
	// create or update event
	CreatedOrUpdate EventType = "createdOrUpdate"
	// delete event
	Deleted EventType = "deleted"
)

type PodUnavailableBudget

type PodUnavailableBudget struct {
	// 最大不可用数量
	// maxUnavailable 和 minAvailable 互斥,maxUnavailable 优先生效
	MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
	// 最小可用数量
	MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"`
}

pod 干扰预算配置

type Service

type Service struct {
	// 是否是无头服务
	Headless bool `json:"headless,omitempty"`
	// 端口列表
	Ports []v1.ServicePort `json:"ports,omitempty"`
}

k8s service 配置

type ServiceTrait

type ServiceTrait struct{}

func (*ServiceTrait) Generate

func (*ServiceTrait) Generate(ttemp *rocketv1alpha1.Trait, obj interface{}) error

func (*ServiceTrait) Handler

func (st *ServiceTrait) Handler(ttemp *rocketv1alpha1.Trait, app *rocketv1alpha1.Application,
	event EventType, client *Client) error

type Trait

type Trait interface {
	// 根据给定的 traitTemplate 生成相应的配置
	Generate(ttemp *rocketv1alpha1.Trait, obj interface{}) error
	// 根据 trait 进行相应的处理
	Handler(trait *rocketv1alpha1.Trait, app *rocketv1alpha1.Application,
		event EventType, client *Client) error
}

func NewPubTrait

func NewPubTrait() Trait

func NewServiceTrait

func NewServiceTrait() Trait

Jump to

Keyboard shortcuts

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