Skip to content

Commit 36d1c69

Browse files
author
Nikolas De Giorgis
authored
CLOUDP-85272: remove persistence method from interface (#444)
1 parent 2b50bc9 commit 36d1c69

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

api/v1/mongodbcommunity_types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,6 @@ func (m MongoDBCommunity) GetMongoDBVersionForAnnotation() string {
502502
return m.GetMongoDBVersion()
503503
}
504504

505-
func (m MongoDBCommunity) Persistent() bool {
506-
return true
507-
}
508-
509505
func (m *MongoDBCommunity) StatefulSetReplicasThisReconciliation() int {
510506
return scale.ReplicasThisReconciliation(m)
511507
}

controllers/construct/mongodbstatefulset.go

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ type MongoDBStatefulSetOwner interface {
7676
AutomationConfigSecretName() string
7777
// GetUpdateStrategyType returns the UpdateStrategyType of the statefulset.
7878
GetUpdateStrategyType() appsv1.StatefulSetUpdateStrategyType
79-
// Persistent returns whether or not the statefulset should have persistent volumes added.
80-
Persistent() bool
8179
// HasSeparateDataAndLogsVolumes returns whether or not the volumes for data and logs would need to be different.
8280
HasSeparateDataAndLogsVolumes() bool
8381
// GetAgentScramKeyfileSecretNamespacedName returns the NamespacedName of the secret which stores the keyfile for the agent.
@@ -120,23 +118,21 @@ func BuildMongoDBReplicaSetStatefulSetModificationFunction(mdb MongoDBStatefulSe
120118
dataVolumeClaim := statefulset.NOOP()
121119
logVolumeClaim := statefulset.NOOP()
122120
singleModeVolumeClaim := func(s *appsv1.StatefulSet) {}
123-
if mdb.Persistent() {
124-
if mdb.HasSeparateDataAndLogsVolumes() {
125-
logVolumeMount := statefulset.CreateVolumeMount(logVolumeName, automationconfig.DefaultAgentLogPath)
126-
dataVolumeMount := statefulset.CreateVolumeMount(dataVolumeName, "/data")
127-
dataVolumeClaim = statefulset.WithVolumeClaim(dataVolumeName, dataPvc())
128-
logVolumeClaim = statefulset.WithVolumeClaim(logVolumeName, logsPvc())
129-
mongodbAgentVolumeMounts = append(mongodbAgentVolumeMounts, dataVolumeMount, logVolumeMount)
130-
mongodVolumeMounts = append(mongodVolumeMounts, dataVolumeMount, logVolumeMount)
131-
} else {
132-
mounts := []corev1.VolumeMount{
133-
statefulset.CreateVolumeMount(dataVolumeName, "/data", statefulset.WithSubPath("data")),
134-
statefulset.CreateVolumeMount(dataVolumeName, automationconfig.DefaultAgentLogPath, statefulset.WithSubPath("logs")),
135-
}
136-
mongodbAgentVolumeMounts = append(mongodbAgentVolumeMounts, mounts...)
137-
mongodVolumeMounts = append(mongodVolumeMounts, mounts...)
138-
singleModeVolumeClaim = statefulset.WithVolumeClaim(dataVolumeName, dataPvc())
121+
if mdb.HasSeparateDataAndLogsVolumes() {
122+
logVolumeMount := statefulset.CreateVolumeMount(logVolumeName, automationconfig.DefaultAgentLogPath)
123+
dataVolumeMount := statefulset.CreateVolumeMount(dataVolumeName, "/data")
124+
dataVolumeClaim = statefulset.WithVolumeClaim(dataVolumeName, dataPvc())
125+
logVolumeClaim = statefulset.WithVolumeClaim(logVolumeName, logsPvc())
126+
mongodbAgentVolumeMounts = append(mongodbAgentVolumeMounts, dataVolumeMount, logVolumeMount)
127+
mongodVolumeMounts = append(mongodVolumeMounts, dataVolumeMount, logVolumeMount)
128+
} else {
129+
mounts := []corev1.VolumeMount{
130+
statefulset.CreateVolumeMount(dataVolumeName, "/data", statefulset.WithSubPath("data")),
131+
statefulset.CreateVolumeMount(dataVolumeName, automationconfig.DefaultAgentLogPath, statefulset.WithSubPath("logs")),
139132
}
133+
mongodbAgentVolumeMounts = append(mongodbAgentVolumeMounts, mounts...)
134+
mongodVolumeMounts = append(mongodVolumeMounts, mounts...)
135+
singleModeVolumeClaim = statefulset.WithVolumeClaim(dataVolumeName, dataPvc())
140136
}
141137

142138
podSecurityContext := podtemplatespec.NOOP()

0 commit comments

Comments
 (0)