Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change main to v1.2.2 #157

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_push_concheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
push:
branches:
- main
- v1.2.1
- v1.2.2
paths:
- connection-check/**

env:
IMAGE_VERSION: '1.2.1'
IMAGE_VERSION: '1.2.2'
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_push_controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- v1.2.1
- v1.2.2
paths:
- controllers/**
- compute/**
Expand All @@ -17,7 +17,7 @@ on:
- ./Makefile

env:
VERSION: '1.2.1'
VERSION: '1.2.2'
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
DAEMON_REGISTRY: ghcr.io/${{ github.repository_owner }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_push_daemon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
push:
branches:
- main
- v1.2.1
- v1.2.2
paths:
- daemon/**
- cni/**
- Makefile

env:
IMAGE_VERSION: '1.2.1'
IMAGE_VERSION: '1.2.2'
DAEMON_REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
# VERSION ?= 0.0.1
VERSION ?= 1.2.1
VERSION ?= 1.2.2
export CHANNELS = "alpha"

# CHANNELS define the bundle channels used in the bundle.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Recommended to deploy in the same default namespace for [health check service](.
```
##### by bundle with operator-sdk
```bash
operator-sdk run bundle ghcr.io/foundation-model-stack/multi-nic-cni-bundle:v1.2.1 -n multi-nic-cni-operator
operator-sdk run bundle ghcr.io/foundation-model-stack/multi-nic-cni-bundle:v1.2.2 -n multi-nic-cni-operator
```
#### Deploy MultiNicNetwork resource
1. Prepare `network.yaml` as shown in the [example](#multinicnetwork)
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ kind: Kustomization
images:
- name: controller
newName: ghcr.io/foundation-model-stack/multi-nic-cni-controller
newTag: v1.2.1
newTag: v1.2.2
2 changes: 1 addition & 1 deletion config/samples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
value: "11000"
- name: RT_TABLE_PATH
value: /opt/rt_tables
image: ghcr.io/foundation-model-stack/multi-nic-cni-daemon:v1.2.1
image: ghcr.io/foundation-model-stack/multi-nic-cni-daemon:v1.2.2
imagePullPolicy: Always
mounts:
- hostpath: /var/lib/cni/bin
Expand Down
2 changes: 1 addition & 1 deletion config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ kind: Kustomization
images:
- name: multi-nic-cni-daemon
newName: ghcr.io/foundation-model-stack/multi-nic-cni-daemon
newTag: v1.2.1
newTag: v1.2.2
2 changes: 1 addition & 1 deletion connection-check/concheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ spec:
serviceAccountName: multi-nic-concheck-account
containers:
- name: concheck
image: ghcr.io/foundation-model-stack/multi-nic-cni-concheck:v1.2.1
image: ghcr.io/foundation-model-stack/multi-nic-cni-concheck:v1.2.2
imagePullPolicy: Always
securityContext:
privileged: true
2 changes: 1 addition & 1 deletion controllers/vars/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
DefaultOperatorNamespace = "multi-nic-cni-operator"
DefaultCNIType = "multi-nic"
DefaultIPAMType = "multi-nic-ipam"
DefaultDaemonImage = "ghcr.io/foundation-model-stack/multi-nic-cni-daemon:v1.2.1"
DefaultDaemonImage = "ghcr.io/foundation-model-stack/multi-nic-cni-daemon:v1.2.2"
DefaultJoinPath = "/join"
DefaultInterfacePath = "/interface"
DefaultAddRoutePath = "/addl3"
Expand Down
2 changes: 1 addition & 1 deletion daemon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export DAEMON_REGISTRY ?= ghcr.io/foundation-model-stack

# DAEMON_IMG defines the image:tag used for daemon
IMAGE_TAG_BASE = $(DAEMON_REGISTRY)/multi-nic-cni
IMAGE_VERSION ?= 1.2.1
IMAGE_VERSION ?= 1.2.2
DAEMON_IMG ?= $(IMAGE_TAG_BASE)-daemon:v$(IMAGE_VERSION)


Expand Down
25 changes: 25 additions & 0 deletions daemon/src/iface/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,28 @@ func GetInterfaces() []backend.InterfaceInfoType {
}
return interfaces
}

func getNetAddressFromDevice(devName string) (string, error) {
devLink, err := netlink.LinkByName(devName)
if err != nil {
log.Printf("cannot find link %s: %v", devName, err)
return "", err
}
addrs, err := netlink.AddrList(devLink, netlink.FAMILY_V4)
if err != nil || len(addrs) == 0 {
log.Printf("cannot list address on %s: %v", devName, err)
return "", err
}
addr := addrs[0].IPNet
if addr == nil {
log.Printf("no address set on %s", devName)
return "", err
}
if devLink.Attrs().Flags&net.FlagUp == 0 {
// interface down
log.Printf("%s down", devName)
return "", err
}
netAddress := getNetAddress(addr)
return netAddress, nil
}
30 changes: 27 additions & 3 deletions daemon/src/iface/pci.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const (

var CheckPointfile string = "/var/lib/kubelet/device-plugins/kubelet_internal_checkpoint"

var deviceMapCache = InitSafeCache()

// modify from https://github.com/k8snetworkplumbingwg/multus-cni/blob/9b45d4b211728aa0db44a1624aac8e61843390cf/pkg/checkpoint/checkpoint.go#L72
// DeviceIDs can map[string]string or []string
type PodDevicesEntry struct {
Expand Down Expand Up @@ -121,10 +123,32 @@ func GetDeviceMap(resourceMap map[string][]string, resourceName string) map[stri

if deviceIDs, exist := resourceMap[resourceName]; exist {
for _, deviceID := range deviceIDs {
masterName, err := GetPfName(deviceID)
if err == nil {
if netAddress, exist := nameNetMap[masterName]; exist {
var masterName string
deviceNameInterface := deviceMapCache.GetCache(deviceID)
if deviceNameInterface != nil {
masterName = deviceNameInterface.(string)
} else {
var err error
masterName, err = GetPfName(deviceID)
if err != nil {
log.Printf("cannot get physical device %s: %v\n", deviceID, err)
} else {
log.Printf("set deviceMapCache %s=%s\n", deviceID, masterName)
deviceMapCache.SetCache(deviceID, masterName)
}
}
if netAddress, exist := nameNetMap[masterName]; exist {
deviceMap[netAddress] = deviceID
} else {
netAddress, err := getNetAddressFromDevice(masterName)
if err != nil {
log.Printf("cannot get network address of device %s: %v\n", masterName, err)
} else {
deviceMap[netAddress] = deviceID
// found new device, update interfaces
GetInterfaces()
nameNetMap = GetNameNetMap()
log.Printf("updated nameNetMap map: %v\n", nameNetMap)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions daemon/src/selector/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ func getDefaultResponse(req NICSelectRequest, masterNameMap map[string]string, n
}

func Select(req NICSelectRequest) NICSelectResponse {
masterNameMap := iface.GetInterfaceNameMap()
nameNetMap := iface.GetNameNetMap()
deviceMap := make(map[string]string)
resourceMap := make(map[string][]string)

Expand All @@ -93,6 +91,8 @@ func Select(req NICSelectRequest) NICSelectResponse {
log.Printf("Cannot get pod: %v\n", err)
}

masterNameMap := iface.GetInterfaceNameMap()
nameNetMap := iface.GetNameNetMap()
netSpec, err := MultinicnetHandler.Get(req.NetAttachDefName, req.PodNamespace)
if err != nil {
return getDefaultResponse(req, masterNameMap, nameNetMap, deviceMap, resourceMap)
Expand Down
Loading