Merge branch '16736-max-token-lifetime'
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Fri, 19 Feb 2021 20:30:14 +0000 (17:30 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Fri, 19 Feb 2021 20:30:14 +0000 (17:30 -0300)
Closes #16736

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

14 files changed:
doc/api/methods/pipeline_instances.html.textile.liquid
doc/install/setup-login.html.textile.liquid
doc/sdk/python/cookbook.html.textile.liquid
doc/user/cwl/arvados-vscode-training.html.md.liquid
lib/config/config.default.yml
lib/config/generated_config.go
lib/controller/localdb/login_oidc.go
lib/crunchrun/crunchrun.go
lib/dispatchcloud/dispatcher_test.go
lib/dispatchcloud/test/stub_driver.go
lib/dispatchcloud/worker/pool.go
lib/dispatchcloud/worker/pool_test.go
lib/dispatchcloud/worker/runner.go
lib/dispatchcloud/worker/worker_test.go

index 56c071ef9b8ef1c13c03f2aea112a879cd193d1f..55baee9b5ab248d7f270eb3ff10d908270a48131 100644 (file)
@@ -21,7 +21,7 @@ Example UUID: @zzzzz-d1hrv-0123456789abcde@
 
 h2. Resource
 
-Deprecated.  A pipeline instance is a collection of jobs managed by @aravdos-run-pipeline-instance@.
+Deprecated.  A pipeline instance is a collection of jobs managed by @arvados-run-pipeline-instance@.
 
 Each PipelineInstance has, in addition to the "Common resource fields":{{site.baseurl}}/api/resources.html:
 
index aec82cfe2a583dd2eaf2d251532e4d46d625ff5e..d11fec9e1005e03140511d48fcee142f9e2a0e86 100644 (file)
@@ -98,7 +98,7 @@ Enable PAM authentication in @config.yml@:
 
 Check the "default config file":{{site.baseurl}}/admin/config.html for more PAM configuration options.
 
-The default PAM configuration on most Linux systems uses the local password database in @/etc/shadow@ for all logins. In this case, in order to log in to Arvados, users must have a shell account and password on the controller host itself. This can be convenient for a single-user or test cluster.
+The default PAM configuration on most Linux systems uses the local password database in @/etc/shadow@ for all logins. In this case, in order to log in to Arvados, users must have a UNIX account and password on the controller host itself. This can be convenient for a single-user or test cluster. User accounts can have @/dev/false@ as the shell in order to allow the user to log into Arvados but not log into a shell on the controller host.
 
 PAM can also be configured to use different backends like LDAP. In a production environment, PAM configuration should use the service name ("arvados" by default) to set a separate policy for Arvados logins: generally, Arvados users should not have shell accounts on the controller node.
 
index 3aa01bbb563a1ea38008d0748de07238f5b06b12..ff3bcf90e052ec033a4d572f0a84392514dfd3e7 100644 (file)
@@ -237,7 +237,7 @@ with c.open(filename, "rb") as reader:
 print("Finished downloading %s" % filename)
 {% endcodeblock %}
 
-h2. Copy files from a collection a new collection
+h2. Copy files from a collection to a new collection
 
 {% codeblock as python %}
 import arvados.collection
@@ -258,7 +258,7 @@ target.save_new(name=target_name, owner_uuid=target_project)
 print("Created collection %s" % target.manifest_locator())
 {% endcodeblock %}
 
-h2. Copy files from a collection another collection
+h2. Copy files from a collection to another collection
 
 {% codeblock as python %}
 import arvados.collection
index 80477e9d77879354dd9eb32c246060b1dc62d0e2..1858f5b574260ebd0addc49379d3a9ce0dd4cb4e 100644 (file)
@@ -9,7 +9,7 @@ Copyright (C) The Arvados Authors. All rights reserved.
 SPDX-License-Identifier: CC-BY-SA-3.0
 
 Imported from https://github.com/arvados/arvados-vscode-cwl-training
-git hash: e21c963c05fb35bd8be15e24f72045e9c1cec668
+git hash: f39d44c1bdb2f82ec8f22ade874ca70544531289
 
 {% endcomment %}
 
@@ -79,16 +79,16 @@ Code (abbreviated "vscode") to develop CWL workflows on Arvados.
 1. Vscode: On the left sidebar, choose `Explorer` ![](images/Explorer.png)
    1. Select `Clone Repository` and enter [https://github.com/arvados/arvados-vscode-cwl-training](https://github.com/arvados/arvados-vscode-cwl-training), then click `Open`
    1. If asked `Would you like to open the cloned repository?` choose `Open`
-1. Vscode: Click on the `Terminal` menu
+1. Go to Arvados Workbench
+   1. Workbench: In the user menu, select `Current token`
+   1. Workbench: Click on `Copy to Clipboard`.
+   1. Workbench: You should see a notification `Token copied to clipboard`.
+   1. Go to Vscode
+   1. Vscode: Click on the `Terminal` menu
    1. Vscode: Click `Run Taskā€¦`
    1. Vscode: Select `Configure Arvados`
-   1. Go to Arvados Workbench
-   1. Workbench: In the user menu, select `Current token`
-   1. Workbench: Copy the text following `ARVADOS_API_HOST=` to the end of the line
-   1. Vscode: Paste the string at the `Value for ARVADOS_API_HOST` prompt
-   1. Workbench: Copy the text following `ARVADOS_API_TOKEN=` to the end of the line
-   1. Vscode: Paste the string at the `Value for ARVADOS_API_TOKEN` prompt
-   1. This will create files called `API_HOST` and `API_TOKEN`
+   1. Vscode: Paste text into the `Current API_TOKEN and API_HOST from Workbench` prompt
+   1. Vscode: This will create files called `API_HOST` and `API_TOKEN`
 
 ## 3. Register & run a workflow
 
index 3e853e1dc5d269a8338b5000bd0840c866fdd58a..6f72c02c1f048c5f9a1910f7e6a1d645776f9767 100644 (file)
@@ -838,7 +838,11 @@ Clusters:
       # stale locks from a previous dispatch process.
       StaleLockTimeout: 1m
 
-      # The crunch-run command to manage the container on a node
+      # The crunch-run command used to start a container on a worker node.
+      #
+      # When dispatching to cloud VMs, this is used only if
+      # DeployRunnerBinary in the CloudVMs section is set to the empty
+      # string.
       CrunchRunCommand: "crunch-run"
 
       # Extra arguments to add to crunch-run invocation
@@ -1059,7 +1063,7 @@ Clusters:
         #
         # Use the empty string to disable this step: nothing will be
         # copied, and cloud instances are assumed to have a suitable
-        # version of crunch-run installed.
+        # version of crunch-run installed; see CrunchRunCommand above.
         DeployRunnerBinary: "/proc/self/exe"
 
         # Tags to add on all resources (VMs, NICs, disks) created by
index a2d83f77f47036cd10470579418f5c28e9d9c4d7..50869bf61bdf7bad820bbc38cb672daf0ab3e54e 100644 (file)
@@ -844,7 +844,11 @@ Clusters:
       # stale locks from a previous dispatch process.
       StaleLockTimeout: 1m
 
-      # The crunch-run command to manage the container on a node
+      # The crunch-run command used to start a container on a worker node.
+      #
+      # When dispatching to cloud VMs, this is used only if
+      # DeployRunnerBinary in the CloudVMs section is set to the empty
+      # string.
       CrunchRunCommand: "crunch-run"
 
       # Extra arguments to add to crunch-run invocation
@@ -1065,7 +1069,7 @@ Clusters:
         #
         # Use the empty string to disable this step: nothing will be
         # copied, and cloud instances are assumed to have a suitable
-        # version of crunch-run installed.
+        # version of crunch-run installed; see CrunchRunCommand above.
         DeployRunnerBinary: "/proc/self/exe"
 
         # Tags to add on all resources (VMs, NICs, disks) created by
index 2b67a95046620c00621de88017e29124e273b5a4..74b8929a2149b14910a88823cb97a5b398a294f9 100644 (file)
@@ -176,7 +176,7 @@ func (ctrl *oidcLoginController) getAuthInfo(ctx context.Context, token *oauth2.
                if names := strings.Fields(strings.TrimSpace(name)); len(names) > 1 {
                        ret.FirstName = strings.Join(names[0:len(names)-1], " ")
                        ret.LastName = names[len(names)-1]
-               } else {
+               } else if len(names) > 0 {
                        ret.FirstName = names[0]
                }
                ret.Email, _ = claims[ctrl.EmailClaim].(string)
index 7d6fb4ed47bef547f4eb3cb1728163c77021bf02..969682f465cefe56a0430b80bef2a461d7022436 100644 (file)
@@ -1887,10 +1887,12 @@ func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
                Log:               cr.CrunchLog,
        }
        os.Unsetenv("GatewayAuthSecret")
-       err = cr.gateway.Start()
-       if err != nil {
-               log.Printf("error starting gateway server: %s", err)
-               return 1
+       if cr.gateway.Address != "" {
+               err = cr.gateway.Start()
+               if err != nil {
+                       log.Printf("error starting gateway server: %s", err)
+                       return 1
+               }
        }
 
        parentTemp, tmperr := cr.MkTempDir("", "crunch-run."+containerID+".")
index d5d90bf3518b75fb548e810e2ad8a7cc2c9867ba..8752ee054456bf1a2a2fc5b8030e8a7eeaa691b1 100644 (file)
@@ -52,8 +52,10 @@ func (s *DispatcherSuite) SetUpTest(c *check.C) {
        s.cluster = &arvados.Cluster{
                ManagementToken: "test-management-token",
                Containers: arvados.ContainersConfig{
-                       DispatchPrivateKey: string(dispatchprivraw),
-                       StaleLockTimeout:   arvados.Duration(5 * time.Millisecond),
+                       CrunchRunCommand:       "crunch-run",
+                       CrunchRunArgumentsList: []string{"--foo", "--extra='args'"},
+                       DispatchPrivateKey:     string(dispatchprivraw),
+                       StaleLockTimeout:       arvados.Duration(5 * time.Millisecond),
                        CloudVMs: arvados.CloudVMsConfig{
                                Driver:               "test",
                                SyncInterval:         arvados.Duration(10 * time.Millisecond),
@@ -161,6 +163,7 @@ func (s *DispatcherSuite) TestDispatchToStubDriver(c *check.C) {
                stubvm.CrunchRunDetachDelay = time.Duration(rand.Int63n(int64(10 * time.Millisecond)))
                stubvm.ExecuteContainer = executeContainer
                stubvm.CrashRunningContainer = finishContainer
+               stubvm.ExtraCrunchRunArgs = "'--foo' '--extra='\\''args'\\'''"
                switch n % 7 {
                case 0:
                        stubvm.Broken = time.Now().Add(time.Duration(rand.Int63n(90)) * time.Millisecond)
index 4d32cf221ce49461e092a834ad192460bc37a49d..1b31a71a264fabf865f981f5f94eab1649847ac4 100644 (file)
@@ -193,6 +193,7 @@ type StubVM struct {
        ArvMountDeadlockRate  float64
        ExecuteContainer      func(arvados.Container) int
        CrashRunningContainer func(arvados.Container)
+       ExtraCrunchRunArgs    string // extra args expected after "crunch-run --detach --stdin-env "
 
        sis          *StubInstanceSet
        id           cloud.InstanceID
@@ -251,7 +252,7 @@ func (svm *StubVM) Exec(env map[string]string, command string, stdin io.Reader,
                fmt.Fprint(stderr, "crunch-run: command not found\n")
                return 1
        }
-       if strings.HasPrefix(command, "crunch-run --detach --stdin-env ") {
+       if strings.HasPrefix(command, "crunch-run --detach --stdin-env "+svm.ExtraCrunchRunArgs) {
                var stdinKV map[string]string
                err := json.Unmarshal(stdinData, &stdinKV)
                if err != nil {
index 6a74280ca452e9b365f6a976f96e04ef03edc7e6..7289179fd6e4526ecfc7204d970172b42018af59 100644 (file)
@@ -121,6 +121,8 @@ func NewPool(logger logrus.FieldLogger, arvClient *arvados.Client, reg *promethe
                systemRootToken:                cluster.SystemRootToken,
                installPublicKey:               installPublicKey,
                tagKeyPrefix:                   cluster.Containers.CloudVMs.TagKeyPrefix,
+               runnerCmdDefault:               cluster.Containers.CrunchRunCommand,
+               runnerArgs:                     cluster.Containers.CrunchRunArgumentsList,
                stop:                           make(chan bool),
        }
        wp.registerMetrics(reg)
@@ -160,6 +162,8 @@ type Pool struct {
        systemRootToken                string
        installPublicKey               ssh.PublicKey
        tagKeyPrefix                   string
+       runnerCmdDefault               string   // crunch-run command to use if not deploying a binary
+       runnerArgs                     []string // extra args passed to crunch-run
 
        // private state
        subscribers  map[<-chan struct{}]chan<- struct{}
@@ -881,7 +885,7 @@ func (wp *Pool) loadRunnerData() error {
        if wp.runnerData != nil {
                return nil
        } else if wp.runnerSource == "" {
-               wp.runnerCmd = "crunch-run"
+               wp.runnerCmd = wp.runnerCmdDefault
                wp.runnerData = []byte{}
                return nil
        }
index a85f7383ab3cdc59fcc1bd0e7ad936703666ca2f..0f5c5ee196d2866269f2bb999292e8a9672c3e47 100644 (file)
@@ -72,8 +72,8 @@ func (suite *PoolSuite) TestResumeAfterRestart(c *check.C) {
        newExecutor := func(cloud.Instance) Executor {
                return &stubExecutor{
                        response: map[string]stubResp{
-                               "crunch-run --list": {},
-                               "true":              {},
+                               "crunch-run-custom --list": {},
+                               "true":                     {},
                        },
                }
        }
@@ -87,6 +87,7 @@ func (suite *PoolSuite) TestResumeAfterRestart(c *check.C) {
                                SyncInterval:       arvados.Duration(time.Millisecond * 10),
                                TagKeyPrefix:       "testprefix:",
                        },
+                       CrunchRunCommand: "crunch-run-custom",
                },
                InstanceTypes: arvados.InstanceTypeMap{
                        type1.Name: type1,
index 0fd99aeeef136cdc1113f55466b1342b7c975cc1..63561874c9c5e570187048922addbbc4e4ece502 100644 (file)
@@ -9,6 +9,7 @@ import (
        "encoding/json"
        "fmt"
        "net"
+       "strings"
        "syscall"
        "time"
 
@@ -22,6 +23,7 @@ type remoteRunner struct {
        executor      Executor
        envJSON       json.RawMessage
        runnerCmd     string
+       runnerArgs    []string
        remoteUser    string
        timeoutTERM   time.Duration
        timeoutSignal time.Duration
@@ -64,6 +66,7 @@ func newRemoteRunner(uuid string, wkr *worker) *remoteRunner {
                executor:      wkr.executor,
                envJSON:       envJSON,
                runnerCmd:     wkr.wp.runnerCmd,
+               runnerArgs:    wkr.wp.runnerArgs,
                remoteUser:    wkr.instance.RemoteUser(),
                timeoutTERM:   wkr.wp.timeoutTERM,
                timeoutSignal: wkr.wp.timeoutSignal,
@@ -81,7 +84,11 @@ func newRemoteRunner(uuid string, wkr *worker) *remoteRunner {
 // assume the remote process _might_ have started, at least until it
 // probes the worker and finds otherwise.
 func (rr *remoteRunner) Start() {
-       cmd := rr.runnerCmd + " --detach --stdin-env '" + rr.uuid + "'"
+       cmd := rr.runnerCmd + " --detach --stdin-env"
+       for _, arg := range rr.runnerArgs {
+               cmd += " '" + strings.Replace(arg, "'", "'\\''", -1) + "'"
+       }
+       cmd += " '" + rr.uuid + "'"
        if rr.remoteUser != "root" {
                cmd = "sudo " + cmd
        }
index cfb7a1bfb7a72b8924d5950deb7fc478f20873b0..4134788b2e27b00544151b857282d376c57a0ccf 100644 (file)
@@ -236,6 +236,8 @@ func (suite *WorkerSuite) TestProbeAndUpdate(c *check.C) {
                        timeoutBooting:   bootTimeout,
                        timeoutProbe:     probeTimeout,
                        exited:           map[string]time.Time{},
+                       runnerCmdDefault: "crunch-run",
+                       runnerArgs:       []string{"--args=not used with --list"},
                        runnerCmd:        "crunch-run",
                        runnerData:       trial.deployRunner,
                        runnerMD5:        md5.Sum(trial.deployRunner),