From 62a9ee2556cd148820efec0a37458df32847bb06 Mon Sep 17 00:00:00 2001 From: Blake Devcich Date: Wed, 28 Jun 2023 08:43:35 -0500 Subject: [PATCH] Build daemons using their makefiles **Note**: The existing clientmount services on compute nodes will need to be removed. See below. The nnf-dm and client-mount daemons were being built manually in nnf-deploy rather than making use of their Makefiles. This was causing the versions to sit at 0.0.0 rather than the built in versioning. provided by the Makefiles. In order to support this change, the client-mount service had to be renamed to clientmountd in dws. The binary built by the Makefile and the RPMs is named clientmountd, so nnf-deply looks for an clientmountd.service file - which wouldn't exist without the rename. Any compute node running the old version will need to remove the service before the renamed service will work properly. At LLNL, this should not be an issue since they are already using the clientmountd binary, but they are writing their own service file. Signed-off-by: Blake Devcich --- config/config.go | 1 + config/daemons.yaml | 8 ++++-- dws | 2 +- main.go | 70 +++++++++------------------------------------ test/int_test.go | 8 +++--- 5 files changed, 24 insertions(+), 65 deletions(-) diff --git a/config/config.go b/config/config.go index fcad89a2..ea500ac2 100644 --- a/config/config.go +++ b/config/config.go @@ -238,6 +238,7 @@ func GetThirdPartyServices(configPath string) ([]ThirdPartyService, error) { type Daemon struct { Name string `yaml:"name"` Bin string `yaml:"bin"` + BuildCmd string `yaml:"buildCmd"` Repository string `yaml:"repository"` Path string `yaml:"path"` SkipNnfNodeName bool `yaml:"skipNnfNodeName"` diff --git a/config/daemons.yaml b/config/daemons.yaml index ff004f92..a26eb45c 100644 --- a/config/daemons.yaml +++ b/config/daemons.yaml @@ -6,16 +6,18 @@ daemons: namespace: nnf-system - name: nnf-data-movement bin: nnf-dm + buildCmd: make build-daemon + path: bin/ repository: nnf-dm - path: daemons/compute/server serviceAccount: name: nnf-dm-daemon namespace: nnf-dm-system extraArgs: "--kubernetes-qps 50 --kubernetes-burst 100" - name: client-mount - bin: clientmount + bin: clientmountd + buildCmd: make build-daemon + path: bin/ repository: dws - path: mount-daemon skipNnfNodeName: true serviceAccount: name: dws-operator-clientmount diff --git a/dws b/dws index 73abc41b..0f35365b 160000 --- a/dws +++ b/dws @@ -1 +1 @@ -Subproject commit 73abc41bd83ccecc8f7a14d86f0c51deebb80314 +Subproject commit 0f35365b2ff69b07291406d1c3f3e96ad3c5cc80 diff --git a/main.go b/main.go index c9f41523..481e7c55 100644 --- a/main.go +++ b/main.go @@ -20,8 +20,6 @@ package main import ( - "bufio" - "bytes" "encoding/json" "errors" "fmt" @@ -276,26 +274,22 @@ func (cmd *InstallCmd) Run(ctx *Context) error { fmt.Printf("Checking module %s\n", module) - if d.Path != "" { - if err := os.Chdir(d.Path); err != nil { - return err - } - } - - if !cmd.NoBuild && d.Bin != "" { - cmd := exec.Command("go", "build", "-o", d.Bin) - cmd.Env = append(cmd.Env, - "CGO_ENABLED=0", - "GOOS=linux", - "GOARCH=amd64", - "GOPRIVATE=github.hpe.com", - ) + if !cmd.NoBuild && d.Bin != "" && d.BuildCmd != "" { + b := strings.Fields(d.BuildCmd) + cmd := exec.Command(b[0], b[1:]...) fmt.Printf("Compile %s daemon...", d.Bin) if _, err := runCommand(ctx, cmd); err != nil { return err } fmt.Printf("DONE\n") + + // Change to the bin's output path + if d.Path != "" { + if err := os.Chdir(d.Path); err != nil { + return err + } + } } for rabbit := range system.Rabbits { @@ -633,11 +627,11 @@ func currentClusterConfig() (string, error) { } } - return "", fmt.Errorf("Cluster Name '%s' not found", context.Context.Cluster) + return "", fmt.Errorf("cluster Name '%s' not found", context.Context.Cluster) } } - return "", fmt.Errorf("Current Context '%s' not found", currentContext) + return "", fmt.Errorf("current Context '%s' not found", currentContext) } func checkNeedsUpdate(ctx *Context, name string, compute string, destination string) (bool, error) { @@ -735,24 +729,6 @@ func lastLocalCommit() (string, error) { return strings.TrimRight(string(out), "\r\n"), err } -func repoURL() (string, error) { - out, err := exec.Command("git", "config", "--get", "remote.origin.url").Output() - return strings.TrimRight(string(out), "\r\n"), err -} - -func checkoutCommit(commit string) error { - return exec.Command("git", "checkout", commit).Run() -} - -func currentTag() (string, error) { - out, err := exec.Command("git", "tag", "--points-at", "HEAD").Output() - return strings.TrimRight(string(out), "\r\n"), err -} - -func addTag(tag string) error { - return exec.Command("git", "tag", "-a", tag, "-m", fmt.Sprintf("\"setting version %s\"", tag)).Run() -} - func getOverlay(ctx *Context, system *config.System, module string) (string, error) { repo, _, err := config.FindRepository(ctx.Repos, module) @@ -772,26 +748,6 @@ func getOverlay(ctx *Context, system *config.System, module string) (string, err return "", nil } -func artifactoryVersion(url, commit string) (string, error) { - out, err := exec.Command("curl", url).Output() - if err != nil { - return "", err - } - - // Artifactory will return a laundry list of hrefs; try and locate the one with the right commit message - scanner := bufio.NewScanner(bytes.NewBuffer(out)) - for scanner.Scan() { - text := scanner.Text() - if strings.Contains(text, commit) { - start := strings.Index(text, "") - return text[start+len("")+1], nil - } - } - - return "", fmt.Errorf("Commit %s Not Found", commit) -} - func deployModule(ctx *Context, system *config.System, module string) error { cmd := exec.Command("make", "deploy") @@ -962,7 +918,7 @@ func deleteSystemConfigFromSOS(ctx *Context, system *config.System, module strin // Wait until the SystemConfiguration resource is completely gone. This may take // some time if there are many compute node namespaces to delete - for true { + for { if _, err := runCommand(ctx, getCmd); err != nil { break } diff --git a/test/int_test.go b/test/int_test.go index 654f95f2..c61b6781 100644 --- a/test/int_test.go +++ b/test/int_test.go @@ -86,11 +86,11 @@ var tests = []*T{ MakeTest("GFS2 with MPI Containers", "#DW jobdw type=gfs2 name=gfs2-with-containers-mpi capacity=100GB", "#DW container name=gfs2-with-containers-mpi profile=example-mpi DW_JOB_foo_local_storage=gfs2-with-containers-mpi"). - WithPermissions(1050, 2050).WithLabels("mpi"), + WithPermissions(1050, 1051).WithLabels("mpi"), MakeTest("Lustre with MPI Containers", "#DW jobdw type=lustre name=lustre-with-containers-mpi capacity=100GB", "#DW container name=lustre-with-containers-mpi profile=example-mpi DW_JOB_foo_local_storage=lustre-with-containers-mpi"). - WithPermissions(2050, 2051).WithLabels("mpi"), + WithPermissions(1050, 1051).WithLabels("mpi"), // Containers - Non-MPI MakeTest("GFS2 with Containers", @@ -115,14 +115,14 @@ var tests = []*T{ "#DW persistentdw name=containers-persistent-storage", "#DW container name=gfs2-lustre-with-containers profile=example-success DW_JOB_foo_local_storage=containers-local-storage DW_PERSISTENT_foo_persistent_storage=containers-persistent-storage"). WithPersistentLustre("containers-persistent-storage"). - WithPermissions(1050, 2050). + WithPermissions(1050, 1051). Pending(), MakeTest("GFS2 and Lustre with Containers MPI", "#DW jobdw name=containers-local-storage-mpi type=gfs2 capacity=100GB", "#DW persistentdw name=containers-persistent-storage-mpi", "#DW container name=gfs2-lustre-with-containers-mpi profile=example-mpi DW_JOB_foo_local_storage=containers-local-storage-mpi DW_PERSISTENT_foo_persistent_storage=containers-persistent-storage-mpi"). WithPersistentLustre("containers-persistent-storage-mpi"). - WithPermissions(1050, 2050). + WithPermissions(1050, 1051). Pending(), }