diff --git a/Makefile b/Makefile index c8ca451..e691891 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ endif # This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit. OPERATOR_SDK_VERSION ?= v1.37.0 # Image URL to use all building/pushing image targets -TAG ?= latest +TAG ?= 1.1.1 IMG ?= ${IMAGE_TAG_BASE}:${TAG} # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.31.0 @@ -231,7 +231,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION) KUSTOMIZE_VERSION ?= v5.3.0 CONTROLLER_TOOLS_VERSION ?= v0.14.0 ENVTEST_VERSION ?= release-0.17 -GOLANGCI_LINT_VERSION ?= v1.64.7 +GOLANGCI_LINT_VERSION ?= v1.64.8 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. diff --git a/charts/network-operator/Chart.yaml b/charts/network-operator/Chart.yaml index 6a7f7f1..701b4f6 100644 --- a/charts/network-operator/Chart.yaml +++ b/charts/network-operator/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: intel-network-operator description: A Helm chart for Intel Network Operator for Kubernetes type: application -version: 1.1.0 -appVersion: "1.1.0" +version: 1.1.1 +appVersion: "1.1.1" dependencies: - name: node-feature-discovery @@ -15,6 +15,6 @@ dependencies: annotations: org.opencontainers.image.url: "https://github.com/intel/network-operator" org.opencontainers.image.source: "https://github.com/intel/network-operator" - org.opencontainers.image.version: "1.1.0" + org.opencontainers.image.version: "1.1.1" org.opencontainers.image.title: "Intel Network Operator" org.opencontainers.image.description: "This chart installs the Intel Network Operator for Kubernetes." diff --git a/charts/network-operator/values.yaml b/charts/network-operator/values.yaml index eab4225..b32c369 100644 --- a/charts/network-operator/values.yaml +++ b/charts/network-operator/values.yaml @@ -3,7 +3,7 @@ logLevel: 2 operator: image: repository: intel/intel-network-operator - tag: 1.1.0 + tag: 1.1.1 imagePullPolicy: IfNotPresent resources: limits: @@ -30,7 +30,7 @@ config: networkMetrics: false image: repository: intel/intel-network-linkdiscovery - tag: 1.1.0 + tag: 1.1.1 imagePullPolicy: IfNotPresent nodeSelector: intel.feature.node.kubernetes.io/gaudi-ready: "true" diff --git a/cmd/discover/main.go b/cmd/discover/main.go index c33e4a8..996aabe 100644 --- a/cmd/discover/main.go +++ b/cmd/discover/main.go @@ -95,6 +95,13 @@ func detectLLDP(config *cmdConfig, networkConfigs map[string]*networkConfigurati lldpResultChan := make(chan lldp.DiscoveryResult, len(networkConfigs)) timeoutctx, cancelctx := context.WithTimeout(config.ctx, config.timeout) + filterFunc := func(portDescription string) bool { + // Check if the port description field has the correct data in it + _, _, err := parseIPFromString(portDescription) + + return err == nil + } + defer cancelctx() for _, networkconfig := range networkConfigs { @@ -107,7 +114,7 @@ func detectLLDP(config *cmdConfig, networkConfigs map[string]*networkConfigurati wg.Add(1) go func() { lldpClient := lldp.NewClient(timeoutctx, networkconfig.link.Attrs().Name, *networkconfig.localHwAddr) - if err := lldpClient.Start(lldpResultChan); err != nil { + if err := lldpClient.Start(lldpResultChan, filterFunc); err != nil { klog.Infof("Cannot start LLDP client: %v\n", err) } wg.Done() diff --git a/cmd/discover/network.go b/cmd/discover/network.go index b8a79b0..d254d7f 100644 --- a/cmd/discover/network.go +++ b/cmd/discover/network.go @@ -213,6 +213,15 @@ func getNetworkConfigs(interfaces []string) ([]string, map[string]*networkConfig return allinterfaces, links, nil } +func parseIPFromString(portDescription string) (net.IP, *net.IPNet, error) { + substrings := strings.Split(portDescription, " ") + if len(substrings) < 2 { + return nil, nil, fmt.Errorf("port description field doesn't follow expected format (no-alert CIDR)") + } + + return net.ParseCIDR(substrings[1]) +} + func selectMask30L3Address(nwconfig *networkConfiguration) (*net.IP, *net.IP, error) { var ( peerNetwork *net.IPNet @@ -221,15 +230,9 @@ func selectMask30L3Address(nwconfig *networkConfiguration) (*net.IP, *net.IP, er err error ) - substrings := strings.Split(nwconfig.portDescription, " ") - if len(substrings) < 2 { - return nil, nil, fmt.Errorf("interface '%s' could not split string '%s'", - nwconfig.link.Attrs().Name, nwconfig.portDescription) - } - - peeraddr, peerNetwork, err = net.ParseCIDR(substrings[1]) + peeraddr, peerNetwork, err = parseIPFromString(nwconfig.portDescription) if err != nil { - return nil, nil, fmt.Errorf("interface '%s' could not parse '%s': %v", + return nil, nil, fmt.Errorf("interface '%s' could not parse CIDR from port description '%s': %v", nwconfig.link.Attrs().Name, nwconfig.portDescription, err) } diff --git a/config/operator/manager/manager.yaml b/config/operator/manager/manager.yaml index 2644eb3..5701728 100644 --- a/config/operator/manager/manager.yaml +++ b/config/operator/manager/manager.yaml @@ -64,7 +64,7 @@ spec: args: - --leader-elect - --health-probe-bind-address=:8081 - image: intel/intel-network-operator:1.1.0 + image: intel/intel-network-operator:1.1.1 name: manager env: - name: OPERATOR_NAMESPACE diff --git a/config/operator/samples/gaudi-l2.yaml b/config/operator/samples/gaudi-l2.yaml index c97f677..26484d3 100644 --- a/config/operator/samples/gaudi-l2.yaml +++ b/config/operator/samples/gaudi-l2.yaml @@ -6,7 +6,7 @@ spec: configurationType: gaudi-so gaudiScaleOut: layer: L2 - image: intel/intel-network-linkdiscovery:1.1.0 + image: intel/intel-network-linkdiscovery:1.1.1 pullPolicy: IfNotPresent logLevel: 1 nodeSelector: diff --git a/config/operator/samples/gaudi-l3-metrics.yaml b/config/operator/samples/gaudi-l3-metrics.yaml index 11ee3a7..52aec4f 100644 --- a/config/operator/samples/gaudi-l3-metrics.yaml +++ b/config/operator/samples/gaudi-l3-metrics.yaml @@ -7,7 +7,7 @@ spec: gaudiScaleOut: layer: L3 networkMetrics: true - image: intel/intel-network-linkdiscovery:1.1.0 + image: intel/intel-network-linkdiscovery:1.1.1 pullPolicy: IfNotPresent logLevel: 1 nodeSelector: diff --git a/config/operator/samples/gaudi-l3-pfc-lldpad-enabled.yaml b/config/operator/samples/gaudi-l3-pfc-lldpad-enabled.yaml index 008836d..4701e33 100644 --- a/config/operator/samples/gaudi-l3-pfc-lldpad-enabled.yaml +++ b/config/operator/samples/gaudi-l3-pfc-lldpad-enabled.yaml @@ -8,7 +8,7 @@ spec: layer: L3 pfcPriorities: "11110000" enableLLDPAD: true - image: intel/intel-network-linkdiscovery:1.1.0 + image: intel/intel-network-linkdiscovery:1.1.1 pullPolicy: IfNotPresent logLevel: 1 nodeSelector: diff --git a/config/operator/samples/gaudi-l3.yaml b/config/operator/samples/gaudi-l3.yaml index 627c7b9..16cf6a0 100644 --- a/config/operator/samples/gaudi-l3.yaml +++ b/config/operator/samples/gaudi-l3.yaml @@ -6,7 +6,7 @@ spec: configurationType: gaudi-so gaudiScaleOut: layer: L3 - image: intel/intel-network-linkdiscovery:1.1.0 + image: intel/intel-network-linkdiscovery:1.1.1 pullPolicy: IfNotPresent logLevel: 1 nodeSelector: diff --git a/internal/controller/networkconfiguration_controller.go b/internal/controller/networkconfiguration_controller.go index d306933..c0fec44 100644 --- a/internal/controller/networkconfiguration_controller.go +++ b/internal/controller/networkconfiguration_controller.go @@ -301,6 +301,8 @@ func updateGaudiScaleOutDaemonSet(ds *apps.DaemonSet, netconf *networkv1alpha1.N ds.Name = netconf.Name ds.ObjectMeta.Namespace = namespace + ds.Spec.Template.Spec.Containers[0].ImagePullPolicy = v1.PullPolicy(netconf.Spec.GaudiScaleOut.PullPolicy) + if len(netconf.Spec.NodeSelector) > 0 { ds.Spec.Template.Spec.NodeSelector = netconf.Spec.NodeSelector } diff --git a/pkg/lldp/client.go b/pkg/lldp/client.go index e37c1c6..c4b799e 100644 --- a/pkg/lldp/client.go +++ b/pkg/lldp/client.go @@ -70,7 +70,7 @@ func NewClient(ctx context.Context, ifacename string, hwAddr []byte) *Client { // Start searches on the configured interface for lldp packages and // pushes the optional TLV SysName and SysDescription fields of each // found lldp package into the given channel. -func (l *Client) Start(resultChan chan<- DiscoveryResult) error { +func (l *Client) Start(resultChan chan<- DiscoveryResult, portDescriptionFilter func(string) bool) error { defer l.Close() var packetSource *gopacket.PacketSource @@ -110,6 +110,8 @@ func (l *Client) Start(resultChan chan<- DiscoveryResult) error { continue } + infoFound := false + dr := DiscoveryResult{InterfaceName: l.InterfaceName} for _, layer := range packet.Layers() { if layer.LayerType() == layers.LayerTypeLinkLayerDiscovery { @@ -134,12 +136,26 @@ func (l *Client) Start(resultChan chan<- DiscoveryResult) error { if !ok { continue } + + if portDescriptionFilter != nil && !portDescriptionFilter(info.PortDescription) { + // Filter function did not match, ignore this packet + continue + } + dr.SysName = info.SysName dr.SysDescription = info.SysDescription dr.PortDescription = info.PortDescription + + infoFound = true } } + + if !infoFound { + // We did not find the info layer, ignore this packet + continue + } + resultChan <- dr return nil