Skip to content

Commit 81d5506

Browse files
committed
wip: get working with flux operator + slingshot
Signed-off-by: vsoch <[email protected]>
1 parent 265a807 commit 81d5506

File tree

5 files changed

+34
-8
lines changed

5 files changed

+34
-8
lines changed

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WORKDIR /go/src/github.com/HPE/cxi-k8s-device-plugin
77
RUN make build
88
RUN cp bin/cxi-k8s-device-plugin /go/bin/
99

10-
FROM alpine:latest
11-
WORKDIR /root/
12-
COPY --from=0 /go/bin/cxi-k8s-device-plugin .
13-
CMD ["./cxi-k8s-device-plugin", "-logtostderr=true", "-stderrthreshold=INFO", "-v=5"]
10+
# FROM alpine:latest
11+
# WORKDIR /root/
12+
# COPY --from=0 /go/bin/cxi-k8s-device-plugin .
13+
CMD ["/go/bin/cxi-k8s-device-plugin", "-logtostderr=true", "-stderrthreshold=INFO", "-v=5"]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,12 @@ kubectl apply \
6060
-f ./deploy/hpecxi-device-plugin-ds.yaml
6161
```
6262

63+
## Pod Resources
64+
65+
```yaml
66+
resources:
67+
requests:
68+
beta.hpe.com/cxi: 1
69+
```
70+
6371
> #### Make sure the IPAM definitions in the `./deploy/NetworkAttachmentDefinition` are follwoing your cluster network requirements.

cmd/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ func main() {
2929
flag.PrintDefaults()
3030
}
3131
var pulse int
32+
devicePrefix := "hsi"
3233
flag.IntVar(&pulse, "pulse", 0, "time between health check polling in seconds. Set to 0 to disable.")
34+
flag.StringVar(&devicePrefix, "prefix", "hsi", "Device prefix to search for in net")
3335
flag.Parse()
3436

3537
for _, v := range versions {

deploy/hpecxi-device-plugin-ds.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ spec:
1212
labels:
1313
name: hpecxi-dp-ds
1414
spec:
15+
nodeSelector:
16+
"cray.nnf.node": "true"
1517
priorityClassName: system-node-critical
1618
tolerations:
1719
- key: CriticalAddonsOnly
1820
operator: Exists
21+
- key: "cray.nnf.node"
22+
operator: Equal
23+
value: "true"
24+
effect: NoSchedule
1925
containers:
2026
- image: ghcr.io/hewlettpackard/cxi-k8s-device-plugin:0.0.1-beta
2127
imagePullPolicy: Always
@@ -45,4 +51,5 @@ spec:
4551
path: /opt/cray
4652
- name: libfabric
4753
hostPath:
48-
path: /usr/lib64
54+
path: /usr/lib64
55+

pkg/hpecxi/hpecxi.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111

1212
const HPEvendorID string = "0x17db"
1313

14+
var cxiDriverRoot = "/sys/module/cxi_ss1/drivers"
15+
1416
// In the future, we may want to include lib paths into the helm.
1517
var LibPaths = map[string]string{
1618
"libfabric": "/opt/cray/lib64",
@@ -61,22 +63,29 @@ func GetLibs() ([]string, error) {
6163
// GetHPECXIs return a map of HPE Cassini on a node identified by the part of the pci address
6264
// This may be changed to use cxilib calls instead of sysfs.
6365
func GetHPECXIs() map[string]int {
64-
if _, err := os.Stat("/sys/module/cxi_core/drivers/"); err != nil {
66+
if _, err := os.Stat(cxiDriverRoot); err != nil {
6567
klog.Warningf("HPE CXI driver unavailable: %s", err)
6668
return make(map[string]int)
6769
}
6870

69-
matches, _ := filepath.Glob("/sys/module/cxi_core/drivers/pci:cxi_core/[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]:*")
71+
cxiRegex := filepath.Join(cxiDriverRoot, "pci:cxi_ss1/[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]:*")
72+
klog.Info(cxiRegex)
73+
matches, _ := filepath.Glob(cxiRegex)
7074

75+
klog.Info("Found matches:")
76+
klog.Info(matches)
7177
devices := make(map[string]int)
7278

7379
for _, path := range matches {
80+
// This is a directory with "net"
81+
// /sys/module/cxi_ss1/drivers/pci:cxi_ss1/0000:01:00.0/
82+
7483
klog.Info(path)
7584
devPaths, _ := filepath.Glob(path + "/net/*")
7685

7786
for _, devPath := range devPaths {
7887
name := filepath.Base(devPath)
79-
if name[0:3] == "hsn" {
88+
if name[0:3] == "hsi" {
8089
nic_id, _ := strconv.Atoi(name[len(name)-1:])
8190
devices[name] = nic_id
8291
}

0 commit comments

Comments
 (0)