server

package
v1.14.8 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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, resources []cke.ResourceDefinition) []cke.Operator

DecideOps returns the next operations to do. This returns nil when no operation 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

type APIError struct {
	Status  int
	Message string
	Err     error
}

APIError is to define REST API errors.

func BadRequest

func BadRequest(reason string) APIError

BadRequest creates an APIError that describes what was bad in the request.

func InternalServerError

func InternalServerError(e error) APIError

InternalServerError creates an APIError.

func (APIError) Error

func (e APIError) Error() string

Error implements error interface.

type Controller

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

Controller manage operations

func NewController

func NewController(s *concurrency.Session, interval, gcInterval, timeout time.Duration, addon Integrator) 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 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

	// 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) 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) 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) 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) 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) KubeletStoppedRegisteredNodes

func (nf *NodeFilter) KubeletStoppedRegisteredNodes() (nodes []*cke.Node)

KubeletStoppedRegisteredNodes returns nodes that are not running kubelet and are registered on Kubernetes.

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() (nodes []*cke.Node)

ProxyOutdatedNodes returns nodes that are running kube-proxy with outdated image or params.

func (*NodeFilter) ProxyStoppedNodes

func (nf *NodeFilter) ProxyStoppedNodes() (nodes []*cke.Node)

ProxyStoppedNodes returns nodes that are not running kube-proxy.

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) SchedulerOutdatedNodes

func (nf *NodeFilter) SchedulerOutdatedNodes(extenders []string) (nodes []*cke.Node)

SchedulerOutdatedNodes returns nodes that are running kube-scheduler with outdated image or params.

func (*NodeFilter) SchedulerStoppedNodes

func (nf *NodeFilter) SchedulerStoppedNodes() (nodes []*cke.Node)

SchedulerStoppedNodes returns control plane nodes that are not running kube-scheduler.

type Server

type Server struct {
	EtcdClient *clientv3.Client
	Timeout    time.Duration
}

Server is the cke server.

func (Server) ServeHTTP

func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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