diff --git a/cmd/notification-manager/main.go b/cmd/notification-manager/main.go index a15607f9..ad6eeb06 100644 --- a/cmd/notification-manager/main.go +++ b/cmd/notification-manager/main.go @@ -95,7 +95,7 @@ func Main() int { return 1 } - logger = log.With(logger, "ts", log.DefaultTimestampUTC) + logger = log.With(logger, "ts", log.DefaultTimestamp) logger = log.With(logger, "caller", log.DefaultCaller) _ = level.Info(logger).Log("msg", "Starting notification manager...", "addr", *listenAddress, "timeout", *webhookTimeout) diff --git a/config/bundle.yaml b/config/bundle.yaml index 2e39f147..8481cde1 100644 --- a/config/bundle.yaml +++ b/config/bundle.yaml @@ -1940,5 +1940,13 @@ spec: requests: cpu: 100m memory: 20Mi + volumeMounts: + - mountPath: /etc/localtime + name: host-time serviceAccountName: notification-manager-sa terminationGracePeriodSeconds: 10 + volumes: + - hostPath: + path: /etc/localtime + type: "" + name: host-time diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 42274236..a10b60db 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -31,4 +31,12 @@ spec: requests: cpu: 100m memory: 20Mi + volumeMounts: + - mountPath: /etc/localtime + name: host-time + volumes: + - hostPath: + path: /etc/localtime + type: "" + name: host-time terminationGracePeriodSeconds: 10 diff --git a/helm/templates/operator.yaml b/helm/templates/operator.yaml index 518c8deb..452fe049 100644 --- a/helm/templates/operator.yaml +++ b/helm/templates/operator.yaml @@ -41,6 +41,14 @@ spec: name: notification-manager-operator resources: {{- toYaml .Values.operator.containers.operator.resources | nindent 10 }} + volumeMounts: + - mountPath: /etc/localtime + name: host-time + volumes: + - hostPath: + path: /etc/localtime + type: "" + name: host-time serviceAccount: notification-manager-sa serviceAccountName: notification-manager-sa nodeSelector: diff --git a/pkg/controllers/notificationmanager_controller.go b/pkg/controllers/notificationmanager_controller.go index 823f271b..603a92f4 100644 --- a/pkg/controllers/notificationmanager_controller.go +++ b/pkg/controllers/notificationmanager_controller.go @@ -196,6 +196,12 @@ func (r *NotificationManagerReconciler) mutateDeployment(deploy *appsv1.Deployme }, }, }, + VolumeMounts: []corev1.VolumeMount{ + { + Name: "host-time", + MountPath: "/etc/localtime", + }, + }, } if len(nm.Spec.NotificationManagerNamespaces) > 0 { @@ -217,6 +223,7 @@ func (r *NotificationManagerReconciler) mutateDeployment(deploy *appsv1.Deployme deploy.Spec.Template.Spec.Containers[i].Ports = newC.Ports deploy.Spec.Template.Spec.Containers[i].Command = newC.Command deploy.Spec.Template.Spec.Containers[i].Env = newC.Env + deploy.Spec.Template.Spec.Containers[i].VolumeMounts = newC.VolumeMounts break } } @@ -226,6 +233,19 @@ func (r *NotificationManagerReconciler) mutateDeployment(deploy *appsv1.Deployme deploy.Spec.Template.Spec.Containers = []corev1.Container{newC} } + if len(deploy.Spec.Template.Spec.Volumes) == 0 { + deploy.Spec.Template.Spec.Volumes = []corev1.Volume{ + { + Name: "host-time", + VolumeSource: corev1.VolumeSource{ + HostPath: &corev1.HostPathVolumeSource{ + Path: "/etc/localtime", + }, + }, + }, + } + } + deploy.SetOwnerReferences(nil) return ctrl.SetControllerReference(nm, deploy, r.Scheme) }