Skip to content

Commit

Permalink
use correct env var for metric port name
Browse files Browse the repository at this point in the history
  • Loading branch information
xaniasd authored and seldondev committed May 13, 2020
1 parent e862592 commit 6263ade
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var (
C client.Client
envPredictiveUnitServicePort = os.Getenv(ENV_PREDICTIVE_UNIT_SERVICE_PORT)
envPredictiveUnitServicePortMetrics = os.Getenv(ENV_PREDICTIVE_UNIT_SERVICE_PORT_METRICS)
predictiveUnitMetricsPortName = GetEnv(ENV_PREDICTIVE_UNIT_METRICS_ENDPOINT, constants.DefaultMetricsPortName)
predictiveUnitMetricsPortName = GetEnv(ENV_PREDICTIVE_UNIT_METRICS_PORT_NAME, constants.DefaultMetricsPortName)
)

const PredictorServerConfigMapKeyName = "predictor_servers"
Expand Down Expand Up @@ -189,6 +189,7 @@ func getUpdatePortNumMap(name string, nextPortNum *int32, portMap map[string]int

func addMetricsPortAndIncrement(nextMetricsPortNum *int32, con *corev1.Container) {
existingMetricPort := GetPort(predictiveUnitMetricsPortName, con.Ports)
predictiveUnitMetricsPortName = GetEnv(ENV_PREDICTIVE_UNIT_METRICS_PORT_NAME, constants.DefaultMetricsPortName)
if existingMetricPort == nil {
con.Ports = append(con.Ports, corev1.ContainerPort{
Name: predictiveUnitMetricsPortName,
Expand Down
2 changes: 1 addition & 1 deletion operator/controllers/seldondeployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ func createContainerService(deploy *appsv1.Deployment,
}...)

//Add Metric Env Var
predictiveUnitMetricsPortName := GetEnv(machinelearningv1.ENV_PREDICTIVE_UNIT_METRICS_ENDPOINT, constants.DefaultMetricsPortName)
predictiveUnitMetricsPortName := GetEnv(machinelearningv1.ENV_PREDICTIVE_UNIT_METRICS_PORT_NAME, constants.DefaultMetricsPortName)
metricPort := getPort(predictiveUnitMetricsPortName, con.Ports)
if metricPort != nil {
con.Env = append(con.Env, []corev1.EnvVar{
Expand Down

0 comments on commit 6263ade

Please sign in to comment.