Skip to content
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

fix: add support for imagePullPolicy for installer daemonsets (#395) #396

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 controllers/ccruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,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 @@ -917,7 +917,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
}
Loading