Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8c3b0a8
removed gpu bookkeeping and modified makefile target in order to disa…
Bianco95 Apr 29, 2024
811f61a
update go.mod and go.sum
Bianco95 Apr 29, 2024
d02e37f
cgo disabled in go releaser
dciangot Apr 30, 2024
6753f5d
Merge remote-tracking branch 'origin/main' into 2-light-version-no-gpu
Bianco95 May 14, 2024
fecb037
updated no gpu light version
Bianco95 May 14, 2024
6d19731
Merge remote-tracking branch 'origin/main' into 2-light-version-no-gpu
Bianco95 May 14, 2024
9a4af35
Update Dockerfile.sidecar-docker
dciangot May 30, 2024
039a6ee
Update Dockerfile.sidecar-docker
dciangot May 30, 2024
ca44171
Update Dockerfile.sidecar-docker
dciangot May 30, 2024
6e857ab
Merge remote-tracking branch 'origin/main' into 2-light-version-no-gpu
Bianco95 May 31, 2024
7ef0e36
updated light version branch
Bianco95 May 31, 2024
3bb2353
Merge branch '2-light-version-no-gpu' of github.com:interTwin-eu/inte…
Bianco95 May 31, 2024
76f99e0
remove rootless dind
dciangot May 31, 2024
b6bfcc9
updated memory limits by setting ulimits and memlock
Bianco95 May 31, 2024
f5bbe39
Update Dockerfile.sidecar-docker
dciangot May 31, 2024
d214cad
revert ulimits
dciangot May 31, 2024
e68a39e
Update Dockerfile.sidecar-docker
dciangot Jun 2, 2024
59730bc
updated with last changes
Bianco95 Jun 14, 2024
dfabf3d
Resolved merge conflicts
Bianco95 Jun 17, 2024
bdb9fcd
updated with latest changes in main
Bianco95 Jun 18, 2024
332e2eb
Merge branch 'main' into 2-light-version-no-gpu
Bianco95 Jun 25, 2024
a03c3c1
increase dind timeout
Jul 17, 2024
c009065
sync with main
Bianco95 Aug 27, 2024
c62cabc
sync with main
Bianco95 Aug 27, 2024
7d68646
updated handling of delete danglind data
Bianco95 Sep 13, 2024
7b92fa2
listen on socket
dciangot Sep 22, 2024
887ed38
Merge pull request #6 from interTwin-eu/socket
dciangot Sep 25, 2024
54ec83f
updated with latest changes; update doc
Bianco95 Jan 15, 2025
cc6f9b2
updated fpga integration
Bianco95 Jan 16, 2025
64127df
started implementing the possibility of disable the fpga bookkeping
Bianco95 Feb 17, 2025
7135ad8
wip
Bianco95 Feb 19, 2025
6561d67
Merge remote-tracking branch 'origin/main' into HEAD
Bianco95 Feb 19, 2025
2286b84
handled mount of xilinx directories; fixed fpga over bookking logic
Bianco95 Mar 12, 2025
4a63965
removed code related to handle old mesh overlay network
Bianco95 Jan 22, 2026
458afe4
Merge branch 'main' of github.com:interTwin-eu/interlink-docker-plugi…
Bianco95 Jan 22, 2026
f46d2c2
updated Create to handle mesh network overlay
Bianco95 Mar 2, 2026
486367a
wip
Bianco95 Mar 4, 2026
a20b6d9
updated DockerConfig to handle FPGA setup
Bianco95 Mar 4, 2026
2ed6360
updated docker configuration to handle manual setup of subnet to use
Bianco95 Mar 17, 2026
6515754
prevent DIND subnet pool exhaustion from orphaned containers/networks
Bianco95 Jul 28, 2026
b8f7af5
fix crash and resource-leak paths in pod creation, status and DIND ro…
Bianco95 Aug 20, 2026
5335458
stop tracking .DS_Store
Bianco95 Aug 20, 2026
cff29bc
merge 2-light-version-no-gpu into main, keeping GPU support
Bianco95 Aug 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bin/
bin/
.DS_Store
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ The main version of the plugin supports the creation of docker containers with G
CGO_ENABLED=1 GOOS=linux go build -o bin/docker-sd cmd/main.go
```
As you can see, the CGO_ENABLED flag is set to 1, which means that the plugin will be built to allow the GO program to use C code. This is necessary to use the Nvidia GPU libraries.
In the second case, the command is the following:
In the second case, it is first necessary to change the branch of the repository with the following command:

```bash
git checkout 2-light-version-no-gpu
```
Then, the command to build the binary executable of the plugin without GPU support is the following:

```bash
CGO_ENABLED=0 GOOS=linux go build -o bin/docker-sd cmd/main.go
Expand Down
57 changes: 47 additions & 10 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ func main() {
log.G(context.Background()).Fatal(err)
}

