Documentation ¶
Index ¶
- func CalculatePodSliceSize(pods []*v1.Pod, replicas int) int
- func CalculateServiceSliceSize(services []*v1.Service, replicas int) int
- func FilterPodsForReplicaType(pods []*v1.Pod, replicaType string) ([]*v1.Pod, error)
- func FilterServicesForReplicaType(services []*v1.Service, replicaType string) ([]*v1.Service, error)
- func GenGeneralName(clusterName string, rtype string, index string) string
- func GetPodSlices(pods []*v1.Pod, replicas int, logger *log.Entry) [][]*v1.Pod
- func GetPortsFromCluster(spec *kubeclusterorgv1alpha1.ReplicaSpec, defaultContainerName string) (map[string]int32, error)
- func GetServiceSlices(services []*v1.Service, replicas int, logger *log.Entry) [][]*v1.Service
- func InitializeReplicaStatuses(clusterStatus *kubeclusterorgv1alpha1.ClusterStatus, ...)
- func MaxInt(x, y int) int
- func PastActiveDeadline(runPolicy *v1alpha1.RunPolicy, clusterStatus v1alpha1.ClusterStatus) bool
- func PastBackoffLimit(clusterName string, runPolicy *v1alpha1.RunPolicy, ...) (bool, error)
- func RecordAbnormalPods(activePods []*v1.Pod, object runtime.Object, recorder record.EventRecorder)
- func SetRestartPolicy(podTemplateSpec *v1.PodTemplateSpec, spec *kubeclusterorgv1alpha1.ReplicaSpec)
- func UpdateClusterReplicaStatuses(clusterStatus *kubeclusterorgv1alpha1.ClusterStatus, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculatePodSliceSize ¶
CalculatePodSliceSize compare max pod index with desired replicas and return larger size
func CalculateServiceSliceSize ¶
CalculateServiceSliceSize compare max pod index with desired replicas and return larger size
func FilterPodsForReplicaType ¶
FilterPodsForReplicaType returns pods belong to a replicaType.
func FilterServicesForReplicaType ¶
func FilterServicesForReplicaType(services []*v1.Service, replicaType string) ([]*v1.Service, error)
FilterServicesForReplicaType returns service belong to a replicaType.
func GetPodSlices ¶
GetPodSlices returns a slice, which element is the slice of pod. It gives enough information to caller to make decision to up/down scale resources.
func GetPortsFromCluster ¶
func GetPortsFromCluster(spec *kubeclusterorgv1alpha1.ReplicaSpec, defaultContainerName string) (map[string]int32, error)
GetPortsFromCluster gets the ports of cluster container. Port could be nil, if distributed communication strategy doesn't need and no other ports that need to be exposed.
func GetServiceSlices ¶
GetServiceSlices returns a slice, which element is the slice of service. Assume the return object is serviceSlices, then serviceSlices[i] is an array of pointers to services corresponding to Services for replica i.
func InitializeReplicaStatuses ¶
func InitializeReplicaStatuses(clusterStatus *kubeclusterorgv1alpha1.ClusterStatus, rtype kubeclusterorgv1alpha1.ReplicaType)
InitializeReplicaStatuses initializes the ReplicaStatuses for replica.
func PastActiveDeadline ¶
func PastActiveDeadline(runPolicy *v1alpha1.RunPolicy, clusterStatus v1alpha1.ClusterStatus) bool
PastActiveDeadline checks if cluster has ActiveDeadlineSeconds field set and if it is exceeded.
func PastBackoffLimit ¶
func PastBackoffLimit(clusterName string, runPolicy *v1alpha1.RunPolicy, replicas map[v1alpha1.ReplicaType]*v1alpha1.ReplicaSpec, pods []*v1.Pod, podFilterFunc func(pods []*v1.Pod, replicaType string) ([]*v1.Pod, error)) (bool, error)
PastBackoffLimit checks if container restartCounts sum exceeds BackoffLimit this method applies only to pods when restartPolicy is one of OnFailure, Always or ExitCode
func RecordAbnormalPods ¶
RecordAbnormalPods records the active pod whose latest condition is not in True status.
func SetRestartPolicy ¶
func SetRestartPolicy(podTemplateSpec *v1.PodTemplateSpec, spec *kubeclusterorgv1alpha1.ReplicaSpec)
SetRestartPolicy check the RestartPolicy defined in cluster spec and overwrite RestartPolicy in podTemplate if necessary
func UpdateClusterReplicaStatuses ¶
func UpdateClusterReplicaStatuses(clusterStatus *kubeclusterorgv1alpha1.ClusterStatus, rtype kubeclusterorgv1alpha1.ReplicaType, pod *corev1.Pod)
UpdateClusterReplicaStatuses updates the ClusterReplicaStatuses according to the pod.
Types ¶
This section is empty.