Skip to content

Commit

Permalink
Merge pull request #203 from zshi-redhat/webhook-unset-default-linktype
Browse files Browse the repository at this point in the history
Unset default linkType value in operator webhook
  • Loading branch information
pliurh authored Nov 22, 2021
2 parents f4cc0f3 + f063cca commit bed15e4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/webhook/mutate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import (
"strings"

"github.com/golang/glog"
"k8s.io/api/admission/v1"
v1 "k8s.io/api/admission/v1"
)

var (
defaultPriorityPatch = map[string]interface{}{"op": "add", "path": "/spec/priority", "value": 99}
defaultDeviceTypePatch = map[string]interface{}{"op": "add", "path": "/spec/deviceType", "value": "netdevice"}
defaultIsRdmaPatch = map[string]interface{}{"op": "add", "path": "/spec/isRdma", "value": false}
defaultLinkTypePatch = map[string]interface{}{"op": "add", "path": "/spec/linkType", "value": "eth"}
InfiniBandIsRdmaPatch = map[string]interface{}{"op": "add", "path": "/spec/isRdma", "value": true}
)

Expand Down Expand Up @@ -41,10 +40,6 @@ func mutateSriovNetworkNodePolicy(cr map[string]interface{}) (*v1.AdmissionRespo
glog.V(2).Infof("mutateSriovNetworkNodePolicy(): set default isRdma to false for %v", name)
patchs = append(patchs, defaultIsRdmaPatch)
}
if _, ok := spec.(map[string]interface{})["linkType"]; !ok {
glog.V(2).Infof("mutateSriovNetworkNodePolicy(): set default linkType to eth for %v", name)
patchs = append(patchs, defaultLinkTypePatch)
}
// Device with InfiniBand link type requires isRdma to be true
if str, ok := spec.(map[string]interface{})["linkType"].(string); ok && strings.ToLower(str) == "ib" {
glog.V(2).Infof("mutateSriovNetworkNodePolicy(): set isRdma to true for %v since ib link type is detected", name)
Expand Down

0 comments on commit bed15e4

Please sign in to comment.