@@ -392,6 +392,21 @@ func (r *Reconciler) SetDesiredNooBaaDB() error {
392392}
393393
394394func (r * Reconciler ) setDesiredCoreEnv (c * corev1.Container ) {
395+ // Filter out NOOBAA_ROOT_SECRET from env vars to avoid exposing it in pod spec
396+ // it is set via mounting the secret as files
397+ // this will remove the leftover env var in case of an upgrade from older operator version (older than 4.21)
398+ // as we preserve env vars on updates by merging the arrays and not replacing them.
399+
400+ if len (c .Env ) > 0 {
401+ filtered := c .Env [:0 ]
402+ for _ , env := range c .Env {
403+ if env .Name != "NOOBAA_ROOT_SECRET" {
404+ filtered = append (filtered , env )
405+ }
406+ }
407+ c .Env = filtered
408+ }
409+
395410 for j := range c .Env {
396411 switch c .Env [j ].Name {
397412 case "AGENT_PROFILE" :
@@ -521,6 +536,10 @@ func (r *Reconciler) SetDesiredCoreApp() error {
521536 r .CoreApp .Spec .ServiceName = r .ServiceMgmt .Name
522537
523538 podSpec := & r .CoreApp .Spec .Template .Spec
539+ // set the termination grace period for noobaa-core pod.
540+ // For now we set it to 1 second. A better approach should be to implement a graceful shutdown for the noobaa-core pod when SIGTERM is received.
541+ terminationGracePeriodSeconds := int64 (1 )
542+ podSpec .TerminationGracePeriodSeconds = & terminationGracePeriodSeconds
524543 podSpec .ServiceAccountName = "noobaa-core"
525544 coreImageChanged := false
526545
@@ -575,10 +594,11 @@ func (r *Reconciler) SetDesiredCoreApp() error {
575594 util .MergeVolumeMountList (& c .VolumeMounts , & dbSecretVolumeMounts )
576595 }
577596
578- if util .KubeCheckQuiet (r .CaBundleConf ) {
597+ // we want to check that the cm exists and also that it has data in it
598+ if util .KubeCheckQuiet (r .CaBundleConf ) && len (r .CaBundleConf .Data ) > 0 {
579599 configMapVolumeMounts := []corev1.VolumeMount {{
580600 Name : r .CaBundleConf .Name ,
581- MountPath : "/etc/ocp-injected-ca-bundle.crt " ,
601+ MountPath : "/etc/ocp-injected-ca-bundle" ,
582602 ReadOnly : true ,
583603 }}
584604 util .MergeVolumeMountList (& c .VolumeMounts , & configMapVolumeMounts )
@@ -658,10 +678,11 @@ func (r *Reconciler) SetDesiredCoreApp() error {
658678 Limits : logResourceList ,
659679 }
660680 }
661- if util .KubeCheckQuiet (r .CaBundleConf ) {
681+ // we want to check that the cm exists and also that it has data in it
682+ if util .KubeCheckQuiet (r .CaBundleConf ) && len (r .CaBundleConf .Data ) > 0 {
662683 configMapVolumeMounts := []corev1.VolumeMount {{
663684 Name : r .CaBundleConf .Name ,
664- MountPath : "/etc/ocp-injected-ca-bundle.crt " ,
685+ MountPath : "/etc/ocp-injected-ca-bundle" ,
665686 ReadOnly : true ,
666687 }}
667688 util .MergeVolumeMountList (& c .VolumeMounts , & configMapVolumeMounts )
@@ -701,7 +722,8 @@ func (r *Reconciler) SetDesiredCoreApp() error {
701722
702723 r .CoreApp .Spec .Template .Annotations ["noobaa.io/configmap-hash" ] = r .CoreAppConfig .Annotations ["noobaa.io/configmap-hash" ]
703724
704- if util .KubeCheckQuiet (r .CaBundleConf ) {
725+ // we want to check that the cm exists and also that it has data in it
726+ if util .KubeCheckQuiet (r .CaBundleConf ) && len (r .CaBundleConf .Data ) > 0 {
705727 configMapVolumes := []corev1.Volume {{
706728 Name : r .CaBundleConf .Name ,
707729 VolumeSource : corev1.VolumeSource {
0 commit comments