From 7229b3235e82ff9d2c3ada19d7afc8f77492daf5 Mon Sep 17 00:00:00 2001 From: "Shiva Krishna, Merla" Date: Mon, 5 Aug 2024 22:54:23 -0700 Subject: [PATCH] Misc spec updates 1. Update NGC modelPuller to be immutable as model profiles cached are tied to each NIM container 2. Change hpaSpec to hpa. 3. Make resources optional for NIMCache 4. Update CRDs across all folders Signed-off-by: Shiva Krishna, Merla --- api/apps/v1alpha1/common_types.go | 2 +- api/apps/v1alpha1/nimcache_types.go | 3 ++- bundle/manifests/apps.nvidia.com_nimcaches.yaml | 16 +++++++++++----- .../manifests/apps.nvidia.com_nimpipelines.yaml | 2 +- .../manifests/apps.nvidia.com_nimservices.yaml | 2 +- config/crd/bases/apps.nvidia.com_nimcaches.yaml | 6 +++++- .../crd/bases/apps.nvidia.com_nimpipelines.yaml | 2 +- .../crd/bases/apps.nvidia.com_nimservices.yaml | 2 +- .../crds/apps.nvidia.com_nimcaches.yaml | 15 +++++++++++---- .../crds/apps.nvidia.com_nimpipelines.yaml | 2 +- .../crds/apps.nvidia.com_nimservices.yaml | 2 +- 11 files changed, 36 insertions(+), 18 deletions(-) diff --git a/api/apps/v1alpha1/common_types.go b/api/apps/v1alpha1/common_types.go index fffab185..b1402a4b 100644 --- a/api/apps/v1alpha1/common_types.go +++ b/api/apps/v1alpha1/common_types.go @@ -52,7 +52,7 @@ type ServiceMonitor struct { // Autoscaling defines attributes to automatically scale the service based on metrics type Autoscaling struct { Enabled *bool `json:"enabled,omitempty"` - HPASpec autoscalingv2.HorizontalPodAutoscalerSpec `json:"hpaspec,omitempty"` + HPASpec autoscalingv2.HorizontalPodAutoscalerSpec `json:"hpa,omitempty"` } // Image defines image attributes diff --git a/api/apps/v1alpha1/nimcache_types.go b/api/apps/v1alpha1/nimcache_types.go index a8bf29bd..da9eeb65 100644 --- a/api/apps/v1alpha1/nimcache_types.go +++ b/api/apps/v1alpha1/nimcache_types.go @@ -35,7 +35,7 @@ type NIMCacheSpec struct { // Storage is the target storage for caching NIM model Storage Storage `json:"storage"` // Resources defines the minimum resources required for the caching job to run(cpu, memory, gpu). - Resources Resources `json:"resources"` + Resources Resources `json:"resources,omitempty"` // Tolerations for running the job to cache the NIM model Tolerations []corev1.Toleration `json:"tolerations,omitempty"` // NodeSelectors are the node selector labels to schedule the caching job. @@ -56,6 +56,7 @@ type NGCSource struct { // The name of an existing pull secret containing the NGC_API_KEY AuthSecret string `json:"authSecret"` // ModelPuller is the container image that can pull the model + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="modelPuller is an immutable field. Please create a new NIMCache resource instead when you want to change this container." ModelPuller string `json:"modelPuller"` // PullSecret to pull the model puller image PullSecret string `json:"pullSecret,omitempty"` diff --git a/bundle/manifests/apps.nvidia.com_nimcaches.yaml b/bundle/manifests/apps.nvidia.com_nimcaches.yaml index 617ea40d..08cf8e68 100644 --- a/bundle/manifests/apps.nvidia.com_nimcaches.yaml +++ b/bundle/manifests/apps.nvidia.com_nimcaches.yaml @@ -183,6 +183,11 @@ spec: description: ModelPuller is the container image that can pull the model type: string + x-kubernetes-validations: + - message: modelPuller is an immutable field. Please create + a new NIMCache resource instead when you want to change + this container. + rule: self == oldSelf pullSecret: description: PullSecret to pull the model puller image type: string @@ -261,7 +266,6 @@ spec: type: object type: array required: - - resources - source - storage type: object @@ -341,14 +345,16 @@ spec: items: description: NIMProfile defines the profiles that were cached properties: + config: + additionalProperties: + type: string + type: object model: type: string + name: + type: string release: type: string - tags: - additionalProperties: - type: string - type: object type: object type: array pvc: diff --git a/bundle/manifests/apps.nvidia.com_nimpipelines.yaml b/bundle/manifests/apps.nvidia.com_nimpipelines.yaml index 6c1a27c3..6a4eb6c4 100644 --- a/bundle/manifests/apps.nvidia.com_nimpipelines.yaml +++ b/bundle/manifests/apps.nvidia.com_nimpipelines.yaml @@ -1295,7 +1295,7 @@ spec: properties: enabled: type: boolean - hpaspec: + hpa: description: HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. properties: diff --git a/bundle/manifests/apps.nvidia.com_nimservices.yaml b/bundle/manifests/apps.nvidia.com_nimservices.yaml index bdd38f1f..c47385ea 100644 --- a/bundle/manifests/apps.nvidia.com_nimservices.yaml +++ b/bundle/manifests/apps.nvidia.com_nimservices.yaml @@ -1263,7 +1263,7 @@ spec: properties: enabled: type: boolean - hpaspec: + hpa: description: HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. properties: diff --git a/config/crd/bases/apps.nvidia.com_nimcaches.yaml b/config/crd/bases/apps.nvidia.com_nimcaches.yaml index ceeafb72..08cf8e68 100644 --- a/config/crd/bases/apps.nvidia.com_nimcaches.yaml +++ b/config/crd/bases/apps.nvidia.com_nimcaches.yaml @@ -183,6 +183,11 @@ spec: description: ModelPuller is the container image that can pull the model type: string + x-kubernetes-validations: + - message: modelPuller is an immutable field. Please create + a new NIMCache resource instead when you want to change + this container. + rule: self == oldSelf pullSecret: description: PullSecret to pull the model puller image type: string @@ -261,7 +266,6 @@ spec: type: object type: array required: - - resources - source - storage type: object diff --git a/config/crd/bases/apps.nvidia.com_nimpipelines.yaml b/config/crd/bases/apps.nvidia.com_nimpipelines.yaml index 6c1a27c3..6a4eb6c4 100644 --- a/config/crd/bases/apps.nvidia.com_nimpipelines.yaml +++ b/config/crd/bases/apps.nvidia.com_nimpipelines.yaml @@ -1295,7 +1295,7 @@ spec: properties: enabled: type: boolean - hpaspec: + hpa: description: HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. properties: diff --git a/config/crd/bases/apps.nvidia.com_nimservices.yaml b/config/crd/bases/apps.nvidia.com_nimservices.yaml index bdd38f1f..c47385ea 100644 --- a/config/crd/bases/apps.nvidia.com_nimservices.yaml +++ b/config/crd/bases/apps.nvidia.com_nimservices.yaml @@ -1263,7 +1263,7 @@ spec: properties: enabled: type: boolean - hpaspec: + hpa: description: HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. properties: diff --git a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimcaches.yaml b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimcaches.yaml index 617ea40d..e8e2e9b5 100644 --- a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimcaches.yaml +++ b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimcaches.yaml @@ -183,6 +183,11 @@ spec: description: ModelPuller is the container image that can pull the model type: string + x-kubernetes-validations: + - message: modelPuller is an immutable field. Please create + a new NIMCache resource instead when you want to change + this container. + rule: self == oldSelf pullSecret: description: PullSecret to pull the model puller image type: string @@ -341,14 +346,16 @@ spec: items: description: NIMProfile defines the profiles that were cached properties: + config: + additionalProperties: + type: string + type: object model: type: string + name: + type: string release: type: string - tags: - additionalProperties: - type: string - type: object type: object type: array pvc: diff --git a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimpipelines.yaml b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimpipelines.yaml index 6c1a27c3..6a4eb6c4 100644 --- a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimpipelines.yaml +++ b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimpipelines.yaml @@ -1295,7 +1295,7 @@ spec: properties: enabled: type: boolean - hpaspec: + hpa: description: HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. properties: diff --git a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimservices.yaml b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimservices.yaml index bdd38f1f..c47385ea 100644 --- a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimservices.yaml +++ b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimservices.yaml @@ -1263,7 +1263,7 @@ spec: properties: enabled: type: boolean - hpaspec: + hpa: description: HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. properties: