Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
07afe3c9
Commit
07afe3c9
authored
Mar 10, 2025
by
Anant Sharma
Committed by
GitHub
Mar 10, 2025
Browse files
style: fix formatting for .go file (#62)
parent
090c825f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
59 deletions
+59
-59
deploy/dynamo/operator/api/dynamo/common/zz_generated.deepcopy.go
...ynamo/operator/api/dynamo/common/zz_generated.deepcopy.go
+2
-2
deploy/dynamo/operator/api/v1alpha1/dynamoinimdeployment_types.go
...ynamo/operator/api/v1alpha1/dynamoinimdeployment_types.go
+2
-2
deploy/dynamo/operator/api/v1alpha1/dynamoinimrequest_types.go
...y/dynamo/operator/api/v1alpha1/dynamoinimrequest_types.go
+5
-5
deploy/dynamo/operator/internal/controller/dynamonimdeployment_controller.go
...tor/internal/controller/dynamonimdeployment_controller.go
+24
-24
deploy/dynamo/operator/internal/controller/dynamonimrequest_controller.go
...erator/internal/controller/dynamonimrequest_controller.go
+17
-17
deploy/dynamo/operator/internal/nim/nim_test.go
deploy/dynamo/operator/internal/nim/nim_test.go
+9
-9
No files found.
deploy/dynamo/operator/api/dynamo/common/zz_generated.deepcopy.go
View file @
07afe3c9
//go:build !ignore_autogenerated
/*
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* SPDX-License-Identifier: Apache-2.0
...
@@ -15,8 +17,6 @@
...
@@ -15,8 +17,6 @@
* limitations under the License.
* limitations under the License.
*/
*/
//go:build !ignore_autogenerated
/*
/*
Copyright 2024.
Copyright 2024.
...
...
deploy/dynamo/operator/api/v1alpha1/dynamoinimdeployment_types.go
View file @
07afe3c9
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
)
)
const
(
const
(
DynamoDeploymentConditionTypeAvailable
=
"Available"
DynamoDeploymentConditionTypeAvailable
=
"Available"
DynamoDeploymentConditionTypeDynamoNimFound
=
"DynamoNimFound"
DynamoDeploymentConditionTypeDynamoNimFound
=
"DynamoNimFound"
DynamoDeploymentConditionTypeDynamoNimRequestFound
=
"DynamoNimRequestFound"
DynamoDeploymentConditionTypeDynamoNimRequestFound
=
"DynamoNimRequestFound"
)
)
...
@@ -45,7 +45,7 @@ type DynamoNimDeploymentSpec struct {
...
@@ -45,7 +45,7 @@ type DynamoNimDeploymentSpec struct {
// contains the name of the service
// contains the name of the service
ServiceName
string
`json:"serviceName,omitempty"`
ServiceName
string
`json:"serviceName,omitempty"`
Resources
*
dynamoCommon
.
Resources
`json:"resources,omitempty"`
Resources
*
dynamoCommon
.
Resources
`json:"resources,omitempty"`
Autoscaling
*
Autoscaling
`json:"autoscaling,omitempty"`
Autoscaling
*
Autoscaling
`json:"autoscaling,omitempty"`
Envs
[]
corev1
.
EnvVar
`json:"envs,omitempty"`
Envs
[]
corev1
.
EnvVar
`json:"envs,omitempty"`
EnvFromSecret
*
string
`json:"envFromSecret,omitempty"`
EnvFromSecret
*
string
`json:"envFromSecret,omitempty"`
...
...
deploy/dynamo/operator/api/v1alpha1/dynamoinimrequest_types.go
View file @
07afe3c9
...
@@ -25,11 +25,11 @@ import (
...
@@ -25,11 +25,11 @@ import (
)
)
const
(
const
(
DynamoNimRequestConditionTypeModelsSeeding
=
"ModelsSeeding"
DynamoNimRequestConditionTypeModelsSeeding
=
"ModelsSeeding"
DynamoNimRequestConditionTypeImageBuilding
=
"ImageBuilding"
DynamoNimRequestConditionTypeImageBuilding
=
"ImageBuilding"
DynamoNimRequestConditionTypeImageExists
=
"ImageExists"
DynamoNimRequestConditionTypeImageExists
=
"ImageExists"
DynamoNimRequestConditionTypeImageExistsChecked
=
"ImageExistsChecked"
DynamoNimRequestConditionTypeImageExistsChecked
=
"ImageExistsChecked"
DynamoNimRequestConditionTypeModelsExists
=
"ModelsExists"
DynamoNimRequestConditionTypeModelsExists
=
"ModelsExists"
DynamoNimRequestConditionTypeDynamoNimAvailable
=
"DynamoNimAvailable"
DynamoNimRequestConditionTypeDynamoNimAvailable
=
"DynamoNimAvailable"
)
)
...
...
deploy/dynamo/operator/internal/controller/dynamonimdeployment_controller.go
View file @
07afe3c9
...
@@ -342,10 +342,10 @@ func (r *DynamoNimDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.
...
@@ -342,10 +342,10 @@ func (r *DynamoNimDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.
// create or update api-server deployment
// create or update api-server deployment
modified_
,
err
:=
r
.
createOrUpdateOrDeleteDeployments
(
ctx
,
createOrUpdateOrDeleteDeploymentsOption
{
modified_
,
err
:=
r
.
createOrUpdateOrDeleteDeployments
(
ctx
,
createOrUpdateOrDeleteDeploymentsOption
{
yataiClient
:
yataiClient
,
yataiClient
:
yataiClient
,
dynamoNimDeployment
:
dynamoNimDeployment
,
dynamoNimDeployment
:
dynamoNimDeployment
,
dynamoNim
:
dynamoNimCR
,
dynamoNim
:
dynamoNimCR
,
clusterName
:
clusterName
,
clusterName
:
clusterName
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
return
...
@@ -380,7 +380,7 @@ func (r *DynamoNimDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.
...
@@ -380,7 +380,7 @@ func (r *DynamoNimDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.
// create or update api-server ingresses
// create or update api-server ingresses
modified_
,
err
=
r
.
createOrUpdateIngresses
(
ctx
,
createOrUpdateIngressOption
{
modified_
,
err
=
r
.
createOrUpdateIngresses
(
ctx
,
createOrUpdateIngressOption
{
yataiClient
:
yataiClient
,
yataiClient
:
yataiClient
,
dynamoNimDeployment
:
dynamoNimDeployment
,
dynamoNimDeployment
:
dynamoNimDeployment
,
dynamoNim
:
dynamoNimCR
,
dynamoNim
:
dynamoNimCR
,
})
})
...
@@ -677,10 +677,10 @@ func (r *DynamoNimDeploymentReconciler) getYataiClientWithAuth(ctx context.Conte
...
@@ -677,10 +677,10 @@ func (r *DynamoNimDeploymentReconciler) getYataiClientWithAuth(ctx context.Conte
}
}
type
createOrUpdateOrDeleteDeploymentsOption
struct
{
type
createOrUpdateOrDeleteDeploymentsOption
struct
{
yataiClient
**
yataiclient
.
YataiClient
yataiClient
**
yataiclient
.
YataiClient
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNim
*
v1alpha1
.
DynamoNim
dynamoNim
*
v1alpha1
.
DynamoNim
clusterName
*
string
clusterName
*
string
}
}
//nolint:nakedret
//nolint:nakedret
...
@@ -738,8 +738,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateDeployment(ctx context.Con
...
@@ -738,8 +738,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateDeployment(ctx context.Con
logs
:=
log
.
FromContext
(
ctx
)
logs
:=
log
.
FromContext
(
ctx
)
deployment
,
err
:=
r
.
generateDeployment
(
ctx
,
generateDeploymentOption
{
deployment
,
err
:=
r
.
generateDeployment
(
ctx
,
generateDeploymentOption
{
dynamoNimDeployment
:
opt
.
dynamoNimDeployment
,
dynamoNimDeployment
:
opt
.
dynamoNimDeployment
,
dynamoNim
:
opt
.
dynamoNim
,
dynamoNim
:
opt
.
dynamoNim
,
yataiClient
:
opt
.
yataiClient
,
yataiClient
:
opt
.
yataiClient
,
clusterName
:
opt
.
clusterName
,
clusterName
:
opt
.
clusterName
,
isStealingTrafficDebugModeEnabled
:
opt
.
isStealingTrafficDebugModeEnabled
,
isStealingTrafficDebugModeEnabled
:
opt
.
isStealingTrafficDebugModeEnabled
,
...
@@ -953,8 +953,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
...
@@ -953,8 +953,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
isDebugPodReceiveProductionTrafficEnabled
:=
checkIfIsDebugPodReceiveProductionTrafficEnabled
(
resourceAnnotations
)
isDebugPodReceiveProductionTrafficEnabled
:=
checkIfIsDebugPodReceiveProductionTrafficEnabled
(
resourceAnnotations
)
containsStealingTrafficDebugModeEnabled
:=
checkIfContainsStealingTrafficDebugModeEnabled
(
opt
.
dynamoNimDeployment
)
containsStealingTrafficDebugModeEnabled
:=
checkIfContainsStealingTrafficDebugModeEnabled
(
opt
.
dynamoNimDeployment
)
modified
,
err
=
r
.
createOrUpdateService
(
ctx
,
createOrUpdateServiceOption
{
modified
,
err
=
r
.
createOrUpdateService
(
ctx
,
createOrUpdateServiceOption
{
dynamoNimDeployment
:
opt
.
dynamoNimDeployment
,
dynamoNimDeployment
:
opt
.
dynamoNimDeployment
,
dynamoNim
:
opt
.
dynamoNim
,
dynamoNim
:
opt
.
dynamoNim
,
isStealingTrafficDebugModeEnabled
:
false
,
isStealingTrafficDebugModeEnabled
:
false
,
isDebugPodReceiveProductionTraffic
:
isDebugPodReceiveProductionTrafficEnabled
,
isDebugPodReceiveProductionTraffic
:
isDebugPodReceiveProductionTrafficEnabled
,
containsStealingTrafficDebugModeEnabled
:
containsStealingTrafficDebugModeEnabled
,
containsStealingTrafficDebugModeEnabled
:
containsStealingTrafficDebugModeEnabled
,
...
@@ -966,8 +966,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
...
@@ -966,8 +966,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
if
containsStealingTrafficDebugModeEnabled
{
if
containsStealingTrafficDebugModeEnabled
{
var
modified_
bool
var
modified_
bool
modified_
,
err
=
r
.
createOrUpdateService
(
ctx
,
createOrUpdateServiceOption
{
modified_
,
err
=
r
.
createOrUpdateService
(
ctx
,
createOrUpdateServiceOption
{
dynamoNimDeployment
:
opt
.
dynamoNimDeployment
,
dynamoNimDeployment
:
opt
.
dynamoNimDeployment
,
dynamoNim
:
opt
.
dynamoNim
,
dynamoNim
:
opt
.
dynamoNim
,
isStealingTrafficDebugModeEnabled
:
false
,
isStealingTrafficDebugModeEnabled
:
false
,
isDebugPodReceiveProductionTraffic
:
isDebugPodReceiveProductionTrafficEnabled
,
isDebugPodReceiveProductionTraffic
:
isDebugPodReceiveProductionTrafficEnabled
,
containsStealingTrafficDebugModeEnabled
:
containsStealingTrafficDebugModeEnabled
,
containsStealingTrafficDebugModeEnabled
:
containsStealingTrafficDebugModeEnabled
,
...
@@ -980,8 +980,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
...
@@ -980,8 +980,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
modified
=
true
modified
=
true
}
}
modified_
,
err
=
r
.
createOrUpdateService
(
ctx
,
createOrUpdateServiceOption
{
modified_
,
err
=
r
.
createOrUpdateService
(
ctx
,
createOrUpdateServiceOption
{
dynamoNimDeployment
:
opt
.
dynamoNimDeployment
,
dynamoNimDeployment
:
opt
.
dynamoNimDeployment
,
dynamoNim
:
opt
.
dynamoNim
,
dynamoNim
:
opt
.
dynamoNim
,
isStealingTrafficDebugModeEnabled
:
true
,
isStealingTrafficDebugModeEnabled
:
true
,
isDebugPodReceiveProductionTraffic
:
isDebugPodReceiveProductionTrafficEnabled
,
isDebugPodReceiveProductionTraffic
:
isDebugPodReceiveProductionTrafficEnabled
,
containsStealingTrafficDebugModeEnabled
:
containsStealingTrafficDebugModeEnabled
,
containsStealingTrafficDebugModeEnabled
:
containsStealingTrafficDebugModeEnabled
,
...
@@ -1032,8 +1032,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
...
@@ -1032,8 +1032,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
}
}
type
createOrUpdateServiceOption
struct
{
type
createOrUpdateServiceOption
struct
{
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNim
*
v1alpha1
.
DynamoNim
dynamoNim
*
v1alpha1
.
DynamoNim
isStealingTrafficDebugModeEnabled
bool
isStealingTrafficDebugModeEnabled
bool
isDebugPodReceiveProductionTraffic
bool
isDebugPodReceiveProductionTraffic
bool
containsStealingTrafficDebugModeEnabled
bool
containsStealingTrafficDebugModeEnabled
bool
...
@@ -1215,7 +1215,7 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateVirtualService(ctx context
...
@@ -1215,7 +1215,7 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateVirtualService(ctx context
}
}
type
createOrUpdateIngressOption
struct
{
type
createOrUpdateIngressOption
struct
{
yataiClient
**
yataiclient
.
YataiClient
yataiClient
**
yataiclient
.
YataiClient
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNim
*
v1alpha1
.
DynamoNim
dynamoNim
*
v1alpha1
.
DynamoNim
}
}
...
@@ -1239,7 +1239,7 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateIngresses(ctx context.Cont
...
@@ -1239,7 +1239,7 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateIngresses(ctx context.Cont
}
}
ingresses
,
err
:=
r
.
generateIngresses
(
ctx
,
generateIngressesOption
{
ingresses
,
err
:=
r
.
generateIngresses
(
ctx
,
generateIngressesOption
{
yataiClient
:
opt
.
yataiClient
,
yataiClient
:
opt
.
yataiClient
,
dynamoNimDeployment
:
dynamoNimDeployment
,
dynamoNimDeployment
:
dynamoNimDeployment
,
dynamoNim
:
dynamoNim
,
dynamoNim
:
dynamoNim
,
})
})
...
@@ -1401,8 +1401,8 @@ func (r *DynamoNimDeploymentReconciler) getKubeAnnotations(dynamoNimDeployment *
...
@@ -1401,8 +1401,8 @@ func (r *DynamoNimDeploymentReconciler) getKubeAnnotations(dynamoNimDeployment *
}
}
type
generateDeploymentOption
struct
{
type
generateDeploymentOption
struct
{
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNim
*
v1alpha1
.
DynamoNim
dynamoNim
*
v1alpha1
.
DynamoNim
yataiClient
**
yataiclient
.
YataiClient
yataiClient
**
yataiclient
.
YataiClient
clusterName
*
string
clusterName
*
string
isStealingTrafficDebugModeEnabled
bool
isStealingTrafficDebugModeEnabled
bool
...
@@ -1588,8 +1588,8 @@ func getDynamoNimRepositoryNameAndDynamoNimVersion(dynamoNim *v1alpha1.DynamoNim
...
@@ -1588,8 +1588,8 @@ func getDynamoNimRepositoryNameAndDynamoNimVersion(dynamoNim *v1alpha1.DynamoNim
}
}
type
generatePodTemplateSpecOption
struct
{
type
generatePodTemplateSpecOption
struct
{
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNim
*
v1alpha1
.
DynamoNim
dynamoNim
*
v1alpha1
.
DynamoNim
yataiClient
**
yataiclient
.
YataiClient
yataiClient
**
yataiclient
.
YataiClient
clusterName
*
string
clusterName
*
string
isStealingTrafficDebugModeEnabled
bool
isStealingTrafficDebugModeEnabled
bool
...
@@ -2499,8 +2499,8 @@ func getResourcesConfig(resources *dynamoCommon.Resources) (corev1.ResourceRequi
...
@@ -2499,8 +2499,8 @@ func getResourcesConfig(resources *dynamoCommon.Resources) (corev1.ResourceRequi
}
}
type
generateServiceOption
struct
{
type
generateServiceOption
struct
{
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNim
*
v1alpha1
.
DynamoNim
dynamoNim
*
v1alpha1
.
DynamoNim
isStealingTrafficDebugModeEnabled
bool
isStealingTrafficDebugModeEnabled
bool
isDebugPodReceiveProductionTraffic
bool
isDebugPodReceiveProductionTraffic
bool
containsStealingTrafficDebugModeEnabled
bool
containsStealingTrafficDebugModeEnabled
bool
...
@@ -2713,7 +2713,7 @@ func (r *DynamoNimDeploymentReconciler) GetIngressConfig(ctx context.Context) (i
...
@@ -2713,7 +2713,7 @@ func (r *DynamoNimDeploymentReconciler) GetIngressConfig(ctx context.Context) (i
}
}
type
generateIngressesOption
struct
{
type
generateIngressesOption
struct
{
yataiClient
**
yataiclient
.
YataiClient
yataiClient
**
yataiclient
.
YataiClient
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNimDeployment
*
v1alpha1
.
DynamoNimDeployment
dynamoNim
*
v1alpha1
.
DynamoNim
dynamoNim
*
v1alpha1
.
DynamoNim
}
}
...
...
deploy/dynamo/operator/internal/controller/dynamonimrequest_controller.go
View file @
07afe3c9
...
@@ -74,11 +74,11 @@ const (
...
@@ -74,11 +74,11 @@ const (
KubeAnnotationDynamoNimRequestHash
=
"yatai.ai/bento-request-hash"
KubeAnnotationDynamoNimRequestHash
=
"yatai.ai/bento-request-hash"
KubeAnnotationDynamoNimRequestImageBuiderHash
=
"yatai.ai/bento-request-image-builder-hash"
KubeAnnotationDynamoNimRequestImageBuiderHash
=
"yatai.ai/bento-request-image-builder-hash"
KubeAnnotationDynamoNimRequestModelSeederHash
=
"yatai.ai/bento-request-model-seeder-hash"
KubeAnnotationDynamoNimRequestModelSeederHash
=
"yatai.ai/bento-request-model-seeder-hash"
KubeLabelYataiImageBuilderSeparateModels
=
"yatai.ai/yatai-image-builder-separate-models"
KubeLabelYataiImageBuilderSeparateModels
=
"yatai.ai/yatai-image-builder-separate-models"
KubeAnnotationDynamoNimStorageNS
=
"yatai.ai/bento-storage-namespace"
KubeAnnotationDynamoNimStorageNS
=
"yatai.ai/bento-storage-namespace"
KubeAnnotationModelStorageNS
=
"yatai.ai/model-storage-namespace"
KubeAnnotationModelStorageNS
=
"yatai.ai/model-storage-namespace"
StoreSchemaAWS
=
"aws"
StoreSchemaAWS
=
"aws"
StoreSchemaGCP
=
"gcp"
StoreSchemaGCP
=
"gcp"
)
)
// DynamoNimRequestReconciler reconciles a DynamoNimRequest object
// DynamoNimRequestReconciler reconciles a DynamoNimRequest object
...
@@ -213,13 +213,13 @@ func (r *DynamoNimRequestReconciler) Reconcile(ctx context.Context, req ctrl.Req
...
@@ -213,13 +213,13 @@ func (r *DynamoNimRequestReconciler) Reconcile(ctx context.Context, req ctrl.Req
if
separateModels
{
if
separateModels
{
dynamoNimRequest
,
modelsExists
,
modelsExistsResult
,
modelsExistsErr
=
r
.
ensureModelsExists
(
ctx
,
ensureModelsExistsOption
{
dynamoNimRequest
,
modelsExists
,
modelsExistsResult
,
modelsExistsErr
=
r
.
ensureModelsExists
(
ctx
,
ensureModelsExistsOption
{
dynamoNimRequest
:
dynamoNimRequest
,
dynamoNimRequest
:
dynamoNimRequest
,
req
:
req
,
req
:
req
,
})
})
}
}
dynamoNimRequest
,
imageInfo
,
imageExists
,
imageExistsResult
,
err
:=
r
.
ensureImageExists
(
ctx
,
ensureImageExistsOption
{
dynamoNimRequest
,
imageInfo
,
imageExists
,
imageExistsResult
,
err
:=
r
.
ensureImageExists
(
ctx
,
ensureImageExistsOption
{
dynamoNimRequest
:
dynamoNimRequest
,
dynamoNimRequest
:
dynamoNimRequest
,
req
:
req
,
req
:
req
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -361,7 +361,7 @@ func isEstargzEnabled() bool {
...
@@ -361,7 +361,7 @@ func isEstargzEnabled() bool {
type
ensureImageExistsOption
struct
{
type
ensureImageExistsOption
struct
{
dynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
dynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
req
ctrl
.
Request
req
ctrl
.
Request
}
}
//nolint:gocyclo,nakedret
//nolint:gocyclo,nakedret
...
@@ -522,7 +522,7 @@ func (r *DynamoNimRequestReconciler) ensureImageExists(ctx context.Context, opt
...
@@ -522,7 +522,7 @@ func (r *DynamoNimRequestReconciler) ensureImageExists(ctx context.Context, opt
if
job
==
nil
{
if
job
==
nil
{
job
,
err
=
r
.
generateImageBuilderJob
(
ctx
,
GenerateImageBuilderJobOption
{
job
,
err
=
r
.
generateImageBuilderJob
(
ctx
,
GenerateImageBuilderJobOption
{
ImageInfo
:
imageInfo
,
ImageInfo
:
imageInfo
,
DynamoNimRequest
:
dynamoNimRequest
,
DynamoNimRequest
:
dynamoNimRequest
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -659,7 +659,7 @@ func (r *DynamoNimRequestReconciler) ensureImageExists(ctx context.Context, opt
...
@@ -659,7 +659,7 @@ func (r *DynamoNimRequestReconciler) ensureImageExists(ctx context.Context, opt
type
ensureModelsExistsOption
struct
{
type
ensureModelsExistsOption
struct
{
dynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
dynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
req
ctrl
.
Request
req
ctrl
.
Request
}
}
//nolint:gocyclo,nakedret
//nolint:gocyclo,nakedret
...
@@ -771,7 +771,7 @@ func (r *DynamoNimRequestReconciler) ensureModelsExists(ctx context.Context, opt
...
@@ -771,7 +771,7 @@ func (r *DynamoNimRequestReconciler) ensureModelsExists(ctx context.Context, opt
if
isPVCNotFound
{
if
isPVCNotFound
{
pvc
=
r
.
generateModelPVC
(
GenerateModelPVCOption
{
pvc
=
r
.
generateModelPVC
(
GenerateModelPVCOption
{
DynamoNimRequest
:
dynamoNimRequest
,
DynamoNimRequest
:
dynamoNimRequest
,
Model
:
&
model
,
Model
:
&
model
,
})
})
err
=
r
.
Create
(
ctx
,
pvc
)
err
=
r
.
Create
(
ctx
,
pvc
)
isPVCAlreadyExists
:=
k8serrors
.
IsAlreadyExists
(
err
)
isPVCAlreadyExists
:=
k8serrors
.
IsAlreadyExists
(
err
)
...
@@ -783,7 +783,7 @@ func (r *DynamoNimRequestReconciler) ensureModelsExists(ctx context.Context, opt
...
@@ -783,7 +783,7 @@ func (r *DynamoNimRequestReconciler) ensureModelsExists(ctx context.Context, opt
var
job
*
batchv1
.
Job
var
job
*
batchv1
.
Job
job
,
err
=
r
.
generateModelSeederJob
(
ctx
,
GenerateModelSeederJobOption
{
job
,
err
=
r
.
generateModelSeederJob
(
ctx
,
GenerateModelSeederJobOption
{
DynamoNimRequest
:
dynamoNimRequest
,
DynamoNimRequest
:
dynamoNimRequest
,
Model
:
&
model
,
Model
:
&
model
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
err
=
errors
.
Wrap
(
err
,
"generate model seeder job"
)
err
=
errors
.
Wrap
(
err
,
"generate model seeder job"
)
...
@@ -1519,7 +1519,7 @@ func isHuggingfaceModel(model *nvidiacomv1alpha1.BentoModel) bool {
...
@@ -1519,7 +1519,7 @@ func isHuggingfaceModel(model *nvidiacomv1alpha1.BentoModel) bool {
type
GenerateModelPVCOption
struct
{
type
GenerateModelPVCOption
struct
{
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
Model
*
nvidiacomv1alpha1
.
BentoModel
Model
*
nvidiacomv1alpha1
.
BentoModel
}
}
//nolint:nakedret
//nolint:nakedret
...
@@ -1558,7 +1558,7 @@ func (r *DynamoNimRequestReconciler) generateModelPVC(opt GenerateModelPVCOption
...
@@ -1558,7 +1558,7 @@ func (r *DynamoNimRequestReconciler) generateModelPVC(opt GenerateModelPVCOption
type
GenerateModelSeederJobOption
struct
{
type
GenerateModelSeederJobOption
struct
{
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
Model
*
nvidiacomv1alpha1
.
BentoModel
Model
*
nvidiacomv1alpha1
.
BentoModel
}
}
//nolint:nakedret
//nolint:nakedret
...
@@ -1611,7 +1611,7 @@ func (r *DynamoNimRequestReconciler) generateModelSeederJob(ctx context.Context,
...
@@ -1611,7 +1611,7 @@ func (r *DynamoNimRequestReconciler) generateModelSeederJob(ctx context.Context,
type
GenerateModelSeederPodTemplateSpecOption
struct
{
type
GenerateModelSeederPodTemplateSpecOption
struct
{
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
Model
*
nvidiacomv1alpha1
.
BentoModel
Model
*
nvidiacomv1alpha1
.
BentoModel
}
}
//nolint:nakedret
//nolint:nakedret
...
@@ -1879,7 +1879,7 @@ echo "Done"
...
@@ -1879,7 +1879,7 @@ echo "Done"
}
}
type
GenerateImageBuilderJobOption
struct
{
type
GenerateImageBuilderJobOption
struct
{
ImageInfo
ImageInfo
ImageInfo
ImageInfo
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
}
}
...
@@ -1959,7 +1959,7 @@ const ModelSeederContainerName = "seeder"
...
@@ -1959,7 +1959,7 @@ const ModelSeederContainerName = "seeder"
const
ModelSeederJobFailedExitCode
=
42
const
ModelSeederJobFailedExitCode
=
42
type
GenerateImageBuilderPodTemplateSpecOption
struct
{
type
GenerateImageBuilderPodTemplateSpecOption
struct
{
ImageInfo
ImageInfo
ImageInfo
ImageInfo
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
DynamoNimRequest
*
nvidiacomv1alpha1
.
DynamoNimRequest
}
}
...
@@ -2154,7 +2154,7 @@ echo "Done"
...
@@ -2154,7 +2154,7 @@ echo "Done"
"DynamoNimDownloadHeader"
:
dynamoNimDownloadHeader
,
"DynamoNimDownloadHeader"
:
dynamoNimDownloadHeader
,
"DynamoNimRepositoryName"
:
dynamoNimRepositoryName
,
"DynamoNimRepositoryName"
:
dynamoNimRepositoryName
,
"DynamoNimVersion"
:
dynamoNimVersion
,
"DynamoNimVersion"
:
dynamoNimVersion
,
"Privileged"
:
privileged
,
"Privileged"
:
privileged
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
err
=
errors
.
Wrap
(
err
,
"failed to execute download command template"
)
err
=
errors
.
Wrap
(
err
,
"failed to execute download command template"
)
...
...
deploy/dynamo/operator/internal/nim/nim_test.go
View file @
07afe3c9
...
@@ -29,7 +29,7 @@ import (
...
@@ -29,7 +29,7 @@ import (
func
TestGenerateDynamoNIMDeployments
(
t
*
testing
.
T
)
{
func
TestGenerateDynamoNIMDeployments
(
t
*
testing
.
T
)
{
type
args
struct
{
type
args
struct
{
parentDynamoDeployment
*
v1alpha1
.
DynamoDeployment
parentDynamoDeployment
*
v1alpha1
.
DynamoDeployment
config
*
DynamoNIMConfig
config
*
DynamoNIMConfig
}
}
tests
:=
[]
struct
{
tests
:=
[]
struct
{
name
string
name
string
...
@@ -91,8 +91,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
...
@@ -91,8 +91,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
Namespace
:
"default"
,
Namespace
:
"default"
,
},
},
Spec
:
v1alpha1
.
DynamoNimDeploymentSpec
{
Spec
:
v1alpha1
.
DynamoNimDeploymentSpec
{
DynamoNim
:
"dynamonim"
,
DynamoNim
:
"dynamonim"
,
ServiceName
:
"service1"
,
ServiceName
:
"service1"
,
Resources
:
&
compounaiCommon
.
Resources
{
Resources
:
&
compounaiCommon
.
Resources
{
Requests
:
&
compounaiCommon
.
ResourceItem
{
Requests
:
&
compounaiCommon
.
ResourceItem
{
CPU
:
"1"
,
CPU
:
"1"
,
...
@@ -125,8 +125,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
...
@@ -125,8 +125,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
Namespace
:
"default"
,
Namespace
:
"default"
,
},
},
Spec
:
v1alpha1
.
DynamoNimDeploymentSpec
{
Spec
:
v1alpha1
.
DynamoNimDeploymentSpec
{
ServiceName
:
"service2"
,
ServiceName
:
"service2"
,
DynamoNim
:
"dynamonim"
,
DynamoNim
:
"dynamonim"
,
},
},
},
},
},
},
...
@@ -188,8 +188,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
...
@@ -188,8 +188,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
Namespace
:
"default"
,
Namespace
:
"default"
,
},
},
Spec
:
v1alpha1
.
DynamoNimDeploymentSpec
{
Spec
:
v1alpha1
.
DynamoNimDeploymentSpec
{
DynamoNim
:
"dynamonim"
,
DynamoNim
:
"dynamonim"
,
ServiceName
:
"service1"
,
ServiceName
:
"service1"
,
Resources
:
&
compounaiCommon
.
Resources
{
Resources
:
&
compounaiCommon
.
Resources
{
Requests
:
&
compounaiCommon
.
ResourceItem
{
Requests
:
&
compounaiCommon
.
ResourceItem
{
CPU
:
"1"
,
CPU
:
"1"
,
...
@@ -222,8 +222,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
...
@@ -222,8 +222,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
Namespace
:
"default"
,
Namespace
:
"default"
,
},
},
Spec
:
v1alpha1
.
DynamoNimDeploymentSpec
{
Spec
:
v1alpha1
.
DynamoNimDeploymentSpec
{
DynamoNim
:
"dynamonim"
,
DynamoNim
:
"dynamonim"
,
ServiceName
:
"service2"
,
ServiceName
:
"service2"
,
},
},
},
},
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment