rgw: change default frontend on nautilus

As per: https://github.com/ceph/ceph/pull/26599, Beast is now the
default fronted for rados gateway.
Newly created cluster as of Nautilus will use it by default.

Resolves: https://github.com/rook/rook/issues/2707
Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2019-02-24 17:22:32 +01:00
1 parent 818bf38b0c
commit 03587352d5
2 files changed
+30 -2

No files matched your search

+13 -2
View File
@@ -24,12 +24,16 @@ import (
"strconv"
"github.com/coreos/pkg/capnslog"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
"github.com/rook/rook/pkg/util"
)
var logger = capnslog.NewPackageLogger("github.com/rook/rook", "cephrgw")
var (
logger = capnslog.NewPackageLogger("github.com/rook/rook", "cephrgw")
rgwFrontendName = "civetweb"
)
const (
keyringTemplate = `[client.radosgw.gateway]
@@ -78,6 +82,13 @@ func portString(config *Config) string {
return portString
}
func rgwFrontend(config *Config) string {
if cephv1.VersionAtLeast(config.ClusterInfo.CephVersionName, cephv1.Nautilus) {
rgwFrontendName = "beast"
}
return rgwFrontendName
}
func generateConfigFiles(context *clusterd.Context, config *Config) error {
// create the rgw data directory
@@ -92,7 +103,7 @@ func generateConfigFiles(context *clusterd.Context, config *Config) error {
"rgw log nonexistent bucket": "true",
"rgw intent log object name utc": "true",
"rgw enable usage log": "true",
"rgw_frontends": fmt.Sprintf("civetweb port=%s", portString(config)),
"rgw_frontends": fmt.Sprintf("%s port=%s", rgwFrontend(config), portString(config)),
"rgw_zone": config.Name,
"rgw_zonegroup": config.Name,
}
+17
View File
@@ -19,6 +19,7 @@ package rgw
import (
"testing"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
"github.com/stretchr/testify/assert"
)
@@ -48,3 +49,19 @@ func TestPortString(t *testing.T) {
result = portString(cfg)
assert.Equal(t, "", result)
}
func TestFrontend(t *testing.T) {
cfg := &Config{}
cfg.ClusterInfo = &cephconfig.ClusterInfo{CephVersionName: "mimic"}
result := rgwFrontend(cfg)
assert.Equal(t, "civetweb", result)
cfg.ClusterInfo.CephVersionName = "nautilus"
result = rgwFrontend(cfg)
assert.Equal(t, "beast", result)
cfg.ClusterInfo.CephVersionName = "octopus"
result = rgwFrontend(cfg)
assert.Equal(t, "beast", result)
}