Skip to content
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

Add well-known label to InferenceGraphs #463

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ import (
)

// KServe Constants
var (
const (
KServeName = "kserve"
KServeAPIGroupName = "serving.kserve.io"
KnativeAutoscalingAPIGroupName = "autoscaling.knative.dev"
KnativeServingAPIGroupNamePrefix = "serving.knative"
KnativeServingAPIGroupName = KnativeServingAPIGroupNamePrefix + ".dev"
KServeNamespace = getEnvOrDefault("POD_NAMESPACE", "kserve")
KServeDefaultVersion = "v0.5.0"
)

var KServeNamespace = getEnvOrDefault("POD_NAMESPACE", "kserve")

// InferenceService Constants
var (
InferenceServiceName = "inferenceservice"
Expand Down Expand Up @@ -300,6 +300,7 @@ const (
KServiceComponentLabel = "component"
KServiceModelLabel = "model"
KServiceEndpointLabel = "endpoint"
KServeWorkloadKind = KServeAPIGroupName + "/kind"
)

// Labels for TrainedModel
Expand Down
10 changes: 7 additions & 3 deletions pkg/controller/v1alpha1/inferencegraph/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import (
"fmt"
"time"

"github.com/kserve/kserve/pkg/apis/serving/v1alpha1"
"github.com/kserve/kserve/pkg/constants"
"github.com/kserve/kserve/pkg/utils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"google.golang.org/protobuf/proto"
Expand All @@ -36,6 +33,10 @@ import (
knservingv1 "knative.dev/serving/pkg/apis/serving/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/kserve/kserve/pkg/apis/serving/v1alpha1"
"github.com/kserve/kserve/pkg/constants"
"github.com/kserve/kserve/pkg/utils"
)

var _ = Describe("Inference Graph controller test", func() {
Expand Down Expand Up @@ -132,6 +133,7 @@ var _ = Describe("Inference Graph controller test", func() {
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"serving.kserve.io/inferencegraph": graphName,
constants.KServeWorkloadKind: "InferenceGraph",
},
Annotations: map[string]string{
"autoscaling.knative.dev/min-scale": "1",
Expand Down Expand Up @@ -290,6 +292,7 @@ var _ = Describe("Inference Graph controller test", func() {
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"serving.kserve.io/inferencegraph": graphName,
constants.KServeWorkloadKind: "InferenceGraph",
},
Annotations: map[string]string{
"autoscaling.knative.dev/min-scale": "1",
Expand Down Expand Up @@ -462,6 +465,7 @@ var _ = Describe("Inference Graph controller test", func() {
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"serving.kserve.io/inferencegraph": graphName,
constants.KServeWorkloadKind: "InferenceGraph",
},
Annotations: map[string]string{
"autoscaling.knative.dev/min-scale": "1",
Expand Down
8 changes: 5 additions & 3 deletions pkg/controller/v1alpha1/inferencegraph/knative_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import (
"reflect"
"strings"

v1alpha1api "github.com/kserve/kserve/pkg/apis/serving/v1alpha1"
"github.com/kserve/kserve/pkg/constants"
"github.com/kserve/kserve/pkg/utils"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
v1 "k8s.io/api/core/v1"
Expand All @@ -42,6 +39,10 @@ import (
knservingv1 "knative.dev/serving/pkg/apis/serving/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"

v1alpha1api "github.com/kserve/kserve/pkg/apis/serving/v1alpha1"
"github.com/kserve/kserve/pkg/constants"
"github.com/kserve/kserve/pkg/utils"
)

var log = logf.Log.WithName("GraphKsvcReconciler")
Expand Down Expand Up @@ -169,6 +170,7 @@ func createKnativeService(componentMeta metav1.ObjectMeta, graph *v1alpha1api.In
return !utils.Includes(constants.RevisionTemplateLabelDisallowedList, key)
})
labels[constants.InferenceGraphLabel] = componentMeta.Name
labels[constants.KServeWorkloadKind] = "InferenceGraph"
service := &knservingv1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: componentMeta.Name,
Expand Down
Loading