"pcdet/vscode:/vscode.git/clone" did not exist on "25d9f503c29104b89cf023c5ca078b03b9bb927b"
Commit 602352ce authored by Neelay Shah's avatar Neelay Shah Committed by GitHub
Browse files

chore: rename dynamo (#44)


Co-authored-by: default avatarBiswa Panda <biswa.panda@gmail.com>
parent ecf53ce2
...@@ -20,7 +20,7 @@ package controller ...@@ -20,7 +20,7 @@ package controller
import ( import (
"strings" "strings"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/v1alpha1" "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/api/v1alpha1"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
...@@ -79,6 +79,6 @@ func getPvcName(crd metav1.Object, defaultName *string) string { ...@@ -79,6 +79,6 @@ func getPvcName(crd metav1.Object, defaultName *string) string {
return crd.GetName() return crd.GetName()
} }
func generateCompoundAINimRequestName(tag string) string { func generateDynamoNimRequestName(tag string) string {
return strings.Split(tag, ":")[0] return strings.Split(tag, ":")[0]
} }
...@@ -34,9 +34,9 @@ import ( ...@@ -34,9 +34,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/predicate"
nvidiacomv1alpha1 "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/v1alpha1" nvidiacomv1alpha1 "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/api/v1alpha1"
commonController "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/internal/controller_common" commonController "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/internal/controller_common"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/internal/nim" "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/internal/nim"
) )
const ( const (
...@@ -45,36 +45,36 @@ const ( ...@@ -45,36 +45,36 @@ const (
PendingState = "pending" PendingState = "pending"
) )
// CompoundAIDeploymentReconciler reconciles a CompoundAIDeployment object // DynamoDeploymentReconciler reconciles a DynamoDeployment object
type CompoundAIDeploymentReconciler struct { type DynamoDeploymentReconciler struct {
client.Client client.Client
Scheme *runtime.Scheme Scheme *runtime.Scheme
Config commonController.Config Config commonController.Config
Recorder record.EventRecorder Recorder record.EventRecorder
} }
// +kubebuilder:rbac:groups=nvidia.com,resources=compoundaideployments,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=nvidia.com,resources=dynamodeployments,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=nvidia.com,resources=compoundaideployments/status,verbs=get;update;patch // +kubebuilder:rbac:groups=nvidia.com,resources=dynamodeployments/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=nvidia.com,resources=compoundaideployments/finalizers,verbs=update // +kubebuilder:rbac:groups=nvidia.com,resources=dynamodeployments/finalizers,verbs=update
// Reconcile is part of the main kubernetes reconciliation loop which aims to // Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state. // move the current state of the cluster closer to the desired state.
// TODO(user): Modify the Reconcile function to compare the state specified by // TODO(user): Modify the Reconcile function to compare the state specified by
// the CompoundAIDeployment object against the actual cluster state, and then // the DynamoDeployment object against the actual cluster state, and then
// perform operations to make the cluster state reflect the state specified by // perform operations to make the cluster state reflect the state specified by
// the user. // the user.
// //
// For more details, check Reconcile and its Result here: // For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.1/pkg/reconcile // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.1/pkg/reconcile
func (r *CompoundAIDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { func (r *DynamoDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
logger := log.FromContext(ctx) logger := log.FromContext(ctx)
var err error var err error
reason := "undefined" reason := "undefined"
readyStatus := metav1.ConditionFalse readyStatus := metav1.ConditionFalse
// retrieve the CRD // retrieve the CRD
compoundAIDeployment := &nvidiacomv1alpha1.CompoundAIDeployment{} dynamoDeployment := &nvidiacomv1alpha1.DynamoDeployment{}
if err = r.Get(ctx, req.NamespacedName, compoundAIDeployment); err != nil { if err = r.Get(ctx, req.NamespacedName, dynamoDeployment); err != nil {
return ctrl.Result{}, client.IgnoreNotFound(err) return ctrl.Result{}, client.IgnoreNotFound(err)
} }
if err != nil { if err != nil {
...@@ -85,11 +85,11 @@ func (r *CompoundAIDeploymentReconciler) Reconcile(ctx context.Context, req ctrl ...@@ -85,11 +85,11 @@ func (r *CompoundAIDeploymentReconciler) Reconcile(ctx context.Context, req ctrl
defer func() { defer func() {
message := "" message := ""
if err != nil { if err != nil {
compoundAIDeployment.SetState(FailedState) dynamoDeployment.SetState(FailedState)
message = err.Error() message = err.Error()
} }
// update the CRD status condition // update the CRD status condition
compoundAIDeployment.Status.Conditions = []metav1.Condition{ dynamoDeployment.Status.Conditions = []metav1.Condition{
{ {
Type: "Ready", Type: "Ready",
Status: readyStatus, Status: readyStatus,
...@@ -98,98 +98,98 @@ func (r *CompoundAIDeploymentReconciler) Reconcile(ctx context.Context, req ctrl ...@@ -98,98 +98,98 @@ func (r *CompoundAIDeploymentReconciler) Reconcile(ctx context.Context, req ctrl
LastTransitionTime: metav1.Now(), LastTransitionTime: metav1.Now(),
}, },
} }
err = r.Status().Update(ctx, compoundAIDeployment) err = r.Status().Update(ctx, dynamoDeployment)
if err != nil { if err != nil {
logger.Error(err, "Unable to update the CRD status", "crd", req.NamespacedName) logger.Error(err, "Unable to update the CRD status", "crd", req.NamespacedName)
} }
logger.Info("Reconciliation done") logger.Info("Reconciliation done")
}() }()
// fetch the CompoundAINIMConfig // fetch the DynamoNIMConfig
compoundAINIMConfig, err := nim.GetCompoundAINIMConfig(ctx, compoundAIDeployment, r.getSecret, r.Recorder) dynamoNIMConfig, err := nim.GetDynamoNIMConfig(ctx, dynamoDeployment, r.getSecret, r.Recorder)
if err != nil { if err != nil {
reason = "failed_to_get_the_CompoundAINIMConfig" reason = "failed_to_get_the_DynamoNIMConfig"
return ctrl.Result{}, err return ctrl.Result{}, err
} }
// generate the CompoundAINimDeployments from the config // generate the DynamoNimDeployments from the config
compoundAINimDeployments, err := nim.GenerateCompoundAINIMDeployments(compoundAIDeployment, compoundAINIMConfig) dynamoNimDeployments, err := nim.GenerateDynamoNIMDeployments(dynamoDeployment, dynamoNIMConfig)
if err != nil { if err != nil {
reason = "failed_to_generate_the_CompoundAINimDeployments" reason = "failed_to_generate_the_DynamoNimDeployments"
return ctrl.Result{}, err return ctrl.Result{}, err
} }
// merge the CompoundAINimDeployments with the CompoundAINimDeployments from the CRD // merge the DynamoNimDeployments with the DynamoNimDeployments from the CRD
for serviceName, deployment := range compoundAINimDeployments { for serviceName, deployment := range dynamoNimDeployments {
if _, ok := compoundAIDeployment.Spec.Services[serviceName]; ok { if _, ok := dynamoDeployment.Spec.Services[serviceName]; ok {
err := mergo.Merge(deployment, compoundAIDeployment.Spec.Services[serviceName], mergo.WithOverride) err := mergo.Merge(deployment, dynamoDeployment.Spec.Services[serviceName], mergo.WithOverride)
if err != nil { if err != nil {
reason = "failed_to_merge_the_CompoundAINimDeployments" reason = "failed_to_merge_the_DynamoNimDeployments"
return ctrl.Result{}, err return ctrl.Result{}, err
} }
} }
} }
// reconcile the compoundAINimRequest // reconcile the dynamoNimRequest
compoundAINimRequest := &nvidiacomv1alpha1.CompoundAINimRequest{ dynamoNimRequest := &nvidiacomv1alpha1.DynamoNimRequest{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: generateCompoundAINimRequestName(compoundAIDeployment.Spec.CompoundAINim), Name: generateDynamoNimRequestName(dynamoDeployment.Spec.DynamoNim),
Namespace: compoundAIDeployment.Namespace, Namespace: dynamoDeployment.Namespace,
}, },
Spec: nvidiacomv1alpha1.CompoundAINimRequestSpec{ Spec: nvidiacomv1alpha1.DynamoNimRequestSpec{
BentoTag: compoundAIDeployment.Spec.CompoundAINim, BentoTag: dynamoDeployment.Spec.DynamoNim,
}, },
} }
if err := ctrl.SetControllerReference(compoundAIDeployment, compoundAINimRequest, r.Scheme); err != nil { if err := ctrl.SetControllerReference(dynamoDeployment, dynamoNimRequest, r.Scheme); err != nil {
reason = "failed_to_set_the_controller_reference_for_the_CompoundAINimRequest" reason = "failed_to_set_the_controller_reference_for_the_DynamoNimRequest"
return ctrl.Result{}, err return ctrl.Result{}, err
} }
_, err = commonController.SyncResource(ctx, r.Client, compoundAINimRequest, types.NamespacedName{Name: compoundAINimRequest.Name, Namespace: compoundAINimRequest.Namespace}, true) _, err = commonController.SyncResource(ctx, r.Client, dynamoNimRequest, types.NamespacedName{Name: dynamoNimRequest.Name, Namespace: dynamoNimRequest.Namespace}, true)
if err != nil { if err != nil {
reason = "failed_to_sync_the_CompoundAINimRequest" reason = "failed_to_sync_the_DynamoNimRequest"
return ctrl.Result{}, err return ctrl.Result{}, err
} }
allAreReady := true allAreReady := true
// reconcile the CompoundAINimDeployments // reconcile the DynamoNimDeployments
for serviceName, compoundAINimDeployment := range compoundAINimDeployments { for serviceName, dynamoNimDeployment := range dynamoNimDeployments {
logger.Info("Reconciling the CompoundAINimDeployment", "serviceName", serviceName, "compoundAINimDeployment", compoundAINimDeployment) logger.Info("Reconciling the DynamoNimDeployment", "serviceName", serviceName, "dynamoNimDeployment", dynamoNimDeployment)
if err := ctrl.SetControllerReference(compoundAIDeployment, compoundAINimDeployment, r.Scheme); err != nil { if err := ctrl.SetControllerReference(dynamoDeployment, dynamoNimDeployment, r.Scheme); err != nil {
reason = "failed_to_set_the_controller_reference_for_the_CompoundAINimDeployment" reason = "failed_to_set_the_controller_reference_for_the_DynamoNimDeployment"
return ctrl.Result{}, err return ctrl.Result{}, err
} }
compoundAINimDeployment, err = commonController.SyncResource(ctx, r.Client, compoundAINimDeployment, types.NamespacedName{Name: compoundAINimDeployment.Name, Namespace: compoundAINimDeployment.Namespace}, true) dynamoNimDeployment, err = commonController.SyncResource(ctx, r.Client, dynamoNimDeployment, types.NamespacedName{Name: dynamoNimDeployment.Name, Namespace: dynamoNimDeployment.Namespace}, true)
if err != nil { if err != nil {
reason = "failed_to_sync_the_CompoundAINimDeployment" reason = "failed_to_sync_the_DynamoNimDeployment"
return ctrl.Result{}, err return ctrl.Result{}, err
} }
if !compoundAINimDeployment.Status.IsReady() { if !dynamoNimDeployment.Status.IsReady() {
allAreReady = false allAreReady = false
} }
} }
if allAreReady { if allAreReady {
compoundAIDeployment.SetState(ReadyState) dynamoDeployment.SetState(ReadyState)
readyStatus = metav1.ConditionTrue readyStatus = metav1.ConditionTrue
} else { } else {
compoundAIDeployment.SetState(PendingState) dynamoDeployment.SetState(PendingState)
} }
return ctrl.Result{}, nil return ctrl.Result{}, nil
} }
func (r *CompoundAIDeploymentReconciler) getSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error) { func (r *DynamoDeploymentReconciler) getSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error) {
secret := &corev1.Secret{} secret := &corev1.Secret{}
err := r.Get(ctx, types.NamespacedName{Namespace: namespace, Name: name}, secret) err := r.Get(ctx, types.NamespacedName{Namespace: namespace, Name: name}, secret)
return secret, errors.Wrap(err, "get secret") return secret, errors.Wrap(err, "get secret")
} }
// SetupWithManager sets up the controller with the Manager. // SetupWithManager sets up the controller with the Manager.
func (r *CompoundAIDeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error { func (r *DynamoDeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr). return ctrl.NewControllerManagedBy(mgr).
For(&nvidiacomv1alpha1.CompoundAIDeployment{}). For(&nvidiacomv1alpha1.DynamoDeployment{}).
Named("compoundaideployment"). Named("dynamodeployment").
Owns(&nvidiacomv1alpha1.CompoundAINimDeployment{}, builder.WithPredicates(predicate.Funcs{ Owns(&nvidiacomv1alpha1.DynamoNimDeployment{}, builder.WithPredicates(predicate.Funcs{
// ignore creation cause we don't want to be called again after we create the deployment // ignore creation cause we don't want to be called again after we create the deployment
CreateFunc: func(ce event.CreateEvent) bool { return false }, CreateFunc: func(ce event.CreateEvent) bool { return false },
DeleteFunc: func(de event.DeleteEvent) bool { return true }, DeleteFunc: func(de event.DeleteEvent) bool { return true },
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
"runtime" "runtime"
"testing" "testing"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/v1alpha1" "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/api/v1alpha1"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
......
...@@ -26,20 +26,20 @@ import ( ...@@ -26,20 +26,20 @@ import (
"strings" "strings"
"emperror.dev/errors" "emperror.dev/errors"
compounaiCommon "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/common" compounaiCommon "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/api/dynamo/common"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas" "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/api/dynamo/modelschemas"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/schemasv1" "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/api/dynamo/schemasv1"
yataiclient "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/yatai-client" yataiclient "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/api/dynamo/yatai-client"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/v1alpha1" "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/api/v1alpha1"
commonconfig "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/pkg/compoundai/config" commonconfig "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/pkg/dynamo/config"
commonconsts "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/pkg/compoundai/consts" commonconsts "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/pkg/dynamo/consts"
"github.com/huandu/xstrings" "github.com/huandu/xstrings"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors" k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/internal/archive" "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/internal/archive"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
) )
...@@ -79,11 +79,11 @@ type ServiceConfig struct { ...@@ -79,11 +79,11 @@ type ServiceConfig struct {
Config Config `yaml:"config"` Config Config `yaml:"config"`
} }
func RetrieveCompoundAINimDownloadURL(ctx context.Context, compoundAIDeployment *v1alpha1.CompoundAIDeployment, secretGetter SecretGetter, recorder EventRecorder) (*string, *string, error) { func RetrieveDynamoNimDownloadURL(ctx context.Context, dynamoDeployment *v1alpha1.DynamoDeployment, secretGetter SecretGetter, recorder EventRecorder) (*string, *string, error) {
compoundAINimDownloadURL := "" dynamoNimDownloadURL := ""
compoundAINimApiToken := "" dynamoNimApiToken := ""
var compoundAINim *schemasv1.BentoFullSchema var dynamoNim *schemasv1.BentoFullSchema
compoundAINimRepositoryName, _, compoundAINimVersion := xstrings.Partition(compoundAIDeployment.Spec.CompoundAINim, ":") dynamoNimRepositoryName, _, dynamoNimVersion := xstrings.Partition(dynamoDeployment.Spec.DynamoNim, ":")
var err error var err error
var yataiClient_ **yataiclient.YataiClient var yataiClient_ **yataiclient.YataiClient
...@@ -103,34 +103,34 @@ func RetrieveCompoundAINimDownloadURL(ctx context.Context, compoundAIDeployment ...@@ -103,34 +103,34 @@ func RetrieveCompoundAINimDownloadURL(ctx context.Context, compoundAIDeployment
yataiClient := *yataiClient_ yataiClient := *yataiClient_
yataiConf := *yataiConf_ yataiConf := *yataiConf_
recorder.Eventf(compoundAIDeployment, corev1.EventTypeNormal, "GenerateImageBuilderPod", "Getting compoundAINim %s from yatai service", compoundAIDeployment.Spec.CompoundAINim) recorder.Eventf(dynamoDeployment, corev1.EventTypeNormal, "GenerateImageBuilderPod", "Getting dynamoNim %s from yatai service", dynamoDeployment.Spec.DynamoNim)
compoundAINim, err = yataiClient.GetBento(ctx, compoundAINimRepositoryName, compoundAINimVersion) dynamoNim, err = yataiClient.GetBento(ctx, dynamoNimRepositoryName, dynamoNimVersion)
if err != nil { if err != nil {
err = errors.Wrap(err, "get compoundAINim") err = errors.Wrap(err, "get dynamoNim")
return nil, nil, err return nil, nil, err
} }
recorder.Eventf(compoundAIDeployment, corev1.EventTypeNormal, "GenerateImageBuilderPod", "Got compoundAINim %s from yatai service", compoundAIDeployment.Spec.CompoundAINim) recorder.Eventf(dynamoDeployment, corev1.EventTypeNormal, "GenerateImageBuilderPod", "Got dynamoNim %s from yatai service", dynamoDeployment.Spec.DynamoNim)
if compoundAINim.TransmissionStrategy != nil && *compoundAINim.TransmissionStrategy == modelschemas.TransmissionStrategyPresignedURL { if dynamoNim.TransmissionStrategy != nil && *dynamoNim.TransmissionStrategy == modelschemas.TransmissionStrategyPresignedURL {
var compoundAINim_ *schemasv1.BentoSchema var dynamoNim_ *schemasv1.BentoSchema
recorder.Eventf(compoundAIDeployment, corev1.EventTypeNormal, "GenerateImageBuilderPod", "Getting presigned url for compoundAINim %s from yatai service", compoundAIDeployment.Spec.CompoundAINim) recorder.Eventf(dynamoDeployment, corev1.EventTypeNormal, "GenerateImageBuilderPod", "Getting presigned url for dynamoNim %s from yatai service", dynamoDeployment.Spec.DynamoNim)
compoundAINim_, err = yataiClient.PresignBentoDownloadURL(ctx, compoundAINimRepositoryName, compoundAINimVersion) dynamoNim_, err = yataiClient.PresignBentoDownloadURL(ctx, dynamoNimRepositoryName, dynamoNimVersion)
if err != nil { if err != nil {
err = errors.Wrap(err, "presign compoundAINim download url") err = errors.Wrap(err, "presign dynamoNim download url")
return nil, nil, err return nil, nil, err
} }
recorder.Eventf(compoundAIDeployment, corev1.EventTypeNormal, "GenerateImageBuilderPod", "Got presigned url for compoundAINim %s from yatai service", compoundAIDeployment.Spec.CompoundAINim) recorder.Eventf(dynamoDeployment, corev1.EventTypeNormal, "GenerateImageBuilderPod", "Got presigned url for dynamoNim %s from yatai service", dynamoDeployment.Spec.DynamoNim)
compoundAINimDownloadURL = compoundAINim_.PresignedDownloadUrl dynamoNimDownloadURL = dynamoNim_.PresignedDownloadUrl
} else { } else {
compoundAINimDownloadURL = fmt.Sprintf("%s/api/v1/bento_repositories/%s/bentos/%s/download", yataiConf.Endpoint, compoundAINimRepositoryName, compoundAINimVersion) dynamoNimDownloadURL = fmt.Sprintf("%s/api/v1/bento_repositories/%s/bentos/%s/download", yataiConf.Endpoint, dynamoNimRepositoryName, dynamoNimVersion)
compoundAINimApiToken = fmt.Sprintf("%s:%s:$%s", commonconsts.YataiImageBuilderComponentName, yataiConf.ClusterName, commonconsts.EnvYataiApiToken) dynamoNimApiToken = fmt.Sprintf("%s:%s:$%s", commonconsts.YataiImageBuilderComponentName, yataiConf.ClusterName, commonconsts.EnvYataiApiToken)
} }
return &compoundAINimDownloadURL, &compoundAINimApiToken, nil return &dynamoNimDownloadURL, &dynamoNimApiToken, nil
} }
// ServicesConfig represents the top-level YAML structure of a compoundAINim yaml file stored in a compoundAINim tar file // ServicesConfig represents the top-level YAML structure of a dynamoNim yaml file stored in a dynamoNim tar file
type CompoundAINIMConfig struct { type DynamoNIMConfig struct {
Services []ServiceConfig `yaml:"services"` Services []ServiceConfig `yaml:"services"`
} }
...@@ -138,7 +138,7 @@ type EventRecorder interface { ...@@ -138,7 +138,7 @@ type EventRecorder interface {
Eventf(obj runtime.Object, eventtype string, reason string, message string, args ...interface{}) Eventf(obj runtime.Object, eventtype string, reason string, message string, args ...interface{})
} }
func RetrieveCompoundAINIMConfigurationFile(ctx context.Context, url string, yataiApiToken string) (*bytes.Buffer, error) { func RetrieveDynamoNIMConfigurationFile(ctx context.Context, url string, yataiApiToken string) (*bytes.Buffer, error) {
req, err := http.NewRequest("GET", url, nil) req, err := http.NewRequest("GET", url, nil)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -173,18 +173,18 @@ func RetrieveCompoundAINIMConfigurationFile(ctx context.Context, url string, yat ...@@ -173,18 +173,18 @@ func RetrieveCompoundAINIMConfigurationFile(ctx context.Context, url string, yat
return yamlContent, nil return yamlContent, nil
} }
func GetYataiClientWithAuth(ctx context.Context, compoundAINimRequest *v1alpha1.CompoundAINimRequest, secretGetter SecretGetter) (**yataiclient.YataiClient, **commonconfig.YataiConfig, error) { func GetYataiClientWithAuth(ctx context.Context, dynamoNimRequest *v1alpha1.DynamoNimRequest, secretGetter SecretGetter) (**yataiclient.YataiClient, **commonconfig.YataiConfig, error) {
orgId, ok := compoundAINimRequest.Labels[commonconsts.NgcOrganizationHeaderName] orgId, ok := dynamoNimRequest.Labels[commonconsts.NgcOrganizationHeaderName]
if !ok { if !ok {
orgId = commonconsts.DefaultOrgId orgId = commonconsts.DefaultOrgId
} }
userId, ok := compoundAINimRequest.Labels[commonconsts.NgcUserHeaderName] userId, ok := dynamoNimRequest.Labels[commonconsts.NgcUserHeaderName]
if !ok { if !ok {
userId = commonconsts.DefaultUserId userId = commonconsts.DefaultUserId
} }
auth := yataiclient.CompoundAIAuthHeaders{ auth := yataiclient.DynamoAuthHeaders{
OrgId: orgId, OrgId: orgId,
UserId: userId, UserId: userId,
} }
...@@ -227,35 +227,35 @@ func GetYataiClient(ctx context.Context, secretGetter SecretGetter) (yataiClient ...@@ -227,35 +227,35 @@ func GetYataiClient(ctx context.Context, secretGetter SecretGetter) (yataiClient
return return
} }
func ParseCompoundAINIMConfig(ctx context.Context, yamlContent *bytes.Buffer) (*CompoundAINIMConfig, error) { func ParseDynamoNIMConfig(ctx context.Context, yamlContent *bytes.Buffer) (*DynamoNIMConfig, error) {
var config CompoundAINIMConfig var config DynamoNIMConfig
logger := log.FromContext(ctx) logger := log.FromContext(ctx)
logger.Info("trying to parse compoundAINim config", "yamlContent", yamlContent.String()) logger.Info("trying to parse dynamoNim config", "yamlContent", yamlContent.String())
err := yaml.Unmarshal(yamlContent.Bytes(), &config) err := yaml.Unmarshal(yamlContent.Bytes(), &config)
return &config, err return &config, err
} }
func GetCompoundAINIMConfig(ctx context.Context, compoundAIDeployment *v1alpha1.CompoundAIDeployment, secretGetter SecretGetter, recorder EventRecorder) (*CompoundAINIMConfig, error) { func GetDynamoNIMConfig(ctx context.Context, dynamoDeployment *v1alpha1.DynamoDeployment, secretGetter SecretGetter, recorder EventRecorder) (*DynamoNIMConfig, error) {
compoundAINimDownloadURL, compoundAINimApiToken, err := RetrieveCompoundAINimDownloadURL(ctx, compoundAIDeployment, secretGetter, recorder) dynamoNimDownloadURL, dynamoNimApiToken, err := RetrieveDynamoNimDownloadURL(ctx, dynamoDeployment, secretGetter, recorder)
if err != nil { if err != nil {
return nil, err return nil, err
} }
yamlContent, err := RetrieveCompoundAINIMConfigurationFile(ctx, *compoundAINimDownloadURL, *compoundAINimApiToken) yamlContent, err := RetrieveDynamoNIMConfigurationFile(ctx, *dynamoNimDownloadURL, *dynamoNimApiToken)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return ParseCompoundAINIMConfig(ctx, yamlContent) return ParseDynamoNIMConfig(ctx, yamlContent)
} }
// generate CompoundAINIMDeployment from config // generate DynamoNIMDeployment from config
func GenerateCompoundAINIMDeployments(parentCompoundAIDeployment *v1alpha1.CompoundAIDeployment, config *CompoundAINIMConfig) (map[string]*v1alpha1.CompoundAINimDeployment, error) { func GenerateDynamoNIMDeployments(parentDynamoDeployment *v1alpha1.DynamoDeployment, config *DynamoNIMConfig) (map[string]*v1alpha1.DynamoNimDeployment, error) {
novaServices := make(map[string]string) novaServices := make(map[string]string)
deployments := make(map[string]*v1alpha1.CompoundAINimDeployment) deployments := make(map[string]*v1alpha1.DynamoNimDeployment)
for _, service := range config.Services { for _, service := range config.Services {
deployment := &v1alpha1.CompoundAINimDeployment{} deployment := &v1alpha1.DynamoNimDeployment{}
deployment.Name = fmt.Sprintf("%s-%s", parentCompoundAIDeployment.Name, strings.ToLower(service.Name)) deployment.Name = fmt.Sprintf("%s-%s", parentDynamoDeployment.Name, strings.ToLower(service.Name))
deployment.Namespace = parentCompoundAIDeployment.Namespace deployment.Namespace = parentDynamoDeployment.Namespace
deployment.Spec.CompoundAINim = strings.Split(parentCompoundAIDeployment.Spec.CompoundAINim, ":")[0] deployment.Spec.DynamoNim = strings.Split(parentDynamoDeployment.Spec.DynamoNim, ":")[0]
deployment.Spec.ServiceName = service.Name deployment.Spec.ServiceName = service.Name
if service.Config.Nova != nil && service.Config.Nova.Enabled { if service.Config.Nova != nil && service.Config.Nova.Enabled {
novaServices[service.Name] = fmt.Sprintf("%s/%s", service.Config.Nova.Name, service.Config.Nova.Namespace) novaServices[service.Name] = fmt.Sprintf("%s/%s", service.Config.Nova.Name, service.Config.Nova.Namespace)
......
...@@ -28,6 +28,6 @@ import ( ...@@ -28,6 +28,6 @@ import (
// Run e2e tests using the Ginkgo runner. // Run e2e tests using the Ginkgo runner.
func TestE2E(t *testing.T) { func TestE2E(t *testing.T) {
RegisterFailHandler(Fail) RegisterFailHandler(Fail)
_, _ = fmt.Fprintf(GinkgoWriter, "Starting compoundai-kubernetes-operator suite\n") _, _ = fmt.Fprintf(GinkgoWriter, "Starting dynamo-kubernetes-operator suite\n")
RunSpecs(t, "e2e suite") RunSpecs(t, "e2e suite")
} }
...@@ -25,10 +25,10 @@ import ( ...@@ -25,10 +25,10 @@ import (
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/test/utils" "github.com/dynemo-ai/dynemo/deploy/dynamo/operator/test/utils"
) )
const namespace = "compoundai-kubernetes-operator-system" const namespace = "dynamo-kubernetes-operator-system"
var _ = Describe("controller", Ordered, func() { var _ = Describe("controller", Ordered, func() {
BeforeAll(func() { BeforeAll(func() {
...@@ -61,7 +61,7 @@ var _ = Describe("controller", Ordered, func() { ...@@ -61,7 +61,7 @@ var _ = Describe("controller", Ordered, func() {
var err error var err error
// projectimage stores the name of the image used in the example // projectimage stores the name of the image used in the example
var projectimage = "example.com/compoundai-kubernetes-operator:v0.0.1" var projectimage = "example.com/dynamo-kubernetes-operator:v0.0.1"
By("building the manager(Operator) image") By("building the manager(Operator) image")
cmd := exec.Command("make", "docker-build", fmt.Sprintf("IMG=%s", projectimage)) cmd := exec.Command("make", "docker-build", fmt.Sprintf("IMG=%s", projectimage))
......
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