// log the interlinkconfig
log.G(context.Background()).Info("\u2705 InterLinkConfig: ", interLinkConfig)

if interLinkConfig.VerboseLogging {
logger.SetLevel(logrus.DebugLevel)
} else if interLinkConfig.ErrorsOnlyLogging {
Expand All @@ -178,35 +181,67 @@ func main() {
if availableDinds == "" {
availableDinds = "2"
}
var dindHandler dindmanager.DindManagerInterface = &dindmanager.DindManager{
DindList: []dindmanager.DindSpecs{},
Ctx: ctx,
}
availableDindsInt, err := strconv.ParseInt(availableDinds, 10, 8)
if err != nil {
log.G(ctx).Info("\u2705 Error parsing availableDinds")
log.G(ctx).Fatal("Error parsing AVAILABLEDINDS: ", err)
}

// Build the subnet pool from the config (empty slice = no pool).
subnetPool, err := dindmanager.InitSubnetPool(interLinkConfig.DockerNetworkSubnet)
if err != nil {
log.G(ctx).Fatal("Error initialising subnet pool: ", err)
}
if len(subnetPool) > 0 {
log.G(ctx).Info(fmt.Sprintf(
"\u2705 Subnet pool initialised: %d /24 subnets available from %v",
len(subnetPool), interLinkConfig.DockerNetworkSubnet,
))
} else {
log.G(ctx).Info("\u2705 No DockerNetworkSubnet configured — Docker will assign subnets automatically")
}

var dindHandler dindmanager.DindManagerInterface = &dindmanager.DindManager{
DindList: []dindmanager.DindSpecs{},
Ctx: ctx,
FPGAEnabled: interLinkConfig.FPGAEnabled,
XilinxToolsPath: interLinkConfig.XilinxToolsPath,
SubnetPool: subnetPool,
}

dindHandler.(*dindmanager.DindManager).InitialPoolSz = len(subnetPool)

dindHandler.CleanDindContainers()
dindHandler.BuildDindContainers(int8(availableDindsInt))

// Periodically reclaim orphan DIND networks left behind by failed creates, so
// a single failure cannot permanently exhaust the subnet pool. Only networks
// with no attached container are removed, and never while a build is running.
go func() {
ticker := time.NewTicker(5 * time.Minute)
defer ticker.Stop()
for range ticker.C {
dindHandler.ReapOrphanNetworks()
}
}()

var gpuManager gpustrategies.GPUManagerInterface = &gpustrategies.GPUManager{
GPUSpecsList: []gpustrategies.GPUSpecs{},
Ctx: ctx,
}

err = gpuManager.Init()
if err != nil {
log.G(ctx).Info("\u274C Init of GPUs failed, error", err)
log.G(ctx).Info(" Init of GPUs failed, error", err)
}

err = gpuManager.Discover()
if err != nil {
log.G(ctx).Info("\u274C Discover of GPUs failed, error: ", err)
log.G(ctx).Info(" Discover of GPUs failed, error: ", err)
}

err = gpuManager.Check()
if err != nil {
log.G(ctx).Info("\u274C Check of GPUs failed, error: ", err)
log.G(ctx).Info(" Check of GPUs failed, error: ", err)
}

SidecarAPIs := docker.SidecarHandler{
Expand Down Expand Up @@ -236,10 +271,12 @@ func main() {
log.G(ctx).Info("\u2705 Tracing is disabled")
}

if os.Getenv("FPGAENABLED") == "1" {
if interLinkConfig.FPGAEnabled {
fpgaManager := &fpgastrategies.FPGAManager{
FPGASpecsList: []fpgastrategies.FPGASpecs{},
Ctx: ctx,
VitisPath: interLinkConfig.VitisPath,
XRTPath: interLinkConfig.XRTPath,
}
err = fpgaManager.Init()
if err != nil {
Expand Down Expand Up @@ -271,7 +308,7 @@ func main() {

// Cleanup the sockfile.
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
go func() {
<-c
os.Remove(strings.ReplaceAll(interLinkConfig.Socket, "unix://", ""))
Expand Down
18 changes: 7 additions & 11 deletions docker/Dockerfile.sidecar-docker
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,26 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o bin/docker-sidecar cmd/main.go
FROM bash:latest as bash-stage

# Deploy the application binary into a lean image
FROM docker:24.0-dind-rootless AS build-release-stage
FROM docker:26.1.3-dind AS build-release-stage

WORKDIR /

USER root:root

RUN mkdir -p /sidecar

COPY --from=build-stage /app/bin/docker-sidecar /sidecar/docker-sidecar

# adding bash binary to be able to perform commands within the sidecar binary
COPY --from=bash-stage /usr/local/bin/bash /bin

USER root:root
ENV INTERLINKCONFIGPATH=/InterLinkConfig.yaml

ENV PATH "$PATH:/bin"

#creating a simple startup script to start both docker rootless and the sidecar
RUN echo -e '#!/bin/bash\ndockerd-entrypoint.sh & /sidecar/docker-sidecar' > /sidecar/startup-docker.sh
RUN echo -e '#!/bin/bash\ndockerd --mtu=1350 & /sidecar/docker-sidecar' > /sidecar/startup-docker.sh
RUN chmod +x /sidecar/startup-docker.sh
RUN chmod -R 777 /sidecar

ENV INTERLINKCONFIGPATH=/InterLinkConfig.yaml

USER 1000:1000

#setting up the path for the docker daemon
ENV DOCKER_HOST=unix:///run/user/1000/docker.sock

WORKDIR /sidecar

Expand Down
51 changes: 26 additions & 25 deletions pkg/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,32 @@ type RetrievedContainer struct {

// InterLinkConfig holds the whole configuration
type InterLinkConfig struct {
VKConfigPath string `yaml:"VKConfigPath"`
VKTokenFile string `yaml:"VKTokenFile"`
Interlinkurl string `yaml:"InterlinkURL"`
Sidecarurl string `yaml:"SidecarURL"`
Sbatchpath string `yaml:"SbatchPath"`
Scancelpath string `yaml:"ScancelPath"`
Squeuepath string `yaml:"SqueuePath"`
Interlinkport string `yaml:"InterlinkPort"`
Socket string `yaml:"Socket"`
Sidecarport string `yaml:"SidecarPort"`
Commandprefix string `yaml:"CommandPrefix"`
ExportPodData bool `yaml:"ExportPodData"`
DataRootFolder string `yaml:"DataRootFolder"`
ServiceAccount string `yaml:"ServiceAccount"`
Namespace string `yaml:"Namespace"`
Tsocks bool `yaml:"Tsocks"`
Tsockspath string `yaml:"TsocksPath"`
Tsocksconfig string `yaml:"TsocksConfig"`
Tsockslogin string `yaml:"TsocksLoginNode"`
BashPath string `yaml:"BashPath"`
VerboseLogging bool `yaml:"VerboseLogging"`
ErrorsOnlyLogging bool `yaml:"ErrorsOnlyLogging"`
PodIP string `yaml:"PodIP"`
SingularityPrefix string `yaml:"SingularityPrefix"`
set bool
VKConfigPath string `yaml:"VKConfigPath"`
VKTokenFile string `yaml:"VKTokenFile"`
Interlinkurl string `yaml:"InterlinkURL"`
Sidecarurl string `yaml:"SidecarURL"`
Sbatchpath string `yaml:"SbatchPath"`
Scancelpath string `yaml:"ScancelPath"`
Squeuepath string `yaml:"SqueuePath"`
Interlinkport string `yaml:"InterlinkPort"`
Socket string `yaml:"Socket"`
Sidecarport string `yaml:"SidecarPort"`
Commandprefix string `yaml:"CommandPrefix"`
ExportPodData bool `yaml:"ExportPodData"`
DataRootFolder string `yaml:"DataRootFolder"`
ServiceAccount string `yaml:"ServiceAccount"`
Namespace string `yaml:"Namespace"`
Tsocks bool `yaml:"Tsocks"`
Tsockspath string `yaml:"TsocksPath"`
Tsocksconfig string `yaml:"TsocksConfig"`
Tsockslogin string `yaml:"TsocksLoginNode"`
BashPath string `yaml:"BashPath"`
VerboseLogging bool `yaml:"VerboseLogging"`
ErrorsOnlyLogging bool `yaml:"ErrorsOnlyLogging"`
PodIP string `yaml:"PodIP"`
SingularityPrefix string `yaml:"SingularityPrefix"`
DockerNetworkSubnet []string `yaml:"DockerNetworkSubnet"`
set bool
}

// ContainerLogOpts is a struct in which it is possible to specify options to retrieve logs from the sidecar
Expand Down
Loading
Loading