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