Documentation ¶
Index ¶
- func AddToMgr(mgr manager.Manager, adapter ReconcileAdapter) error
- func GetEmployerByEmployee(ctx context.Context, client client.Client, employee client.Object) ([]string, error)
- type CUDEmployeeResults
- type CUDEmployerResults
- type Consist
- type EnqueueServiceByPod
- func (e *EnqueueServiceByPod) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueServiceByPod) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueServiceByPod) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueServiceByPod) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
- type EnqueueServiceWithRateLimit
- func (e *EnqueueServiceWithRateLimit) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueServiceWithRateLimit) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueServiceWithRateLimit) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueServiceWithRateLimit) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
- type ExpectedFinalizerRecordOptions
- type IEmployee
- type IEmployer
- type MultiClusterOptions
- type PodEmployeeStatuses
- type PodExpectedFinalizerOps
- type ReconcileAdapter
- type ReconcileLifecycleOptions
- type ReconcileOptions
- type ReconcileRequeueOptions
- type ReconcileWatchOptions
- type StatusRecordOptions
- type ToCUDEmployees
- type ToCUDEmployer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CUDEmployeeResults ¶ added in v0.0.2
type CUDEmployerResults ¶ added in v0.0.2
type Consist ¶
func NewReconcile ¶
func NewReconcile(mgr manager.Manager, reconcileAdapter ReconcileAdapter) *Consist
type EnqueueServiceByPod ¶
type EnqueueServiceByPod struct {
// contains filtered or unexported fields
}
func (*EnqueueServiceByPod) Create ¶
func (e *EnqueueServiceByPod) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
func (*EnqueueServiceByPod) Delete ¶
func (e *EnqueueServiceByPod) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
func (*EnqueueServiceByPod) Generic ¶
func (e *EnqueueServiceByPod) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
func (*EnqueueServiceByPod) Update ¶
func (e *EnqueueServiceByPod) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
type EnqueueServiceWithRateLimit ¶
type EnqueueServiceWithRateLimit struct{}
func (*EnqueueServiceWithRateLimit) Create ¶
func (e *EnqueueServiceWithRateLimit) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
func (*EnqueueServiceWithRateLimit) Delete ¶
func (e *EnqueueServiceWithRateLimit) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
func (*EnqueueServiceWithRateLimit) Generic ¶
func (e *EnqueueServiceWithRateLimit) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
func (*EnqueueServiceWithRateLimit) Update ¶
func (e *EnqueueServiceWithRateLimit) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
type ExpectedFinalizerRecordOptions ¶ added in v0.0.2
type ExpectedFinalizerRecordOptions interface { // NeedRecordExpectedFinalizerCondition only needed for those adapters that follow PodOpsLifecycle, // in the case of employment relationship might change(like label/selector changes) and the compensation logic // of kusionstack.io/operating can't handle the changes. // in most cases, this option is not needed. NeedRecordExpectedFinalizerCondition() bool }
type IEmployee ¶
type IEmployee interface { GetEmployeeId() string // GetEmployeeName returns employee's name // note: in multi cluster case, if adapters deployed in fed and employees are under local, the format of employeeName // should be "employeeName" + "#" + "clusterName" GetEmployeeName() string GetEmployeeStatuses() interface{} EmployeeEqual(employee IEmployee) (bool, error) }
type MultiClusterOptions ¶ added in v0.0.2
type MultiClusterOptions interface {
EmployeeFed() bool
}
MultiClusterOptions defines whether employee is under fed cluster "kusionstack.io/kube-utils/multicluster" is the solution for multi cluster if MultiClusterOptions implemented, the cache and client of manager should be generated via "kusionstack.io/kube-utils/multicluster"
type PodEmployeeStatuses ¶
type PodEmployeeStatuses struct { // can be set by calling SetCommonPodEmployeeStatus Ip string `json:"ip,omitempty"` Ipv6 string `json:"ipv6,omitempty"` LifecycleReady bool `json:"lifecycleReady,omitempty"` // extra info related to backend provider ExtraStatus interface{} `json:"extraStatus,omitempty"` }
func GetCommonPodEmployeeStatus ¶
func GetCommonPodEmployeeStatus(pod *corev1.Pod) (PodEmployeeStatuses, error)
GetCommonPodEmployeeStatus called by ReconcileAdapter's GetExpectedEmployee/GetCurrentEmployee
type PodExpectedFinalizerOps ¶
type ReconcileAdapter ¶
type ReconcileAdapter interface { GetControllerName() string // GetSelectedEmployeeNames returns employees' names selected by employer // note: in multi cluster case, if adapters deployed in fed and employees are under local, the format of employeeName // should be "employeeName" + "#" + "clusterName" GetSelectedEmployeeNames(ctx context.Context, employer client.Object) ([]string, error) // GetExpectedEmployer and GetCurrentEmployer return expect/current status of employer from related backend provider GetExpectedEmployer(ctx context.Context, employer client.Object) ([]IEmployer, error) GetCurrentEmployer(ctx context.Context, employer client.Object) ([]IEmployer, error) // CreateEmployer/UpdateEmployer/DeleteEmployer handles creation/update/deletion of resources related to employer on related backend provider CreateEmployer(ctx context.Context, employer client.Object, toCreates []IEmployer) ([]IEmployer, []IEmployer, error) UpdateEmployer(ctx context.Context, employer client.Object, toUpdates []IEmployer) ([]IEmployer, []IEmployer, error) DeleteEmployer(ctx context.Context, employer client.Object, toDeletes []IEmployer) ([]IEmployer, []IEmployer, error) // GetExpectedEmployee and GetCurrentEmployee return expect/current status of employees from related backend provider GetExpectedEmployee(ctx context.Context, employer client.Object) ([]IEmployee, error) GetCurrentEmployee(ctx context.Context, employer client.Object) ([]IEmployee, error) // CreateEmployees/UpdateEmployees/DeleteEmployees handles creation/update/deletion of resources related to employee on related backend provider CreateEmployees(ctx context.Context, employer client.Object, toCreates []IEmployee) ([]IEmployee, []IEmployee, error) UpdateEmployees(ctx context.Context, employer client.Object, toUpdates []IEmployee) ([]IEmployee, []IEmployee, error) DeleteEmployees(ctx context.Context, employer client.Object, toDeletes []IEmployee) ([]IEmployee, []IEmployee, error) }
ReconcileAdapter is the interface that customized controllers should implement.
type ReconcileLifecycleOptions ¶
type ReconcileLifecycleOptions interface { FollowPodOpsLifeCycle() bool // NeedRecordLifecycleFinalizerCondition only needed for those adapters that follow PodOpsLifecycle, // in the case of employment relationship might change and resources in backend provider might be changed by others. NeedRecordLifecycleFinalizerCondition() bool }
ReconcileLifecycleOptions defines whether PodOpsLifecycle followed and whether employees' LifecycleFinalizer conditions need to be Recorded/Erased to employer's anno. If not implemented, the default options would be: FollowPodOpsLifeCycle: true and NeedRecordLifecycleFinalizerCondition: false
type ReconcileOptions ¶
type ReconcileOptions interface { GetRateLimiter() ratelimiter.RateLimiter GetMaxConcurrent() int }
ReconcileOptions includes max concurrent reconciles and rate limiter, max concurrent reconcile: 5 and DefaultControllerRateLimiter() will be used if ReconcileOptions not implemented.
type ReconcileRequeueOptions ¶
type ReconcileWatchOptions ¶
type ReconcileWatchOptions interface { NewEmployer() client.Object NewEmployee() client.Object EmployerEventHandler() handler.EventHandler EmployeeEventHandler() handler.EventHandler EmployerPredicates() predicate.Funcs EmployeePredicates() predicate.Funcs }
ReconcileWatchOptions defines what employer and employee is and how controller watch default employer: Service, default employee: Pod Recommend: implement ReconcileWatchOptions if Employer resource might be reconciled by other controller, different Predicates make an employer won't be reconciled by more than one controller so that LifecycleFinalizer won't be solved incorrectly.
type StatusRecordOptions ¶ added in v0.0.2
type StatusRecordOptions interface { RecordStatuses(ctx context.Context, employer client.Object, cudEmployerResults CUDEmployerResults, cudEmployeeResults CUDEmployeeResults) error }
StatusRecordOptions defines methods of record something for adapters