-
-
Notifications
You must be signed in to change notification settings - Fork 44
Playground should be triggered to create Services and then Pods once the model is created #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,12 @@ package inference | |
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
|
|
||
| "github.com/onsi/ginkgo/v2" | ||
| "github.com/onsi/gomega" | ||
| corev1 "k8s.io/api/core/v1" | ||
| apierrors "k8s.io/apimachinery/pkg/api/errors" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/apimachinery/pkg/types" | ||
| "k8s.io/utils/ptr" | ||
|
|
@@ -155,5 +157,54 @@ var _ = ginkgo.Describe("playground controller test", func() { | |
| }, | ||
| }, | ||
| }), | ||
| ginkgo.Entry("create the model after playground is created", &testValidatingCase{ | ||
| makePlayground: func() *inferenceapi.Playground { | ||
| return util.MockASamplePlayground(ns.Name) | ||
| }, | ||
| updates: []*update{ | ||
| { | ||
| playgroundUpdateFn: func(playground *inferenceapi.Playground) { | ||
| // Delete the pre-provision model before creating playground. | ||
| gomega.Expect(k8sClient.Delete(ctx, model)).To(gomega.Succeed()) | ||
| // To make sure model not exists. | ||
| gomega.Eventually(func() error { | ||
| oldModel := &coreapi.OpenModel{} | ||
| if err := k8sClient.Get(ctx, types.NamespacedName{Name: model.Name, Namespace: model.Namespace}, oldModel); err != nil { | ||
| if apierrors.IsNotFound(err) { | ||
| return nil | ||
| } | ||
| return err | ||
| } | ||
| return fmt.Errorf("model %s/%s still exists", model.Namespace, model.Name) | ||
| }, util.IntegrationTimeout, util.Interval).Should(gomega.Succeed()) | ||
|
|
||
| gomega.Expect(k8sClient.Create(ctx, playground)).To(gomega.Succeed()) | ||
| }, | ||
| checkPlayground: func(ctx context.Context, k8sClient client.Client, playground *inferenceapi.Playground) { | ||
| gomega.Consistently(func() error { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if no condition is expected.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes for now, but this can be optimized like pending for model creation in the follow up if you're interested or together with this PR, whatever you like. So when there's no condition with Playground or model is not created, Playground is Pending, but with different reasons, one is
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I will do it in another PR. |
||
| updatePlayground := inferenceapi.Playground{} | ||
| if err := k8sClient.Get(ctx, types.NamespacedName{Name: playground.Name, Namespace: playground.Namespace}, &updatePlayground); err != nil { | ||
| return err | ||
| } | ||
| if len(updatePlayground.Status.Conditions) != 0 { | ||
| return fmt.Errorf("playground status conditions should be empty, got %v", updatePlayground.Status.Conditions) | ||
| } | ||
| return nil | ||
| }, 3*util.Interval, util.Interval).Should(gomega.Succeed()) | ||
| }, | ||
| }, | ||
| { | ||
| // create the model after playground is created. | ||
| playgroundUpdateFn: func(_ *inferenceapi.Playground) { | ||
| model = util.MockASampleModel() | ||
| gomega.Expect(k8sClient.Create(ctx, model)).To(gomega.Succeed()) | ||
| }, | ||
| checkPlayground: func(ctx context.Context, k8sClient client.Client, playground *inferenceapi.Playground) { | ||
| validation.ValidatePlayground(ctx, k8sClient, playground) | ||
| validation.ValidatePlaygroundStatusEqualTo(ctx, k8sClient, playground, inferenceapi.PlaygroundProgressing, "Pending", metav1.ConditionTrue) | ||
| }, | ||
| }, | ||
| }, | ||
| }), | ||
| ) | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.