pipelines icon indicating copy to clipboard operation
pipelines copied to clipboard

[Question] How to add port on kubeflow pipeline in kfpv2?

Open sefgsefg opened this issue 1 year ago • 4 comments

Discussed in https://github.com/kubeflow/pipelines/discussions/11027

Originally posted by sefgsefg July 23, 2024 kfp == 2.8.0

kfp-kubernetes == 1.2.0

@dsl.component()
def server():
    ....

@dsl.pipeline()
def my_pipeline():
    server_task=server()
    server_task.add_port(V1ContainerPort(name='my-port', container_port=8080))

---> server_task.add_port(V1ContainerPort(name='my-port', container_port=8080))

AttributeError: 'PipelineTask' object has no attribute 'add_port'

In kfpv1 the code can work, but in kfpv2 'add_port' had been removed. Is there any method to add port on task ?

sefgsefg avatar Sep 07 '24 08:09 sefgsefg

For argoworkflow backend I am using something like this

  mainContainer: |
    imagePullPolicy: IfNotPresent
    resources:
      requests:
        cpu: 0.1
        memory: 64Mi
      limits:
        cpu: 0.5
        memory: 512Mi
    ports:
    - containerPort: 8080

but it will be port for all mainContainer

sanchesoon avatar Sep 10 '24 19:09 sanchesoon

@sanchesoon THX for your answer. But I'm a way that can edit port directly in python and compile into yaml file. I think kfpv2 should have a method to add it.

sefgsefg avatar Sep 11 '24 01:09 sefgsefg

@rimolive Sorry, do you know the relevant solutions?

sefgsefg avatar Oct 04 '24 03:10 sefgsefg

@sefgsefg Unfortunately there's no support yet in SDK v2 but you can contribute with implementing it. Let me know if you need any help.

rimolive avatar Oct 04 '24 15:10 rimolive

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 04 '24 07:12 github-actions[bot]

/lifecycle stale

rimolive avatar Dec 04 '24 17:12 rimolive

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 03 '25 07:02 github-actions[bot]

/lifecycle frozen

rimolive avatar Feb 05 '25 16:02 rimolive