[go: nahoru, domu]

Skip to content

Commit

Permalink
fix: add support for imagePullPolicy for installer daemonsets (confid…
Browse files Browse the repository at this point in the history
…ential-containers#395)

Signed-off-by: Teodor <teodor.pripoae@gmail.com>
  • Loading branch information
teodor-pripoae committed Jul 18, 2024
1 parent 29bea08 commit 63e716c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/ccruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ func (r *CcRuntimeReconciler) processDaemonset(operation DaemonOperation) *appsv
{
Name: "cc-runtime-install-pod",
Image: r.ccRuntime.Spec.Config.PayloadImage,
ImagePullPolicy: "Always",
ImagePullPolicy: imagePullPolicyOrDefault(r.ccRuntime.Spec.Config.ImagePullPolicy),
Lifecycle: preStopHook,
SecurityContext: &corev1.SecurityContext{
// TODO - do we really need to run as root?
Expand Down Expand Up @@ -908,7 +908,7 @@ func (r *CcRuntimeReconciler) makeHookDaemonset(operation DaemonOperation) *apps
{
Name: "cc-runtime-" + string(operation) + "-pod",
Image: image,
ImagePullPolicy: "Always",
ImagePullPolicy: imagePullPolicyOrDefault(r.ccRuntime.Spec.Config.ImagePullPolicy),
SecurityContext: &corev1.SecurityContext{
Privileged: &runPrivileged,
RunAsUser: &runAsUser,
Expand Down
13 changes: 13 additions & 0 deletions controllers/common.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package controllers

import (
corev1 "k8s.io/api/core/v1"
)

// DaemonOperation represents the operation the daemon is going to perform
type DaemonOperation string

Expand All @@ -26,6 +30,8 @@ const (
UpgradeOperation DaemonOperation = "upgrade"

RuntimeConfigFinalizer = "runtimeconfig.confidentialcontainers.org/finalizer"

DefaultImagePullPolicy = corev1.PullAlways
)

func contains(list []string, s string) bool {
Expand All @@ -36,3 +42,10 @@ func contains(list []string, s string) bool {
}
return false
}

func imagePullPolicyOrDefault(policy corev1.PullPolicy) corev1.PullPolicy {
if policy == "" {
return DefaultImagePullPolicy
}
return policy
}

0 comments on commit 63e716c

Please sign in to comment.