Skip to content

Commit

Permalink
Add number of available replicas to Model printcolumns
Browse files Browse the repository at this point in the history
  • Loading branch information
lc525 committed Sep 5, 2024
1 parent c6f27ef commit 98ae6ea
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,13 @@ spec:
jsonPath: .status.conditions[?(@.type=="ModelReady")].status
name: Ready
type: string
- description: Number of replicas
jsonPath: .status.replicas
name: Replicas
- description: Number of desired replicas
jsonPath: .spec.replicas
name: Desired Replicas
type: integer
- description: Number of replicas available to receive inference requests
jsonPath: .status.availableReplicas
name: Available Replicas
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
Expand Down
10 changes: 7 additions & 3 deletions k8s/yaml/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@ spec:
jsonPath: .status.conditions[?(@.type=="ModelReady")].status
name: Ready
type: string
- description: Number of replicas
jsonPath: .status.replicas
name: Replicas
- description: Number of desired replicas
jsonPath: .spec.replicas
name: Desired Replicas
type: integer
- description: Number of replicas available to receive inference requests
jsonPath: .status.availableReplicas
name: Available Replicas
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
Expand Down
3 changes: 2 additions & 1 deletion operator/apis/mlops/v1alpha1/model_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ type ModelStatus struct {
//+kubebuilder:resource:shortName=mlm
//+kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas
//+kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="ModelReady")].status`,description="Model ready status"
//+kubebuilder:printcolumn:name="Replicas",type=integer,JSONPath=`.status.replicas`, description="Number of replicas"
//+kubebuilder:printcolumn:name="Desired Replicas",type=integer,JSONPath=`.spec.replicas`,description="Number of desired replicas"
//+kubebuilder:printcolumn:name="Available Replicas",type=integer,JSONPath=`.status.availableReplicas`,description="Number of replicas available to receive inference requests"
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

// Model is the Schema for the models API
Expand Down
10 changes: 7 additions & 3 deletions operator/config/crd/bases/mlops.seldon.io_models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ spec:
jsonPath: .status.conditions[?(@.type=="ModelReady")].status
name: Ready
type: string
- description: Number of replicas
jsonPath: .status.replicas
name: Replicas
- description: Number of desired replicas
jsonPath: .spec.replicas
name: Desired Replicas
type: integer
- description: Number of replicas available to receive inference requests
jsonPath: .status.availableReplicas
name: Available Replicas
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
Expand Down
2 changes: 2 additions & 0 deletions operator/scheduler/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ func (s *SchedulerClient) SubscribeModelEvents(ctx context.Context, grpcClient s
}

// Set the total number of replicas targeted by this model
// The .status.replicas CRD field is used by HPA to determine the current
// number replicas that exist, irrespective of their state
latestModel.Status.Replicas = int32(
modelStatus.GetAvailableReplicas() +
modelStatus.GetUnavailableReplicas(),
Expand Down

0 comments on commit 98ae6ea

Please sign in to comment.