-
Notifications
You must be signed in to change notification settings - Fork 500
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
Conversation
Signed-off-by: Aylei <rayingecho@gmail.com>
@@ -403,3 +404,14 @@ func (tc *TidbCluster) Timezone() string { | |||
} | |||
return tz | |||
} | |||
|
|||
func (tc *TidbCluster) GetInstanceName() string { |
There was a problem hiding this comment.
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.
/run-all-test |
1 similar comment
/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", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
Your auto merge job has been accepted, waiting for 1417 |
/run-all-tests |
Signed-off-by: Aylei rayingecho@gmail.com
close #1418
Check List
Tests
Does this PR introduce a user-facing change?: