Open draese opened 3 years ago
Hi @draese We have opened a bug on this and are investigating it. Meanwhile, to get unblocked, please use the environment variable PRODUCTPAGE.DEFAULT_SERVICE_PORT_TCP (or an equivalent one) in your code.
(Adding @amsoedal in case I'm forgetting anything)
@draese We just released a new version in VS Code with the fix for this issue. Could you please give it a try and validate it works for you as well?
Hi @daniv-msft and @amsoedal !
Thanks for the quick responses to this issue! I tried the scenario with version v1.0.120210408 (on macos). Indeed, the services are now proxied out on my local dev env with the same port as in the k8s cluster as the debug output of the bridge shows:
EndpointManager came up successfully.
Loaded Bridge To Kubernetes environment file 'KubernetesLocalProcessConfig.yaml'.
Waiting for 'eventsapp-f9d7b5c55-lmk4t' in namespace 'events' to reach running state...
Deployment 'events/eventsapp' patched to run agent.
Found container 'eventsapp' in pod 'eventsapp-f9d7b5c55-lmk4t'.
Preparing to run Bridge To Kubernetes configured as pod events/eventsapp-f9d7b5c55-lmk4t ...
Connection established.
Service 'eventsapp' is available on 127.1.1.1:9090.
Service 'productpage.default' is available on 127.1.1.2:9080.
Service 'kafka-test.kafka' is available on 127.1.1.3:9092.
Hosts file updated.
Container port 8080 is available at localhost:8080.
But... the environment variables (set in the local dev env) still show the 55xxx port numbers for these services:
PRODUCT_HOST=127.1.1.2
KAFKA_BOOTSTRAP=127.1.1.3
EVENTSAPP_PORT=TCP://127.1.1.1:55049
EVENTSAPP_SERVICE_PORT_TCP=55049
EVENTSAPP_PORT_55049_TCP_PROTO=TCP
EVENTSAPP_PORT_55049_TCP=TCP://127.1.1.1:55049
EVENTSAPP_PORT_55049_TCP_PORT=55049
EVENTSAPP_SERVICE_PORT=55049
EVENTSAPP_PORT_55049_TCP_ADDR=127.1.1.1
EVENTSAPP_SERVICE_HOST=127.1.1.1
PRODUCTPAGE.DEFAULT_PORT=TCP://127.1.1.2:55049
PRODUCTPAGE.DEFAULT_SERVICE_PORT_TCP=55049
PRODUCTPAGE.DEFAULT_PORT_55049_TCP_PROTO=TCP
PRODUCTPAGE.DEFAULT_PORT_55049_TCP=TCP://127.1.1.2:55049
PRODUCTPAGE.DEFAULT_PORT_55049_TCP_PORT=55049
PRODUCTPAGE.DEFAULT_SERVICE_PORT=55049
PRODUCTPAGE.DEFAULT_PORT_55049_TCP_ADDR=127.1.1.2
PRODUCTPAGE.DEFAULT_SERVICE_HOST=127.1.1.2
KAFKA_TEST.KAFKA_PORT=TCP://127.1.1.3:55049
KAFKA_TEST.KAFKA_SERVICE_PORT_TCP=55049
KAFKA_TEST.KAFKA_PORT_55049_TCP_PROTO=TCP
KAFKA_TEST.KAFKA_PORT_55049_TCP=TCP://127.1.1.3:55049
KAFKA_TEST.KAFKA_PORT_55049_TCP_PORT=55049
KAFKA_TEST.KAFKA_SERVICE_PORT=55049
KAFKA_TEST.KAFKA_PORT_55049_TCP_ADDR=127.1.1.3
KAFKA_TEST.KAFKA_SERVICE_HOST=127.1.1.3
Interestingly, the service (here Kafka) seems to be reachable through both ports (9092 and 55049) on 127.1.1.3 now. So, adjusting the env vars would be more of a consistency thing.
Thanks again, Olli
Thanks @draese for giving this a try so quickly! @amsoedal, is it possible that we use the wrong ports when generating the env variables?
@daniv-msft yes I think you're right. I'll have a look today!
Describe the bug I defined services with a specific port in k8s (i.e. 9032 for a Kafka broker) but when mapping the very same service into my local dev environment, it gets a different port (55000rer range) assigned on my local (macos) machine. I tried the same on a Windows machine and the port (9032) was created on the local dev env as expected, so this seems to be macos specific.
I.e. from KubernetesLocalProcessConfig.yaml:
From the service spec: spec: clusterIP: 10.43.10.159 ports:
From the k8s env vars: PRODUCTPAGE.DEFAULT_PORT=TCP://127.1.1.2:55049 PRODUCTPAGE.DEFAULT_SERVICE_PORT_TCP=55049
Therefore a mapping from 9080 to 55049
To Reproduce Seems to happen for all services on a macos development environment (Visual Studio Code, latest)
Expected behavior Same port being assigned locally
Logs 2021-04-05T17:44:44.7096610Z | MindaroCli | TRACE | Event: Command.Start{"properties":{"arguments":"connect --service eventsapp --env /var/folders/rt/0j5j4qp56cqcb4_zz6pbbg9r0000gn/t/tmp-8521btt6mmv5xl5g.env --script /var/folders/rt/0j5j4qp56cqcb4_zz6pbbg9r0000gn/t/tmp-8521btt6mmv5xl5g.env.cmd --control-port 54832 --ppid 8518 --namespace events --elevation-requests [{\"requesttype\":\"edithostsfile\"}] --local-port 8080","isRoutingEnabled":"false"},"metrics":null} \nOperation context: {"clientRequestId":null,"correlationId":"175a6192-f097-4e81-9ef6-97a9ce79e7e51617644663848:7ffac70f50d3","requestId":null,"userSubscriptionId":null,"startTime":"2021-04-05T17:44:44.4823840Z","userAgent":"VSCode/1.0.120210330","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210330.5","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64","framework":".NET Core 3.1.9","macAddressHash":"5a5d057acb277392da1ecc8e5d2ad7119c5c321c43bcb5c73b71c6200004adbc","processId":8846,"targetEnvironment":"Production","commandId":"7ffac70f50d3"}}
2021-04-05T17:44:44.7885870Z | MindaroCli | TRACE | Running Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand...\nOperation context: {"clientRequestId":null,"correlationId":"175a6192-f097-4e81-9ef6-97a9ce79e7e51617644663848:7ffac70f50d3","requestId":null,"userSubscriptionId":null,"startTime":"2021-04-05T17:44:44.4823840Z","userAgent":"VSCode/1.0.120210330","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210330.5","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64","framework":".NET Core 3.1.9","macAddressHash":"5a5d057acb277392da1ecc8e5d2ad7119c5c321c43bcb5c73b71c6200004adbc","processId":8846,"targetEnvironment":"Production","commandId":"7ffac70f50d3","targetNamespaceName":"events","targetServiceName":"eventsapp","isRoutingEnabled":false}}
2021-04-05T17:44:44.7944570Z | MindaroCli | TRACE | Initializing progress reporter...
2021-04-05T17:44:47.2782950Z | MindaroCli | TRACE | Remoting started listening on 54832
2021-04-05T17:44:50.6573450Z | MindaroCli | TRACE | Waiting for EndpointManager to come up ...\n
2021-04-05T17:44:52.2931610Z | MindaroCli | TRACE | EndpointManager came up successfully.\n
2021-04-05T17:44:53.0574000Z | MindaroCli | TRACE | Loaded Bridge To Kubernetes environment file 'KubernetesLocalProcessConfig.yaml'.\n
2021-04-05T17:44:54.0082050Z | MindaroCli | TRACE | Waiting for 'eventsapp-6fd77d9f65-l575x' in namespace 'events' to reach running state...\n
2021-04-05T17:44:57.1923390Z | MindaroCli | TRACE | Deployment 'events/eventsapp' patched to run agent.\n
2021-04-05T17:44:57.1934110Z | MindaroCli | TRACE | Found container 'eventsapp' in pod 'eventsapp-6fd77d9f65-l575x'.\n
2021-04-05T17:44:57.1962700Z | MindaroCli | TRACE | Preparing to run Bridge To Kubernetes configured as pod events/eventsapp-6fd77d9f65-l575x ...\n
2021-04-05T17:44:58.0539330Z | MindaroCli | TRACE | Connection established.\n
2021-04-05T17:45:00.3200850Z | MindaroCli | TRACE | Service 'eventsapp' is available on 127.1.1.1:55049.\n
2021-04-05T17:45:00.3204400Z | MindaroCli | TRACE | Service 'productpage.default' is available on 127.1.1.2:55049.\n
2021-04-05T17:45:00.3205940Z | MindaroCli | TRACE | Service 'kafka-test.kafka' is available on 127.1.1.3:55049.\n
2021-04-05T17:45:01.3304350Z | MindaroCli | TRACE | Hosts file updated.\n
2021-04-05T17:45:01.3403810Z | MindaroCli | TRACE | Container port 8080 is available at localhost:8080.\n
2021-04-05T17:45:01.3442960Z | MindaroCli | TRACE | ##################### Environment started. #############################################################\n
2021-04-05T17:45:01.3455700Z | MindaroCli | TRACE | Script /var/folders/rt/0j5j4qp56cqcb4_zz6pbbg9r0000gn/T/tmp-8521bTT6Mmv5Xl5g.env.cmd created.
2021-04-05T17:45:01.3458230Z | MindaroCli | TRACE | Run /var/folders/rt/0j5j4qp56cqcb4_zz6pbbg9r0000gn/T/tmp-8521bTT6Mmv5Xl5g.env.cmd in your existing console to also get connected.\n
2021-04-05T18:28:39.9213940Z | MindaroCli | TRACE | Stopping workload and cleaning up...\n
2021-04-05T18:28:39.9592870Z | MindaroCli | TRACE | Restore: Deployment 'eventsapp' restored to original state with image 'draese/eventsapp'.\n
2021-04-05T18:28:41.9792090Z | MindaroCli | TRACE | Event: Command.End {"properties":{"arguments":"connect --service eventsapp --env /var/folders/rt/0j5j4qp56cqcb4_zz6pbbg9r0000gn/t/tmp-8521btt6mmv5xl5g.env --script /var/folders/rt/0j5j4qp56cqcb4_zz6pbbg9r0000gn/t/tmp-8521btt6mmv5xl5g.env.cmd --control-port 54832 --ppid 8518 --namespace events --elevation-requests [{\"requesttype\":\"edithostsfile\"}] --local-port 8080","result":"Succeeded"},"metrics":{"duration":2637308.0}}
Environment Details Client used (VS Code): mindaro.mindaro@1.0.120210330