Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add switch to control the Dashboard Proxy (#2713) #2719

Merged
merged 2 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6476,6 +6476,18 @@ string
which used by Dashboard.</p>
</td>
</tr>
<tr>
<td>
<code>enableDashboardInternalProxy</code></br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>EnableDashboardInternalProxy would directly set <code>internal-proxy</code> in the <code>PdConfig</code></p>
</td>
</tr>
</tbody>
</table>
<h3 id="pdstatus">PDStatus</h3>
Expand Down
2 changes: 2 additions & 0 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,8 @@ spec:
type: string
dataSubDir:
type: string
enableDashboardInternalProxy:
type: boolean
env:
items:
properties:
Expand Down
7 changes: 7 additions & 0 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.

4 changes: 4 additions & 0 deletions pkg/apis/pingcap/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ type PDSpec struct {
// which used by Dashboard.
// +optional
TLSClientSecretName *string `json:"tlsClientSecretName,omitempty"`

// EnableDashboardInternalProxy would directly set `internal-proxy` in the `PdConfig`
// +optional
EnableDashboardInternalProxy *bool `json:"enableDashboardInternalProxy,omitempty"`
}

// +k8s:openapi-gen=true
Expand Down
5 changes: 5 additions & 0 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.

11 changes: 11 additions & 0 deletions pkg/manager/member/pd_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,17 @@ func getPDConfigMap(tc *v1alpha1.TidbCluster) (*corev1.ConfigMap, error) {
config.Dashboard.TiDBKeyPath = pointer.StringPtr(path.Join(tidbClientCertPath, corev1.TLSPrivateKeyKey))
}

if tc.Spec.PD.EnableDashboardInternalProxy != nil {
if config.Dashboard != nil {
// EnableDashboardInternalProxy has a higher priority to cover the configuration in Dashboard
config.Dashboard.InternalProxy = pointer.BoolPtr(*tc.Spec.PD.EnableDashboardInternalProxy)
} else {
config.Dashboard = &v1alpha1.DashboardConfig{
InternalProxy: pointer.BoolPtr(*tc.Spec.PD.EnableDashboardInternalProxy),
}
}
}

confText, err := MarshalTOML(config)
if err != nil {
return nil, err
Expand Down