Skip to content

Commit 8bfb9ec

Browse files
committed
Use same image as driver in rendered templates
Signed-off-by: Kevin Klues <[email protected]>
1 parent d4ede35 commit 8bfb9ec

File tree

9 files changed

+30
-2
lines changed

9 files changed

+30
-2
lines changed

cmd/compute-domain-controller/controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ type ManagerConfig struct {
3535
// driverNamespace is the Kubernetes namespace where the driver operates
3636
driverNamespace string
3737

38+
// imageName is the full image name to use when rendering templates
39+
imageName string
40+
3841
// clientsets provides access to various Kubernetes API client interfaces
3942
clientsets flags.ClientSets
4043

@@ -62,6 +65,7 @@ func (c *Controller) Run(ctx context.Context) error {
6265
managerConfig := &ManagerConfig{
6366
driverName: c.config.driverName,
6467
driverNamespace: c.config.flags.namespace,
68+
imageName: c.config.flags.imageName,
6569
clientsets: c.config.clientsets,
6670
workQueue: workQueue,
6771
}

cmd/compute-domain-controller/daemonset.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type DaemonSetTemplateData struct {
4848
ComputeDomainLabelKey string
4949
ComputeDomainLabelValue types.UID
5050
ResourceClaimTemplateName string
51+
ImageName string
5152
}
5253

5354
type DaemonSetManager struct {
@@ -180,6 +181,7 @@ func (m *DaemonSetManager) Create(ctx context.Context, namespace string, cd *nva
180181
ComputeDomainLabelKey: computeDomainLabelKey,
181182
ComputeDomainLabelValue: cd.UID,
182183
ResourceClaimTemplateName: rct.Name,
184+
ImageName: m.config.imageName,
183185
}
184186

185187
tmpl, err := template.ParseFiles(DaemonSetTemplatePath)

cmd/compute-domain-controller/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type Flags struct {
5252

5353
podName string
5454
namespace string
55+
imageName string
5556

5657
httpEndpoint string
5758
metricsPath string
@@ -91,6 +92,13 @@ func newApp() *cli.App {
9192
Destination: &flags.namespace,
9293
EnvVars: []string{"NAMESPACE"},
9394
},
95+
&cli.StringFlag{
96+
Name: "image-name",
97+
Usage: "The full image name to use for rendering templates.",
98+
Required: true,
99+
Destination: &flags.imageName,
100+
EnvVars: []string{"IMAGE_NAME"},
101+
},
94102
&cli.StringFlag{
95103
Category: "HTTP server:",
96104
Name: "http-endpoint",

cmd/gpu-kubelet-plugin/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type Flags struct {
4747
containerDriverRoot string
4848
hostDriverRoot string
4949
nvidiaCTKPath string
50+
imageName string
5051
}
5152

5253
type Config struct {
@@ -109,6 +110,13 @@ func newApp() *cli.App {
109110
Destination: &flags.nvidiaCTKPath,
110111
EnvVars: []string{"NVIDIA_CTK_PATH"},
111112
},
113+
&cli.StringFlag{
114+
Name: "image-name",
115+
Usage: "The full image name to use for rendering templates.",
116+
Required: true,
117+
Destination: &flags.imageName,
118+
EnvVars: []string{"IMAGE_NAME"},
119+
},
112120
}
113121
cliFlags = append(cliFlags, flags.kubeClientConfig.Flags()...)
114122
cliFlags = append(cliFlags, flags.loggingConfig.Flags()...)

cmd/gpu-kubelet-plugin/sharing.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ type MpsControlDaemonTemplateData struct {
9292
MpsShmDirectory string
9393
MpsPipeDirectory string
9494
MpsLogDirectory string
95+
MpsImageName string
9596
}
9697

9798
func NewTimeSlicingManager(deviceLib *deviceLib) *TimeSlicingManager {
@@ -206,6 +207,7 @@ func (m *MpsControlDaemon) Start(ctx context.Context, config *configapi.MpsConfi
206207
MpsShmDirectory: m.shmDir,
207208
MpsPipeDirectory: m.pipeDir,
208209
MpsLogDirectory: m.logDir,
210+
MpsImageName: m.manager.config.flags.imageName,
209211
}
210212

211213
if config != nil && config.DefaultActiveThreadPercentage != nil {

deployments/helm/nvidia-dra-driver-gpu/templates/controller.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ spec:
6464
valueFrom:
6565
fieldRef:
6666
fieldPath: metadata.namespace
67+
- name: IMAGE_NAME
68+
value: {{ include "nvidia-dra-driver-gpu.fullimage" . }}
6769
{{- with .Values.controller.nodeSelector }}
6870
nodeSelector:
6971
{{- toYaml . | nindent 8 }}

deployments/helm/nvidia-dra-driver-gpu/templates/kubeletplugin.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ spec:
150150
valueFrom:
151151
fieldRef:
152152
fieldPath: metadata.namespace
153+
- name: IMAGE_NAME
154+
value: {{ include "nvidia-dra-driver-gpu.fullimage" . }}
153155
volumeMounts:
154156
- name: plugins-registry
155157
mountPath: /var/lib/kubelet/plugins_registry

templates/compute-domain-daemon.tmpl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
{{ .ComputeDomainLabelKey }}: {{ .ComputeDomainLabelValue }}
2323
containers:
2424
- name: compute-domain-daemon
25-
image: ubuntu:22.04
25+
image: {{ .ImageName }}
2626
command: [sh, -c]
2727
args:
2828
- |-

templates/mps-control-daemon.tmpl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
hostPID: true
2121
containers:
2222
- name: mps-control-daemon
23-
image: ubuntu:22.04
23+
image: {{ .MpsImageName }}
2424
securityContext:
2525
privileged: true
2626
command: [chroot, /driver-root, sh, -c]

0 commit comments

Comments
 (0)