Skip to content

Commit

Permalink
Make worker image as an argument (#24)
Browse files Browse the repository at this point in the history
* Make worker image as an argument
  • Loading branch information
shaoxt authored Jul 7, 2020
1 parent 1392cb3 commit c8d024f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/podcheckpoint_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type PodCheckpointReconciler struct {
Log logr.Logger
Scheme *runtime.Scheme
WorkerNamespace string
WorkerImage string
}

type realClock struct{}
Expand Down Expand Up @@ -160,7 +161,7 @@ func (r *PodCheckpointReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
Containers: []corev1.Container{
{
Name: "kube-forensics-worker",
Image: "keikoproj/kube-forensics-worker:latest",
Image: r.WorkerImage,
ImagePullPolicy: "Always",
VolumeMounts: []corev1.VolumeMount{
{
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ func main() {
var metricsAddr string
var enableLeaderElection bool
var workerNamespace string
var workerImage string

flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
"Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")
flag.StringVar(&workerNamespace, "worker-namespace", "forensics-system", "The target namespace for forensics worker")
flag.StringVar(&workerImage, "worker-image", "keikoproj/kube-forensics-worker:latest", "The worker image of forensics worker ")
flag.Parse()

ctrl.SetLogger(zap.Logger(true))
Expand All @@ -72,6 +74,7 @@ func main() {
Log: ctrl.Log.WithName("controllers").WithName("PodCheckpoint"),
Scheme: mgr.GetScheme(),
WorkerNamespace: workerNamespace,
WorkerImage: workerImage,
}).SetupWithManager(mgr)
if err != nil {
setupLog.Error(err, "unable to create controller", "controller", "PodCheckpoint")
Expand Down

0 comments on commit c8d024f

Please sign in to comment.