[stub] stubbing in daemonset and yaml resources, updates driver name for now to try it

This commit is contained in:
dougbtv 2025-03-26 14:58:05 -04:00
parent 8f8bdd8772
commit 062b5f82ea
6 changed files with 107 additions and 3 deletions

View File

@ -29,7 +29,7 @@ const (
cdiVendor = "k8s." + DriverName
cdiClass = "gpu"
cdiKind = cdiVendor + "/" + cdiClass
DriverName = "gpu.example.com"
DriverName = "gpu.multus-cni.io"
cdiCommonDeviceName = "common"
)

101
deployments/dra.yml Normal file
View File

@ -0,0 +1,101 @@
---
apiVersion: resource.k8s.io/v1beta1
kind: DeviceClass
metadata:
name: gpu.multus-cni.io
spec:
selectors:
- cel:
expression: "device.driver == 'gpu.multus-cni.io'"
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: dra-multus-driver
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: dra-multus-driver-role
rules:
- apiGroups: ["resource.k8s.io"]
resources: ["resourceclaims"]
verbs: ["get"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get"]
- apiGroups: ["resource.k8s.io"]
resources: ["resourceslices"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: dra-multus-driver-role-binding
subjects:
- kind: ServiceAccount
name: dra-multus-driver
namespace: default
roleRef:
kind: ClusterRole
name: dra-multus-driver-role
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: dra-multus-driver
namespace: default
labels:
app: dra-multus-driver
spec:
selector:
matchLabels:
app: dra-multus-driver
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: dra-multus-driver
spec:
priorityClassName: system-node-critical
serviceAccountName: dra-multus-driver
containers:
- name: plugin
image: dougbtv/dra-multus-driver:dev
imagePullPolicy: IfNotPresent
command: ["/dra-example-driver"]
securityContext:
privileged: true
env:
- name: CDI_ROOT
value: /var/run/cdi
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NUM_DEVICES
value: "8"
volumeMounts:
- name: plugins-registry
mountPath: /var/lib/kubelet/plugins_registry
- name: plugins
mountPath: /var/lib/kubelet/plugins
- name: cdi
mountPath: /var/run/cdi
volumes:
- name: plugins-registry
hostPath:
path: /var/lib/kubelet/plugins_registry
- name: plugins
hostPath:
path: /var/lib/kubelet/plugins
- name: cdi
hostPath:
path: /var/run/cdi

View File

@ -80,3 +80,5 @@ echo "Building kubeconfig_generator"
go build -o "${DEST_DIR}"/kubeconfig_generator ${BUILD_ARGS} -ldflags "${LDFLAGS}" ./cmd/kubeconfig_generator
echo "Building cert-approver"
go build -o "${DEST_DIR}"/cert-approver ${BUILD_ARGS} -ldflags "${LDFLAGS}" ./cmd/cert-approver
echo "Building dra-multus-driver"
go build -o "${DEST_DIR}"/dra-multus-driver ${BUILD_ARGS} -ldflags "${LDFLAGS}" ./cmd/dra-multus-driver

View File

@ -12,6 +12,7 @@ LABEL org.opencontainers.image.source=https://github.com/k8snetworkplumbingwg/mu
COPY --from=build /usr/src/multus-cni/bin /usr/src/multus-cni/bin
COPY --from=build /usr/src/multus-cni/LICENSE /usr/src/multus-cni/LICENSE
COPY --from=build /usr/src/multus-cni/bin/cert-approver /
COPY --from=build /usr/src/multus-cni/bin/dra-multus-driver /
WORKDIR /
ENTRYPOINT [ "/usr/src/multus-cni/bin/multus-daemon" ]

View File

@ -26,7 +26,7 @@ import (
)
const (
GroupName = "gpu.resource.example.com"
GroupName = "gpu.resource.multus-cni.io"
Version = "v1alpha1"
GpuConfigKind = "GpuConfig"

View File

@ -15,6 +15,6 @@
*/
// +k8s:deepcopy-gen=package
// +groupName=gpu.resource.example.com
// +groupName=gpu.resource.multus-cni.io
package v1alpha1