-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add register -> nodes in graph endpoint
This adds the registration command for the subsystem, ensuring that the subsystem root is created (e.g., for IO) and the cluster name (e.g., IO for cluster keebler) created off of that. We currently allow any vertex to be created with an edge to itself (within the same subsystem) OR to a reference in the dominant subystem. We have that reference birectional so if/when there is a delete command we can parse the subsystem nodes (e.g., IO) to find the link to the dominant subsystem node, and then clean it up from the other side (and no dangling entries that no longer exist). Now that this is added I can work on a prototype of intents (basically a jobspec asking to request resources for this) Signed-off-by: vsoch <[email protected]>
- Loading branch information
Showing
24 changed files
with
1,067 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package register | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/converged-computing/rainbow/pkg/client" | ||
"github.com/converged-computing/rainbow/pkg/config" | ||
) | ||
|
||
// RegisterSubsystem registers a subsystem | ||
func RegisterSubsystem( | ||
host, | ||
clusterName, | ||
subsystemNodes, | ||
subsystem, | ||
cfgFile string, | ||
) error { | ||
|
||
c, err := client.NewClient(host) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// A config file is required here | ||
if cfgFile == "" { | ||
return fmt.Errorf("an existing configuration file is required to register a subsystem") | ||
} | ||
if subsystem == "" { | ||
return fmt.Errorf("a subsystem name is required to register") | ||
} | ||
// Read in the config, if provided, command line takes preference | ||
cfg, err := config.NewRainbowClientConfig(cfgFile, "", "", "", "") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
log.Printf("registering subsystem to cluster: %s", cfg.Scheduler.Name) | ||
|
||
// Last argument is subsystem name, which we can derive from graph | ||
response, err := c.RegisterSubsystem( | ||
context.Background(), | ||
cfg.Cluster.Name, | ||
cfg.Cluster.Secret, | ||
subsystemNodes, | ||
subsystem, | ||
) | ||
// If we get here, success! Dump all the stuff. | ||
log.Printf("%s", response) | ||
return err | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.