core: add ROOK_REVISION_HISTORY_LIMIT operator setting
This adds an operator config setting ROOK_REVISION_HISTORY_LIMIT
defaulting to kubernetes'value for RevisionHistoryLimit.
If configured, the provided value will be used as RevisionHistoryLimit
for all Deployments rook creates.
Fixes: #12722
Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit ab8fd90aa6)
This commit is contained in:
1 parent
d815286186
commit
d60966a626
16 files changed
+71
-6
No files matched your search
@@ -133,6 +133,33 @@ func TestSetEnforceHostNetwork(t *testing.T) {
|
||||
assert.False(t, EnforceHostNetwork())
|
||||
}
|
||||
|
||||
func TestSetRevisionHistoryLimit(t *testing.T) {
|
||||
opConfig := map[string]string{}
|
||||
t.Run("ROOK_REVISION_HISTORY_LIMIT: test default value", func(t *testing.T) {
|
||||
SetRevisionHistoryLimit(opConfig)
|
||||
assert.Nil(t, RevisionHistoryLimit())
|
||||
})
|
||||
|
||||
var value string = "foo"
|
||||
t.Run("ROOK_REVISION_HISTORY_LIMIT: test invalid value 'foo'", func(t *testing.T) {
|
||||
opConfig[revisionHistoryLimitSettingName] = value
|
||||
SetRevisionHistoryLimit(opConfig)
|
||||
assert.Nil(t, RevisionHistoryLimit())
|
||||
})
|
||||
|
||||
t.Run("ROOK_REVISION_HISTORY_LIMIT: test empty string value", func(t *testing.T) {
|
||||
value = ""
|
||||
opConfig[revisionHistoryLimitSettingName] = value
|
||||
SetRevisionHistoryLimit(opConfig)
|
||||
assert.Nil(t, RevisionHistoryLimit())
|
||||
})
|
||||
t.Run("ROOK_REVISION_HISTORY_LIMIT: test valig value '10'", func(t *testing.T) {
|
||||
value = "10"
|
||||
opConfig[revisionHistoryLimitSettingName] = value
|
||||
SetRevisionHistoryLimit(opConfig)
|
||||
assert.Equal(t, int32(10), *RevisionHistoryLimit())
|
||||
})
|
||||
}
|
||||
func TestIsReadyToReconcile(t *testing.T) {
|
||||
scheme := scheme.Scheme
|
||||
scheme.AddKnownTypes(cephv1.SchemeGroupVersion, &cephv1.CephCluster{}, &cephv1.CephClusterList{})
|
||||
|
||||
Reference in new issue
Block a user