Unverified Commit b16b6bc6 authored by Thomas Montfort's avatar Thomas Montfort Committed by GitHub
Browse files

fix: attach dynamo namespace label to Grove PodCliques (#3359)

parent 62661cce
...@@ -780,7 +780,7 @@ func GenerateBasePodSpec( ...@@ -780,7 +780,7 @@ func GenerateBasePodSpec(
addStandardEnvVars(&container, controllerConfig) addStandardEnvVars(&container, controllerConfig)
var volumes []corev1.Volume volumes := make([]corev1.Volume, 0, len(component.VolumeMounts)+1) // +1 for shared memory volume
for _, volumeMount := range component.VolumeMounts { for _, volumeMount := range component.VolumeMounts {
if volumeMount.Name == "" { if volumeMount.Name == "" {
...@@ -1008,6 +1008,9 @@ func generateLabels(component *v1alpha1.DynamoComponentDeploymentOverridesSpec, ...@@ -1008,6 +1008,9 @@ func generateLabels(component *v1alpha1.DynamoComponentDeploymentOverridesSpec,
labels := make(map[string]string) labels := make(map[string]string)
labels[commonconsts.KubeLabelDynamoSelector] = GetDynamoComponentName(dynamoDeployment, componentName) labels[commonconsts.KubeLabelDynamoSelector] = GetDynamoComponentName(dynamoDeployment, componentName)
labels[commonconsts.KubeLabelDynamoGraphDeploymentName] = dynamoDeployment.Name labels[commonconsts.KubeLabelDynamoGraphDeploymentName] = dynamoDeployment.Name
if component.DynamoNamespace != nil {
labels[commonconsts.KubeLabelDynamoNamespace] = *component.DynamoNamespace
}
if component.ComponentType != "" { if component.ComponentType != "" {
labels[commonconsts.KubeLabelDynamoComponentType] = component.ComponentType labels[commonconsts.KubeLabelDynamoComponentType] = component.ComponentType
} }
......
...@@ -1265,6 +1265,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -1265,6 +1265,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypeFrontend, commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypeFrontend,
commonconsts.KubeLabelDynamoSubComponentType: "test-sub-component", commonconsts.KubeLabelDynamoSubComponentType: "test-sub-component",
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
"nvidia.com/label1": "label1", "nvidia.com/label1": "label1",
"nvidia.com/label2": "label2", "nvidia.com/label2": "label2",
}, },
...@@ -1415,6 +1416,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -1415,6 +1416,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-planner", commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-planner",
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypePlanner, commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypePlanner,
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
}, },
Annotations: map[string]string{}, Annotations: map[string]string{},
Spec: grovev1alpha1.PodCliqueSpec{ Spec: grovev1alpha1.PodCliqueSpec{
...@@ -1798,6 +1800,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -1798,6 +1800,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue, commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue,
commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-worker-ldr", commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-worker-ldr",
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
"nvidia.com/label1": "label1", "nvidia.com/label1": "label1",
"nvidia.com/label2": "label2", "nvidia.com/label2": "label2",
}, },
...@@ -1949,6 +1952,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -1949,6 +1952,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue, commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue,
commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-worker-wkr", commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-worker-wkr",
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
"nvidia.com/label1": "label1", "nvidia.com/label1": "label1",
"nvidia.com/label2": "label2", "nvidia.com/label2": "label2",
}, },
...@@ -2064,6 +2068,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -2064,6 +2068,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-frontend", commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-frontend",
commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypeFrontend, commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypeFrontend,
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
}, },
Annotations: map[string]string{}, Annotations: map[string]string{},
Spec: grovev1alpha1.PodCliqueSpec{ Spec: grovev1alpha1.PodCliqueSpec{
...@@ -2201,6 +2206,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -2201,6 +2206,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue, commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue,
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypePlanner, commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypePlanner,
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
}, },
Annotations: map[string]string{}, Annotations: map[string]string{},
Spec: grovev1alpha1.PodCliqueSpec{ Spec: grovev1alpha1.PodCliqueSpec{
...@@ -2597,6 +2603,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -2597,6 +2603,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue, commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue,
commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypeWorker, commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypeWorker,
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
"nvidia.com/label1": "label1", "nvidia.com/label1": "label1",
"nvidia.com/label2": "label2", "nvidia.com/label2": "label2",
}, },
...@@ -2735,6 +2742,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -2735,6 +2742,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue, commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue,
commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-worker-wkr", commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-worker-wkr",
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
"nvidia.com/label1": "label1", "nvidia.com/label1": "label1",
"nvidia.com/label2": "label2", "nvidia.com/label2": "label2",
}, },
...@@ -2850,6 +2858,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -2850,6 +2858,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue, commonconsts.KubeLabelMetricsEnabled: commonconsts.KubeLabelValueTrue,
commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-frontend", commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-frontend",
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
}, },
Annotations: map[string]string{}, Annotations: map[string]string{},
Spec: grovev1alpha1.PodCliqueSpec{ Spec: grovev1alpha1.PodCliqueSpec{
...@@ -2987,6 +2996,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -2987,6 +2996,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-planner", commonconsts.KubeLabelDynamoSelector: "test-dynamo-graph-deployment-planner",
commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment", commonconsts.KubeLabelDynamoGraphDeploymentName: "test-dynamo-graph-deployment",
commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypePlanner, commonconsts.KubeLabelDynamoComponentType: commonconsts.ComponentTypePlanner,
commonconsts.KubeLabelDynamoNamespace: "dynamo-test-dynamo-graph-deployment",
}, },
Annotations: map[string]string{}, Annotations: map[string]string{},
Spec: grovev1alpha1.PodCliqueSpec{ Spec: grovev1alpha1.PodCliqueSpec{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment