@@ -281,13 +281,18 @@ func GenerateOLSDeployment(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (
281281 // Note: Callback never returns an error, using ForEach for convenient iteration
282282 _ = utils .ForEachExternalConfigMap (cr , func (name , source string ) error {
283283 var volumeName , mountPath string
284+ var items []corev1.KeyToPath
284285 switch source {
285286 case "additional-ca" :
286287 volumeName = utils .AdditionalCAVolumeName
287288 mountPath = UserCAMountPath
288289 case "proxy-ca" :
289290 volumeName = utils .ProxyCACertVolumeName
290291 mountPath = path .Join (utils .OLSAppCertsMountRoot , utils .ProxyCACertVolumeName )
292+ certKey := utils .GetProxyCACertKey (cr .Spec .OLSConfig .ProxyConfig .ProxyCACertificateRef )
293+ items = []corev1.KeyToPath {
294+ {Key : certKey , Path : certKey },
295+ }
291296 default :
292297 return nil
293298 }
@@ -298,6 +303,7 @@ func GenerateOLSDeployment(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (
298303 ConfigMap : & corev1.ConfigMapVolumeSource {
299304 LocalObjectReference : corev1.LocalObjectReference {Name : name },
300305 DefaultMode : & volumeDefaultMode ,
306+ Items : items ,
301307 },
302308 },
303309 })
@@ -381,13 +387,16 @@ func GenerateOLSDeployment(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (
381387 return nil , fmt .Errorf ("failed to get ConfigMap resource version: %w" , err )
382388 }
383389
390+ proxyCACMResourceVersion := utils .GetProxyCACertResourceVersion (r , ctx , cr )
391+
384392 deployment := appsv1.Deployment {
385393 ObjectMeta : metav1.ObjectMeta {
386394 Name : utils .OLSAppServerDeploymentName ,
387395 Namespace : r .GetNamespace (),
388396 Labels : utils .GenerateAppServerSelectorLabels (),
389397 Annotations : map [string ]string {
390- utils .OLSConfigMapResourceVersionAnnotation : configMapResourceVersion ,
398+ utils .OLSConfigMapResourceVersionAnnotation : configMapResourceVersion ,
399+ utils .ProxyCACertResourceVersionAnnotation : proxyCACMResourceVersion ,
391400 },
392401 },
393402 Spec : appsv1.DeploymentSpec {
@@ -535,14 +544,28 @@ func updateOLSDeployment(r reconciler.Reconciler, ctx context.Context, existingD
535544 }
536545 }
537546
547+ // Step 3: Check if Proxy CA ConfigMap ResourceVersion has changed
548+ storedProxyCACMVersion := existingDeployment .Annotations [utils .ProxyCACertResourceVersionAnnotation ]
549+ currentProxyCACMVersion := desiredDeployment .Annotations [utils .ProxyCACertResourceVersionAnnotation ]
550+ if storedProxyCACMVersion != currentProxyCACMVersion {
551+ changed = true
552+ }
553+
538554 // If nothing changed, skip update
539555 if ! changed {
540556 return nil
541557 }
542558
543559 // Apply changes - always update spec and annotations since something changed
544560 existingDeployment .Spec = desiredDeployment .Spec
561+
562+ // Initialize annotations if nil
563+ if existingDeployment .Annotations == nil {
564+ existingDeployment .Annotations = make (map [string ]string )
565+ }
566+
545567 existingDeployment .Annotations [utils .OLSConfigMapResourceVersionAnnotation ] = desiredDeployment .Annotations [utils .OLSConfigMapResourceVersionAnnotation ]
568+ existingDeployment .Annotations [utils .ProxyCACertResourceVersionAnnotation ] = desiredDeployment .Annotations [utils .ProxyCACertResourceVersionAnnotation ]
546569
547570 r .GetLogger ().Info ("updating OLS deployment" , "name" , existingDeployment .Name )
548571
0 commit comments