Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Make ports more flexiable for customizations #131

Merged
merged 5 commits into from
Apr 13, 2021

Conversation

xieydd
Copy link
Member

@xieydd xieydd commented Apr 7, 2021

Signed-off-by: xieydd chrisydxie@tencent.com
Try to resolve issue #122 .
This has been tested with tf-operator.

# tf-job
Worker:
  template:
    spec:
      ports:
      - name: test
        containerPort: 80

# worker svc
spec:
  clusterIP: None
  ports:
  - name: test
    port: 80
    protocol: TCP
    targetPort: 80
  - name: tfjob-port
    port: 2222
    protocol: TCP
    targetPort: 2222
  selector:
    group-name: kubeflow.org
    job-name: dist-mnist-for-e2e-test
    replica-index: "0"
    replica-type: ps
  sessionAffinity: None
  type: ClusterIP

Copy link
Member

@gaocegege gaocegege left a comment

Choose a reason for hiding this comment

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

There is no need to make the map a pointer, I think.

return nil, nil
}
// GetPortsFromJob gets the ports of job container. Port could be nil, if distributed communication strategy doesn't need and no other ports that need to be exposed.
func (jc *JobController) GetPortsFromJob(spec *apiv1.ReplicaSpec) (*map[string]int32, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func (jc *JobController) GetPortsFromJob(spec *apiv1.ReplicaSpec) (*map[string]int32, error) {
func (jc *JobController) GetPortsFromJob(spec *apiv1.ReplicaSpec) (map[string]int32, error) {

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, you are right.

@Jeffwan
Copy link
Member

Jeffwan commented Apr 7, 2021

Looks straight forward. @gaocegege please have another look

/approve

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Jeffwan, terrytangyuan, xieydd

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Jeffwan,terrytangyuan]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@gaocegege gaocegege left a comment

Choose a reason for hiding this comment

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

The code LGTM, should we add some test cases?

@Jeffwan
Copy link
Member

Jeffwan commented Apr 9, 2021

The code LGTM, should we add some test cases?

I think test_job can be updated for testing purpose. @xieydd Can you help take a look?

@xieydd
Copy link
Member Author

xieydd commented Apr 9, 2021

Add test case make sense, i will add it.

Copy link
Member

@gaocegege gaocegege left a comment

Choose a reason for hiding this comment

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

/lgtm

@google-oss-robot google-oss-robot merged commit 719ac19 into kubeflow:master Apr 13, 2021
@xieydd xieydd deleted the make_port_flexiable branch November 8, 2021 08:13
georgkaleido pushed a commit to georgkaleido/common that referenced this pull request Jun 9, 2022
Co-authored-by: Paul Angerer <dabauxi@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants