Skip to content

Commit

Permalink
Rename syncPeriod to pollingPeriod
Browse files Browse the repository at this point in the history
  • Loading branch information
barkbay committed Feb 24, 2021
1 parent d9075db commit 802fc67
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions pkg/apis/elasticsearch/v1/autoscaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ var (
// resources specification. By default we don't want a CPU limit, hence a default value of 0.0
defaultCPURequestsToLimitsRatio = 0.0

// defaultSyncPeriod is the default period between 2 Elasticsearch autoscaling API polls.
defaultSyncPeriod = 60 * time.Second
// defaultPollingPeriod is the default period between 2 Elasticsearch autoscaling API polls.
defaultPollingPeriod = 60 * time.Second
)

// -- Elasticsearch Autoscaling API structures
Expand All @@ -58,8 +58,8 @@ type AutoscalingPolicy struct {
type AutoscalingSpec struct {
AutoscalingPolicySpecs AutoscalingPolicySpecs `json:"policies"`

// SyncPeriod is the period at which to synchronize and poll the Elasticsearch autoscaling API.
SyncPeriod *metav1.Duration `json:"syncPeriod"`
// PollingPeriod is the period at which to synchronize and poll the Elasticsearch autoscaling API.
PollingPeriod *metav1.Duration `json:"pollingPeriod"`

// Elasticsearch is stored in the autoscaling spec for convenience. It should be removed once the autoscaling spec is
// fully part of the Elasticsearch specification.
Expand Down Expand Up @@ -166,12 +166,12 @@ func (aps AutoscalingPolicySpec) IsStorageDefined() bool {
return aps.Storage != nil
}

// GetSyncPeriodOrDefault returns the sync period as specified by the user in the autoscaling specification or the default value.
func (as AutoscalingSpec) GetSyncPeriodOrDefault() time.Duration {
if as.SyncPeriod != nil {
return as.SyncPeriod.Duration
// GetPollingPeriodOrDefault returns the polling period as specified by the user in the autoscaling specification or the default value.
func (as AutoscalingSpec) GetPollingPeriodOrDefault() time.Duration {
if as.PollingPeriod != nil {
return as.PollingPeriod.Duration
}
return defaultSyncPeriod
return defaultPollingPeriod
}

// findByRoles returns the autoscaling specification associated with a set of roles or nil if not found.
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/autoscaling/elasticsearch/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (r *ReconcileElasticsearch) Reconcile(ctx context.Context, request reconcil
func defaultResult(autoscalingSpecification esv1.AutoscalingSpec) reconcile.Result {
return reconcile.Result{
Requeue: true,
RequeueAfter: autoscalingSpecification.GetSyncPeriodOrDefault(),
RequeueAfter: autoscalingSpecification.GetPollingPeriodOrDefault(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ metadata:
}
}
}],
"syncPeriod": "42s"
"pollingPeriod": "42s"
}'
elasticsearch.alpha.elastic.co/autoscaling-status: '{"policies":[{"name":"di","nodeSets":[{"name":"di","nodeCount":8}],"resources":{"requests":{"cpu":"6","memory":"8Gi","storage":"4Gi"}},"state":[{"type":"HorizontalScalingLimitReached","messages":["Can''t provide total required storage 37106614256, max number of nodes is 8, requires 9 nodes"]}],"lastModificationTime":"2021-01-17T05:59:22Z"},{"name":"ml","nodeSets":[{"name":"ml","nodeCount":1}],"resources":{"requests":{"cpu":"2","memory":"2Gi"}},"state":[],"lastModificationTime":"2021-01-17T13:25:18Z"}]}'
elasticsearch.k8s.elastic.co/cluster-uuid: FghvC9XFS16wDXdAusm9yg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ metadata:
}
}
}],
"syncPeriod": "42s"
"pollingPeriod": "42s"
}'
elasticsearch.alpha.elastic.co/autoscaling-status: '{"policies":[{"name":"di","nodeSets":[{"name":"di","nodeCount":8}],"resources":{"requests":{"cpu":"6","memory":"8Gi","storage":"4Gi"}},"state":[{"type":"HorizontalScalingLimitReached","messages":["Can''t provide total required storage 37106614256, max number of nodes is 8, requires 9 nodes"]}],"lastModificationTime":"2021-01-17T05:59:22Z"},{"name":"ml","nodeSets":[{"name":"ml","nodeCount":1}],"resources":{"requests":{"cpu":"2","memory":"2Gi"}},"state":[],"lastModificationTime":"2021-01-17T13:25:18Z"}]}'
elasticsearch.k8s.elastic.co/cluster-uuid: FghvC9XFS16wDXdAusm9yg
Expand Down

0 comments on commit 802fc67

Please sign in to comment.