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 store labels #3784

Merged
merged 10 commits into from
Feb 25, 2021
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 @@ -18057,6 +18057,18 @@ Defaults to 3m</p>
<p>StorageVolumes configure additional storage for TiKV pods.</p>
</td>
</tr>
<tr>
<td>
<code>StoreLabels</code></br>
<em>
[]string
</em>
</td>
<td>
<em>(Optional)</em>
<p>StoreLabels configure additional labels for TiKV stores.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="tikvstatus">TiKVStatus</h3>
Expand Down
4 changes: 4 additions & 0 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10760,6 +10760,10 @@ spec:
type: object
tikv:
properties:
StoreLabels:
items:
type: string
type: array
additionalContainers:
items:
properties:
Expand Down
14 changes: 14 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 @@ -468,6 +468,10 @@ type TiKVSpec struct {
// StorageVolumes configure additional storage for TiKV pods.
// +optional
StorageVolumes []StorageVolume `json:"storageVolumes,omitempty"`

// StoreLabels configure additional labels for TiKV stores.
L3T marked this conversation as resolved.
Show resolved Hide resolved
// +optional
StoreLabels []string `json:"StoreLabels,omitempty"`
L3T marked this conversation as resolved.
Show resolved Hide resolved
}

// TiFlashSpec contains details of TiFlash members
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.

6 changes: 3 additions & 3 deletions pkg/manager/member/tikv_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,8 @@ func (m *tikvMemberManager) setStoreLabelsForTiKV(tc *v1alpha1.TidbCluster) (int
return setCount, err
}

locationLabels := []string(config.Replication.LocationLabels)
if locationLabels == nil {
StoreLabels := append(config.Replication.LocationLabels, tc.Spec.TiKV.StoreLabels...)
L3T marked this conversation as resolved.
Show resolved Hide resolved
if StoreLabels == nil {
return setCount, nil
}

Expand All @@ -843,7 +843,7 @@ func (m *tikvMemberManager) setStoreLabelsForTiKV(tc *v1alpha1.TidbCluster) (int
}

nodeName := pod.Spec.NodeName
ls, err := m.getNodeLabels(nodeName, locationLabels)
ls, err := m.getNodeLabels(nodeName, StoreLabels)
if err != nil || len(ls) == 0 {
klog.Warningf("node: [%s] has no node labels, skipping set store labels for Pod: [%s/%s]", nodeName, ns, podName)
continue
Expand Down