Skip to content

Commit

Permalink
search all namespaces for Sriov/NetworkNodePolicy objects
Browse files Browse the repository at this point in the history
  • Loading branch information
sebrandon1 committed Nov 14, 2024
1 parent 48536ad commit 1e0b834
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
12 changes: 12 additions & 0 deletions pkg/autodiscover/autodiscover.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ type DiscoveredTestData struct {
AllPackageManifests []*olmPkgv1.PackageManifest
SriovNetworks []sriovNetworkOp.SriovNetwork
SriovNetworkNodePolicies []sriovNetworkOp.SriovNetworkNodePolicy
AllSriovNetworks []sriovNetworkOp.SriovNetwork
AllSriovNetworkNodePolicies []sriovNetworkOp.SriovNetworkNodePolicy
NetworkAttachmentDefinitions []nadClient.NetworkAttachmentDefinition
Deployments []appsv1.Deployment
StatefulSet []appsv1.StatefulSet
Expand Down Expand Up @@ -280,6 +282,16 @@ func DoAutoDiscover(config *configuration.TestConfiguration) DiscoveredTestData
log.Fatal("Cannot get list of sriov network node policies, err: %v", err)
}

data.AllSriovNetworks, err = getSriovNetworks(oc, data.AllNamespaces)
if err != nil {
log.Fatal("Cannot get list of sriov networks, err: %v", err)
}

data.AllSriovNetworkNodePolicies, err = getSriovNetworkNodePolicies(oc, data.AllNamespaces)
if err != nil {
log.Fatal("Cannot get list of sriov network node policies, err: %v", err)
}

data.NetworkAttachmentDefinitions, err = getNetworkAttachmentDefinitions(oc, data.Namespaces)
if err != nil {
log.Fatal("Cannot get list of network attachment definitions, err: %v", err)
Expand Down
6 changes: 3 additions & 3 deletions pkg/provider/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,9 @@ func (p *Pod) IsUsingSRIOVWithMTU() (bool, error) {

// If the network-status annotation is not set, let's check the SriovNetwork/SriovNetworkNodePolicy CRs
// to see if the MTU is set there.
log.Debug("Number of SriovNetworks: %d", len(env.SriovNetworks))
log.Debug("Number of SriovNetworkNodePolicies: %d", len(env.SriovNetworkNodePolicies))
if sriovNetworkUsesMTU(env.SriovNetworks, env.SriovNetworkNodePolicies, nad.Name) {
log.Debug("Number of SriovNetworks: %d", len(env.AllSriovNetworks))
log.Debug("Number of SriovNetworkNodePolicies: %d", len(env.AllSriovNetworkNodePolicies))
if sriovNetworkUsesMTU(env.AllSriovNetworks, env.AllSriovNetworkNodePolicies, nad.Name) {
return true, nil
}
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ type TestEnvironment struct { // rename this with testTarget
AllPackageManifests []*olmpkgv1.PackageManifest `json:"AllPackageManifests"`
OperatorGroups []*olmv1.OperatorGroup `json:"OperatorGroups"`
SriovNetworks []sriovNetworkOp.SriovNetwork
AllSriovNetworks []sriovNetworkOp.SriovNetwork
SriovNetworkNodePolicies []sriovNetworkOp.SriovNetworkNodePolicy
AllSriovNetworkNodePolicies []sriovNetworkOp.SriovNetworkNodePolicy
NetworkAttachmentDefinitions []nadClient.NetworkAttachmentDefinition
IstioServiceMeshFound bool
ValidProtocolNames []string
Expand Down Expand Up @@ -359,6 +361,8 @@ func buildTestEnvironment() { //nolint:funlen
// SR-IOV
env.SriovNetworks = data.SriovNetworks
env.SriovNetworkNodePolicies = data.SriovNetworkNodePolicies
env.AllSriovNetworks = data.AllSriovNetworks
env.AllSriovNetworkNodePolicies = data.AllSriovNetworkNodePolicies
env.NetworkAttachmentDefinitions = data.NetworkAttachmentDefinitions
for _, pod := range env.Pods {
isCreatedByDeploymentConfig, err := pod.CreatedByDeploymentConfig()
Expand Down

0 comments on commit 1e0b834

Please sign in to comment.