Skip to content

Commit

Permalink
Use the new VERSION file to report the TrueIngress version
Browse files Browse the repository at this point in the history
This removes our dependency on the TrueIngress go module, which wasn't
very useful as it just called the TrueIngress executables and we can
do that ourselves.

Signed-off-by: toby cabot <toby@acnodal.io>
  • Loading branch information
caboteria committed Dec 13, 2023
1 parent 76f9bfc commit 30276f3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
8 changes: 5 additions & 3 deletions cmd/adhoc-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
ctrl "sigs.k8s.io/controller-runtime"

"epic-gateway.org/resource-model/controllers"
"epic-gateway.org/resource-model/internal/exec"
"epic-gateway.org/resource-model/internal/network"
"epic-gateway.org/resource-model/internal/pfc"
// +kubebuilder:scaffold:imports
Expand Down Expand Up @@ -75,8 +74,11 @@ func runAdhocAgent(cmd *cobra.Command, args []string) error {

setupLog.V(1).Info("Cleaning up TrueIngress")

// Empty the PFC tables.
if err := exec.RunScript(setupLog, "/opt/acnodal/bin/pfc_cli_go initialize"); err != nil {
// See if the PFC is installed
pfc.Check(setupLog)

// Empty the PFC tables
if err := pfc.Initialize(setupLog); err != nil {
return err
}

Expand Down
13 changes: 3 additions & 10 deletions cmd/node-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (

epicv1 "epic-gateway.org/resource-model/api/v1"
"epic-gateway.org/resource-model/controllers"
"epic-gateway.org/resource-model/internal/exec"
"epic-gateway.org/true-ingress/pfc"
"epic-gateway.org/resource-model/internal/pfc"
// +kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -88,16 +87,10 @@ func runNodeAgent(cmd *cobra.Command, args []string) error {
}

// See if the PFC is installed
ok, message := pfc.Check()
if ok {
// print the version
setupLog.Info("PFC", "version", message)
} else {
setupLog.Info("PFC Error", "message", message)
}
pfc.Check(setupLog)

// Empty the PFC tables
if err := exec.RunScript(setupLog, "/opt/acnodal/bin/pfc_cli_go initialize"); err != nil {
if err := pfc.Initialize(setupLog); err != nil {
return err
}

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.19
replace github.com/3scale-ops/marin3r => epic-gateway.org/marin3r v0.9.1-epic7

require (
epic-gateway.org/true-ingress v0.22.4
github.com/3scale-ops/marin3r v0.9.1
github.com/containernetworking/plugins v0.8.7
github.com/go-logr/logr v1.2.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
epic-gateway.org/marin3r v0.9.1-epic7 h1:YuEyZTZdJUs27qrkcW2o/xWe/f1SJpjSpJcQALmHFSE=
epic-gateway.org/marin3r v0.9.1-epic7/go.mod h1:bVIvwvEFiAtfPZnjDUJBt4Ujb6jvfeqzemOBmaEw750=
epic-gateway.org/true-ingress v0.22.4 h1:6y3NOAK8XvRGEwvhO6LUzi1C+jMQbVkF0T3WNshSkgo=
epic-gateway.org/true-ingress v0.22.4/go.mod h1:V2xlNKPoJvztoDAyyWxHmPNuTqwfWQGOxlObDeRpGVI=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
Expand Down
2 changes: 1 addition & 1 deletion internal/exec/run_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func RunScript(log logr.Logger, script string) error {
if stdoutStderr, err := cmd.CombinedOutput(); err != nil {
log.Error(err, "Script FAILED", "script", script, "combined-output", string(stdoutStderr))
} else {
log.V(1).Info("Script succeeded", "script", script)
log.V(1).Info("Script succeeded", "script", script, "combined-output", string(stdoutStderr))
}

return err
Expand Down
11 changes: 11 additions & 0 deletions internal/pfc/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,14 @@ func configure(log logr.Logger, nic string, qid int, flags int) error {
script := fmt.Sprintf("/opt/acnodal/bin/cli_cfg set %[1]s %[2]d %[3]d", nic, qid, flags)
return epicexec.RunScript(log, script)
}

func Check(log logr.Logger) error {
return epicexec.RunScript(log, "cat /opt/acnodal/bin/VERSION")
}

func Initialize(log logr.Logger) error {
if err := epicexec.RunScript(log, fmt.Sprintf("/opt/acnodal/bin/cli_service del all")); err != nil {
return err
}
return epicexec.RunScript(log, fmt.Sprintf("/opt/acnodal/bin/cli_tunnel del all"))
}

0 comments on commit 30276f3

Please sign in to comment.