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

make controller logic independable with certain tidbcluster label #1419

Merged
merged 3 commits into from
Dec 26, 2019

Conversation

aylei
Copy link
Contributor

@aylei aylei commented Dec 25, 2019

Signed-off-by: Aylei rayingecho@gmail.com

close #1418

Check List

Tests

  • Unit test
  • E2E test

Does this PR introduce a user-facing change?:

The instance label key of resources owned by `tidbcluster` is default to the cluster name now. 

Signed-off-by: Aylei <rayingecho@gmail.com>
@@ -403,3 +404,14 @@ func (tc *TidbCluster) Timezone() string {
}
return tz
}

func (tc *TidbCluster) GetInstanceName() string {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could define a GetLabels() method and shadow the one of ObjectMeta so that the controller logic don't have to be modified, but that way we have to copy a map every time this method get called.

@aylei
Copy link
Contributor Author

aylei commented Dec 25, 2019

/run-all-test

1 similar comment
@aylei
Copy link
Contributor Author

aylei commented Dec 25, 2019

/run-all-test

@@ -1088,7 +1088,7 @@ func TestGetPDConfigMap(t *testing.T) {
Labels: map[string]string{
"app.kubernetes.io/name": "tidb-cluster",
"app.kubernetes.io/managed-by": "tidb-operator",
"app.kubernetes.io/instance": "",
"app.kubernetes.io/instance": "foo",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use const vars in label package to replace these keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both make sense, by not using the const var, the correctness of the labelKey itself is also tested, it just depends on the purpose of the UTs

@@ -676,7 +676,7 @@ func TestGetNewPumpConfigMap(t *testing.T) {
Labels: map[string]string{
"app.kubernetes.io/name": "tidb-cluster",
"app.kubernetes.io/managed-by": "tidb-operator",
"app.kubernetes.io/instance": "",
"app.kubernetes.io/instance": "foo",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor

@cofyc cofyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aylei aylei requested a review from onlymellb December 26, 2019 07:20
Copy link
Contributor

@onlymellb onlymellb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@weekface
Copy link
Contributor

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Dec 26, 2019

Your auto merge job has been accepted, waiting for 1417

@sre-bot
Copy link
Contributor

sre-bot commented Dec 26, 2019

/run-all-tests

@sre-bot sre-bot merged commit 2d407d9 into pingcap:master Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove dependency on tidbcluster labels
5 participants