Merge pull request #7440 from travisn/mgr-labels

ceph: Set active mgr label on mgr services
This commit is contained in:
Travis Nielsen
2021-03-19 11:16:33 -06:00
committed by GitHub
3 changed files with 6 additions and 7 deletions
@@ -13,6 +13,7 @@ spec:
matchLabels:
app: rook-ceph-mgr
rook_cluster: rook-ceph
ceph_daemon_id: a
endpoints:
- port: http-metrics
path: /metrics
+4 -6
View File
@@ -246,7 +246,7 @@ func getDefaultMgrLivenessProbe() *v1.Probe {
// MakeMetricsService generates the Kubernetes service object for the monitoring service
func (c *Cluster) MakeMetricsService(name, activeDaemon, servicePortMetricName string) (*v1.Service, error) {
labels := controller.AppLabels(AppName, c.clusterInfo.Namespace)
labels := c.selectorLabels(activeDaemon)
svc := &v1.Service{
ObjectMeta: metav1.ObjectMeta{
@@ -268,7 +268,7 @@ func (c *Cluster) MakeMetricsService(name, activeDaemon, servicePortMetricName s
// If the cluster is external we don't need to add the selector
if name != ExternalMgrAppName {
svc.Spec.Selector = c.selectorLabels(activeDaemon)
svc.Spec.Selector = labels
}
err := c.clusterInfo.OwnerInfo.SetControllerReference(svc)
@@ -279,9 +279,7 @@ func (c *Cluster) MakeMetricsService(name, activeDaemon, servicePortMetricName s
}
func (c *Cluster) makeDashboardService(name, activeDaemon string) (*v1.Service, error) {
labels := controller.AppLabels(AppName, c.clusterInfo.Namespace)
selectorLabels := controller.AppLabels(AppName, c.clusterInfo.Namespace)
selectorLabels[controller.DaemonIDLabel] = activeDaemon
labels := c.selectorLabels(activeDaemon)
portName := "https-dashboard"
if !c.spec.Dashboard.SSL {
@@ -294,7 +292,7 @@ func (c *Cluster) makeDashboardService(name, activeDaemon string) (*v1.Service,
Labels: labels,
},
Spec: v1.ServiceSpec{
Selector: selectorLabels,
Selector: labels,
Type: v1.ServiceTypeClusterIP,
Ports: []v1.ServicePort{
{
+1 -1
View File
@@ -91,7 +91,7 @@ func TestServiceSpec(t *testing.T) {
assert.NotNil(t, s)
assert.Equal(t, "rook-mgr", s.Name)
assert.Equal(t, 1, len(s.Spec.Ports))
assert.Equal(t, 2, len(s.Labels))
assert.Equal(t, 3, len(s.Labels))
assert.Equal(t, 3, len(s.Spec.Selector))
assert.Equal(t, "foo", s.Spec.Selector[controller.DaemonIDLabel])
}