@@ -375,6 +375,20 @@ func makeHookPod(hook *deployapi.LifecycleHook, rc *kapi.ReplicationController,
375
375
376
376
gracePeriod := int64 (10 )
377
377
378
+ var podSecurityContextCopy * kapi.PodSecurityContext
379
+ if ctx , err := kapi .Scheme .DeepCopy (rc .Spec .Template .Spec .SecurityContext ); err != nil {
380
+ return nil , fmt .Errorf ("unable to copy pod securityContext: %v" , err )
381
+ } else {
382
+ podSecurityContextCopy = ctx .(* kapi.PodSecurityContext )
383
+ }
384
+
385
+ var securityContextCopy * kapi.SecurityContext
386
+ if ctx , err := kapi .Scheme .DeepCopy (baseContainer .SecurityContext ); err != nil {
387
+ return nil , fmt .Errorf ("unable to copy securityContext: %v" , err )
388
+ } else {
389
+ securityContextCopy = ctx .(* kapi.SecurityContext )
390
+ }
391
+
378
392
pod := & kapi.Pod {
379
393
ObjectMeta : kapi.ObjectMeta {
380
394
Name : namer .GetPodName (rc .Name , suffix ),
@@ -397,8 +411,10 @@ func makeHookPod(hook *deployapi.LifecycleHook, rc *kapi.ReplicationController,
397
411
Env : mergedEnv ,
398
412
Resources : resources ,
399
413
VolumeMounts : volumeMounts ,
414
+ SecurityContext : securityContextCopy ,
400
415
},
401
416
},
417
+ SecurityContext : podSecurityContextCopy ,
402
418
Volumes : volumes ,
403
419
ActiveDeadlineSeconds : & maxDeploymentDurationSeconds ,
404
420
// Setting the node selector on the hook pod so that it is created
0 commit comments