Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions ipu-plugin/pkg/infrapod/bindata/vsp-p4-pvc/05.vsp_p4_pv.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions ipu-plugin/pkg/infrapod/bindata/vsp-p4-pvc/06.vsp_p4_pvc.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions ipu-plugin/pkg/infrapod/bindata/vsp-p4/01.vsp_p4_sa.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions ipu-plugin/pkg/infrapod/bindata/vsp-p4/02.vsp_p4_role.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions ipu-plugin/pkg/infrapod/bindata/vsp-p4/03.vsp_p4_role_binding.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions ipu-plugin/pkg/infrapod/bindata/vsp-p4/04.vsp_p4_service.yaml

This file was deleted.

67 changes: 0 additions & 67 deletions ipu-plugin/pkg/infrapod/bindata/vsp-p4/99.vsp_p4.yaml

This file was deleted.

67 changes: 0 additions & 67 deletions ipu-plugin/pkg/infrapod/infrapod.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ package infrapod

import (
"context"
"embed"
"fmt"
"os"
"strconv"
"time"

"github.com/bombsimon/logrusr/v4"
"github.com/go-logr/logr"
"github.com/intel/ipu-opi-plugins/ipu-plugin/pkg/k8s/render"
"github.com/intel/ipu-opi-plugins/ipu-plugin/pkg/types"
logrus "github.com/sirupsen/logrus"
appsv1 "k8s.io/api/apps/v1"
Expand All @@ -29,8 +27,6 @@ import (
"k8s.io/client-go/rest"
)

//go:embed bindata/*
var binData embed.FS
var (
scheme = runtime.NewScheme()
)
Expand Down Expand Up @@ -164,69 +160,6 @@ func (infrapodMgr *InfrapodMgrOcImpl) getPvCrs() (error, bool) {
return err, false
}

/*
Create p4 pvc This will create ->
persistentvolumes
persistentvolumeclaims
*/
func (infrapodMgr *InfrapodMgrOcImpl) CreatePvCrs() error {
err, isPresent := infrapodMgr.getPvCrs()
if err != nil {
infrapodMgr.log.Error(err, "failed to start PV")
return fmt.Errorf("failed to get PV due to: %v", err)
}
if isPresent {
infrapodMgr.log.Error(err, "PV already present")
return nil
}
err = render.OperateAllFromBinData(infrapodMgr.log, "vsp-p4-pvc",
infrapodMgr.vspP4Template.ToMap(), binData, infrapodMgr.mgr.GetClient(),
nil, infrapodMgr.mgr.GetScheme(), false)
if err != nil {
infrapodMgr.log.Error(err, "failed to start PV")
return fmt.Errorf("failed to start PV due to: %v", err)
}
return nil
}

/*
Create p4 pod This will create ->
ServiceAccount
role
rolebindings
service for p4runtime
P4 pod
*/
func (infrapodMgr *InfrapodMgrOcImpl) CreateCrs() error {
err := render.OperateAllFromBinData(infrapodMgr.log, "vsp-p4",
infrapodMgr.vspP4Template.ToMap(), binData, infrapodMgr.mgr.GetClient(),
nil, infrapodMgr.mgr.GetScheme(), false)
if err != nil {
infrapodMgr.log.Error(err, "failed to start vsp-p4")
return fmt.Errorf("failed to start vsp-p4 (p4Image:%s) due to: %v", infrapodMgr.vspP4Template.ImageName, err)
}
return nil
}

/*
Delete p4 pod This will delete ->
ServiceAccount
role
rolebindings
service for p4runtime
P4 pod
*/
func (infrapodMgr *InfrapodMgrOcImpl) DeleteCrs() error {
err := render.OperateAllFromBinData(infrapodMgr.log, "vsp-p4",
infrapodMgr.vspP4Template.ToMap(), binData, infrapodMgr.mgr.GetClient(),
nil, infrapodMgr.mgr.GetScheme(), true)
if err != nil {
infrapodMgr.log.Error(err, "failed to delete vsp-p4")
return fmt.Errorf("failed to delete vsp-p4 (p4Image:%s) due to: %v", infrapodMgr.vspP4Template.ImageName, err)
}
return nil
}

func (infrapodMgr *InfrapodMgrOcImpl) WaitForPodDelete(timeout time.Duration) error {
/*
This waits for P4 pod status to be ready.
Expand Down
16 changes: 0 additions & 16 deletions ipu-plugin/pkg/ipuplugin/ipuplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,10 @@ func (s *server) Run() error {
syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
}
}()
if err = s.infrapodMgr.DeleteCrs(); err != nil {
log.Error(err, "unable to Delete Crs : %v", err)
return err
}
if err = s.infrapodMgr.WaitForPodDelete(60 * time.Second); err != nil {
log.Error(err, "unable to Wait for pod deletion : %v", err)
return err
}
if err = s.infrapodMgr.CreatePvCrs(); err != nil {
log.Error(err, "unable to Create PV Crs : %v", err)
return err
}
if err = s.infrapodMgr.CreateCrs(); err != nil {
log.Error(err, "unable to Create Crs : %v", err)
return err
}
if err = s.infrapodMgr.WaitForPodReady(60 * time.Second); err != nil {
log.Error(err, "unable to Wait for pod creation : %v", err)
return err
Expand Down Expand Up @@ -264,10 +252,6 @@ func (s *server) Stop() {
s.bridgeCtlr.DeleteBridges()
// Delete P4 rules on exit
cleanUpRulesOnExit(s.p4rtClient)
if err := s.infrapodMgr.DeleteCrs(); err != nil {
log.Error(err, "unable to Delete Crs : %v", err)
// Do not return since we continue on error
}
//Restore Red Hat primary network path via opcodes - This is required after the primiary network P4 rules are deleted.
utils.RestoreRHPrimaryNetwork()
}
Expand Down
3 changes: 0 additions & 3 deletions ipu-plugin/pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ type P4RTClient interface {

type InfrapodMgr interface {
StartMgr() error
CreateCrs() error
CreatePvCrs() error
DeleteCrs() error
WaitForPodDelete(timeout time.Duration) error
WaitForPodReady(timeout time.Duration) error
}
Loading