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 runtimeClass support to modelmesh deployment #531

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions config/default/config-defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ storageHelperResources:
cpu: "2"
memory: "512Mi"
serviceAccountName: ""
runtimeClassName: ""
metrics:
enabled: true
builtInServerTypes:
Expand Down
10 changes: 10 additions & 0 deletions controllers/modelmesh/modelmesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type Deployment struct {
PullerImageCommand []string
PullerResources *corev1.ResourceRequirements
Replicas uint16
RuntimeClassName string
Port uint16
TLSSecretName string
TLSClientAuth string
Expand Down Expand Up @@ -131,6 +132,7 @@ func (m *Deployment) Apply(ctx context.Context) error {
m.configureRuntimePodSpecLabels,
m.ensureMMContainerIsLast,
m.configureRuntimePodSpecImagePullSecrets,
m.addRuntimeClassToDeployment,
); tErr != nil {
return tErr
}
Expand Down Expand Up @@ -313,3 +315,11 @@ func (m *Deployment) setConfigMap() error {
m.AnnotationConfigMap = annotationConfigMap
return nil
}

// Add runtimeClassName to the deployment spec
func (m *Deployment) addRuntimeClassToDeployment(deployment *appsv1.Deployment) error {
if m.RuntimeClassName != "" {
deployment.Spec.Template.Spec.RuntimeClassName = &m.RuntimeClassName
}
return nil
}
1 change: 1 addition & 0 deletions controllers/servingruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ func (r *ServingRuntimeReconciler) Reconcile(ctx context.Context, req ctrl.Reque
AnnotationsMap: cfg.RuntimePodAnnotations,
LabelsMap: cfg.RuntimePodLabels,
ImagePullSecrets: cfg.ImagePullSecrets,
RuntimeClassName: cfg.RuntimeClassName,
}
// if the runtime is disabled, delete the deployment
if spec.IsDisabled() || !spec.IsMultiModelRuntime() || !mmEnabled {
Expand Down
1 change: 1 addition & 0 deletions docs/configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The following parameters are currently supported. _Note_ the keys are expressed
| `runtimePodAnnotations` | `metadata.annotations` to be added to all `ServingRuntime` pods | (\*\*\*\*\*) See default annotations below |
| `imagePullSecrets` | The image pull secrets to use for runtime Pods | |
| `allowAnyPVC` | Allows any PVC in predictor to configure PVC for runtime pods when it's not in storage secret | `false` |
| `runtimeClassName` | The K8s runtimeClassName to use for the runtime |

(\*) Currently requires a controller restart to take effect

Expand Down
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ type Config struct {

ImagePullSecrets []corev1.LocalObjectReference

RuntimeClassName string

// For internal use only
InternalModelMeshEnvVars EnvVarList
}
Expand Down