Skip to content

Commit

Permalink
Build daemons using their makefiles
Browse files Browse the repository at this point in the history
**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 <[email protected]>
  • Loading branch information
bdevcich committed Jun 29, 2023
1 parent 90c7236 commit 62a9ee2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 65 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
8 changes: 5 additions & 3 deletions config/daemons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dws
Submodule dws updated from 73abc4 to 0f3536
70 changes: 13 additions & 57 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
package main

import (
"bufio"
"bytes"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand All @@ -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, "<a href=\"")
end := strings.Index(text, "\">")
return text[start+len("<a href=\"") : end-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")
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions test/int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(),
}

Expand Down

0 comments on commit 62a9ee2

Please sign in to comment.