Skip to content

Commit

Permalink
update yaml configuration to allow for control plane status detection
Browse files Browse the repository at this point in the history
  • Loading branch information
relyt0925 authored and bn222 committed Oct 6, 2022
1 parent e5b58e8 commit a13b59e
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 29 deletions.
4 changes: 2 additions & 2 deletions api/v1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1 contains API Schema definitions for the sriovnetwork v1 API group
//+kubebuilder:object:generate=true
//+groupName=sriovnetwork.openshift.io
// +kubebuilder:object:generate=true
// +groupName=sriovnetwork.openshift.io
package v1

import (
Expand Down
3 changes: 3 additions & 0 deletions deploy/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ rules:
- apiGroups: ["machineconfiguration.openshift.io"]
resources: ["*"]
verbs: ["*"]
- apiGroups: [ "config.openshift.io" ]
resources: [ "infrastructures" ]
verbs: [ "get", "list", "watch" ]
3 changes: 3 additions & 0 deletions deployment/sriov-network-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ rules:
- apiGroups: [""]
resources: ["pods/eviction"]
verbs: ["create"]
- apiGroups: [ "config.openshift.io" ]
resources: [ "infrastructures" ]
verbs: [ "get", "list", "watch" ]
14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ func DiscoverSriovDevices(withUnsupported bool) ([]sriovnetworkv1.InterfaceExt,
}

// SyncNodeState Attempt to update the node state to match the desired state
//
func SyncNodeState(newState *sriovnetworkv1.SriovNetworkNodeState, pfsToConfig map[string]bool) error {
if IsKernelLockdownMode(true) && hasMellanoxInterfacesInSpec(newState) {
glog.Warningf("cannot use mellanox devices when in kernel lockdown mode")
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/utils_virtual.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func tryToGetVirtualInterfaceName(pciAddr string) string {
}

// SyncNodeStateVirtual attempt to update the node state to match the desired state
// in virtual platforms
// in virtual platforms
func SyncNodeStateVirtual(newState *sriovnetworkv1.SriovNetworkNodeState) error {
var err error
for _, ifaceStatus := range newState.Status.Interfaces {
Expand Down
22 changes: 11 additions & 11 deletions test/util/netns/netns.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const (
sriovNumVfsFile = "sriov_numvfs"
)

//SetPfVfLinkNetNs requires physical function (PF) PCI address and a string to a network namespace in which to add
//any associated virtual functions (VF). VFs must be attached to kernel driver to provide links. Attaching VFs to
//vfio-pci driver is not supported. PF is set to target network namespace.
//Polling interval is required and this period will determine how often the VFs Links are checked to ensure they are in
//the target network namespace. Two channels are required - one for informing the func to end and one to inform
//the caller of an error or if the function has ended. It is this func responsibility to cleanup the done channel and
//callers responsibility to cleanup quit channel.
// SetPfVfLinkNetNs requires physical function (PF) PCI address and a string to a network namespace in which to add
// any associated virtual functions (VF). VFs must be attached to kernel driver to provide links. Attaching VFs to
// vfio-pci driver is not supported. PF is set to target network namespace.
// Polling interval is required and this period will determine how often the VFs Links are checked to ensure they are in
// the target network namespace. Two channels are required - one for informing the func to end and one to inform
// the caller of an error or if the function has ended. It is this func responsibility to cleanup the done channel and
// callers responsibility to cleanup quit channel.
func SetPfVfLinkNetNs(pfPciAddr, netNsPath string, pollInterval time.Duration, quitCh chan bool, doneCh chan error) {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
Expand Down Expand Up @@ -83,8 +83,8 @@ func SetPfVfLinkNetNs(pfPciAddr, netNsPath string, pollInterval time.Duration, q
}
}

//setVfNetNs requires physical function (PF) PCI address and a handle to a network namespace in which to add
//any associated virtual functions (VF). If no VFs are found, no error is returned.
// setVfNetNs requires physical function (PF) PCI address and a handle to a network namespace in which to add
// any associated virtual functions (VF). If no VFs are found, no error is returned.
func setVfNetNs(pfPciAddr string, targetNetNs netns.NsHandle) error {
var (
err error
Expand Down Expand Up @@ -141,8 +141,8 @@ func setVfNetNs(pfPciAddr string, targetNetNs netns.NsHandle) error {
return nil
}

//setLinkNetNs attempts to create a link object from PCI address and change the network namespace. Arg pciAddr must have
//an associated interface name in the current network namespace or an error is thrown.
// setLinkNetNs attempts to create a link object from PCI address and change the network namespace. Arg pciAddr must have
// an associated interface name in the current network namespace or an error is thrown.
func setLinkNetNs(pciAddr string, targetNetNs netns.NsHandle) error {
var err error
netDir := filepath.Join(sysBusPci, pciAddr, "net")
Expand Down

0 comments on commit a13b59e

Please sign in to comment.