diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml index 0dd90f80d..575cac054 100644 --- a/deploy/charts/rook-ceph/templates/resources.yaml +++ b/deploy/charts/rook-ceph/templates/resources.yaml @@ -1920,6 +1920,9 @@ spec: multiClusterService: description: Enable multiClusterService to export the Services between peer clusters properties: + clusterID: + description: 'ClusterID uniquely identifies a cluster. It is used as a prefix to nslookup exported services. For example: ...svc.clusterset.local' + type: string enabled: description: Enable multiClusterService to export the mon and OSD services to peer cluster. Ensure that peer clusters are connected using an MCS API compatible application, like Globalnet Submariner. type: boolean diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml index ea2eea9ab..d4a3e4abf 100644 --- a/deploy/examples/crds.yaml +++ b/deploy/examples/crds.yaml @@ -1918,6 +1918,9 @@ spec: multiClusterService: description: Enable multiClusterService to export the Services between peer clusters properties: + clusterID: + description: 'ClusterID uniquely identifies a cluster. It is used as a prefix to nslookup exported services. For example: ...svc.clusterset.local' + type: string enabled: description: Enable multiClusterService to export the mon and OSD services to peer cluster. Ensure that peer clusters are connected using an MCS API compatible application, like Globalnet Submariner. type: boolean diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index 72ec1675a..7872dd99b 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -2207,6 +2207,10 @@ type MultiClusterServiceSpec struct { // like Globalnet Submariner. // +optional Enabled bool `json:"enabled,omitempty"` + + // ClusterID uniquely identifies a cluster. It is used as a prefix to nslookup exported + // services. For example: ...svc.clusterset.local + ClusterID string `json:"clusterID,omitempty"` } type ConnectionsSpec struct { // Encryption settings for the network connections. diff --git a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go index e40a15aa1..22e2a50a1 100644 --- a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go @@ -2287,6 +2287,11 @@ func (in *GaneshaServerSpec) DeepCopyInto(out *GaneshaServerSpec) { } } in.Resources.DeepCopyInto(&out.Resources) + if in.HostNetwork != nil { + in, out := &in.HostNetwork, &out.HostNetwork + *out = new(bool) + **out = **in + } return } @@ -2334,6 +2339,11 @@ func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) { *out = new(bool) **out = **in } + if in.DashboardEnabled != nil { + in, out := &in.DashboardEnabled, &out.DashboardEnabled + *out = new(bool) + **out = **in + } return } @@ -2499,6 +2509,22 @@ func (in *KeyManagementServiceSpec) DeepCopy() *KeyManagementServiceSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyRotationSpec) DeepCopyInto(out *KeyRotationSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyRotationSpec. +func (in *KeyRotationSpec) DeepCopy() *KeyRotationSpec { + if in == nil { + return nil + } + out := new(KeyRotationSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in Labels) DeepCopyInto(out *Labels) { { @@ -2791,6 +2817,11 @@ func (in *MonitoringSpec) DeepCopyInto(out *MonitoringSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(metav1.Duration) + **out = **in + } return } @@ -3820,6 +3851,7 @@ func (in *SanitizeDisksSpec) DeepCopy() *SanitizeDisksSpec { func (in *SecuritySpec) DeepCopyInto(out *SecuritySpec) { *out = *in in.KeyManagementService.DeepCopyInto(&out.KeyManagementService) + out.KeyRotation = in.KeyRotation return } diff --git a/pkg/operator/ceph/cluster/mon/service.go b/pkg/operator/ceph/cluster/mon/service.go index 2c1a35e00..f64c0c068 100644 --- a/pkg/operator/ceph/cluster/mon/service.go +++ b/pkg/operator/ceph/cluster/mon/service.go @@ -75,7 +75,7 @@ func (c *Cluster) createService(mon *monConfig) (*v1.Service, error) { func (c *Cluster) exportService(service *v1.Service, monDaemon string) (string, error) { logger.Infof("exporting service %q", service.Name) - exportedIP, err := k8sutil.ExportService(c.ClusterInfo.Context, c.context, service) + exportedIP, err := k8sutil.ExportService(c.ClusterInfo.Context, c.context, service, c.spec.Network.MultiClusterService.ClusterID) if err != nil { return "", errors.Wrapf(err, "failed to export service %q", service.Name) } diff --git a/pkg/operator/ceph/cluster/osd/spec.go b/pkg/operator/ceph/cluster/osd/spec.go index 15d740a08..26c43b3e9 100644 --- a/pkg/operator/ceph/cluster/osd/spec.go +++ b/pkg/operator/ceph/cluster/osd/spec.go @@ -485,7 +485,7 @@ func (c *Cluster) makeDeployment(osdProps osdProperties, osd OSDInfo, provisionC return nil, errors.Wrapf(err, "failed to configure osd service for osd.%d", osd.ID) } - exportedIP, err := k8sutil.ExportService(c.clusterInfo.Context, c.context, osdService) + exportedIP, err := k8sutil.ExportService(c.clusterInfo.Context, c.context, osdService, c.spec.Network.MultiClusterService.ClusterID) if err != nil { return nil, errors.Wrapf(err, "failed to export service %q", osdService.Name) } diff --git a/pkg/operator/k8sutil/service.go b/pkg/operator/k8sutil/service.go index 0e4e67418..94798d834 100644 --- a/pkg/operator/k8sutil/service.go +++ b/pkg/operator/k8sutil/service.go @@ -119,7 +119,7 @@ func IsServiceExported(ctx context.Context, c *clusterd.Context, name, namespace } // ExportService exports the service using MCS API and returns the external IP of the exported service -func ExportService(ctx context.Context, c *clusterd.Context, service *v1.Service) (string, error) { +func ExportService(ctx context.Context, c *clusterd.Context, service *v1.Service, clusterID string) (string, error) { client, err := mcsv1Client.NewForConfig(c.KubeConfig) if err != nil { return "", errors.Wrap(err, "failed to get mcs-api client") @@ -140,7 +140,7 @@ func ExportService(ctx context.Context, c *clusterd.Context, service *v1.Service var exportedIP string var serviceExportError error - exportedIP, err = GetExportedServiceIP(fmt.Sprintf("%s.%s.svc.clusterset.local", service.Name, service.Namespace)) + exportedIP, err = GetExportedServiceIP(fmt.Sprintf("%s.%s.%s.svc.clusterset.local", clusterID, service.Name, service.Namespace)) if err != nil { serviceExportError = errors.Wrapf(err, "failed to get exported service IP for %q", service.Name)