Merge pull request #16618 from subhamkrai/add-missing-endpointslice-label
mgr: add required k8s label for endpointSlice
This commit is contained in:
2 files changed
+5
No files matched your search
@@ -863,6 +863,7 @@ func RgwOpsLogSidecarContainer(opsLogFile, ns string, c cephv1.ClusterSpec, env
|
||||
// CreateExternalMetricsEndpoints creates external metric endpoint
|
||||
func createExternalMetricsEndpoints(namespace string, monitoringSpec cephv1.MonitoringSpec, ownerInfo *k8sutil.OwnerInfo) (*discoveryv1.EndpointSlice, error) {
|
||||
labels := AppLabels("rook-ceph-mgr", namespace)
|
||||
labels[discoveryv1.LabelServiceName] = ExternalMgrAppName
|
||||
|
||||
// Convert v1.EndpointAddress to string addresses
|
||||
addresses := make([]string, len(monitoringSpec.ExternalMgrEndpoints))
|
||||
|
||||
@@ -36,6 +36,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
discoveryv1 "k8s.io/api/discovery/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -367,6 +368,9 @@ func TestConfigureExternalMetricsEndpoint(t *testing.T) {
|
||||
currentEndpoints, err := ctx.Clientset.DiscoveryV1().EndpointSlices(namespace).Get(context.TODO(), "rook-ceph-mgr-external", metav1.GetOptions{})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "172.17.0.12", currentEndpoints.Endpoints[0].Addresses[0], currentEndpoints)
|
||||
assert.Equal(t, currentEndpoints.Labels[discoveryv1.LabelServiceName], ExternalMgrAppName)
|
||||
assert.Equal(t, currentEndpoints.Labels[k8sutil.AppAttr], "rook-ceph-mgr")
|
||||
assert.Equal(t, currentEndpoints.Labels[k8sutil.ClusterAttr], namespace)
|
||||
})
|
||||
|
||||
t.Run("spec and current active mgr endpoint identical with existing endpoint object", func(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user