This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
/
executor.go
43 lines (38 loc) · 1.64 KB
/
executor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package controllers
import (
"k8s.io/client-go/kubernetes"
appslisters "k8s.io/client-go/listers/apps/v1beta1"
corelisters "k8s.io/client-go/listers/core/v1"
rbaclisters "k8s.io/client-go/listers/rbac/v1beta1"
"k8s.io/client-go/tools/record"
clientset "github.com/jetstack/navigator/pkg/client/clientset/versioned"
listers "github.com/jetstack/navigator/pkg/client/listers/navigator/v1alpha1"
)
// State contains the current state of the world, including accessors for
// modifying this state (e.g. kubernetes clientsets)
type State struct {
// The Clientset to use when performing updates
Clientset kubernetes.Interface
// The NavigatorClientset to use for updates
NavigatorClientset clientset.Interface
Recorder record.EventRecorder
StatefulSetLister appslisters.StatefulSetLister
ConfigMapLister corelisters.ConfigMapLister
PilotLister listers.PilotLister
PodLister corelisters.PodLister
ServiceLister corelisters.ServiceLister
ServiceAccountLister corelisters.ServiceAccountLister
RoleBindingLister rbaclisters.RoleBindingLister
RoleLister rbaclisters.RoleLister
}
type Action interface {
Name() string
// Execute should attempt to execute the action. If it is not possible to
// apply the specified changes (e.g. due to the cluster not being in a
// 'ready state', or some transient error) then an error will be returned
// so the action can be requeued. This allows for non-blocking blocking of
// actions, with retries. The workqueues default scheduling and rate limit
// will thus handle fairness within Navigator, and handle backing off on
// retries.
Execute(state *State) error
}