"vscode:/vscode.git/clone" did not exist on "6d4475db4d97147db11d8b1bd9b8bb156870d874"
Commit 07afe3c9 authored by Anant Sharma's avatar Anant Sharma Committed by GitHub
Browse files

style: fix formatting for .go file (#62)

parent 090c825f
//go:build !ignore_autogenerated
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
......@@ -15,8 +17,6 @@
* limitations under the License.
*/
//go:build !ignore_autogenerated
/*
Copyright 2024.
......
......@@ -24,7 +24,7 @@ import (
)
const (
DynamoDeploymentConditionTypeAvailable = "Available"
DynamoDeploymentConditionTypeAvailable = "Available"
DynamoDeploymentConditionTypeDynamoNimFound = "DynamoNimFound"
DynamoDeploymentConditionTypeDynamoNimRequestFound = "DynamoNimRequestFound"
)
......@@ -45,7 +45,7 @@ type DynamoNimDeploymentSpec struct {
// contains the name of the service
ServiceName string `json:"serviceName,omitempty"`
Resources *dynamoCommon.Resources `json:"resources,omitempty"`
Resources *dynamoCommon.Resources `json:"resources,omitempty"`
Autoscaling *Autoscaling `json:"autoscaling,omitempty"`
Envs []corev1.EnvVar `json:"envs,omitempty"`
EnvFromSecret *string `json:"envFromSecret,omitempty"`
......
......@@ -25,11 +25,11 @@ import (
)
const (
DynamoNimRequestConditionTypeModelsSeeding = "ModelsSeeding"
DynamoNimRequestConditionTypeImageBuilding = "ImageBuilding"
DynamoNimRequestConditionTypeImageExists = "ImageExists"
DynamoNimRequestConditionTypeImageExistsChecked = "ImageExistsChecked"
DynamoNimRequestConditionTypeModelsExists = "ModelsExists"
DynamoNimRequestConditionTypeModelsSeeding = "ModelsSeeding"
DynamoNimRequestConditionTypeImageBuilding = "ImageBuilding"
DynamoNimRequestConditionTypeImageExists = "ImageExists"
DynamoNimRequestConditionTypeImageExistsChecked = "ImageExistsChecked"
DynamoNimRequestConditionTypeModelsExists = "ModelsExists"
DynamoNimRequestConditionTypeDynamoNimAvailable = "DynamoNimAvailable"
)
......
......@@ -342,10 +342,10 @@ func (r *DynamoNimDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.
// create or update api-server deployment
modified_, err := r.createOrUpdateOrDeleteDeployments(ctx, createOrUpdateOrDeleteDeploymentsOption{
yataiClient: yataiClient,
yataiClient: yataiClient,
dynamoNimDeployment: dynamoNimDeployment,
dynamoNim: dynamoNimCR,
clusterName: clusterName,
clusterName: clusterName,
})
if err != nil {
return
......@@ -380,7 +380,7 @@ func (r *DynamoNimDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.
// create or update api-server ingresses
modified_, err = r.createOrUpdateIngresses(ctx, createOrUpdateIngressOption{
yataiClient: yataiClient,
yataiClient: yataiClient,
dynamoNimDeployment: dynamoNimDeployment,
dynamoNim: dynamoNimCR,
})
......@@ -677,10 +677,10 @@ func (r *DynamoNimDeploymentReconciler) getYataiClientWithAuth(ctx context.Conte
}
type createOrUpdateOrDeleteDeploymentsOption struct {
yataiClient **yataiclient.YataiClient
yataiClient **yataiclient.YataiClient
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
clusterName *string
clusterName *string
}
//nolint:nakedret
......@@ -738,8 +738,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateDeployment(ctx context.Con
logs := log.FromContext(ctx)
deployment, err := r.generateDeployment(ctx, generateDeploymentOption{
dynamoNimDeployment: opt.dynamoNimDeployment,
dynamoNim: opt.dynamoNim,
dynamoNimDeployment: opt.dynamoNimDeployment,
dynamoNim: opt.dynamoNim,
yataiClient: opt.yataiClient,
clusterName: opt.clusterName,
isStealingTrafficDebugModeEnabled: opt.isStealingTrafficDebugModeEnabled,
......@@ -953,8 +953,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
isDebugPodReceiveProductionTrafficEnabled := checkIfIsDebugPodReceiveProductionTrafficEnabled(resourceAnnotations)
containsStealingTrafficDebugModeEnabled := checkIfContainsStealingTrafficDebugModeEnabled(opt.dynamoNimDeployment)
modified, err = r.createOrUpdateService(ctx, createOrUpdateServiceOption{
dynamoNimDeployment: opt.dynamoNimDeployment,
dynamoNim: opt.dynamoNim,
dynamoNimDeployment: opt.dynamoNimDeployment,
dynamoNim: opt.dynamoNim,
isStealingTrafficDebugModeEnabled: false,
isDebugPodReceiveProductionTraffic: isDebugPodReceiveProductionTrafficEnabled,
containsStealingTrafficDebugModeEnabled: containsStealingTrafficDebugModeEnabled,
......@@ -966,8 +966,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
if containsStealingTrafficDebugModeEnabled {
var modified_ bool
modified_, err = r.createOrUpdateService(ctx, createOrUpdateServiceOption{
dynamoNimDeployment: opt.dynamoNimDeployment,
dynamoNim: opt.dynamoNim,
dynamoNimDeployment: opt.dynamoNimDeployment,
dynamoNim: opt.dynamoNim,
isStealingTrafficDebugModeEnabled: false,
isDebugPodReceiveProductionTraffic: isDebugPodReceiveProductionTrafficEnabled,
containsStealingTrafficDebugModeEnabled: containsStealingTrafficDebugModeEnabled,
......@@ -980,8 +980,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
modified = true
}
modified_, err = r.createOrUpdateService(ctx, createOrUpdateServiceOption{
dynamoNimDeployment: opt.dynamoNimDeployment,
dynamoNim: opt.dynamoNim,
dynamoNimDeployment: opt.dynamoNimDeployment,
dynamoNim: opt.dynamoNim,
isStealingTrafficDebugModeEnabled: true,
isDebugPodReceiveProductionTraffic: isDebugPodReceiveProductionTrafficEnabled,
containsStealingTrafficDebugModeEnabled: containsStealingTrafficDebugModeEnabled,
......@@ -1032,8 +1032,8 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateOrDeleteServices(ctx conte
}
type createOrUpdateServiceOption struct {
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
isStealingTrafficDebugModeEnabled bool
isDebugPodReceiveProductionTraffic bool
containsStealingTrafficDebugModeEnabled bool
......@@ -1215,7 +1215,7 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateVirtualService(ctx context
}
type createOrUpdateIngressOption struct {
yataiClient **yataiclient.YataiClient
yataiClient **yataiclient.YataiClient
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
}
......@@ -1239,7 +1239,7 @@ func (r *DynamoNimDeploymentReconciler) createOrUpdateIngresses(ctx context.Cont
}
ingresses, err := r.generateIngresses(ctx, generateIngressesOption{
yataiClient: opt.yataiClient,
yataiClient: opt.yataiClient,
dynamoNimDeployment: dynamoNimDeployment,
dynamoNim: dynamoNim,
})
......@@ -1401,8 +1401,8 @@ func (r *DynamoNimDeploymentReconciler) getKubeAnnotations(dynamoNimDeployment *
}
type generateDeploymentOption struct {
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
yataiClient **yataiclient.YataiClient
clusterName *string
isStealingTrafficDebugModeEnabled bool
......@@ -1588,8 +1588,8 @@ func getDynamoNimRepositoryNameAndDynamoNimVersion(dynamoNim *v1alpha1.DynamoNim
}
type generatePodTemplateSpecOption struct {
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
yataiClient **yataiclient.YataiClient
clusterName *string
isStealingTrafficDebugModeEnabled bool
......@@ -2499,8 +2499,8 @@ func getResourcesConfig(resources *dynamoCommon.Resources) (corev1.ResourceRequi
}
type generateServiceOption struct {
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
isStealingTrafficDebugModeEnabled bool
isDebugPodReceiveProductionTraffic bool
containsStealingTrafficDebugModeEnabled bool
......@@ -2713,7 +2713,7 @@ func (r *DynamoNimDeploymentReconciler) GetIngressConfig(ctx context.Context) (i
}
type generateIngressesOption struct {
yataiClient **yataiclient.YataiClient
yataiClient **yataiclient.YataiClient
dynamoNimDeployment *v1alpha1.DynamoNimDeployment
dynamoNim *v1alpha1.DynamoNim
}
......
......@@ -74,11 +74,11 @@ const (
KubeAnnotationDynamoNimRequestHash = "yatai.ai/bento-request-hash"
KubeAnnotationDynamoNimRequestImageBuiderHash = "yatai.ai/bento-request-image-builder-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"
KubeAnnotationModelStorageNS = "yatai.ai/model-storage-namespace"
StoreSchemaAWS = "aws"
StoreSchemaGCP = "gcp"
KubeAnnotationModelStorageNS = "yatai.ai/model-storage-namespace"
StoreSchemaAWS = "aws"
StoreSchemaGCP = "gcp"
)
// DynamoNimRequestReconciler reconciles a DynamoNimRequest object
......@@ -213,13 +213,13 @@ func (r *DynamoNimRequestReconciler) Reconcile(ctx context.Context, req ctrl.Req
if separateModels {
dynamoNimRequest, modelsExists, modelsExistsResult, modelsExistsErr = r.ensureModelsExists(ctx, ensureModelsExistsOption{
dynamoNimRequest: dynamoNimRequest,
req: req,
req: req,
})
}
dynamoNimRequest, imageInfo, imageExists, imageExistsResult, err := r.ensureImageExists(ctx, ensureImageExistsOption{
dynamoNimRequest: dynamoNimRequest,
req: req,
req: req,
})
if err != nil {
......@@ -361,7 +361,7 @@ func isEstargzEnabled() bool {
type ensureImageExistsOption struct {
dynamoNimRequest *nvidiacomv1alpha1.DynamoNimRequest
req ctrl.Request
req ctrl.Request
}
//nolint:gocyclo,nakedret
......@@ -522,7 +522,7 @@ func (r *DynamoNimRequestReconciler) ensureImageExists(ctx context.Context, opt
if job == nil {
job, err = r.generateImageBuilderJob(ctx, GenerateImageBuilderJobOption{
ImageInfo: imageInfo,
ImageInfo: imageInfo,
DynamoNimRequest: dynamoNimRequest,
})
if err != nil {
......@@ -659,7 +659,7 @@ func (r *DynamoNimRequestReconciler) ensureImageExists(ctx context.Context, opt
type ensureModelsExistsOption struct {
dynamoNimRequest *nvidiacomv1alpha1.DynamoNimRequest
req ctrl.Request
req ctrl.Request
}
//nolint:gocyclo,nakedret
......@@ -771,7 +771,7 @@ func (r *DynamoNimRequestReconciler) ensureModelsExists(ctx context.Context, opt
if isPVCNotFound {
pvc = r.generateModelPVC(GenerateModelPVCOption{
DynamoNimRequest: dynamoNimRequest,
Model: &model,
Model: &model,
})
err = r.Create(ctx, pvc)
isPVCAlreadyExists := k8serrors.IsAlreadyExists(err)
......@@ -783,7 +783,7 @@ func (r *DynamoNimRequestReconciler) ensureModelsExists(ctx context.Context, opt
var job *batchv1.Job
job, err = r.generateModelSeederJob(ctx, GenerateModelSeederJobOption{
DynamoNimRequest: dynamoNimRequest,
Model: &model,
Model: &model,
})
if err != nil {
err = errors.Wrap(err, "generate model seeder job")
......@@ -1519,7 +1519,7 @@ func isHuggingfaceModel(model *nvidiacomv1alpha1.BentoModel) bool {
type GenerateModelPVCOption struct {
DynamoNimRequest *nvidiacomv1alpha1.DynamoNimRequest
Model *nvidiacomv1alpha1.BentoModel
Model *nvidiacomv1alpha1.BentoModel
}
//nolint:nakedret
......@@ -1558,7 +1558,7 @@ func (r *DynamoNimRequestReconciler) generateModelPVC(opt GenerateModelPVCOption
type GenerateModelSeederJobOption struct {
DynamoNimRequest *nvidiacomv1alpha1.DynamoNimRequest
Model *nvidiacomv1alpha1.BentoModel
Model *nvidiacomv1alpha1.BentoModel
}
//nolint:nakedret
......@@ -1611,7 +1611,7 @@ func (r *DynamoNimRequestReconciler) generateModelSeederJob(ctx context.Context,
type GenerateModelSeederPodTemplateSpecOption struct {
DynamoNimRequest *nvidiacomv1alpha1.DynamoNimRequest
Model *nvidiacomv1alpha1.BentoModel
Model *nvidiacomv1alpha1.BentoModel
}
//nolint:nakedret
......@@ -1879,7 +1879,7 @@ echo "Done"
}
type GenerateImageBuilderJobOption struct {
ImageInfo ImageInfo
ImageInfo ImageInfo
DynamoNimRequest *nvidiacomv1alpha1.DynamoNimRequest
}
......@@ -1959,7 +1959,7 @@ const ModelSeederContainerName = "seeder"
const ModelSeederJobFailedExitCode = 42
type GenerateImageBuilderPodTemplateSpecOption struct {
ImageInfo ImageInfo
ImageInfo ImageInfo
DynamoNimRequest *nvidiacomv1alpha1.DynamoNimRequest
}
......@@ -2154,7 +2154,7 @@ echo "Done"
"DynamoNimDownloadHeader": dynamoNimDownloadHeader,
"DynamoNimRepositoryName": dynamoNimRepositoryName,
"DynamoNimVersion": dynamoNimVersion,
"Privileged": privileged,
"Privileged": privileged,
})
if err != nil {
err = errors.Wrap(err, "failed to execute download command template")
......
......@@ -29,7 +29,7 @@ import (
func TestGenerateDynamoNIMDeployments(t *testing.T) {
type args struct {
parentDynamoDeployment *v1alpha1.DynamoDeployment
config *DynamoNIMConfig
config *DynamoNIMConfig
}
tests := []struct {
name string
......@@ -91,8 +91,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
Namespace: "default",
},
Spec: v1alpha1.DynamoNimDeploymentSpec{
DynamoNim: "dynamonim",
ServiceName: "service1",
DynamoNim: "dynamonim",
ServiceName: "service1",
Resources: &compounaiCommon.Resources{
Requests: &compounaiCommon.ResourceItem{
CPU: "1",
......@@ -125,8 +125,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
Namespace: "default",
},
Spec: v1alpha1.DynamoNimDeploymentSpec{
ServiceName: "service2",
DynamoNim: "dynamonim",
ServiceName: "service2",
DynamoNim: "dynamonim",
},
},
},
......@@ -188,8 +188,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
Namespace: "default",
},
Spec: v1alpha1.DynamoNimDeploymentSpec{
DynamoNim: "dynamonim",
ServiceName: "service1",
DynamoNim: "dynamonim",
ServiceName: "service1",
Resources: &compounaiCommon.Resources{
Requests: &compounaiCommon.ResourceItem{
CPU: "1",
......@@ -222,8 +222,8 @@ func TestGenerateDynamoNIMDeployments(t *testing.T) {
Namespace: "default",
},
Spec: v1alpha1.DynamoNimDeploymentSpec{
DynamoNim: "dynamonim",
ServiceName: "service2",
DynamoNim: "dynamonim",
ServiceName: "service2",
},
},
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment