Skip to content

Commit a22422f

Browse files
authored
Address nil pointer in K8s Annotations for TrafficSplitter (#1293)
1 parent 3d95861 commit a22422f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/types/userconfig/api.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,11 @@ func IdentifyAPI(filePath string, name string, kind Kind, index int) string {
188188

189189
// InitReplicas was left out deliberately
190190
func (api *API) ToK8sAnnotations() map[string]string {
191-
annotations := map[string]string{
192-
ProcessesPerReplicaAnnotationKey: s.Int32(api.Predictor.ProcessesPerReplica),
193-
ThreadsPerProcessAnnotationKey: s.Int32(api.Predictor.ThreadsPerProcess),
191+
annotations := map[string]string{}
192+
if api.Predictor != nil {
193+
annotations[ProcessesPerReplicaAnnotationKey] = s.Int32(api.Predictor.ProcessesPerReplica)
194+
annotations[ThreadsPerProcessAnnotationKey] = s.Int32(api.Predictor.ThreadsPerProcess)
195+
194196
}
195197

196198
if api.Networking != nil {

0 commit comments

Comments
 (0)