Documentation ¶
Index ¶
- Variables
- func DecideOps(c *cke.Cluster, cs *cke.ClusterStatus, constraints *cke.Constraints, ...) ([]cke.Operator, cke.OperationPhase)
- func RunIntegrator(ctx context.Context, it Integrator) error
- type APIError
- type Config
- type Controller
- type DecideOpsRebootArgs
- type Integrator
- type NodeFilter
- func (nf *NodeFilter) APIServerOutdatedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) APIServerStoppedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) ControlPlane() []*cke.Node
- func (nf *NodeFilter) ControllerManagerOutdatedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) ControllerManagerStoppedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) CordonedNodes() (nodes []*corev1.Node)
- func (nf *NodeFilter) EtcdBootstrapped() bool
- func (nf *NodeFilter) EtcdIsGood() bool
- func (nf *NodeFilter) EtcdNewMembers() (nodes []*cke.Node)
- func (nf *NodeFilter) EtcdNonCPMembers(healthy bool) (nodes []*cke.Node, ids []uint64)
- func (nf *NodeFilter) EtcdNonClusterMembers(healthy bool) (members []*etcdserverpb.Member)
- func (nf *NodeFilter) EtcdOutdatedMembers() (nodes []*cke.Node)
- func (nf *NodeFilter) EtcdRiversOutdatedNodes() (cps []*cke.Node)
- func (nf *NodeFilter) EtcdRiversStoppedNodes() (cps []*cke.Node)
- func (nf *NodeFilter) EtcdStoppedMembers() (nodes []*cke.Node)
- func (nf *NodeFilter) EtcdUnmarkedMembers() (nodes []*cke.Node)
- func (nf *NodeFilter) EtcdUnstartedMembers() (nodes []*cke.Node)
- func (nf *NodeFilter) HealthyAPIServer() *cke.Node
- func (nf *NodeFilter) HealthyAPIServerNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) InCluster(address string) bool
- func (nf *NodeFilter) KubeletOutdatedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) KubeletStoppedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) KubeletUnrecognizedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) NonClusterNodes() (nodes []*corev1.Node)
- func (nf *NodeFilter) OutdatedAttrsNodes() (nodes []*corev1.Node)
- func (nf *NodeFilter) ProxyOutdatedNodes(params cke.ProxyParams) (nodes []*cke.Node)
- func (nf *NodeFilter) ProxyRunningUnexpectedlyNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) ProxyStoppedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) RegisteredNodes(target []*cke.Node) (nodes []*cke.Node)
- func (nf *NodeFilter) RiversOutdatedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) RiversStoppedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) SSHConnectedNodes(targets []*cke.Node, includeControlPlane, includeWorker bool) (nodes []*cke.Node)
- func (nf *NodeFilter) SSHNotConnectedNodes(targets []*cke.Node, includeControlPlane, includeWorker bool) (nodes []*cke.Node)
- func (nf *NodeFilter) SchedulerOutdatedNodes(params cke.SchedulerParams) (nodes []*cke.Node)
- func (nf *NodeFilter) SchedulerStoppedNodes() (nodes []*cke.Node)
- func (nf *NodeFilter) UnhealthyAPIServerNodes() (nodes []*cke.Node)
- type Server
Constants ¶
This section is empty.
Variables ¶
var ( APIErrBadRequest = APIError{http.StatusBadRequest, "invalid request", nil} APIErrForbidden = APIError{http.StatusForbidden, "forbidden", nil} APIErrNotFound = APIError{http.StatusNotFound, "requested resource is not found", nil} APIErrBadMethod = APIError{http.StatusMethodNotAllowed, "method not allowed", nil} APIErrConflict = APIError{http.StatusConflict, "conflicted", nil} APIErrLengthRequired = APIError{http.StatusLengthRequired, "content-length is required", nil} APIErrTooLargeAsset = APIError{http.StatusRequestEntityTooLarge, "too large asset", nil} )
Common API errors
Functions ¶
func DecideOps ¶
func DecideOps(c *cke.Cluster, cs *cke.ClusterStatus, constraints *cke.Constraints, resources []cke.ResourceDefinition, rebootArgs DecideOpsRebootArgs, config *Config) ([]cke.Operator, cke.OperationPhase)
DecideOps returns the next operations to do and the operation phase. This returns nil when no operations need to be done.
func RunIntegrator ¶
func RunIntegrator(ctx context.Context, it Integrator) error
RunIntegrator simply executes Integrator until ctx is canceled. This is for debugging.
Types ¶
type APIError ¶
APIError is to define REST API errors.
func BadRequest ¶
BadRequest creates an APIError that describes what was bad in the request.
func InternalServerError ¶
InternalServerError creates an APIError.
type Config ¶ added in v1.26.1
type Config struct { // Interval is the interval of the main loop. Interval time.Duration // CertsGCInterval is the interval of the certificate garbage collection. CertsGCInterval time.Duration // MaxConcurrentUpdates is the maximum number of concurrent updates. MaxConcurrentUpdates int }
Config is the configuration for cke-server.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller manage operations
func NewController ¶
func NewController(s *concurrency.Session, addon Integrator, config *Config) Controller
NewController construct controller instance
func (Controller) GetClusterStatus ¶
func (c Controller) GetClusterStatus(ctx context.Context, cluster *cke.Cluster, inf cke.Infrastructure) (*cke.ClusterStatus, error)
GetClusterStatus consults the whole cluster and constructs *ClusterStatus.
func (Controller) Run ¶
func (c Controller) Run(ctx context.Context) error
Run execute procedures with leader elections
func (Controller) TidyExpiredCertificates ¶ added in v1.14.8
func (c Controller) TidyExpiredCertificates(ctx context.Context, client *vault.Client, ca string) error
TidyExpiredCertificates call tidy endpoints of Vault API
type DecideOpsRebootArgs ¶ added in v1.22.8
type DecideOpsRebootArgs struct { RQEntries []*cke.RebootQueueEntry NewlyDrained []*cke.RebootQueueEntry DrainCompleted []*cke.RebootQueueEntry DrainTimedout []*cke.RebootQueueEntry RebootDequeued []*cke.RebootQueueEntry RebootCancelled []*cke.RebootQueueEntry }
type Integrator ¶
type Integrator interface { // StartWatch starts watching etcd until the context is canceled. // // It should send an empty struct to the channel when some event occurs. // To avoid blocking, use select when sending. // // If the integrator does not implement StartWatch, simply return nil. StartWatch(context.Context, chan<- struct{}) error // Init is called just once when the server becomes a new leader. Init(ctx context.Context, leaderKey string) error // Do does something for CKE. leaderKey is an etcd object key that // exists as long as the current process is the leader. Do(ctx context.Context, leaderKey string, clusterStatus *cke.ClusterStatus) error }
Integrator defines interface to integrate external addon into CKE server.
type NodeFilter ¶
type NodeFilter struct {
// contains filtered or unexported fields
}
NodeFilter filters nodes to
func NewNodeFilter ¶
func NewNodeFilter(cluster *cke.Cluster, status *cke.ClusterStatus) *NodeFilter
NewNodeFilter creates and initializes NodeFilter.
func (*NodeFilter) APIServerOutdatedNodes ¶
func (nf *NodeFilter) APIServerOutdatedNodes() (nodes []*cke.Node)
APIServerOutdatedNodes returns nodes that are running API server with outdated image or params.
func (*NodeFilter) APIServerStoppedNodes ¶
func (nf *NodeFilter) APIServerStoppedNodes() (nodes []*cke.Node)
APIServerStoppedNodes returns control plane nodes that are not running API server.
func (*NodeFilter) ControlPlane ¶
func (nf *NodeFilter) ControlPlane() []*cke.Node
ControlPlane returns control plane nodes.
func (*NodeFilter) ControllerManagerOutdatedNodes ¶
func (nf *NodeFilter) ControllerManagerOutdatedNodes() (nodes []*cke.Node)
ControllerManagerOutdatedNodes returns nodes that are running controller manager with outdated image or params.
func (*NodeFilter) ControllerManagerStoppedNodes ¶
func (nf *NodeFilter) ControllerManagerStoppedNodes() (nodes []*cke.Node)
ControllerManagerStoppedNodes returns control plane nodes that are not running controller manager.
func (*NodeFilter) CordonedNodes ¶ added in v1.18.6
func (nf *NodeFilter) CordonedNodes() (nodes []*corev1.Node)
CordonedNodes returns nodes that are cordoned and annotated as reboot/repair operation targets.
func (*NodeFilter) EtcdBootstrapped ¶
func (nf *NodeFilter) EtcdBootstrapped() bool
EtcdBootstrapped returns true if etcd cluster has been bootstrapped.
func (*NodeFilter) EtcdIsGood ¶
func (nf *NodeFilter) EtcdIsGood() bool
EtcdIsGood returns true if etcd cluster is responding and all members are in sync.
func (*NodeFilter) EtcdNewMembers ¶
func (nf *NodeFilter) EtcdNewMembers() (nodes []*cke.Node)
EtcdNewMembers returns control plane nodes to be added to the etcd cluster.
func (*NodeFilter) EtcdNonCPMembers ¶
func (nf *NodeFilter) EtcdNonCPMembers(healthy bool) (nodes []*cke.Node, ids []uint64)
EtcdNonCPMembers returns nodes and IDs of etcd members running on non control plane nodes. The order of ids matches the order of nodes.
func (*NodeFilter) EtcdNonClusterMembers ¶ added in v1.14.1
func (nf *NodeFilter) EtcdNonClusterMembers(healthy bool) (members []*etcdserverpb.Member)
EtcdNonClusterMembers returns etcd members whose IDs are not defined in cluster YAML.
func (*NodeFilter) EtcdOutdatedMembers ¶
func (nf *NodeFilter) EtcdOutdatedMembers() (nodes []*cke.Node)
EtcdOutdatedMembers returns nodes that are running etcd with outdated image or params.
func (*NodeFilter) EtcdRiversOutdatedNodes ¶ added in v1.14.1
func (nf *NodeFilter) EtcdRiversOutdatedNodes() (cps []*cke.Node)
EtcdRiversOutdatedNodes returns nodes that are running rivers with outdated image or params.
func (*NodeFilter) EtcdRiversStoppedNodes ¶ added in v1.14.1
func (nf *NodeFilter) EtcdRiversStoppedNodes() (cps []*cke.Node)
EtcdRiversStoppedNodes returns nodes that are not running rivers.
func (*NodeFilter) EtcdStoppedMembers ¶
func (nf *NodeFilter) EtcdStoppedMembers() (nodes []*cke.Node)
EtcdStoppedMembers returns control plane nodes that are not running etcd.
func (*NodeFilter) EtcdUnmarkedMembers ¶ added in v1.24.2
func (nf *NodeFilter) EtcdUnmarkedMembers() (nodes []*cke.Node)
EtcdUnmarkedMembers returns nodes that are working as in-sync members of the etcd cluster but not marked as added members.
func (*NodeFilter) EtcdUnstartedMembers ¶
func (nf *NodeFilter) EtcdUnstartedMembers() (nodes []*cke.Node)
EtcdUnstartedMembers returns nodes that are added to members but not really joined to the etcd cluster. Such members need to be re-added.
func (*NodeFilter) HealthyAPIServer ¶
func (nf *NodeFilter) HealthyAPIServer() *cke.Node
HealthyAPIServer returns a control plane node running healthy API server. If there is no healthy API server, it returns the first control plane node.
func (*NodeFilter) HealthyAPIServerNodes ¶ added in v1.15.4
func (nf *NodeFilter) HealthyAPIServerNodes() (nodes []*cke.Node)
HealthyAPIServerNodes returns nodes which have healthy API servers
func (*NodeFilter) InCluster ¶
func (nf *NodeFilter) InCluster(address string) bool
InCluster returns true if a node having address is defined in cluster YAML.
func (*NodeFilter) KubeletOutdatedNodes ¶
func (nf *NodeFilter) KubeletOutdatedNodes() (nodes []*cke.Node)
KubeletOutdatedNodes returns nodes that are running kubelet with outdated image or params.
func (*NodeFilter) KubeletStoppedNodes ¶
func (nf *NodeFilter) KubeletStoppedNodes() (nodes []*cke.Node)
KubeletStoppedNodes returns nodes that are not running kubelet.
func (*NodeFilter) KubeletUnrecognizedNodes ¶ added in v1.14.13
func (nf *NodeFilter) KubeletUnrecognizedNodes() (nodes []*cke.Node)
KubeletUnrecognizedNodes returns nodes of which kubelet is still running but not recognized by k8s.
func (*NodeFilter) NonClusterNodes ¶
func (nf *NodeFilter) NonClusterNodes() (nodes []*corev1.Node)
NonClusterNodes returns nodes not defined in cluster YAML.
func (*NodeFilter) OutdatedAttrsNodes ¶
func (nf *NodeFilter) OutdatedAttrsNodes() (nodes []*corev1.Node)
OutdatedAttrsNodes returns nodes that have outdated set of labels, attributes, and/or taints.
func (*NodeFilter) ProxyOutdatedNodes ¶
func (nf *NodeFilter) ProxyOutdatedNodes(params cke.ProxyParams) (nodes []*cke.Node)
ProxyOutdatedNodes returns nodes that are running kube-proxy with outdated image or params.
func (*NodeFilter) ProxyRunningUnexpectedlyNodes ¶ added in v1.20.4
func (nf *NodeFilter) ProxyRunningUnexpectedlyNodes() (nodes []*cke.Node)
ProxyRunningUnexpectedlyNodes returns nodes that are running kube-proxy unexpectedly.
func (*NodeFilter) ProxyStoppedNodes ¶
func (nf *NodeFilter) ProxyStoppedNodes() (nodes []*cke.Node)
ProxyStoppedNodes returns nodes that are not running kube-proxy.
func (*NodeFilter) RegisteredNodes ¶ added in v1.27.5
func (nf *NodeFilter) RegisteredNodes(target []*cke.Node) (nodes []*cke.Node)
RegisteredNodes returns nodes that are registered on Kubernetes out of targets.
func (*NodeFilter) RiversOutdatedNodes ¶
func (nf *NodeFilter) RiversOutdatedNodes() (nodes []*cke.Node)
RiversOutdatedNodes returns nodes that are running rivers with outdated image or params.
func (*NodeFilter) RiversStoppedNodes ¶
func (nf *NodeFilter) RiversStoppedNodes() (nodes []*cke.Node)
RiversStoppedNodes returns nodes that are not running rivers.
func (*NodeFilter) SSHConnectedNodes ¶ added in v1.15.4
func (nf *NodeFilter) SSHConnectedNodes(targets []*cke.Node, includeControlPlane, includeWorker bool) (nodes []*cke.Node)
SSHConnectedNodes returns nodes that are connected via SSH out of targets
func (*NodeFilter) SSHNotConnectedNodes ¶ added in v1.15.4
func (nf *NodeFilter) SSHNotConnectedNodes(targets []*cke.Node, includeControlPlane, includeWorker bool) (nodes []*cke.Node)
SSHNotConnectedNodes returns nodes that are not connected via SSH out of targets.
func (*NodeFilter) SchedulerOutdatedNodes ¶
func (nf *NodeFilter) SchedulerOutdatedNodes(params cke.SchedulerParams) (nodes []*cke.Node)
func (*NodeFilter) SchedulerStoppedNodes ¶
func (nf *NodeFilter) SchedulerStoppedNodes() (nodes []*cke.Node)
SchedulerStoppedNodes returns control plane nodes that are not running kube-scheduler.
func (*NodeFilter) UnhealthyAPIServerNodes ¶ added in v1.15.4
func (nf *NodeFilter) UnhealthyAPIServerNodes() (nodes []*cke.Node)
UnhealthyAPIServerNodes returns nodes which have unhealthy API servers