Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix grafana dashboards update when adding new folder #1794

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ func (m *MetricsCollector) ensureDeployment(ctx context.Context, isUWL bool, dep
if isDifferentSpec || isDifferentReplicas || deployParams.forceRestart {
m.Log.Info("Updating Deployment", "name", name, "namespace", m.Namespace, "isDifferentSpec", isDifferentSpec, "isDifferentReplicas", isDifferentReplicas, "forceRestart", deployParams.forceRestart)
if deployParams.forceRestart && foundMetricsCollectorDep.Status.ReadyReplicas != 0 {
desiredMetricsCollectorDep.Spec.Template.ObjectMeta.Labels[restartLabel] = time.Now().Format("2006-1-2.1504")
desiredMetricsCollectorDep.Spec.Template.ObjectMeta.Labels[restartLabel] = time.Now().Format("2006-1-2.150405")
}

desiredMetricsCollectorDep.ResourceVersion = foundMetricsCollectorDep.ResourceVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ spec:
image: quay.io/stolostron/grafana:2.4.0-SNAPSHOT-2021-09-23-07-02-14
imagePullPolicy: IfNotPresent
name: grafana
env:
- name: SQLITE_TMPDIR
value: /var/lib/grafana # SQLITE needs write permissions to a temp dir. Letting the default /tmp fails as the root filesystem is read-only.
ports:
- containerPort: 3001
name: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func updateDeployLabel(c client.Client, dName string, isUpdate bool) {
}
if isUpdate || dep.Status.ReadyReplicas != 0 {
newDep := dep.DeepCopy()
newDep.Spec.Template.ObjectMeta.Labels[restartLabel] = time.Now().Format("2006-1-2.1504")
newDep.Spec.Template.ObjectMeta.Labels[restartLabel] = time.Now().Format("2006-1-2.150405")
err := c.Patch(context.TODO(), newDep, client.StrategicMergeFrom(dep))
if err != nil {
log.Error(err, "Failed to update the deployment", "name", dName)
Expand Down
2 changes: 1 addition & 1 deletion operators/pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func UpdateDeployLabel(c client.Client, dName, namespace, label string) error {
return err
}
if dep.Status.ReadyReplicas != 0 {
dep.Spec.Template.ObjectMeta.Labels[label] = time.Now().Format("2006-1-2.1504")
dep.Spec.Template.ObjectMeta.Labels[label] = time.Now().Format("2006-1-2.150405")
err = c.Update(context.TODO(), dep)
if err != nil {
log.Error(err, "Failed to update the deployment", "name", dName)
Expand Down
Loading