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

fix: operator planner metric port injection (#3294)

parent 44a40a0b
...@@ -32,7 +32,7 @@ func (p *PlannerDefaults) GetBaseContainer(context ComponentContext) (corev1.Con ...@@ -32,7 +32,7 @@ func (p *PlannerDefaults) GetBaseContainer(context ComponentContext) (corev1.Con
} }
container.Env = append(container.Env, []corev1.EnvVar{ container.Env = append(container.Env, []corev1.EnvVar{
{ {
Name: "PROMETHEUS_PORT", Name: "PLANNER_PROMETHEUS_PORT",
Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort), Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort),
}, },
}...) }...)
......
...@@ -55,7 +55,7 @@ func TestPlannerDefaults_GetBaseContainer(t *testing.T) { ...@@ -55,7 +55,7 @@ func TestPlannerDefaults_GetBaseContainer(t *testing.T) {
{Name: "DYN_NAMESPACE", Value: "dynamo-namespace"}, {Name: "DYN_NAMESPACE", Value: "dynamo-namespace"},
{Name: "DYN_PARENT_DGD_K8S_NAME", Value: "name"}, {Name: "DYN_PARENT_DGD_K8S_NAME", Value: "name"},
{Name: "DYN_PARENT_DGD_K8S_NAMESPACE", Value: "namespace"}, {Name: "DYN_PARENT_DGD_K8S_NAMESPACE", Value: "namespace"},
{Name: "PROMETHEUS_PORT", Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort)}, {Name: "PLANNER_PROMETHEUS_PORT", Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort)},
}, },
}, },
}, },
......
...@@ -729,7 +729,7 @@ func GenerateBasePodSpec( ...@@ -729,7 +729,7 @@ func GenerateBasePodSpec(
} }
} }
} }
container.Env = MergeEnvs(component.Envs, container.Env) container.Env = MergeEnvs(container.Env, component.Envs)
// Merge probes entirely if they are passed (no partial merge) // Merge probes entirely if they are passed (no partial merge)
if component.LivenessProbe != nil { if component.LivenessProbe != nil {
......
...@@ -625,6 +625,12 @@ func TestGenerateDynamoComponentsDeployments(t *testing.T) { ...@@ -625,6 +625,12 @@ func TestGenerateDynamoComponentsDeployments(t *testing.T) {
}, },
}, },
}, },
Envs: []corev1.EnvVar{
{
Name: "TEST_ENV",
Value: "test-value",
},
},
}, },
}, },
}, },
...@@ -666,6 +672,12 @@ func TestGenerateDynamoComponentsDeployments(t *testing.T) { ...@@ -666,6 +672,12 @@ func TestGenerateDynamoComponentsDeployments(t *testing.T) {
Args: []string{"echo hello world", "sleep 99999"}, Args: []string{"echo hello world", "sleep 99999"},
}, },
}, },
Envs: []corev1.EnvVar{
{
Name: "TEST_ENV",
Value: "test-value",
},
},
}, },
}, },
}, },
...@@ -699,6 +711,12 @@ func TestGenerateDynamoComponentsDeployments(t *testing.T) { ...@@ -699,6 +711,12 @@ func TestGenerateDynamoComponentsDeployments(t *testing.T) {
}, },
}, },
Autoscaling: nil, Autoscaling: nil,
Envs: []corev1.EnvVar{
{
Name: "TEST_ENV",
Value: "test-value",
},
},
}, },
}, },
}, },
...@@ -1501,7 +1519,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -1501,7 +1519,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
Value: "http://localhost:9090", Value: "http://localhost:9090",
}, },
{ {
Name: "PROMETHEUS_PORT", Name: "PLANNER_PROMETHEUS_PORT",
Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort), Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort),
}, },
}, },
...@@ -2276,7 +2294,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -2276,7 +2294,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
Value: "test-namespace", Value: "test-namespace",
}, },
{ {
Name: "PROMETHEUS_PORT", Name: "PLANNER_PROMETHEUS_PORT",
Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort), Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort),
}, },
}, },
...@@ -3067,7 +3085,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) { ...@@ -3067,7 +3085,7 @@ func TestGenerateGrovePodCliqueSet(t *testing.T) {
Value: "test-namespace", Value: "test-namespace",
}, },
{ {
Name: "PROMETHEUS_PORT", Name: "PLANNER_PROMETHEUS_PORT",
Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort), Value: fmt.Sprintf("%d", commonconsts.DynamoPlannerMetricsPort),
}, },
}, },
...@@ -4347,6 +4365,24 @@ func TestGenerateBasePodSpec_Frontend(t *testing.T) { ...@@ -4347,6 +4365,24 @@ func TestGenerateBasePodSpec_Frontend(t *testing.T) {
"DYN_HTTP_PORT": fmt.Sprintf("%d", commonconsts.DynamoServicePort), "DYN_HTTP_PORT": fmt.Sprintf("%d", commonconsts.DynamoServicePort),
}, },
}, },
{
name: "frontend with overriding env var",
component: &v1alpha1.DynamoComponentDeploymentOverridesSpec{
DynamoComponentDeploymentSharedSpec: v1alpha1.DynamoComponentDeploymentSharedSpec{
ComponentType: commonconsts.ComponentTypeFrontend,
Envs: []corev1.EnvVar{
{
Name: "DYN_HTTP_PORT",
Value: "3000",
},
},
},
},
backendFramework: BackendFrameworkVLLM,
wantEnvVars: map[string]string{
"DYN_HTTP_PORT": "3000",
},
},
} }
for _, tt := range tests { for _, tt := range tests {
......
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