Skip to content

Commit f5261ca

Browse files
committed
Adjust max length for log path. Small refactor of generateRepoHostLogPath function.
1 parent 1cbac34 commit f5261ca

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:
@@ -20271,7 +20271,7 @@ spec:
2027120271
running in Backup Job Pods.
2027220272
properties:
2027320273
path:
20274-
maxLength: 4096
20274+
maxLength: 256
2027520275
type: string
2027620276
type: object
2027720277
priorityClassName:
@@ -20438,7 +20438,7 @@ spec:
2043820438
running in postgres instance pods.
2043920439
properties:
2044020440
path:
20441-
maxLength: 4096
20441+
maxLength: 256
2044220442
type: string
2044320443
type: object
2044420444
manual:
@@ -21414,7 +21414,7 @@ spec:
2141421414
running in the repo host pod.
2141521415
properties:
2141621416
path:
21417-
maxLength: 4096
21417+
maxLength: 256
2141821418
type: string
2141921419
type: object
2142021420
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)