jina-ai / serve

☁️ Build multimodal AI applications with cloud-native stack
https://jina.ai/serve
Apache License 2.0
21.13k stars 2.22k forks source link

bug: gateway configurations ignored in Flow method- `to_kubernetes_yaml` #5984

Closed sansmoraxz closed 1 year ago

sansmoraxz commented 1 year ago

Describe the bug Gateway configurations are ignored while ejecting a Flow as kubernetes yaml


Describe how you solve it

Try the below code:

from jina import Flow

f = (
    Flow()
    .config_gateway(port=12345, protocol="http") \
    .add(uses='jinahub+docker://TransformerTorchEncoder') \
    .add(
        uses='jinahub+docker://SimpleIndexer',
        uses_metas={'workspace': './mydb'},
        uses_with = {'table_name': 'my_custon_table_name'}
    )
)

f.to_kubernetes_yaml("./kbe")

On investigating the generated executors and gateway yaml we can see that both the gateway parameters are ignored.

Generated port is 8080 with GRPC protocol.


Environment

- jina 3.19.1
- docarray 0.21.1
- jcloud 0.2.13
- jina-hubble-sdk 0.39.0
- jina-proto 0.1.27
- protobuf 3.20.3
- proto-backend cpp
- grpcio 1.47.5
- pyyaml 6.0
- python 3.10.12
- platform Linux
- platform-release 5.15.120+
- platform-version #1 SMP Fri Jul 21 03:39:30 UTC 2023
- architecture x86_64
- processor x86_64
- uid 2485378023938
- session-id 8ee68d36-2caa-11ee-a70b-0242ac130202
- uptime 2023-07-27T18:22:34.368597
- ci-vendor (unset)
- internal False
* JINA_DEFAULT_HOST (unset)
* JINA_DEFAULT_TIMEOUT_CTRL (unset)
* JINA_DEPLOYMENT_NAME (unset)
* JINA_DISABLE_UVLOOP (unset)
* JINA_EARLY_STOP (unset)
* JINA_FULL_CLI (unset)
* JINA_GATEWAY_IMAGE (unset)
* JINA_GRPC_RECV_BYTES (unset)
* JINA_GRPC_SEND_BYTES (unset)
* JINA_HUB_NO_IMAGE_REBUILD (unset)
* JINA_LOG_CONFIG (unset)
* JINA_LOG_LEVEL (unset)
* JINA_LOG_NO_COLOR (unset)
* JINA_MP_START_METHOD (unset)
* JINA_OPTOUT_TELEMETRY (unset)
* JINA_RANDOM_PORT_MAX (unset)
* JINA_RANDOM_PORT_MIN (unset)
* JINA_LOCKS_ROOT (unset)
* JINA_K8S_ACCESS_MODES (unset)
* JINA_K8S_STORAGE_CLASS_NAME (unset)
* JINA_K8S_STORAGE_CAPACITY (unset)
* JINA_STREAMER_ARGS (unset)
JoanFM commented 1 year ago

Hey @sansmoraxz ,

The Port is ignored consciously, because the port at which the container binds to is irrelevant as long as the service also uses that port which is the case.

The protocol seems indeed weird and I will check what happens. In the meanwhile can you try not configuring a Gateway for now but passing the args directlu to Flow?

Thank you very much

JoanFM commented 1 year ago

Hey @sansmoraxz ,

I have checked and there is no bug (except the Port thing I previously commented for which I will add documentation in a PR).

What you see is that Executors are using grpc. This is because Gateway communicates with Executors through gRPC. But the gateway service indeed startsHTTP` which is correct.

In this case Flow is the service that you should connect to via HTTP

sansmoraxz commented 1 year ago

Can confirm that port is not being injected. Fields such as protocol, ssl_certfile and ssl_keyfile work as expected.

JoanFM commented 1 year ago

so it works, is it okey to close? I did not get the latest message

sansmoraxz commented 1 year ago

Yes. Closing

JoanFM commented 1 year ago

Thanks for it @sansmoraxz ,

Please keep reporting doubts and potential problems you may have along the way