Merge pull request #3626 from jmolmo/issue-3603
Set "ssl_server_port" dashboard setting if it is present in ceph dashboard config
This commit is contained in:
4 files changed
+23
-21
No files matched your search
@@ -112,7 +112,7 @@ type DashboardSpec struct {
|
||||
// The dashboard webserver port
|
||||
Port int `json:"port,omitempty"`
|
||||
// Whether SSL should be used
|
||||
SSL *bool `json:"ssl,omitempty"`
|
||||
SSL bool `json:"ssl,omitempty"`
|
||||
}
|
||||
|
||||
// MonitoringSpec represents the settings for Prometheus based Ceph monitoring
|
||||
|
||||
@@ -482,7 +482,7 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
|
||||
out.DisruptionManagement = in.DisruptionManagement
|
||||
in.Mon.DeepCopyInto(&out.Mon)
|
||||
out.RBDMirroring = in.RBDMirroring
|
||||
in.Dashboard.DeepCopyInto(&out.Dashboard)
|
||||
out.Dashboard = in.Dashboard
|
||||
out.Monitoring = in.Monitoring
|
||||
out.External = in.External
|
||||
in.Mgr.DeepCopyInto(&out.Mgr)
|
||||
@@ -523,11 +523,6 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DashboardSpec) DeepCopyInto(out *DashboardSpec) {
|
||||
*out = *in
|
||||
if in.SSL != nil {
|
||||
in, out := &in.SSL, &out.SSL
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/rook/rook/pkg/daemon/ceph/client"
|
||||
cephver "github.com/rook/rook/pkg/operator/ceph/version"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -121,27 +122,33 @@ func (c *Cluster) configureDashboardModule(m *mgrConfig) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// server port
|
||||
port := strconv.Itoa(m.DashboardPort)
|
||||
changed, err := client.MgrSetConfig(c.context, c.Namespace, m.DaemonID, c.clusterInfo.CephVersion, "mgr/dashboard/server_port", port, false)
|
||||
// ssl support
|
||||
ssl := strconv.FormatBool(c.dashboard.SSL)
|
||||
changed, err := client.MgrSetConfig(c.context, c.Namespace, m.DaemonID, c.clusterInfo.CephVersion, "mgr/dashboard/ssl", ssl, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
hasChanged = hasChanged || changed
|
||||
|
||||
// ssl support
|
||||
var ssl string
|
||||
if c.dashboard.SSL == nil {
|
||||
ssl = ""
|
||||
} else {
|
||||
ssl = strconv.FormatBool(*c.dashboard.SSL)
|
||||
}
|
||||
changed, err = client.MgrSetConfig(c.context, c.Namespace, m.DaemonID, c.clusterInfo.CephVersion, "mgr/dashboard/ssl", ssl, false)
|
||||
// server port
|
||||
port := strconv.Itoa(m.DashboardPort)
|
||||
changed, err = client.MgrSetConfig(c.context, c.Namespace, m.DaemonID, c.clusterInfo.CephVersion, "mgr/dashboard/server_port", port, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
hasChanged = hasChanged || changed
|
||||
|
||||
// SSL enabled. Needed to set specifically the ssl port setting starting with Nautilus(14.2.1)
|
||||
if c.dashboard.SSL {
|
||||
if c.clusterInfo.CephVersion.IsAtLeast(cephver.CephVersion{Major: 14, Minor: 2, Extra: 1}) {
|
||||
changed, err = client.MgrSetConfig(c.context, c.Namespace, m.DaemonID, c.clusterInfo.CephVersion, "mgr/dashboard/ssl_server_port", port, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
hasChanged = hasChanged || changed
|
||||
}
|
||||
}
|
||||
|
||||
if hasChanged {
|
||||
logger.Infof("dashboard config has changed")
|
||||
return c.restartDashboard()
|
||||
@@ -158,7 +165,7 @@ func (c *Cluster) initializeSecureDashboard() error {
|
||||
return fmt.Errorf("failed to generate a password. %+v", err)
|
||||
}
|
||||
|
||||
if c.dashboard.SSL == nil || *c.dashboard.SSL {
|
||||
if c.dashboard.SSL {
|
||||
alreadyCreated, err := c.createSelfSignedCert()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create a self signed cert. %+v", err)
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestStartSecureDashboard(t *testing.T) {
|
||||
CephVersion: cephver.Mimic,
|
||||
}
|
||||
c := &Cluster{clusterInfo: clusterInfo, context: &clusterd.Context{Clientset: test.New(3), Executor: executor}, Namespace: "myns",
|
||||
dashboard: cephv1.DashboardSpec{Enabled: true}, cephVersion: cephv1.CephVersionSpec{Image: "ceph/ceph:v13.2.2"}}
|
||||
dashboard: cephv1.DashboardSpec{Enabled: true, SSL: true}, cephVersion: cephv1.CephVersionSpec{Image: "ceph/ceph:v13.2.2"}}
|
||||
c.exitCode = func(err error) (int, bool) {
|
||||
if exitCodeResponse != 0 {
|
||||
return exitCodeResponse, true
|
||||
|
||||
Reference in new issue
Block a user