-
Notifications
You must be signed in to change notification settings - Fork 205
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
WIP: Use intel-gpu-plugin with intel-gpu-fakedev generated devices #1118
Open
eero-t
wants to merge
1
commit into
intel:main
Choose a base branch
from
eero-t:gpu-plugin-fake
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+136
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
deployments/gpu_plugin/overlays/fake_devices/add-nfd-feature-file.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: intel-gpu-plugin | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: intel-gpu-nfd | ||
# convert generated sysfs content to NFD feature labels file | ||
image: intel/intel-gpu-initcontainer:devel | ||
imagePullPolicy: IfNotPresent | ||
securityContext: | ||
readOnlyRootFilesystem: true | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
drop: [ "ALL" ] | ||
volumeMounts: | ||
- name: nfd-features | ||
mountPath: /nfd | ||
readOnly: false | ||
workingDir: /usr/local/bin/gpu-sw | ||
# needed until GPU plugin drops NFD hook usage due to: | ||
# https://github.com/kubernetes-sigs/node-feature-discovery/issues/856 | ||
command: ["sh", "-c", "while true; do ./intel-gpu-nfdhook | tee /nfd/fake-gpu; sleep 99999; done"] | ||
volumes: | ||
- name: nfd-features | ||
hostPath: | ||
path: /etc/kubernetes/node-feature-discovery/features.d/ | ||
type: DirectoryOrCreate |
10 changes: 10 additions & 0 deletions
10
deployments/gpu_plugin/overlays/fake_devices/del-intel-gpu-initcontainer.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: intel-gpu-plugin | ||
spec: | ||
template: | ||
spec: | ||
initContainers: | ||
- name: intel-gpu-initcontainer | ||
$patch: delete |
49 changes: 49 additions & 0 deletions
49
deployments/gpu_plugin/overlays/fake_devices/fake-device-volumes.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: intel-gpu-plugin | ||
spec: | ||
template: | ||
spec: | ||
initContainers: | ||
- name: fakedev-generator | ||
# container runtime prevents writing to /sys & /dev, | ||
# so volumes need to be mounted elsewhere | ||
volumeMounts: | ||
- name: devfs | ||
mountPath: /tmp/fakedev/dev | ||
readOnly: false | ||
- name: sysfs | ||
mountPath: /tmp/fakedev/sys | ||
readOnly: false | ||
# files are generated under CWD | ||
workingDir: /tmp/fakedev | ||
containers: | ||
- name: intel-gpu-nfd | ||
# expects sysfs here | ||
volumeMounts: | ||
- name: sysfs | ||
mountPath: /host-sys | ||
readOnly: true | ||
- name: intel-gpu-plugin | ||
args: [ | ||
"-prefix=/tmp/fakedev", | ||
"-shared-dev-num=2", | ||
"-enable-monitoring", | ||
"-resource-manager" | ||
] | ||
# devfs host & container paths must match for everything to work | ||
volumeMounts: | ||
- name: devfs | ||
mountPath: /tmp/fakedev/dev | ||
readOnly: true | ||
- name: sysfs | ||
mountPath: /tmp/fakedev/sys | ||
readOnly: true | ||
volumes: | ||
- name: devfs | ||
hostPath: | ||
path: /tmp/fakedev/dev | ||
type: DirectoryOrCreate | ||
- name: sysfs | ||
emptyDir: {} |
8 changes: 8 additions & 0 deletions
8
deployments/gpu_plugin/overlays/fake_devices/fakedev-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Info": "8x 4 GiB DG1 [Iris Xe MAX Graphics] GPUs", | ||
"DevCount": 8, | ||
"DevMemSize": 4294967296, | ||
"Capabilities": { | ||
"platform": "fake_DG1" | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
deployments/gpu_plugin/overlays/fake_devices/generate-fake-devices.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: intel-gpu-plugin | ||
spec: | ||
template: | ||
spec: | ||
volumes: | ||
- name: fake-conf | ||
configMap: | ||
name: fakedev-config | ||
initContainers: | ||
- name: fakedev-generator | ||
image: intel/intel-gpu-fakedev:devel | ||
securityContext: | ||
runAsUser: 0 | ||
readOnlyRootFilesystem: false | ||
allowPrivilegeEscalation: false | ||
volumeMounts: | ||
- name: fake-conf | ||
mountPath: /config | ||
readOnly: true | ||
# generate fake sysfs / devfs files for GPU plugin based on config | ||
command: ["/generator", "-json", "/config/fakedev.json", "-verbose"] |
15 changes: 15 additions & 0 deletions
15
deployments/gpu_plugin/overlays/fake_devices/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
bases: | ||
- ../fractional_resources | ||
configMapGenerator: | ||
- name: fakedev-config | ||
files: | ||
- fakedev-config.json | ||
patches: | ||
- fake-device-volumes.yaml | ||
- generate-fake-devices.yaml | ||
# NFD feature file changes is obsolete after GPU plugin moves away from NFD hooks | ||
# https://github.com/kubernetes-sigs/node-feature-discovery/issues/856 | ||
- del-intel-gpu-initcontainer.yaml | ||
- add-nfd-feature-file.yaml |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mythi I'm not really sure about adding -fake suffix to all objects: service, serviceAccount, clusterRole, clusterRoleBinding, configMap, daemonSet.
I think it would be rare to run both fake and real GPU plugin at the same time in the same cluster, but even if you would:
What if it would use a different namespace instead?
E.g. if one would want operator to support also fake plugin, wouldn't different namespace be easier for that, than every object having a different name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the suggestion since the "standalone" daemonset was named with that
-fake
. I'm OK not to use this suggestion if you think it make more sense as it is.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to change just the deployment name with kustomize?
Even if one would use separate namespace for the whole thing, it may still make sense to have
-fake
suffix for the deployment name, just to make sure nobody confuses it with the real thing e.g. inkubectl get pods -A
output.In my own fake GPU plugin tests, I've used "validation" namespace for it, but something like "fake-validation" would make it clearer that it's not the real thing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on that namespace topic, one idea could be to add
namespace: somefake
intokustomization.yaml