Skip to content

Commit

Permalink
NCSDEV-11024: fix go workflow non compliances
Browse files Browse the repository at this point in the history
  • Loading branch information
Jing Zhang committed Nov 30, 2023
1 parent 9ac2c0f commit b4eabf3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/fssclient/datamodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Packet fssclient - FSS Connect REST API interface.
// Package fssclient - FSS Connect REST API interface.
package fssclient

import (
Expand Down
21 changes: 11 additions & 10 deletions pkg/fssclient/fssclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ func (f *FssClient) Resync(firstRun bool, deploymentID string) error {
}
// delete lag host ports at last
for nodeName, lagPortsInNode := range lagPorts {
for lagPortName, lagPortId := range lagPortsInNode {
u := hostPortPath + "/" + lagPortId
for lagPortName, lagPortID := range lagPortsInNode {
u := hostPortPath + "/" + lagPortID
klog.Infof("Delete path=%s", u)
statusCode, _, err := f.DELETE(u)
if err != nil {
Expand Down Expand Up @@ -668,8 +668,8 @@ func (f *FssClient) Resync(firstRun bool, deploymentID string) error {
if exists {
delete(f.database.hostPortLabels, fssSubnetID)

for _, hostPortLabelId := range hostPortLabelIDByVlan {
delete(f.database.attachedPorts, hostPortLabelId)
for _, hostPortLabelID := range hostPortLabelIDByVlan {
delete(f.database.attachedPorts, hostPortLabelID)
}
}
}
Expand Down Expand Up @@ -766,8 +766,8 @@ func (f *FssClient) Resync(firstRun bool, deploymentID string) error {
}
// delete lag ports at the last
for nodeName, lagPortsToDelete := range lagPorts {
for lagPortName, lagPortId := range lagPortsToDelete {
u := hostPortPath + "/" + lagPortId
for lagPortName, lagPortID := range lagPortsToDelete {
u := hostPortPath + "/" + lagPortID
klog.Warningf("Delete unknown hostPort in server: %s", u)
statusCode, _, err := f.DELETE(u)
if err != nil {
Expand Down Expand Up @@ -806,6 +806,7 @@ func (f *FssClient) Resync(firstRun bool, deploymentID string) error {
return nil
}

// CreateSubnetInterface creates VLAN interface (host port label)
func (f *FssClient) CreateSubnetInterface(fssWorkloadEvpnName string, fssSubnetName string, vlanID int) (string, string, error) {
fssSubnetID := ""
hostPortLabelID := ""
Expand Down Expand Up @@ -904,7 +905,7 @@ func (f *FssClient) CreateSubnetInterface(fssWorkloadEvpnName string, fssSubnetN
return fssSubnetID, hostPortLabel.ID, nil
}

// GetSubnetInterface returns VLAN interface if exists
// GetSubnetInterface returns VLAN interface (host port label) if exists
func (f *FssClient) GetSubnetInterface(fssWorkloadEvpnName string, fssSubnetName string, vlanID int) (string, string, string, bool) {
fssWorkloadEvpnID, ok := f.database.workloadMapping[fssWorkloadEvpnName]
if !ok {
Expand All @@ -929,7 +930,7 @@ func (f *FssClient) GetSubnetInterface(fssWorkloadEvpnName string, fssSubnetName
return fssWorkloadEvpnID, fssSubnetID, hostPortLabelID, true
}

// AttachSubnetInterface attaches VLAN interface
// AttachSubnetInterface attaches VLAN interface (host port label) to subnet
func (f *FssClient) AttachSubnetInterface(fssSubnetID string, vlanID int, hostPortLabelID string) error {
klog.Infof("Attach hostPortLabel %s to fssSubnetID %s for vlanID %d", hostPortLabelID, fssSubnetID, vlanID)
attachedLabels := f.database.attachedLabels[fssSubnetID]
Expand Down Expand Up @@ -969,7 +970,7 @@ func (f *FssClient) AttachSubnetInterface(fssSubnetID string, vlanID int, hostPo
return nil
}

// DeleteSubnetInterface deletes VLAN interface
// DeleteSubnetInterface deletes VLAN interface (host port label)
func (f *FssClient) DeleteSubnetInterface(fssWorkloadEvpnID string, fssSubnetID string, vlanID int, hostPortLabelID string, requestType datatypes.NadAction) error {
klog.Infof("Delete hostPortLabel %s for fssSubnetID %s and vlanID %d", hostPortLabelID, fssSubnetID, vlanID)
var result error
Expand Down Expand Up @@ -1160,7 +1161,7 @@ func (f *FssClient) DetachHostPort(hostPortLabelID string, node string, port dat
return result
}

// DetachNode detaches host port by node
// DetachNode delete host port by node
func (f *FssClient) DetachNode(nodeName string) {
var lagPorts = make(map[string]HostPortIDByName)
for k, v := range f.database.hostPorts[nodeName] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func validateNetworkAttachmentDefinition(operation admissionv1.Operation, netAtt
glog.V(5).Infof("validating NAD: %+v", netAttachDef)

var confBytes []byte
var mutationRequired bool = false
mutationRequired := false
if netAttachDef.Spec.Config != "" {
// try to unmarshal config into NetworkConfig or NetworkConfigList
// using actual code from libcni - if succesful, it means that the config
Expand Down

0 comments on commit b4eabf3

Please sign in to comment.