Skip to content

Commit 9c39b1e

Browse files
committed
Adjust max length for log path. Small refactor of generateRepoHostLogPath function.
1 parent b898c71 commit 9c39b1e

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ spec:
14291429
running in Backup Job Pods.
14301430
properties:
14311431
path:
1432-
maxLength: 4096
1432+
maxLength: 256
14331433
type: string
14341434
type: object
14351435
priorityClassName:
@@ -1596,7 +1596,7 @@ spec:
15961596
running in postgres instance pods.
15971597
properties:
15981598
path:
1599-
maxLength: 4096
1599+
maxLength: 256
16001600
type: string
16011601
type: object
16021602
manual:
@@ -2572,7 +2572,7 @@ spec:
25722572
running in the repo host pod.
25732573
properties:
25742574
path:
2575-
maxLength: 4096
2575+
maxLength: 256
25762576
type: string
25772577
type: object
25782578
priorityClassName:
@@ -20275,7 +20275,7 @@ spec:
2027520275
running in Backup Job Pods.
2027620276
properties:
2027720277
path:
20278-
maxLength: 4096
20278+
maxLength: 256
2027920279
type: string
2028020280
type: object
2028120281
priorityClassName:
@@ -20442,7 +20442,7 @@ spec:
2044220442
running in postgres instance pods.
2044320443
properties:
2044420444
path:
20445-
maxLength: 4096
20445+
maxLength: 256
2044620446
type: string
2044720447
type: object
2044820448
manual:
@@ -21418,7 +21418,7 @@ spec:
2141821418
running in the repo host pod.
2141921419
properties:
2142021420
path:
21421-
maxLength: 4096
21421+
maxLength: 256
2142221422
type: string
2142321423
type: object
2142421424
priorityClassName:

internal/pgbackrest/config.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -811,20 +811,17 @@ func serverConfig(cluster *v1beta1.PostgresCluster) iniSectionSet {
811811
//
812812
// This function assumes that the backups/pgbackrest spec is present in cluster.
813813
func generateRepoHostLogPath(cluster *v1beta1.PostgresCluster) string {
814-
var pgBackRestLogPath string
815814
for _, repo := range cluster.Spec.Backups.PGBackRest.Repos {
816815
if repo.Volume != nil {
817816
// If the user has set a log path in the spec, use it.
818817
// Otherwise, default to /pgbackrest/repo#/log
819818
if cluster.Spec.Backups.PGBackRest.RepoHost != nil &&
820819
cluster.Spec.Backups.PGBackRest.RepoHost.Log != nil &&
821820
cluster.Spec.Backups.PGBackRest.RepoHost.Log.Path != "" {
822-
pgBackRestLogPath = cluster.Spec.Backups.PGBackRest.RepoHost.Log.Path
823-
} else {
824-
pgBackRestLogPath = fmt.Sprintf(naming.PGBackRestRepoLogPath, repo.Name)
821+
return cluster.Spec.Backups.PGBackRest.RepoHost.Log.Path
825822
}
826-
break
823+
return fmt.Sprintf(naming.PGBackRestRepoLogPath, repo.Name)
827824
}
828825
}
829-
return pgBackRestLogPath
826+
return ""
830827
}

pkg/apis/postgres-operator.crunchydata.com/v1beta1/shared_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ func (in *AdditionalVolume) AsVolume(name string) corev1.Volume {
386386

387387
// LoggingConfiguration provides logging configuration for various components
388388
type LoggingConfiguration struct {
389-
// +kubebuilder:validation:MaxLength=4096
389+
// +kubebuilder:validation:MaxLength=256
390390
// +optional
391391
Path string `json:"path,omitempty"`
392392
}

0 commit comments

Comments
 (0)