/* Copyright 2019 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package config import ( "encoding/json" "os" "strings" "github.com/pkg/errors" "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/clusterd" "github.com/rook/rook/pkg/daemon/ceph/client" "github.com/rook/rook/pkg/util/exec" "golang.org/x/exp/slices" "gopkg.in/ini.v1" ) // Alias for cluster CRD ceph config options map type CephConfigOptionsMap = map[string]map[string]string // MonStore provides methods for setting Ceph configurations in the centralized mon // configuration database. type MonStore struct { context *clusterd.Context clusterInfo *client.ClusterInfo } // GetMonStore returns a new MonStore for the cluster. func GetMonStore(context *clusterd.Context, clusterInfo *client.ClusterInfo) *MonStore { return &MonStore{ context: context, clusterInfo: clusterInfo, } } // Option defines the pieces of information relevant to Ceph configuration options. type Option struct { // Who is the entity(-ies) the option should apply to. Who string // Option is the option key Option string // Value is the value for the option Value string } // SetIfChanged sets a config in the centralized mon configuration database if the config has // changed value. // https://docs.ceph.com/docs/master/rados/configuration/ceph-conf/#monitor-configuration-database // // There is a bug through at least Ceph v18 where `ceph config get global