Skip to content

Commit ba2b53e

Browse files
committed
Shorter pgrestore Job Names
The name of the PVC being utilized for a pgrestore Job is now no longer included in the Job name. This ensures the 63 character limit for Kubernetes Job naming is not easily exceeded when creating pgrestore Jobs, i.e. for clusters with names longer than simply a few characters. Issue: [ch9163]
1 parent 1f75618 commit ba2b53e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/operator/pgdump/restore.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package pgdump
1818
import (
1919
"bytes"
2020
"encoding/json"
21+
"fmt"
2122
"os"
2223

2324
"github.com/crunchydata/postgres-operator/internal/config"
@@ -75,7 +76,8 @@ func Restore(namespace string, clientset kubeapi.Interface, task *crv1.Pgtask) {
7576
taskName := task.Name
7677

7778
jobFields := restorejobTemplateFields{
78-
JobName: "pgrestore-" + task.Spec.Parameters[config.LABEL_PGRESTORE_FROM_CLUSTER] + "-from-" + fromPvcName + "-" + util.RandStringBytesRmndr(4),
79+
JobName: fmt.Sprintf("pgrestore-%s-%s", task.Spec.Parameters[config.LABEL_PGRESTORE_FROM_CLUSTER],
80+
util.RandStringBytesRmndr(4)),
7981
TaskName: taskName,
8082
ClusterName: clusterName,
8183
SecurityContext: operator.GetPodSecurityContext(storage.GetSupplementalGroups()),

0 commit comments

Comments
 (0)