Skip to content

Commit b910275

Browse files
committed
remove comments and add version compare
1 parent 3075f5d commit b910275

6 files changed

Lines changed: 18 additions & 11 deletions

File tree

deploy/bundle.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
21
apiVersion: apiextensions.k8s.io/v1
32
kind: CustomResourceDefinition
43
metadata:

deploy/crd.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
21
apiVersion: apiextensions.k8s.io/v1
32
kind: CustomResourceDefinition
43
metadata:

deploy/cw-bundle.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
21
apiVersion: apiextensions.k8s.io/v1
32
kind: CustomResourceDefinition
43
metadata:

e2e-tests/version-service/conf/crd.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
21
apiVersion: apiextensions.k8s.io/v1
32
kind: CustomResourceDefinition
43
metadata:

pkg/psmdb/mongos.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,21 @@ func MongosStatefulsetSpec(cr *api.PerconaServerMongoDB, template corev1.PodTemp
4646
},
4747
}
4848
}
49-
return appsv1.StatefulSetSpec{
49+
50+
spec := appsv1.StatefulSetSpec{
5051
Replicas: &cr.Spec.Sharding.Mongos.Size,
5152
Selector: &metav1.LabelSelector{
5253
MatchLabels: naming.MongosLabels(cr),
5354
},
54-
Template: template,
55-
UpdateStrategy: updateStrategy,
56-
RevisionHistoryLimit: cr.Spec.RevisionHistoryLimit,
55+
Template: template,
56+
UpdateStrategy: updateStrategy,
57+
}
58+
59+
if cr.CompareVersion("1.23.0") >= 0 {
60+
spec.RevisionHistoryLimit = cr.Spec.RevisionHistoryLimit
5761
}
62+
63+
return spec
5864
}
5965

6066
func MongosTemplateSpec(cr *api.PerconaServerMongoDB, initImage string, log logr.Logger, customConf config.CustomConfig, cfgInstances []string) (corev1.PodTemplateSpec, error) {

pkg/psmdb/statefulset.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ func StatefulSpec(ctx context.Context, cr *api.PerconaServerMongoDB, replset *ap
422422
}
423423
}
424424

425-
return appsv1.StatefulSetSpec{
425+
spec := appsv1.StatefulSetSpec{
426426
ServiceName: cr.Name + "-" + replset.Name,
427427
Replicas: &size,
428428
Selector: &metav1.LabelSelector{
@@ -453,9 +453,14 @@ func StatefulSpec(ctx context.Context, cr *api.PerconaServerMongoDB, replset *ap
453453
},
454454
},
455455
UpdateStrategy: updateStrategy,
456-
RevisionHistoryLimit: cr.Spec.RevisionHistoryLimit,
457456
VolumeClaimTemplates: volumeClaimTemplates,
458-
}, nil
457+
}
458+
459+
if cr.CompareVersion("1.23.0") >= 0 {
460+
spec.RevisionHistoryLimit = cr.Spec.RevisionHistoryLimit
461+
}
462+
463+
return spec, nil
459464
}
460465

461466
func logRotateConfigVolume(configs StatefulConfigParams, cr *api.PerconaServerMongoDB) *corev1.Volume {

0 commit comments

Comments
 (0)