Skip to content

Commit 3081b0f

Browse files
committed
feat(chart): added package and skyhook image pull secrets
1 parent 46072b5 commit 3081b0f

File tree

5 files changed

+46
-34
lines changed

5 files changed

+46
-34
lines changed

chart/templates/deployment.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ spec:
7878
value: {{ quote .Values.webhook.enable }}
7979
- name: NAMESPACE
8080
value: {{ .Release.Namespace }}
81-
- name: IMAGE_PULL_SECRET
82-
value: {{ quote .Values.imagePullSecret }}
81+
- name: PACKAGE_IMAGE_PULL_SECRET
82+
value: {{ quote .Values.packageImagePullSecret }}
83+
- name: SKYHOOK_IMAGE_PULL_SECRET
84+
value: {{ quote .Values.skyhookImagePullSecret }}
8385
- name: COPY_DIR_ROOT
8486
value: {{ quote .Values.controllerManager.manager.env.copyDirRoot }}
8587
- name: REAPPLY_ON_REBOOT
@@ -138,7 +140,7 @@ spec:
138140
securityContext: {{- toYaml .Values.controllerManager.kubeRbacProxy.containerSecurityContext
139141
| nindent 10 }}
140142
imagePullSecrets:
141-
- name: {{ quote .Values.imagePullSecret }}
143+
- name: {{ quote .Values.skyhookImagePullSecret }}
142144
securityContext:
143145
runAsNonRoot: true
144146
serviceAccountName: {{ include "chart.fullname" . }}-controller-manager

chart/values.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ webhookService:
130130
rbac:
131131
createSkyhookViewerRole: false
132132
createSkyhookEditorRole: false
133-
## imagePullSecret: is the secret used to pull the operator controller image, agent image, and package images.
134-
imagePullSecret: node-init-secret
133+
## skyhookImagePullSecret: is the secret used to pull the operator controller image, agent image.
134+
skyhookImagePullSecret: node-init-secret
135+
## packageImagePullSecret: is the secret used to pull the package images.
136+
packageImagePullSecret: node-init-secret
135137
## useHostNetwork: Whether the Operator pods should use hostNetwork: true or false
136138
useHostNetwork: false
137139
## estimatedPackageCount: estimated number of packages to be installed on the cluster

operator/config/manager/manager.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ spec:
9797
value: "true"
9898
- name: NAMESPACE
9999
value: skyhook-operator-system
100-
- name: IMAGE_PULL_SECRET
100+
- name: SKYHOOK_IMAGE_PULL_SECRET
101+
value: node-init-secret
102+
- name: PACKAGE_IMAGE_PULL_SECRET
101103
value: node-init-secret
102104
- name: COPY_DIR_ROOT
103105
value: /var/lib/skyhook

operator/internal/controller/skyhook_controller.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,16 @@ const (
7272
)
7373

7474
type SkyhookOperatorOptions struct {
75-
Namespace string `env:"NAMESPACE, default=skyhook"`
76-
MaxInterval time.Duration `env:"DEFAULT_INTERVAL, default=10m"`
77-
ImagePullSecret string `env:"IMAGE_PULL_SECRET, default=node-init-secret"` //TODO: should this be defaulted?
78-
CopyDirRoot string `env:"COPY_DIR_ROOT, default=/var/lib/skyhook"`
79-
ReapplyOnReboot bool `env:"REAPPLY_ON_REBOOT, default=false"`
80-
RuntimeRequiredTaint string `env:"RUNTIME_REQUIRED_TAINT, default=skyhook.nvidia.com=runtime-required:NoSchedule"`
81-
PauseImage string `env:"PAUSE_IMAGE, default=registry.k8s.io/pause:3.10"`
82-
AgentImage string `env:"AGENT_IMAGE, default=ghcr.io/nvidia/skyhook/agent:latest"` // TODO: this needs to be updated with a working default
83-
AgentLogRoot string `env:"AGENT_LOG_ROOT, default=/var/log/skyhook"`
75+
Namespace string `env:"NAMESPACE, default=skyhook"`
76+
MaxInterval time.Duration `env:"DEFAULT_INTERVAL, default=10m"`
77+
PackageImagePullSecret string `env:"PACKAGE_IMAGE_PULL_SECRET"`
78+
SkyhookImagePullSecret string `env:"SKYHOOK_IMAGE_PULL_SECRET"`
79+
CopyDirRoot string `env:"COPY_DIR_ROOT, default=/var/lib/skyhook"`
80+
ReapplyOnReboot bool `env:"REAPPLY_ON_REBOOT, default=false"`
81+
RuntimeRequiredTaint string `env:"RUNTIME_REQUIRED_TAINT, default=skyhook.nvidia.com=runtime-required:NoSchedule"`
82+
PauseImage string `env:"PAUSE_IMAGE, default=registry.k8s.io/pause:3.10"`
83+
AgentImage string `env:"AGENT_IMAGE, default=ghcr.io/nvidia/skyhook/agent:latest"` // TODO: this needs to be updated with a working default
84+
AgentLogRoot string `env:"AGENT_LOG_ROOT, default=/var/log/skyhook"`
8485
}
8586

