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
@@ -54,6 +54,9 @@ const (
|
||||
enforceHostNetworkSettingName string = "ROOK_ENFORCE_HOST_NETWORK"
|
||||
enforceHostNetworkDefaultValue string = "false"
|
||||
|
||||
revisionHistoryLimitSettingName string = "ROOK_REVISION_HISTORY_LIMIT"
|
||||
revisionHistoryLimitDefaultValue string = ""
|
||||
|
||||
// UninitializedCephConfigError refers to the error message printed by the Ceph CLI when there is no ceph configuration file
|
||||
// This typically is raised when the operator has not finished initializing
|
||||
UninitializedCephConfigError = "error calling conf_read_file"
|
||||
@@ -86,7 +89,8 @@ var (
|
||||
OperatorCephBaseImageVersion string
|
||||
|
||||
// loopDevicesAllowed indicates whether loop devices are allowed to be used
|
||||
loopDevicesAllowed = false
|
||||
loopDevicesAllowed = false
|
||||
revisionHistoryLimit *int32 = nil
|
||||
)
|
||||
|
||||
func DiscoveryDaemonEnabled(data map[string]string) bool {
|
||||
@@ -133,6 +137,26 @@ func EnforceHostNetwork() bool {
|
||||
return cephv1.EnforceHostNetwork()
|
||||
}
|
||||
|
||||
func SetRevisionHistoryLimit(data map[string]string) {
|
||||
strval := k8sutil.GetValue(data, revisionHistoryLimitSettingName, revisionHistoryLimitDefaultValue)
|
||||
if strval != "" {
|
||||
numval, err := strconv.ParseInt(strval, 10, 32)
|
||||
if err != nil {
|
||||
logger.Warningf("failed to parse value %q for %q. assuming default value.", strval, revisionHistoryLimitSettingName)
|
||||
revisionHistoryLimit = nil
|
||||
return
|
||||
|
||||
}
|
||||
limit := int32(numval)
|
||||
revisionHistoryLimit = &limit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func RevisionHistoryLimit() *int32 {
|
||||
return revisionHistoryLimit
|
||||
}
|
||||
|
||||
// canIgnoreHealthErrStatusInReconcile determines whether a status of HEALTH_ERR in the CephCluster can be ignored safely.
|
||||
func canIgnoreHealthErrStatusInReconcile(cephCluster cephv1.CephCluster, controllerName string) bool {
|
||||
// Get a list of all the keys causing the HEALTH_ERR status.
|
||||
|
||||
Reference in new issue
Block a user