Giter Club home page Giter Club logo

Comments (11)

runabol avatar runabol commented on June 19, 2024

Is that server running on Docker as well? If so, what about creating a docker network for that http server and using the networks property on the task (https://www.tork.run/rest-api)?

from tork.

v36372 avatar v36372 commented on June 19, 2024

The server is running on k8s. I have the docker socket mounted inside to have access to docker API.

from tork.

runabol avatar runabol commented on June 19, 2024

And you can't access the service through its service endpoint?

from tork.

v36372 avatar v36372 commented on June 19, 2024

No, that would required a k8s service account which is too much of a risk we don't want to do that.

from tork.

v36372 avatar v36372 commented on June 19, 2024

And you can't access the service through its service endpoint?

I misinterpreted your reply. I can not access the service through the service endpoint because the container IP address is blocked by the cluster.

from tork.

v36372 avatar v36372 commented on June 19, 2024

I'm thinking we could go for this:

	hc := container.HostConfig{
		PublishAllPorts: true,
		Mounts:          mounts,
		Resources:       resources,
                ExtraHosts:      t.ExtraHosts,
	}

Task definition:

name: Example
tasks:
  - name: Example
    extra_hosts:
      - host.docker.internal:host-gateway
    run: |
      apk add curl
      curl host.docker.internal:8080 > $TORK_OUTPUT
    image:  alpine:3.18.3

from tork.

v36372 avatar v36372 commented on June 19, 2024

@runabol hi, any update on this? Maybe there is a quick fix to unblock on my end 🤔

from tork.

runabol avatar runabol commented on June 19, 2024

I guess I still fail to understand why an (internal) service endpoint can't be used to solve your problem.

Allowing tasks to interact with the host machine directly will potentially compromise the isolation of tasks and introduce security risks.

from tork.

v36372 avatar v36372 commented on June 19, 2024

I guess I still fail to understand why an (internal) service endpoint can't be used to solve your problem.

Allowing tasks to interact with the host machine directly will potentially compromise the isolation of tasks and introduce security risks.

mainly because I'm using tork in embedded mode. Worker has /var/run/docker.sock mounted inside, both coordinator & worker are deployed on a k8s cluster (same cluster with the internal service). This cluster only accept connections from the cluster IP range. In order for one of my worker node to reach this internal service, the cluster firewall rules need to be updated to allow new IP range, which is something I don't want to mess with.

from tork.

runabol avatar runabol commented on June 19, 2024

Have you considered implementing this using a middleware?

from tork.

v36372 avatar v36372 commented on June 19, 2024

Have you considered implementing this using a middleware?

Yeah, I made it work using middleware, letting the coordinator handle this and then pass results back to the task through ENVs. Thanks.

from tork.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.