kserve
kserve copied to clipboard
Kserve defaulting causing duplicates of environment variable
/kind bug
What steps did you take and what happened: Create example xgboost isvc and enable gRPC
apiVersion: "serving.kserve.io/v1beta1"
kind: "InferenceService"
metadata:
name: "xgboost-iris"
spec:
predictor:
xgboost:
protocolVersion: "v2"
storageUri: "gs://kfserving-examples/models/xgboost/iris"
ports:
- containerPort: 9000
name: h2c
protocol: TCP
The pod spec has duplicated environment variable
Environment:
MLSERVER_MODEL_NAME: xgboost-iris
MLSERVER_MODEL_URI: /mnt/models
MLSERVER_MODEL_NAME: xgboost-iris
MLSERVER_MODEL_URI: /mnt/models
Additionally, attempt to override the defaults leads to duplicated environment variable with different values
apiVersion: "serving.kserve.io/v1beta1"
kind: "InferenceService"
metadata:
name: "xgboost-iris"
spec:
predictor:
xgboost:
protocolVersion: "v2"
storageUri: "gs://kfserving-examples/models/xgboost/iris"
ports:
- containerPort: 9000
name: h2c
protocol: TCP
env:
- name: MLSERVER_MODEL_NAME
value: my-model
The pod spec:
Environment:
MLSERVER_MODEL_NAME: my-model
MLSERVER_MODEL_NAME: xgboost-iris
MLSERVER_MODEL_URI: /mnt/models
What did you expect to happen:
- Defaulting should not duplicate environment variable and should prioritise user's defined environment variable
Anything else you would like to add:
I believe it's because the defaulter always append .Env without checking the presence of existing environment variable. (https://github.com/kserve/kserve/blob/a6ed8e4b006e27433de2336e0e8b7cec11137dc1/pkg/apis/serving/v1beta1/inference_service_defaults.go#L264)
Environment:
- Kserve: 0.8.0