8687
func (o *SkyhookOperatorOptions) Validate() error {
@@ -1507,7 +1508,7 @@ func createInterruptPodForPackage(opts SkyhookOperatorOptions, _interrupt *v1alp
15071508
},
15081509
ImagePullSecrets: []corev1.LocalObjectReference{
15091510
{
1510-
Name: opts.ImagePullSecret,
1511+
Name: opts.SkyhookImagePullSecret,
15111512
},
15121513
},
15131514
HostPID: true,
@@ -1714,7 +1715,10 @@ func createPodFromPackage(opts SkyhookOperatorOptions, _package *v1alpha1.Packag
17141715
},
17151716
ImagePullSecrets: []corev1.LocalObjectReference{
17161717
{
1717-
Name: opts.ImagePullSecret,
1718+
Name: opts.PackageImagePullSecret,
1719+
},
1720+
{
1721+
Name: opts.SkyhookImagePullSecret,
17181722
},
17191723
},
17201724
Volumes: volumes,

operator/internal/controller/skyhook_controller_test.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -457,15 +457,16 @@ var _ = Describe("skyhook controller tests", func() {
457457

458458
It("Ensure all the config env vars are set", func() {
459459
opts := SkyhookOperatorOptions{
460-
Namespace: "skyhook",
461-
MaxInterval: time.Second * 61,
462-
ImagePullSecret: "foo",
463-
CopyDirRoot: "/tmp",
464-
ReapplyOnReboot: true,
465-
RuntimeRequiredTaint: "skyhook.nvidia.com=runtime-required:NoSchedule",
466-
AgentImage: "foo:bar",
467-
PauseImage: "foo:bar",
468-
AgentLogRoot: "/log",
460+
Namespace: "skyhook",
461+
MaxInterval: time.Second * 61,
462+
PackageImagePullSecret: "foo",
463+
SkyhookImagePullSecret: "foo",
464+
CopyDirRoot: "/tmp",
465+
ReapplyOnReboot: true,
466+
RuntimeRequiredTaint: "skyhook.nvidia.com=runtime-required:NoSchedule",
467+
AgentImage: "foo:bar",
468+
PauseImage: "foo:bar",
469+
AgentLogRoot: "/log",
469470
}
470471
Expect(opts.Validate()).To(BeNil())
471472

@@ -558,14 +559,15 @@ var _ = Describe("skyhook controller tests", func() {
558559
It("Check validations of skyhook options", func() {
559560
// good options
560561
opts := SkyhookOperatorOptions{
561-
Namespace: "skyhook",
562-
MaxInterval: time.Second * 61,
563-
ImagePullSecret: "foo",
564-
CopyDirRoot: "/tmp",
565-
ReapplyOnReboot: true,
566-
RuntimeRequiredTaint: "skyhook.nvidia.com=runtime-required:NoSchedule",
567-
AgentImage: "foo:bar",
568-
PauseImage: "foo:bar",
562+
Namespace: "skyhook",
563+
MaxInterval: time.Second * 61,
564+
PackageImagePullSecret: "foo",
565+
SkyhookImagePullSecret: "foo",
566+
CopyDirRoot: "/tmp",
567+
ReapplyOnReboot: true,
568+
RuntimeRequiredTaint: "skyhook.nvidia.com=runtime-required:NoSchedule",
569+
AgentImage: "foo:bar",
570+
PauseImage: "foo:bar",
569571
}
570572
Expect(opts.Validate()).To(BeNil())
571573

0 commit comments

Comments
 (0)