Skip to content

Commit

Permalink
jgf: refactor to use shared functions and fix containment
Browse files Browse the repository at this point in the history
Problem: the containment paths are currently not set,
and each resource type has a separate function.
Solution: create a shared node generation function
that uses a common resource counter, where the counter
manages the global and resource-specific counts. This
scoped commit includes refactor of those JGF functions,
which also means removing resources that are not present
in the graph (e.g., rack and socket) and ensuring that
we do not recreate the subnet since we loop through
nodes (and might hit the same one twice). I am also
removing the NFD features because I think they are
changed and might lead to error if someone has them.
We should assess which of them we want/need and add
them back strategically. I have a local test but want
to push this first to give a look over / run current
tests to determine if other changes are needed.

Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed May 28, 2024
1 parent 3ab00ad commit 422c313
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 293 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ^1.19
go-version: ^1.21

- name: Build Containers
run: |
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ^1.19
go-version: ^1.21

- name: Build Container
run: |
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ^1.19
go-version: ^1.21

- name: Download fluence artifact
uses: actions/download-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion src/fluence/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func main() {

// Fluxion GRPC
flux := fluxion.Fluxion{}
flux.InitFluxion(policy, label)
flux.InitFluxion(*policy, *label)

lis, err := net.Listen("tcp", port)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions src/fluence/fluxion/fluxion.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ type Fluxion struct {
}

// InitFluxion creates a new client to interaction with the fluxion API (via go bindings)
func (fluxion *Fluxion) InitFluxion(policy *string, label *string) {
func (fluxion *Fluxion) InitFluxion(policy string, label string) {
fluxion.cli = fluxcli.NewReapiClient()

klog.Infof("[Fluence] Created flux resource client %s", fluxion.cli)
err := utils.CreateJGF(defaults.KubernetesJsonGraphFormat, label)
err := utils.CreateInClusterJGF(defaults.KubernetesJsonGraphFormat, label)
if err != nil {
return
}
Expand All @@ -36,8 +36,8 @@ func (fluxion *Fluxion) InitFluxion(policy *string, label *string) {
}

p := "{}"
if *policy != "" {
p = string("{\"matcher_policy\": \"" + *policy + "\"}")
if policy != "" {
p = string("{\"matcher_policy\": \"" + policy + "\"}")
klog.Infof("[Fluence] match policy: %s", p)
}
fluxion.cli.InitContext(string(jgf), p)
Expand Down
Loading

0 comments on commit 422c313

Please sign in to comment.