-
Notifications
You must be signed in to change notification settings - Fork 499
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
support mysqlNodePort and statusNodePort #2941
Conversation
examples/basic/tidb-cluster.yaml
Outdated
@@ -33,5 +33,8 @@ spec: | |||
baseImage: pingcap/tidb | |||
replicas: 1 | |||
service: | |||
type: ClusterIP | |||
type: NodePort | |||
exposeStatus: true |
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.
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.
This is updated by mistake.. I think we don't need to update this file
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.
updated in 2a9b38e
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.
IMO this is not necessary for the basic example
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.
deleted in da93fcb
pkg/util/util.go
Outdated
@@ -240,6 +240,13 @@ func RetainManagedFields(desiredSvc, existedSvc *corev1.Service) { | |||
// Retain NodePorts | |||
for id, dport := range desiredSvc.Spec.Ports { | |||
for _, eport := range existedSvc.Spec.Ports { | |||
if tidbSvcSpec != nil { | |||
if dport.Name == "mysql-client" && tidbSvcSpec.GetMySQLNodePort() != 0 { |
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.
The port name for tidb is configurable.
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.
BTW, this should be a common function that may be called by other service sync functions and may also add other fields (even if not now), is it better to handle this out of this function? WDYT @lichunzhu @cofyc
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.
Or we may check dport.NodePort
, if !=0, skip the logic to get port from existedSvc?
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.
nice advice, updated in 2a9b38e
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
Codecov Report
@@ Coverage Diff @@
## master #2941 +/- ##
=======================================
Coverage 40.91% 40.91%
=======================================
Files 153 153
Lines 16748 16752 +4
=======================================
+ Hits 6852 6854 +2
- Misses 9354 9355 +1
- Partials 542 543 +1
Flags with carried forward coverage won't be shown. Click here to find out more. |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-1.1 in PR #2986 |
* cherry pick #2941 to release-1.1 Signed-off-by: ti-srebot <[email protected]> * regenerate code Co-authored-by: Chunzhu Li <[email protected]>
What problem does this PR solve?
resolve #2915. support user specied
mysqlNodePort
andstatusNodePort
What is changed and how does it work?
MySQLNodePort
andStatusNodePort
field to support specifiedmysqlNodePort
and `statusNodePort.MySQLNodePort
orStatusNodePort
is set.Check List
Tests
Test manually set
mySQLNodePort
andstatusNodePort
. They can work in svc. Besides, if we don't set them, the svc port won't change every time.Related changes
Does this PR introduce a user-facing change?: