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 7, 2024
1 parent df7b103 commit 2e4a7be
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 @@ -91,6 +91,8 @@ type DiscoveredTestData struct {
HelmChartReleases map[string][]*release.Release
SriovNetworks []sriovNetworkOp.SriovNetwork
SriovNetworkNodePolicies []sriovNetworkOp.SriovNetworkNodePolicy
AllSriovNetworks []sriovNetworkOp.SriovNetwork
AllSriovNetworkNodePolicies []sriovNetworkOp.SriovNetworkNodePolicy
NetworkAttachmentDefinitions []nadClient.NetworkAttachmentDefinition
K8sVersion string
OpenshiftVersion string
Expand Down Expand Up @@ -277,6 +279,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 @@ -119,7 +119,9 @@ type TestEnvironment struct { // rename this with testTarget
AllCatalogSources []*olmv1Alpha.CatalogSource `json:"-"`
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 @@ -352,6 +354,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

operators := createOperators(data.Csvs, data.AllSubscriptions,
Expand Down

0 comments on commit 2e4a7be

Please sign in to comment.