Merge branch '19428-webdav-performance'
[arvados.git] / services / crunch-dispatch-slurm / crunch-dispatch-slurm.go
index c31d7997522fa1caa73507a009d680b3835a2f46..ac394e114962ddf05d2e71e94cc4bb1ff46c4780 100644 (file)
@@ -7,6 +7,8 @@ package dispatchslurm
 
 import (
        "context"
+       "crypto/hmac"
+       "crypto/sha256"
        "fmt"
        "log"
        "math"
@@ -99,7 +101,6 @@ func (disp *Dispatcher) configure() error {
                if disp.Client.Insecure {
                        os.Setenv("ARVADOS_API_HOST_INSECURE", "1")
                }
-               os.Setenv("ARVADOS_EXTERNAL_CLIENT", "")
                for k, v := range disp.cluster.Containers.SLURM.SbatchEnvironmentVariables {
                        os.Setenv(k, v)
                }
@@ -213,7 +214,12 @@ func (disp *Dispatcher) submit(container arvados.Container, crunchRunCommand []s
        crArgs := append([]string(nil), crunchRunCommand...)
        crArgs = append(crArgs, "--runtime-engine="+disp.cluster.Containers.RuntimeEngine)
        crArgs = append(crArgs, container.UUID)
-       crScript := strings.NewReader(execScript(crArgs))
+
+       h := hmac.New(sha256.New, []byte(disp.cluster.SystemRootToken))
+       fmt.Fprint(h, container.UUID)
+       authsecret := fmt.Sprintf("%x", h.Sum(nil))
+
+       crScript := strings.NewReader(execScript(crArgs, map[string]string{"GatewayAuthSecret": authsecret}))
 
        sbArgs, err := disp.sbatchArgs(container)
        if err != nil {