Skip to content

Commit 6c18294

Browse files
committed
Update curated model argument in ValidateClusterAPIs()
1 parent 8b0a916 commit 6c18294

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pkg/operator/resources/validations.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ func ValidateClusterAPIs(apis []userconfig.API, projectFiles spec.ProjectFiles)
102102
for i := range apis {
103103
api := &apis[i]
104104
if api.Kind == userconfig.RealtimeAPIKind || api.Kind == userconfig.BatchAPIKind {
105-
models := []spec.CuratedModelResource{}
106-
if err := spec.ValidateAPI(api, &models, projectFiles, config.Provider, config.AWS, config.GCP, config.K8s); err != nil {
105+
if err := spec.ValidateAPI(api, nil, projectFiles, config.Provider, config.AWS, config.GCP, config.K8s); err != nil {
107106
return errors.Wrap(err, api.Identify())
108107
}
109108
if err := validateK8s(api, virtualServices, maxMem); err != nil {

pkg/types/spec/validations.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,11 @@ func ValidateAPI(
702702
k8sClient *k8s.Client, // will be nil for local provider
703703
) error {
704704

705+
// if models is nil, we need to set it to an empty slice to avoid nil pointer exceptions
706+
if models == nil {
707+
models = &[]CuratedModelResource{}
708+
}
709+
705710
if provider != types.LocalProviderType && api.Networking.Endpoint == nil {
706711
api.Networking.Endpoint = pointer.String("/" + api.Name)
707712
}

0 commit comments

Comments
 (0)