Skip to content
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 deployments/container/Dockerfile.distroless
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ RUN set -eux; \
wget -nv -O - https://go.dev/dl/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz \
| tar -C /usr/local -xz

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH

ENV GOOS=linux\
GOARCH=amd64
Expand Down
12 changes: 9 additions & 3 deletions pkg/device_plugin/gfd.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ func runGFD() {
return
}

saName := os.Getenv("POD_SERVICE_ACCOUNT")
if saName == "" {
log.Printf("POD_SERVICE_ACCOUNT environment variable is required for running GFD")
return
}

// 2. Authenticate within the cluster
config, err := rest.InClusterConfig()
if err != nil {
Expand All @@ -106,7 +112,7 @@ func runGFD() {
}

// 3. Create the gfd pod and delete when its done
gfdPod := createGFDPod(clientset, nodeName, namespace, gfdImage)
gfdPod := createGFDPod(clientset, nodeName, namespace, gfdImage, saName)
err = LaunchPodWithRetries(clientset, gfdPod, namespace)
if err != nil {
log.Printf("Error creating GFD pod: %v", err.Error())
Expand All @@ -122,7 +128,7 @@ func runGFD() {
return
}

func createGFDPod(clientset *kubernetes.Clientset, nodeName, namespace, gfdImage string) *corev1.Pod {
func createGFDPod(clientset *kubernetes.Clientset, nodeName, namespace, gfdImage, saName string) *corev1.Pod {
var trueValue bool = true
var runtimeClassName string = "kata-qemu-nvidia-gpu"
// check if this is an snp machine with ConfidentialContainers enabled
Expand Down Expand Up @@ -152,7 +158,7 @@ func createGFDPod(clientset *kubernetes.Clientset, nodeName, namespace, gfdImage
NodeName: nodeName, // This forces the pod to land on the specific node
RestartPolicy: corev1.RestartPolicyOnFailure,
RuntimeClassName: &runtimeClassName,
ServiceAccountName: "nvidia-sandbox-device-plugin",
ServiceAccountName: saName,
Containers: []corev1.Container{
{
Name: "gpu-feature-discovery",
Expand Down