20649: cloudtest obeys DeployPublicKey config, like a-d-c.
authorTom Clegg <tom@curii.com>
Thu, 10 Aug 2023 14:45:46 +0000 (10:45 -0400)
committerTom Clegg <tom@curii.com>
Thu, 10 Aug 2023 14:45:46 +0000 (10:45 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/cloud/cloudtest/cmd.go
lib/cloud/cloudtest/tester.go

index 0c1049b76c25ee3bfd3278e8e15c954f9065b632..2dc13e5a51a2f3c423db922a837186400e3d812d 100644 (file)
@@ -99,6 +99,7 @@ func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
                InstanceType:        it,
                SSHKey:              key,
                SSHPort:             cluster.Containers.CloudVMs.SSHPort,
+               DeployPublicKey:     cluster.Containers.CloudVMs.DeployPublicKey,
                BootProbeCommand:    cluster.Containers.CloudVMs.BootProbeCommand,
                InstanceInitCommand: cloud.InitCommand(cluster.Containers.CloudVMs.InstanceInitCommand),
                ShellCommand:        *shellCommand,
index f7c2a3c73d9682569d33ae8eec98416626c6fcde..a335278ed6b15a91794bc8927697dec3a6aef1ec 100644 (file)
@@ -41,6 +41,7 @@ type tester struct {
        ImageID             cloud.ImageID
        SSHKey              ssh.Signer
        SSHPort             string
+       DeployPublicKey     bool
        BootProbeCommand    string
        InstanceInitCommand cloud.InitCommand
        ShellCommand        string
@@ -174,15 +175,21 @@ func (t *tester) runWithDriverParameters(driverParameters json.RawMessage) bool
        bootDeadline := time.Now().Add(t.TimeoutBooting)
        initCommand := worker.TagVerifier{Instance: nil, Secret: t.secret, ReportVerified: nil}.InitCommand() + "\n" + t.InstanceInitCommand
 
+       installPublicKey := t.SSHKey.PublicKey()
+       if !t.DeployPublicKey {
+               installPublicKey = nil
+       }
+
        t.Logger.WithFields(logrus.Fields{
                "InstanceType":         t.InstanceType.Name,
                "ProviderInstanceType": t.InstanceType.ProviderType,
                "ImageID":              t.ImageID,
                "Tags":                 tags,
                "InitCommand":          initCommand,
+               "DeployPublicKey":      installPublicKey != nil,
        }).Info("creating instance")
        t0 := time.Now()
-       inst, err := t.is.Create(t.InstanceType, t.ImageID, tags, initCommand, t.SSHKey.PublicKey())
+       inst, err := t.is.Create(t.InstanceType, t.ImageID, tags, initCommand, installPublicKey)
        lgrC := t.Logger.WithField("Duration", time.Since(t0))
        if err != nil {
                // Create() might have failed due to a bug or network