Documentation ¶
Index ¶
- type AutoScaler
- type EDSResource
- func (r *EDSResource) APIVersion() string
- func (r *EDSResource) Drain(ctx context.Context, pod *v1.Pod) error
- func (r *EDSResource) EnsureResources() error
- func (r *EDSResource) Generation() int64
- func (r *EDSResource) Kind() string
- func (r *EDSResource) LabelSelector() map[string]string
- func (r *EDSResource) Labels() map[string]string
- func (r *EDSResource) Name() string
- func (r *EDSResource) Namespace() string
- func (r *EDSResource) OnStableReplicasHook(ctx context.Context) error
- func (r *EDSResource) PodTemplateSpec() *v1.PodTemplateSpec
- func (r *EDSResource) PreScaleDownHook(ctx context.Context) error
- func (r *EDSResource) Replicas() int32
- func (r *EDSResource) Self() runtime.Object
- func (r *EDSResource) UID() types.UID
- func (r *EDSResource) UpdateStatus(sts *appsv1.StatefulSet) error
- func (r *EDSResource) VolumeClaimTemplates() []v1.PersistentVolumeClaim
- type ESClient
- func (c *ESClient) Cleanup(ctx context.Context) error
- func (c *ESClient) CreateIndex(indexName, groupName string, shards, replicas int) error
- func (c *ESClient) DeleteIndex(indexName string) error
- func (c *ESClient) Drain(ctx context.Context, pod *v1.Pod) error
- func (c *ESClient) GetIndices() ([]ESIndex, error)
- func (c *ESClient) GetNodes() ([]ESNode, error)
- func (c *ESClient) GetShards() ([]ESShard, error)
- func (c *ESClient) UpdateIndexSettings(indices []ESIndex) error
- type ESHealth
- type ESIndex
- type ESNode
- type ESResource
- type ESSettings
- type ESShard
- type ElasticsearchMetricsCollector
- type ElasticsearchOperator
- type Operator
- type ScalingDirection
- type ScalingOperation
- type StatefulResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoScaler ¶
type AutoScaler struct {
// contains filtered or unexported fields
}
func NewAutoScaler ¶
func NewAutoScaler(es *ESResource, metricsInterval time.Duration, esClient *ESClient) *AutoScaler
func (*AutoScaler) GetScalingOperation ¶
func (as *AutoScaler) GetScalingOperation() (*ScalingOperation, error)
TODO: check alternative approach by configuring the tags used for `index.routing.allocation` and deriving the indices from there.
type EDSResource ¶
type EDSResource struct {
// contains filtered or unexported fields
}
func (*EDSResource) APIVersion ¶
func (r *EDSResource) APIVersion() string
func (*EDSResource) EnsureResources ¶
func (r *EDSResource) EnsureResources() error
func (*EDSResource) Generation ¶
func (r *EDSResource) Generation() int64
func (*EDSResource) Kind ¶
func (r *EDSResource) Kind() string
func (*EDSResource) LabelSelector ¶
func (r *EDSResource) LabelSelector() map[string]string
func (*EDSResource) Labels ¶
func (r *EDSResource) Labels() map[string]string
func (*EDSResource) Name ¶
func (r *EDSResource) Name() string
func (*EDSResource) Namespace ¶
func (r *EDSResource) Namespace() string
func (*EDSResource) OnStableReplicasHook ¶
func (r *EDSResource) OnStableReplicasHook(ctx context.Context) error
OnStableReplicasHook ensures that the indexReplicas is set as defined in the EDS scaling-operation annotation.
func (*EDSResource) PodTemplateSpec ¶
func (r *EDSResource) PodTemplateSpec() *v1.PodTemplateSpec
func (*EDSResource) PreScaleDownHook ¶
func (r *EDSResource) PreScaleDownHook(ctx context.Context) error
PreScaleDownHook ensures that the IndexReplicas is set as defined in the EDS 'scaling-operation' annotation prior to scaling down the internal StatefulSet.
func (*EDSResource) Replicas ¶
func (r *EDSResource) Replicas() int32
func (*EDSResource) Self ¶
func (r *EDSResource) Self() runtime.Object
func (*EDSResource) UID ¶
func (r *EDSResource) UID() types.UID
func (*EDSResource) UpdateStatus ¶
func (r *EDSResource) UpdateStatus(sts *appsv1.StatefulSet) error
UpdateStatus updates the status of the EDS to set the current replicas from StatefulSet and updating the observedGeneration.
func (*EDSResource) VolumeClaimTemplates ¶
func (r *EDSResource) VolumeClaimTemplates() []v1.PersistentVolumeClaim
type ESClient ¶
ESClient is a pod drainer which can drain data from Elasticsearch pods.
func (*ESClient) CreateIndex ¶
func (*ESClient) DeleteIndex ¶
func (*ESClient) GetIndices ¶
func (*ESClient) UpdateIndexSettings ¶
type ESIndex ¶
type ESIndex struct { Index string `json:"index"` Primaries int32 `json:"pri"` Replicas int32 `json:"rep"` }
ESIndex represent an index to be used in public APIs
type ESResource ¶
type ESResource struct { ElasticsearchDataSet *zv1.ElasticsearchDataSet StatefulSet *appsv1.StatefulSet MetricSet *zv1.ElasticsearchMetricSet Pods []v1.Pod }
func (*ESResource) Replicas ¶
func (es *ESResource) Replicas() int32
Replicas returns the desired node replicas of an ElasticsearchDataSet In case it was not specified, it will return '1'.
type ESSettings ¶
type ESSettings struct { Transient struct { Cluster struct { Routing struct { Allocation struct { Exclude struct { IP string `json:"_ip"` } `json:"exclude"` } `json:"allocation"` Rebalance struct { Enable string `json:"enable"` } `json:"rebalance"` } `json:"routing"` } `json:"cluster"` } `json:"transient"` }
ESSettings represent response from _cluster/settings
type ElasticsearchMetricsCollector ¶
type ElasticsearchMetricsCollector struct {
// contains filtered or unexported fields
}
type ElasticsearchOperator ¶
func NewElasticsearchOperator ¶
func NewElasticsearchOperator( client *clientset.Clientset, priorityNodeSelectors map[string]string, interval, autoscalerInterval time.Duration, operatorID, namespace, clusterDNSZone string, elasticsearchEndpoint *url.URL, ) *ElasticsearchOperator
NewElasticsearchOperator initializes a new ElasticsearchDataSet operator instance.
func (*ElasticsearchOperator) Run ¶
func (o *ElasticsearchOperator) Run(ctx context.Context)
Run runs the main loop of the operator.
type Operator ¶
type Operator struct {
// contains filtered or unexported fields
}
Operator is a generic operator that can manage Pods filtered by a selector.
type ScalingDirection ¶
type ScalingDirection int
const ( DOWN ScalingDirection = iota NONE UP )
func (ScalingDirection) String ¶
func (d ScalingDirection) String() string
type ScalingOperation ¶
type ScalingOperation struct { ScalingDirection ScalingDirection NodeReplicas *int32 IndexReplicas []ESIndex Description string }
type StatefulResource ¶
type StatefulResource interface { // Name returns the name of the resource. Name() string // Namespace returns the namespace where the resource is located. Namespace() string // APIVersion returns the APIVersion of the resource. APIVersion() string // Kind returns the kind of the resource. Kind() string // Generation returns the generation of the resource. Generation() int64 // UID returns the uid of the resource. UID() types.UID // Labels returns the labels of the resource. Labels() map[string]string // LabelSelector returns a set of labels to be used for label selecting. LabelSelector() map[string]string // Replicas returns the desired replicas of the resource. Replicas() int32 // PodTemplateSpec returns the pod template spec of the resource. This // is added to the underlying StatefulSet. PodTemplateSpec() *v1.PodTemplateSpec // VolumeClaimTemplates returns the volume claim templates of the // resource. This is added to the underlying StatefulSet. VolumeClaimTemplates() []v1.PersistentVolumeClaim Self() runtime.Object // EnsureResources EnsureResources() error // UpdateStatus updates the status of the StatefulResource. The // statefulset is parsed to provide additional information like // replicas to the status. UpdateStatus(sts *appsv1.StatefulSet) error // PreScaleDownHook is triggered when a scaledown is to be performed. // It's ensured that the hook will be triggered at least once, but it // may trigger multiple times e.g. if the scaledown fails at a later // stage and has to be retried. PreScaleDownHook(ctx context.Context) error // OnStableReplicasHook is triggered when the statefulSet is observed // to be stable meaning readyReplicas == desiredReplicas. // This hook can for instance be used to perform cleanup tasks. OnStableReplicasHook(ctx context.Context) error // Drain drains a pod for data. It's expected that the method only // returns after the pod has been drained. Drain(ctx context.Context, pod *v1.Pod) error }