Skip to content

Commit

Permalink
Add extend ability to query external service for autoscaler (#2279) (#…
Browse files Browse the repository at this point in the history
…2375)

* add external ability
  • Loading branch information
Yisaer committed May 7, 2020
1 parent 76219b9 commit be2edab
Show file tree
Hide file tree
Showing 14 changed files with 519 additions and 68 deletions.
109 changes: 109 additions & 0 deletions docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2329,6 +2329,21 @@ 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">
ExternalEndpoint
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ExternalEndpoint makes the auto-scaler controller able to query the external service
to fetch the recommended replicas for TiKV/TiDB</p>
</td>
</tr>
</tbody>
</table>
<h3 id="basicautoscalerstatus">BasicAutoScalerStatus</h3>
Expand Down Expand Up @@ -3096,6 +3111,62 @@ imported from TiDB v3.1.0</p>
</tr>
</tbody>
</table>
<h3 id="externalendpoint">ExternalEndpoint</h3>
<p>
(<em>Appears on:</em>
<a href="#basicautoscalerspec">BasicAutoScalerSpec</a>)
</p>
<p>
<p>ExternalEndpoint describes the external service endpoint
which provides the ability to get the tikv/tidb auto-scaling recommended replicas</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>host</code></br>
<em>
string
</em>
</td>
<td>
<p>Host indicates the external service&rsquo;s host</p>
</td>
</tr>
<tr>
<td>
<code>port</code></br>
<em>
int32
</em>
</td>
<td>
<p>Port indicates the external service&rsquo;s port</p>
</td>
</tr>
<tr>
<td>
<code>tlsSecret</code></br>
<em>
<a href="#secretref">
SecretRef
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>TLSSecret indicates the Secret which stores the TLS configuration. If set, the operator will use https
to communicate to the external service</p>
</td>
</tr>
</tbody>
</table>
<h3 id="filelogconfig">FileLogConfig</h3>
<p>
(<em>Appears on:</em>
Expand Down Expand Up @@ -7298,6 +7369,44 @@ string
<p>
<p>S3StorageProviderType represents the specific storage provider that implements the S3 interface</p>
</p>
<h3 id="secretref">SecretRef</h3>
<p>
(<em>Appears on:</em>
<a href="#externalendpoint">ExternalEndpoint</a>)
</p>
<p>
<p>SecretRef indicates to secret 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="security">Security</h3>
<p>
(<em>Appears on:</em>
Expand Down
48 changes: 48 additions & 0 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5616,6 +5616,30 @@ spec:
type: object
tidb:
properties:
externalEndpoint:
properties:
host:
type: string
path:
type: string
port:
format: int32
type: integer
tlsSecret:
properties:
name:
type: string
namespace:
type: string
required:
- name
- namespace
type: object
required:
- host
- port
- path
type: object
maxReplicas:
format: int32
type: integer
Expand Down Expand Up @@ -5644,6 +5668,30 @@ spec:
type: object
tikv:
properties:
externalEndpoint:
properties:
host:
type: string
path:
type: string
port:
format: int32
type: integer
tlsSecret:
properties:
name:
type: string
namespace:
type: string
required:
- name
- namespace
type: object
required:
- host
- port
- path
type: object
maxReplicas:
format: int32
type: integer
Expand Down
95 changes: 92 additions & 3 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.

28 changes: 28 additions & 0 deletions pkg/apis/pingcap/v1alpha1/tidbclusterautoscaler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ type BasicAutoScalerSpec struct {
// 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
ExternalEndpoint *ExternalEndpoint `json:"externalEndpoint,omitempty"`
}

// +k8s:openapi-gen=true
Expand Down Expand Up @@ -198,3 +203,26 @@ type MetricsStatus struct {
// TargetValue indicates the threshold value for this metrics in auto-scaling
ThresholdValue string `json:"thresholdValue"`
}

// +k8s:openapi-gen=true
// ExternalEndpoint describes the external service endpoint
// which provides the ability to get the tikv/tidb auto-scaling recommended replicas
type ExternalEndpoint struct {
// Host indicates the external service's host
Host string `json:"host"`
// Port indicates the external service's port
Port int32 `json:"port"`
// Path indicates the external service's path
Path string `json:"path"`
// TLSSecret indicates the Secret which stores the TLS configuration. If set, the operator will use https
// to communicate to the external service
// +optional
TLSSecret *SecretRef `json:"tlsSecret,omitempty"`
}

// +k8s:openapi-gen=true
// SecretRef indicates to secret ref
type SecretRef struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
}
Loading

0 comments on commit be2edab

Please sign in to comment.