Skip to content

Commit

Permalink
Add AutoScalerRef in TidbCluster Status (#2791) (#2800)
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

Co-authored-by: Song Gao <disxiaofei@163.com>
  • Loading branch information
ti-srebot and Yisaer authored Jun 23, 2020
1 parent 4f676df commit eabf4f9
Show file tree
Hide file tree
Showing 17 changed files with 413 additions and 268 deletions.
80 changes: 50 additions & 30 deletions docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2572,36 +2572,6 @@ string
</tr>
<tr>
<td>
<code>scaleOutThreshold</code></br>
<em>
int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>ScaleOutThreshold describe the consecutive threshold for the auto-scaling,
if the consecutive counts of the scale-out result in auto-scaling reach this number,
the auto-scaling would be performed.
If not set, the default value is 3.</p>
</td>
</tr>
<tr>
<td>
<code>scaleInThreshold</code></br>
<em>
int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>ScaleInThreshold describe the consecutive threshold for the auto-scaling,
if the consecutive counts of the scale-in result in auto-scaling reach this number,
the auto-scaling would be performed.
If not set, the default value is 5.</p>
</td>
</tr>
<tr>
<td>
<code>externalEndpoint</code></br>
<em>
<a href="#externalendpoint">
Expand Down Expand Up @@ -14725,6 +14695,44 @@ BasicAutoScalerStatus
</tr>
</tbody>
</table>
<h3 id="tidbclusterautoscalerref">TidbClusterAutoScalerRef</h3>
<p>
(<em>Appears on:</em>
<a href="#tidbclusterstatus">TidbClusterStatus</a>)
</p>
<p>
<p>TidbClusterAutoScalerRef indicates to the target auto-scaler ref</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>name</code></br>
<em>
string
</em>
</td>
<td>
</td>
</tr>
<tr>
<td>
<code>namespace</code></br>
<em>
string
</em>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<h3 id="tidbclusterautoscalerspec">TidbClusterAutoScalerSpec</h3>
<p>
(<em>Appears on:</em>
Expand Down Expand Up @@ -15482,6 +15490,18 @@ TidbMonitorRef
</tr>
<tr>
<td>
<code>auto-scaler,omitempyt</code></br>
<em>
<a href="#tidbclusterautoscalerref">
TidbClusterAutoScalerRef
</a>
</em>
</td>
<td>
</td>
</tr>
<tr>
<td>
<code>conditions</code></br>
<em>
<a href="#tidbclustercondition">
Expand Down
12 changes: 0 additions & 12 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12791,15 +12791,9 @@ spec:
scaleInIntervalSeconds:
format: int32
type: integer
scaleInThreshold:
format: int32
type: integer
scaleOutIntervalSeconds:
format: int32
type: integer
scaleOutThreshold:
format: int32
type: integer
required:
- maxReplicas
type: object
Expand Down Expand Up @@ -12846,15 +12840,9 @@ spec:
scaleInIntervalSeconds:
format: int32
type: integer
scaleInThreshold:
format: int32
type: integer
scaleOutIntervalSeconds:
format: int32
type: integer
scaleOutThreshold:
format: int32
type: integer
required:
- maxReplicas
type: object
Expand Down
69 changes: 27 additions & 42 deletions pkg/apis/pingcap/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 7 additions & 15 deletions pkg/apis/pingcap/v1alpha1/tidbclusterautoscaler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,6 @@ type BasicAutoScalerSpec struct {
// MetricsTimeDuration describe the Time duration to be queried in the Prometheus
// +optional
MetricsTimeDuration *string `json:"metricsTimeDuration,omitempty"`

// ScaleOutThreshold describe the consecutive threshold for the auto-scaling,
// if the consecutive counts of the scale-out result in auto-scaling reach this number,
// the auto-scaling would be performed.
// If not set, the default value is 3.
// +optional
ScaleOutThreshold *int32 `json:"scaleOutThreshold,omitempty"`

// ScaleInThreshold describe the consecutive threshold for the auto-scaling,
// if the consecutive counts of the scale-in result in auto-scaling reach this number,
// the auto-scaling would be performed.
// If not set, the default value is 5.
// +optional
ScaleInThreshold *int32 `json:"scaleInThreshold,omitempty"`

// ExternalEndpoint makes the auto-scaler controller able to query the external service
// to fetch the recommended replicas for TiKV/TiDB
// +optional
Expand Down Expand Up @@ -246,3 +231,10 @@ type SecretRef struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
}

// +k8s:openapi-gen=true
// TidbClusterAutoScalerRef indicates to the target auto-scaler ref
type TidbClusterAutoScalerRef struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
}
17 changes: 9 additions & 8 deletions pkg/apis/pingcap/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,15 @@ type TidbClusterSpec struct {

// TidbClusterStatus represents the current status of a tidb cluster.
type TidbClusterStatus struct {
ClusterID string `json:"clusterID,omitempty"`
PD PDStatus `json:"pd,omitempty"`
TiKV TiKVStatus `json:"tikv,omitempty"`
TiDB TiDBStatus `json:"tidb,omitempty"`
Pump PumpStatus `josn:"pump,omitempty"`
TiFlash TiFlashStatus `json:"tiflash,omitempty"`
TiCDC TiCDCStatus `json:"ticdc,omitempty"`
Monitor *TidbMonitorRef `json:"monitor,omitempty"`
ClusterID string `json:"clusterID,omitempty"`
PD PDStatus `json:"pd,omitempty"`
TiKV TiKVStatus `json:"tikv,omitempty"`
TiDB TiDBStatus `json:"tidb,omitempty"`
Pump PumpStatus `josn:"pump,omitempty"`
TiFlash TiFlashStatus `json:"tiflash,omitempty"`
TiCDC TiCDCStatus `json:"ticdc,omitempty"`
Monitor *TidbMonitorRef `json:"monitor,omitempty"`
AutoScaler *TidbClusterAutoScalerRef `json:"auto-scaler,omitempyt"`
// Represents the latest available observations of a tidb cluster's state.
// +optional
Conditions []TidbClusterCondition `json:"conditions,omitempty"`
Expand Down
31 changes: 21 additions & 10 deletions pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eabf4f9

Please sign in to comment.