Skip to content

Commit fd9e9c1

Browse files
committed
removed unused config options. Also now using commonIL from the main interlink repo
1 parent 494cf11 commit fd9e9c1

File tree

15 files changed

+183
-310
lines changed

15 files changed

+183
-310
lines changed

README.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,28 @@ make all
4949
```
5050

5151
and you will be able to find the built slurm-sd binary inside the bin directory. Before executing it, remember to check
52-
if the configuration file is correctly set according to your needs. You can find an example one under examples/config/InterLinkConfig.yaml.
53-
Do not forget to set the INTERLINKCONFIGPATH environment variable to point to your config.
52+
if the configuration file is correctly set according to your needs. You can find an example one under examples/config/SlurmConfig.yaml.
53+
Do not forget to set the SLURMCONFIGPATH environment variable to point to your config.
54+
55+
### :gear: A SLURM config example
56+
57+
```yaml
58+
SidecarPort: "4000"
59+
SbatchPath: "/usr/bin/sbatch"
60+
ScancelPath: "/usr/bin/scancel"
61+
SqueuePath: "/usr/bin/squeue"
62+
CommandPrefix: ""
63+
SingularityPrefix: ""
64+
ExportPodData: true
65+
DataRootFolder: ".local/interlink/jobs/"
66+
Namespace: "vk"
67+
Tsocks: false
68+
TsocksPath: "$WORK/tsocks-1.8beta5+ds1/libtsocks.so"
69+
TsocksLoginNode: "login01"
70+
BashPath: /bin/bash
71+
VerboseLogging: true
72+
ErrorsOnlyLogging: false
73+
```
5474
5575
### :pencil2: Annotations
5676
@@ -65,15 +85,12 @@ It is possible to specify Annotations when submitting Pods to the K8S cluster. A
6585
| slurm-job.vk.io/flags | Used to specify SLURM flags. These flags will be added to the SLURM script in the form of #SBATCH flag1, #SBATCH flag2, etc |
6686
| slurm-job.vk.io/mpi-flags | Used to prepend "mpiexec -np $SLURM_NTASKS \*flags\*" to the Singularity Execution |
6787
68-
### :wrench: InterLink Config file
88+
### :gear: Explanation of the SLURM Config file
6989
70-
Detailed explanation of the InterLink config file key values. Edit the config file before running the binary or before
90+
Detailed explanation of the SLURM config file key values. Edit the config file before running the binary or before
7191
building the docker image (`docker compose up -d --build --force-recreate` will recreate and re-run the updated image)
7292
| Key | Value |
7393
|--------------|-----------|
74-
| InterlinkURL | the URL to allow the Virtual Kubelet to contact the InterLink module. |
75-
| SidecarURL | the URL to allow InterLink to communicate with the Sidecar module (docker, slurm, etc). Do not specify port here |
76-
| InterlinkPort | the Interlink listening port. InterLink and VK will communicate over this port. |
7794
| SidecarPort | the sidecar listening port. Sidecar and Interlink will communicate on this port. Set $SIDECARPORT environment variable to specify a custom one |
7895
| SbatchPath | path to your Slurm's sbatch binary |
7996
| ScancelPath | path to your Slurm's scancel binary |
@@ -91,19 +108,14 @@ building the docker image (`docker compose up -d --build --force-recreate` will
91108
### :wrench: Environment Variables list
92109

93110
Here's the complete list of every customizable environment variable. When specified, it overwrites the listed key
94-
within the InterLink config file.
111+
within the SLURM config file.
95112

96113
| Env | Value |
97114
|--------------|-----------|
98-
| VK_CONFIG_PATH | VK config file path |
99-
| INTERLINKURL | the URL to allow the Virtual Kubelet to contact the InterLink module. Do not specify a port here. Overwrites InterlinkURL. |
100-
| INTERLINKPORT | the InterLink listening port. InterLink and VK will communicate over this port. Overwrites InterlinkPort. |
101-
| INTERLINKCONFIGPATH | your InterLink config file path. Default is `./kustomizations/InterLinkConfig.yaml` |
102-
| SIDECARURL | the URL to allow InterLink to communicate with the Sidecar module (docker, slurm, etc). Do not specify port here. Overwrites SidecarURL. |
115+
| SLURMCONFIGPATH | your SLURM config file path. Default is `/etc/interlink/SlurmConfig.yaml` |
103116
| SIDECARPORT | the Sidecar listening port. Docker default is 4000, Slurm default is 4001. |
104117
| SBATCHPATH | path to your Slurm's sbatch binary. Overwrites SbatchPath. |
105118
| SCANCELPATH | path to your Slurm's scancel binary. Overwrites ScancelPath. |
106-
| VKTOKENFILE | path to a file containing your token fot OAuth2 proxy authentication. Overwrites VKTokenFile. |
107119
| SHARED_FS | set this env to "true" to save configmaps values inside files directly mounted to Singularity containers instead of using ENVS to create them later |
108120
| CUSTOMKUBECONF | path to a service account kubeconfig |
109121
| TSOCKS | true or false, to use tsocks library allowing proxy networking. Working on Slurm sidecar at the moment. Overwrites Tsocks. |

cmd/main.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@ import (
99
"github.com/virtual-kubelet/virtual-kubelet/log"
1010
logruslogger "github.com/virtual-kubelet/virtual-kubelet/log/logrus"
1111

12-
commonIL "github.com/intertwin-eu/interlink-slurm-plugin/pkg/common"
1312
slurm "github.com/intertwin-eu/interlink-slurm-plugin/pkg/slurm"
1413
)
1514

1615
func main() {
1716
logger := logrus.StandardLogger()
1817

19-
interLinkConfig, err := commonIL.NewInterLinkConfig()
18+
slurmConfig, err := slurm.NewSlurmConfig()
2019
if err != nil {
2120
panic(err)
2221
}
2322

24-
if interLinkConfig.VerboseLogging {
23+
if slurmConfig.VerboseLogging {
2524
logger.SetLevel(logrus.DebugLevel)
26-
} else if interLinkConfig.ErrorsOnlyLogging {
25+
} else if slurmConfig.ErrorsOnlyLogging {
2726
logger.SetLevel(logrus.ErrorLevel)
2827
} else {
2928
logger.SetLevel(logrus.InfoLevel)
@@ -34,10 +33,10 @@ func main() {
3433
JobIDs := make(map[string]*slurm.JidStruct)
3534
Ctx, cancel := context.WithCancel(context.Background())
3635
defer cancel()
37-
log.G(Ctx).Debug("Debug level: " + strconv.FormatBool(interLinkConfig.VerboseLogging))
36+
log.G(Ctx).Debug("Debug level: " + strconv.FormatBool(slurmConfig.VerboseLogging))
3837

3938
SidecarAPIs := slurm.SidecarHandler{
40-
Config: interLinkConfig,
39+
Config: slurmConfig,
4140
JIDs: &JobIDs,
4241
Ctx: Ctx,
4342
}
@@ -48,10 +47,10 @@ func main() {
4847
mutex.HandleFunc("/delete", SidecarAPIs.StopHandler)
4948
mutex.HandleFunc("/getLogs", SidecarAPIs.GetLogsHandler)
5049

51-
slurm.CreateDirectories(interLinkConfig)
52-
slurm.LoadJIDs(Ctx, interLinkConfig, &JobIDs)
50+
slurm.CreateDirectories(slurmConfig)
51+
slurm.LoadJIDs(Ctx, slurmConfig, &JobIDs)
5352

54-
err = http.ListenAndServe(":"+interLinkConfig.Sidecarport, mutex)
53+
err = http.ListenAndServe(":"+slurmConfig.Sidecarport, mutex)
5554
if err != nil {
5655
log.G(Ctx).Fatal(err)
5756
}

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ WORKDIR /root
4444

4545
COPY --from=build-stage /app/bin/slurm-sidecar /sidecar/slurm-sidecar
4646

47-
ENV INTERLINKCONFIGPATH=/root/InterLinkConfig.yaml
47+
ENV SLURMCONFIGPATH=/root/SlurmConfig.yaml
4848

49-
COPY docker/InterLinkConfig.yaml .
49+
COPY docker/SlurmConfig.yaml .
5050

5151
RUN apt update && apt install -y software-properties-common \
5252
&& add-apt-repository -y ppa:apptainer/ppa \
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
VKTokenFile: "$HOME/interLink/token"
2-
InterlinkURL: "http://192.168.122.121"
3-
SidecarURL: "http://localhost"
4-
InterlinkPort: "3000"
51
SidecarPort: "4000"
62
SbatchPath: "/usr/bin/sbatch"
73
ScancelPath: "/usr/bin/scancel"
84
SqueuePath: "/usr/bin/squeue"
95
CommandPrefix: ""
6+
SingularityPrefix: ""
107
ExportPodData: true
118
DataRootFolder: ".local/interlink/jobs/"
12-
ServiceAccount: "interlink"
139
Namespace: "vk"
1410
Tsocks: false
1511
TsocksPath: "$WORK/tsocks-1.8beta5+ds1/libtsocks.so"
1612
TsocksLoginNode: "login01"
1713
BashPath: /bin/bash
1814
VerboseLogging: true
19-
ErrorsOnlyLogging: false
15+
ErrorsOnlyLogging: false
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
VKTokenFile: "$HOME/interLink/token"
2-
InterlinkURL: "http://interlink-api"
3-
SidecarURL: "http://docker-sidecar"
4-
InterlinkPort: "3000"
51
SidecarPort: "4000"
62
SbatchPath: "/usr/bin/sbatch"
73
ScancelPath: "/usr/bin/scancel"
84
SqueuePath: "/usr/bin/squeue"
5+
CommandPrefix: ""
6+
SingularityPrefix: ""
97
ExportPodData: true
108
DataRootFolder: ".local/interlink/jobs/"
11-
ServiceAccount: "interlink"
129
Namespace: "vk"
1310
Tsocks: false
1411
TsocksPath: "$WORK/tsocks-1.8beta5+ds1/libtsocks.so"
1512
TsocksLoginNode: "login01"
1613
BashPath: /bin/bash
1714
VerboseLogging: true
18-
ErrorsOnlyLogging: false
19-
Pod_IP: "172.16.9.11"
15+
ErrorsOnlyLogging: false

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ toolchain go1.21.3
77
require (
88
github.com/alexellis/go-execute v0.6.0
99
github.com/containerd/containerd v1.7.6
10+
github.com/intertwin-eu/interlink v0.0.0-20240523154644-820ca4bd6fac
1011
github.com/sirupsen/logrus v1.9.3
1112
github.com/virtual-kubelet/virtual-kubelet v1.11.0
1213
gopkg.in/yaml.v2 v2.4.0
@@ -33,8 +34,6 @@ require (
3334
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3435
github.com/modern-go/reflect2 v1.0.2 // indirect
3536
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
36-
github.com/rogpeppe/go-internal v1.11.0 // indirect
37-
github.com/stretchr/testify v1.9.0 // indirect
3837
golang.org/x/net v0.20.0 // indirect
3938
golang.org/x/oauth2 v0.16.0 // indirect
4039
golang.org/x/sys v0.17.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJY
4040
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
4141
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
4242
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
43+
github.com/intertwin-eu/interlink v0.0.0-20240523154644-820ca4bd6fac h1:LdpDorMFbMkcIpO9F9LmvBaUteyWrqEKzDjuhcF4fAc=
44+
github.com/intertwin-eu/interlink v0.0.0-20240523154644-820ca4bd6fac/go.mod h1:BxkHXL7pr4PwdpGR685KgidM+r94N1W+S+cpc/o2MX8=
4345
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
4446
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
4547
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=

pkg/common/func.go

Lines changed: 0 additions & 166 deletions
This file was deleted.

0 commit comments

Comments
 (0)