Merge pull request #12067 from rook/mergify/bp/release-1.11/pr-12064

MCS: use cluster ID for ns lookup on exported service. (backport #12064)
This commit is contained in:
Travis Nielsen authored and GitHub committed 2023-04-11 11:39:16 -06:00
commit 6ea0722bdc
7 files changed
+46 -4

No files matched your search

@@ -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: <clusterid>.<svc>.<ns>.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
+3
View File
@@ -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: <clusterid>.<svc>.<ns>.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
+4
View File
@@ -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: <clusterid>.<svc>.<ns>.svc.clusterset.local
ClusterID string `json:"clusterID,omitempty"`
}
type ConnectionsSpec struct {
// Encryption settings for the network connections.
@@ -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
}
+1 -1
View File
@@ -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)
}
+1 -1
View File
@@ -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)
}
+2 -2
View File
@@ -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)