"vscode:/vscode.git/clone" did not exist on "58df5aca4c3f58feaa903f76b06b09b87a6f6f28"
Unverified Commit 26fe79dc authored by julienmancuso's avatar julienmancuso Committed by GitHub
Browse files

feat: rename operator CRDs (#795)

parent a03fd307
...@@ -39,7 +39,7 @@ router = APIRouter(prefix="/api/v2/deployments", tags=["deployments"]) ...@@ -39,7 +39,7 @@ router = APIRouter(prefix="/api/v2/deployments", tags=["deployments"])
def sanitize_deployment_name(name: Optional[str], dynamo_nim: str) -> str: def sanitize_deployment_name(name: Optional[str], dynamo_nim: str) -> str:
""" """
Resolve a name for the DynamoDeployment that will work safely in k8s Resolve a name for the DynamoGraphDeployment that will work safely in k8s
Args: Args:
name: Optional custom name name: Optional custom name
......
...@@ -27,10 +27,10 @@ class K8sResource: ...@@ -27,10 +27,10 @@ class K8sResource:
self.plural = plural self.plural = plural
DynamoDeployment = K8sResource( DynamoGraphDeployment = K8sResource(
group="nvidia.com", group="nvidia.com",
version="v1alpha1", version="v1alpha1",
plural="dynamodeployments", plural="dynamographdeployments",
) )
...@@ -69,7 +69,7 @@ def create_dynamo_deployment( ...@@ -69,7 +69,7 @@ def create_dynamo_deployment(
envs: Optional[List[Dict[str, str]]] = None, envs: Optional[List[Dict[str, str]]] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
""" """
Create a DynamoDeployment custom resource. Create a DynamoGraphDeployment custom resource.
Args: Args:
name: Deployment name name: Deployment name
...@@ -83,23 +83,27 @@ def create_dynamo_deployment( ...@@ -83,23 +83,27 @@ def create_dynamo_deployment(
""" """
body = { body = {
"apiVersion": "nvidia.com/v1alpha1", "apiVersion": "nvidia.com/v1alpha1",
"kind": "DynamoDeployment", "kind": "DynamoGraphDeployment",
"metadata": {"name": name, "namespace": namespace, "labels": labels}, "metadata": {"name": name, "namespace": namespace, "labels": labels},
"spec": {"dynamoNim": dynamo_nim, "services": {}, "envs": envs if envs else []}, "spec": {
"dynamoGraph": dynamo_nim,
"services": {},
"envs": envs if envs else [],
},
} }
return create_custom_resource( return create_custom_resource(
group=DynamoDeployment.group, group=DynamoGraphDeployment.group,
version=DynamoDeployment.version, version=DynamoGraphDeployment.version,
namespace=namespace, namespace=namespace,
plural=DynamoDeployment.plural, plural=DynamoGraphDeployment.plural,
body=body, body=body,
) )
def get_dynamo_deployment(name: str, namespace: str) -> Dict[str, Any]: def get_dynamo_deployment(name: str, namespace: str) -> Dict[str, Any]:
""" """
Get a DynamoDeployment custom resource. Get a DynamoGraphDeployment custom resource.
Args: Args:
name: Deployment name name: Deployment name
...@@ -119,10 +123,10 @@ def get_dynamo_deployment(name: str, namespace: str) -> Dict[str, Any]: ...@@ -119,10 +123,10 @@ def get_dynamo_deployment(name: str, namespace: str) -> Dict[str, Any]:
api = client.CustomObjectsApi() api = client.CustomObjectsApi()
try: try:
return api.get_namespaced_custom_object( return api.get_namespaced_custom_object(
group=DynamoDeployment.group, group=DynamoGraphDeployment.group,
version=DynamoDeployment.version, version=DynamoGraphDeployment.version,
namespace=namespace, namespace=namespace,
plural=DynamoDeployment.plural, plural=DynamoGraphDeployment.plural,
name=name, name=name,
) )
except client.rest.ApiException as e: except client.rest.ApiException as e:
...@@ -141,7 +145,7 @@ def get_namespace() -> str: ...@@ -141,7 +145,7 @@ def get_namespace() -> str:
def delete_dynamo_deployment(name: str, namespace: str) -> Dict[str, Any]: def delete_dynamo_deployment(name: str, namespace: str) -> Dict[str, Any]:
""" """
Delete a DynamoDeployment custom resource. Delete a DynamoGraphDeployment custom resource.
""" """
try: try:
config.load_incluster_config() config.load_incluster_config()
...@@ -151,10 +155,10 @@ def delete_dynamo_deployment(name: str, namespace: str) -> Dict[str, Any]: ...@@ -151,10 +155,10 @@ def delete_dynamo_deployment(name: str, namespace: str) -> Dict[str, Any]:
api = client.CustomObjectsApi() api = client.CustomObjectsApi()
try: try:
return api.delete_namespaced_custom_object( return api.delete_namespaced_custom_object(
group=DynamoDeployment.group, group=DynamoGraphDeployment.group,
version=DynamoDeployment.version, version=DynamoGraphDeployment.version,
namespace=namespace, namespace=namespace,
plural=DynamoDeployment.plural, plural=DynamoGraphDeployment.plural,
name=name, name=name,
) )
except client.rest.ApiException as e: except client.rest.ApiException as e:
...@@ -169,7 +173,7 @@ def list_dynamo_deployments( ...@@ -169,7 +173,7 @@ def list_dynamo_deployments(
label_selector: Optional[str] = None, label_selector: Optional[str] = None,
) -> List[Dict[str, Any]]: ) -> List[Dict[str, Any]]:
""" """
List DynamoDeployment custom resources. List DynamoGraphDeployment custom resources.
Args: Args:
namespace: Target namespace namespace: Target namespace
...@@ -189,10 +193,10 @@ def list_dynamo_deployments( ...@@ -189,10 +193,10 @@ def list_dynamo_deployments(
api = client.CustomObjectsApi() api = client.CustomObjectsApi()
try: try:
response = api.list_namespaced_custom_object( response = api.list_namespaced_custom_object(
group=DynamoDeployment.group, group=DynamoGraphDeployment.group,
version=DynamoDeployment.version, version=DynamoGraphDeployment.version,
namespace=namespace, namespace=namespace,
plural=DynamoDeployment.plural, plural=DynamoGraphDeployment.plural,
label_selector=label_selector, label_selector=label_selector,
) )
return response["items"] return response["items"]
......
...@@ -23,7 +23,7 @@ version: 25.2.0-rc3 ...@@ -23,7 +23,7 @@ version: 25.2.0-rc3
home: https://nvidia.com home: https://nvidia.com
dependencies: dependencies:
- name: dynamo-operator - name: dynamo-operator
version: 0.1.4 version: 0.1.5
repository: file://components/operator repository: file://components/operator
condition: dynamo-operator.enabled condition: dynamo-operator.enabled
- name: dynamo-api-store - name: dynamo-api-store
......
...@@ -30,7 +30,7 @@ rules: ...@@ -30,7 +30,7 @@ rules:
- apiGroups: - apiGroups:
- nvidia.com - nvidia.com
resources: resources:
- dynamodeployments - dynamographdeployments
verbs: verbs:
- create - create
- delete - delete
......
...@@ -27,7 +27,7 @@ type: application ...@@ -27,7 +27,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.4 version: 0.1.5
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
...@@ -35,5 +35,5 @@ version: 0.1.4 ...@@ -35,5 +35,5 @@ version: 0.1.4
appVersion: "0.1.0" appVersion: "0.1.0"
dependencies: dependencies:
- name: dynamo-crds - name: dynamo-crds
version: 0.1.3 version: 0.1.4
repository: file://charts/dynamo-crds repository: file://charts/dynamo-crds
\ No newline at end of file
...@@ -16,5 +16,5 @@ apiVersion: v2 ...@@ -16,5 +16,5 @@ apiVersion: v2
name: dynamo-crds name: dynamo-crds
description: A Helm chart for CRDs of dynamo operator description: A Helm chart for CRDs of dynamo operator
type: application type: application
version: 0.1.3 version: 0.1.4
dependencies: [] dependencies: []
\ No newline at end of file
...@@ -19,20 +19,20 @@ kind: CustomResourceDefinition ...@@ -19,20 +19,20 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.16.4 controller-gen.kubebuilder.io/version: v0.16.4
name: dynamonimdeployments.nvidia.com name: dynamocomponentdeployments.nvidia.com
spec: spec:
group: nvidia.com group: nvidia.com
names: names:
kind: DynamoNimDeployment kind: DynamoComponentDeployment
listKind: DynamoNimDeploymentList listKind: DynamoComponentDeploymentList
plural: dynamonimdeployments plural: dynamocomponentdeployments
singular: dynamonimdeployment singular: dynamocomponentdeployment
scope: Namespaced scope: Namespaced
versions: versions:
- additionalPrinterColumns: - additionalPrinterColumns:
- description: Bento - description: Dynamo component
jsonPath: .spec.bento jsonPath: .spec.dynamoComponent
name: Bento name: DynamoComponent
type: string type: string
- description: Available - description: Available
jsonPath: .status.conditions[?(@.type=='Available')].status jsonPath: .status.conditions[?(@.type=='Available')].status
...@@ -389,9 +389,9 @@ spec: ...@@ -389,9 +389,9 @@ spec:
minReplicas: minReplicas:
type: integer type: integer
type: object type: object
dynamoNamespace: dynamoComponent:
type: string type: string
dynamoNim: dynamoNamespace:
type: string type: string
dynamoTag: dynamoTag:
type: string type: string
...@@ -2798,7 +2798,7 @@ spec: ...@@ -2798,7 +2798,7 @@ spec:
serviceName: serviceName:
type: string type: string
required: required:
- dynamoNim - dynamoComponent
- dynamoTag - dynamoTag
type: object type: object
status: status:
......
...@@ -19,36 +19,32 @@ kind: CustomResourceDefinition ...@@ -19,36 +19,32 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.16.4 controller-gen.kubebuilder.io/version: v0.16.4
name: dynamonimrequests.nvidia.com name: dynamocomponentrequests.nvidia.com
spec: spec:
group: nvidia.com group: nvidia.com
names: names:
kind: DynamoNimRequest kind: DynamoComponentRequest
listKind: DynamoNimRequestList listKind: DynamoComponentRequestList
plural: dynamonimrequests plural: dynamocomponentrequests
singular: dynamonimrequest singular: dynamocomponentrequest
scope: Namespaced scope: Namespaced
versions: versions:
- additionalPrinterColumns: - additionalPrinterColumns:
- description: Bento Tag - description: Dynamo component
jsonPath: .spec.bentoTag jsonPath: .spec.dynamoComponent
name: Bento-Tag name: DynamoComponent
type: string type: string
- description: Download URL - description: Download URL
jsonPath: .spec.downloadUrl jsonPath: .spec.downloadUrl
name: Download-Url name: Download-Url
type: string type: string
- description: Image
jsonPath: .spec.image
name: Image
type: string
- description: Image Exists - description: Image Exists
jsonPath: .status.conditions[?(@.type=='ImageExists')].status jsonPath: .status.conditions[?(@.type=='ImageExists')].status
name: Image-Exists name: Image-Exists
type: string type: string
- description: Bento Available - description: Dynamo Component Available
jsonPath: .status.conditions[?(@.type=='BentoAvailable')].status jsonPath: .status.conditions[?(@.type=='DynamoComponentAvailable')].status
name: Bento-Available name: DynamoComponent-Available
type: string type: string
- jsonPath: .metadata.creationTimestamp - jsonPath: .metadata.creationTimestamp
name: Age name: Age
...@@ -65,17 +61,10 @@ spec: ...@@ -65,17 +61,10 @@ spec:
type: object type: object
spec: spec:
properties: properties:
bentoTag:
type: string
buildArgs: buildArgs:
items: items:
type: string type: string
type: array type: array
context:
properties:
bentomlVersion:
type: string
type: object
dockerConfigJsonSecretName: dockerConfigJsonSecretName:
type: string type: string
downloadUrl: downloadUrl:
...@@ -105,6 +94,8 @@ spec: ...@@ -105,6 +94,8 @@ spec:
x-kubernetes-map-type: atomic x-kubernetes-map-type: atomic
type: object type: object
type: array type: array
dynamoComponent:
type: string
image: image:
type: string type: string
imageBuildTimeout: imageBuildTimeout:
...@@ -1422,29 +1413,12 @@ spec: ...@@ -1422,29 +1413,12 @@ spec:
type: object type: object
type: array type: array
type: object type: object
models:
items:
properties:
downloadUrl:
type: string
size:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
tag:
type: string
required:
- tag
type: object
type: array
ociRegistryInsecure: ociRegistryInsecure:
type: boolean type: boolean
serviceName: serviceName:
type: string type: string
required: required:
- bentoTag - dynamoComponent
type: object type: object
status: status:
properties: properties:
......
...@@ -19,14 +19,14 @@ kind: CustomResourceDefinition ...@@ -19,14 +19,14 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.16.4 controller-gen.kubebuilder.io/version: v0.16.4
name: dynamonims.nvidia.com name: dynamocomponents.nvidia.com
spec: spec:
group: nvidia.com group: nvidia.com
names: names:
kind: DynamoNim kind: DynamoComponent
listKind: DynamoNimList listKind: DynamoComponentList
plural: dynamonims plural: dynamocomponents
singular: dynamonim singular: dynamocomponent
scope: Namespaced scope: Namespaced
versions: versions:
- name: v1alpha1 - name: v1alpha1
...@@ -41,11 +41,8 @@ spec: ...@@ -41,11 +41,8 @@ spec:
type: object type: object
spec: spec:
properties: properties:
context: dynamoComponent:
properties:
bentomlVersion:
type: string type: string
type: object
image: image:
type: string type: string
imagePullSecrets: imagePullSecrets:
...@@ -57,30 +54,11 @@ spec: ...@@ -57,30 +54,11 @@ spec:
type: object type: object
x-kubernetes-map-type: atomic x-kubernetes-map-type: atomic
type: array type: array
models:
items:
properties:
downloadUrl:
type: string
size:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
tag:
type: string
required:
- tag
type: object
type: array
serviceName: serviceName:
type: string type: string
tag:
type: string
required: required:
- dynamoComponent
- image - image
- tag
type: object type: object
status: status:
properties: properties:
......
...@@ -19,14 +19,14 @@ kind: CustomResourceDefinition ...@@ -19,14 +19,14 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.16.4 controller-gen.kubebuilder.io/version: v0.16.4
name: dynamodeployments.nvidia.com name: dynamographdeployments.nvidia.com
spec: spec:
group: nvidia.com group: nvidia.com
names: names:
kind: DynamoDeployment kind: DynamoGraphDeployment
listKind: DynamoDeploymentList listKind: DynamoGraphDeploymentList
plural: dynamodeployments plural: dynamographdeployments
singular: dynamodeployment singular: dynamographdeployment
scope: Namespaced scope: Namespaced
versions: versions:
- name: v1alpha1 - name: v1alpha1
...@@ -41,7 +41,7 @@ spec: ...@@ -41,7 +41,7 @@ spec:
type: object type: object
spec: spec:
properties: properties:
dynamoNim: dynamoGraph:
type: string type: string
envs: envs:
items: items:
...@@ -2855,7 +2855,7 @@ spec: ...@@ -2855,7 +2855,7 @@ spec:
type: object type: object
type: object type: object
required: required:
- dynamoNim - dynamoGraph
type: object type: object
status: status:
properties: properties:
......
...@@ -330,8 +330,10 @@ rules: ...@@ -330,8 +330,10 @@ rules:
- apiGroups: - apiGroups:
- nvidia.com - nvidia.com
resources: resources:
- dynamonimdeployments - dynamocomponentdeployments
- dynamodeployments - dynamocomponentrequests
- dynamocomponents
- dynamographdeployments
verbs: verbs:
- create - create
- delete - delete
...@@ -343,61 +345,18 @@ rules: ...@@ -343,61 +345,18 @@ rules:
- apiGroups: - apiGroups:
- nvidia.com - nvidia.com
resources: resources:
- dynamonimdeployments/finalizers - dynamocomponentdeployments/finalizers
- dynamodeployments/finalizers - dynamocomponentrequests/finalizers
- dynamographdeployments/finalizers
verbs: verbs:
- update - update
- apiGroups: - apiGroups:
- nvidia.com - nvidia.com
resources: resources:
- dynamonimdeployments/status - dynamocomponentdeployments/status
- dynamodeployments/status - dynamocomponentrequests/status
verbs: - dynamocomponents/status
- get - dynamographdeployments/status
- patch
- update
- apiGroups:
- nvidia.com
resources:
- dynamonimrequests
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- nvidia.com
resources:
- dynamonimrequests/finalizers
verbs:
- update
- apiGroups:
- nvidia.com
resources:
- dynamonimrequests/status
verbs:
- get
- patch
- update
- apiGroups:
- nvidia.com
resources:
- dynamonims
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- nvidia.com
resources:
- dynamonims/status
verbs: verbs:
- get - get
- patch - patch
......
...@@ -31,7 +31,5 @@ go.work ...@@ -31,7 +31,5 @@ go.work
*.swo *.swo
*~ *~
# Nemo K8s Operator specific
config/crd/bases/nvidia.com_nimcaches.yaml
config/crd/bases/nvidia.com_trainingworkloads.yaml
!env* !env*
\ No newline at end of file
...@@ -13,7 +13,7 @@ resources: ...@@ -13,7 +13,7 @@ resources:
namespaced: true namespaced: true
controller: true controller: true
domain: nvidia.com domain: nvidia.com
kind: DynamoNimDeployment kind: DynamoComponentDeployment
path: github.com/ai-dynamo/dynamo/deploy/dynamo/operator/api/v1alpha1 path: github.com/ai-dynamo/dynamo/deploy/dynamo/operator/api/v1alpha1
version: v1alpha1 version: v1alpha1
- api: - api:
...@@ -21,14 +21,14 @@ resources: ...@@ -21,14 +21,14 @@ resources:
namespaced: true namespaced: true
controller: true controller: true
domain: nvidia.com domain: nvidia.com
kind: DynamoNimRequest kind: DynamoComponentRequest
path: github.com/ai-dynamo/dynamo/deploy/dynamo/operator/api/v1alpha1 path: github.com/ai-dynamo/dynamo/deploy/dynamo/operator/api/v1alpha1
version: v1alpha1 version: v1alpha1
- api: - api:
crdVersion: v1 crdVersion: v1
namespaced: true namespaced: true
domain: nvidia.com domain: nvidia.com
kind: DynamoNim kind: DynamoComponent
path: github.com/ai-dynamo/dynamo/deploy/dynamo/operator/api/v1alpha1 path: github.com/ai-dynamo/dynamo/deploy/dynamo/operator/api/v1alpha1
version: v1alpha1 version: v1alpha1
- api: - api:
...@@ -36,7 +36,7 @@ resources: ...@@ -36,7 +36,7 @@ resources:
namespaced: true namespaced: true
controller: true controller: true
domain: nvidia.com domain: nvidia.com
kind: DynamoDeployment kind: DynamoGraphDeployment
path: github.com/ai-dynamo/dynamo/deploy/dynamo/operator/api/v1alpha1 path: github.com/ai-dynamo/dynamo/deploy/dynamo/operator/api/v1alpha1
version: v1alpha1 version: v1alpha1
version: "3" version: "3"
...@@ -5,7 +5,7 @@ A Kubernetes Operator to manage all Dynamo pipelines using custom resources. ...@@ -5,7 +5,7 @@ A Kubernetes Operator to manage all Dynamo pipelines using custom resources.
## Overview ## Overview
This operator automates the deployment and lifecycle management of `DynamoDeployment` resources in Kubernetes clusters. This operator automates the deployment and lifecycle management of `DynamoGraphDeployment` resources in Kubernetes clusters.
Built with [Kubebuilder](https://book.kubebuilder.io/), it follows Kubernetes best practices and supports declarative configuration through CustomResourceDefinitions (CRDs). Built with [Kubebuilder](https://book.kubebuilder.io/), it follows Kubernetes best practices and supports declarative configuration through CustomResourceDefinitions (CRDs).
......
...@@ -26,7 +26,6 @@ import ( ...@@ -26,7 +26,6 @@ import (
type DynamoComponent struct { type DynamoComponent struct {
PresignedDownloadUrl string `json:"presigned_download_url"` PresignedDownloadUrl string `json:"presigned_download_url"`
TransmissionStrategy *TransmissionStrategy `json:"transmission_strategy"` TransmissionStrategy *TransmissionStrategy `json:"transmission_strategy"`
Manifest *DynamoComponentManifest `json:"manifest"`
} }
type TransmissionStrategy string type TransmissionStrategy string
...@@ -36,11 +35,6 @@ const ( ...@@ -36,11 +35,6 @@ const (
TransmissionStrategyProxy TransmissionStrategy = "proxy" TransmissionStrategyProxy TransmissionStrategy = "proxy"
) )
type DynamoComponentManifest struct {
BentomlVersion string `json:"bentoml_version"`
Models []string `json:"models"`
}
type Duration time.Duration type Duration time.Duration
func (d Duration) MarshalJSON() ([]byte, error) { func (d Duration) MarshalJSON() ([]byte, error) {
......
...@@ -21,42 +21,28 @@ package v1alpha1 ...@@ -21,42 +21,28 @@ package v1alpha1
import ( import (
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// DynamoNimSpec defines the desired state of DynamoNim // DynamoComponentSpec defines the desired state of DynamoComponent
type DynamoNimSpec struct { type DynamoComponentSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file // Important: Run "make" to regenerate code after modifying this file
// +kubebuilder:validation:Required // +kubebuilder:validation:Required
Tag string `json:"tag"` DynamoComponent string `json:"dynamoComponent"`
// +kubebuilder:validation:Required // +kubebuilder:validation:Required
Image string `json:"image"` Image string `json:"image"`
ServiceName string `json:"serviceName,omitempty"` ServiceName string `json:"serviceName,omitempty"`
Context *BentoContext `json:"context,omitempty"`
Models []BentoModel `json:"models,omitempty"`
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"` ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
} }
type BentoContext struct { // DynamoComponentStatus defines the observed state of DynamoComponent
BentomlVersion string `json:"bentomlVersion,omitempty"` type DynamoComponentStatus struct {
}
type BentoModel struct {
// +kubebuilder:validation:Required
Tag string `json:"tag"`
DownloadURL string `json:"downloadUrl,omitempty"`
Size *resource.Quantity `json:"size,omitempty"`
}
// DynamoNimStatus defines the observed state of DynamoNim
type DynamoNimStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file // Important: Run "make" to regenerate code after modifying this file
Ready bool `json:"ready"` Ready bool `json:"ready"`
...@@ -65,24 +51,24 @@ type DynamoNimStatus struct { ...@@ -65,24 +51,24 @@ type DynamoNimStatus struct {
// +kubebuilder:object:root=true // +kubebuilder:object:root=true
// +kubebuilder:subresource:status // +kubebuilder:subresource:status
// DynamoNim is the Schema for the dynamonims API // DynamoComponent is the Schema for the dynamocomponents API
type DynamoNim struct { type DynamoComponent struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"` metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DynamoNimSpec `json:"spec,omitempty"` Spec DynamoComponentSpec `json:"spec,omitempty"`
Status DynamoNimStatus `json:"status,omitempty"` Status DynamoComponentStatus `json:"status,omitempty"`
} }
// +kubebuilder:object:root=true // +kubebuilder:object:root=true
// DynamoNimList contains a list of DynamoNim // DynamoComponentList contains a list of DynamoComponent
type DynamoNimList struct { type DynamoComponentList struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"` metav1.ListMeta `json:"metadata,omitempty"`
Items []DynamoNim `json:"items"` Items []DynamoComponent `json:"items"`
} }
func init() { func init() {
SchemeBuilder.Register(&DynamoNim{}, &DynamoNimList{}) SchemeBuilder.Register(&DynamoComponent{}, &DynamoComponentList{})
} }
...@@ -26,28 +26,28 @@ import ( ...@@ -26,28 +26,28 @@ import (
) )
const ( const (
DynamoDeploymentConditionTypeAvailable = "Available" DynamoGraphDeploymentConditionTypeAvailable = "Available"
DynamoDeploymentConditionTypeDynamoNimFound = "DynamoNimFound" DynamoGraphDeploymentConditionTypeDynamoComponentFound = "DynamoComponentFound"
DynamoDeploymentConditionTypeDynamoNimRequestFound = "DynamoNimRequestFound" DynamoGraphDeploymentConditionTypeDynamoComponentRequestFound = "DynamoComponentRequestFound"
) )
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// DynamoNimDeploymentSpec defines the desired state of DynamoNimDeployment // DynamoComponentDeploymentSpec defines the desired state of DynamoComponentDeployment
type DynamoNimDeploymentSpec struct { type DynamoComponentDeploymentSpec struct {
DynamoNim string `json:"dynamoNim"` DynamoComponent string `json:"dynamoComponent"`
// contains the tag of the DynamoNim: for example, "my_package:MyService" // contains the tag of the DynamoComponent: for example, "my_package:MyService"
DynamoTag string `json:"dynamoTag"` DynamoTag string `json:"dynamoTag"`
DynamoNimDeploymentSharedSpec `json:",inline"` DynamoComponentDeploymentSharedSpec `json:",inline"`
} }
type DynamoNimDeploymentOverridesSpec struct { type DynamoComponentDeploymentOverridesSpec struct {
DynamoNimDeploymentSharedSpec `json:",inline"` DynamoComponentDeploymentSharedSpec `json:",inline"`
} }
type DynamoNimDeploymentSharedSpec struct { type DynamoComponentDeploymentSharedSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file // Important: Run "make" to regenerate code after modifying this file
...@@ -108,8 +108,8 @@ type IngressSpec struct { ...@@ -108,8 +108,8 @@ type IngressSpec struct {
IngressControllerClassName *string `json:"ingressControllerClassName,omitempty"` IngressControllerClassName *string `json:"ingressControllerClassName,omitempty"`
} }
// DynamoNimDeploymentStatus defines the observed state of DynamoNimDeployment // DynamoComponentDeploymentStatus defines the observed state of DynamoComponentDeployment
type DynamoNimDeploymentStatus struct { type DynamoComponentDeploymentStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file // Important: Run "make" to regenerate code after modifying this file
Conditions []metav1.Condition `json:"conditions"` Conditions []metav1.Condition `json:"conditions"`
...@@ -121,45 +121,45 @@ type DynamoNimDeploymentStatus struct { ...@@ -121,45 +121,45 @@ type DynamoNimDeploymentStatus struct {
//+kubebuilder:object:root=true //+kubebuilder:object:root=true
//+kubebuilder:subresource:status //+kubebuilder:subresource:status
//+kubebuilder:storageversion //+kubebuilder:storageversion
//+kubebuilder:printcolumn:name="Bento",type="string",JSONPath=".spec.bento",description="Bento" //+kubebuilder:printcolumn:name="DynamoComponent",type="string",JSONPath=".spec.dynamoComponent",description="Dynamo component"
//+kubebuilder:printcolumn:name="Available",type="string",JSONPath=".status.conditions[?(@.type=='Available')].status",description="Available" //+kubebuilder:printcolumn:name="Available",type="string",JSONPath=".status.conditions[?(@.type=='Available')].status",description="Available"
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" //+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// DynamoNimDeployment is the Schema for the dynamonimdeployments API // DynamoComponentDeployment is the Schema for the dynamocomponentdeployments API
type DynamoNimDeployment struct { type DynamoComponentDeployment struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"` metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DynamoNimDeploymentSpec `json:"spec,omitempty"` Spec DynamoComponentDeploymentSpec `json:"spec,omitempty"`
Status DynamoNimDeploymentStatus `json:"status,omitempty"` Status DynamoComponentDeploymentStatus `json:"status,omitempty"`
} }
// +kubebuilder:object:root=true // +kubebuilder:object:root=true
// DynamoNimDeploymentList contains a list of DynamoNimDeployment // DynamoComponentDeploymentList contains a list of DynamoComponentDeployment
type DynamoNimDeploymentList struct { type DynamoComponentDeploymentList struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"` metav1.ListMeta `json:"metadata,omitempty"`
Items []DynamoNimDeployment `json:"items"` Items []DynamoComponentDeployment `json:"items"`
} }
func init() { func init() {
SchemeBuilder.Register(&DynamoNimDeployment{}, &DynamoNimDeploymentList{}) SchemeBuilder.Register(&DynamoComponentDeployment{}, &DynamoComponentDeploymentList{})
} }
func (s *DynamoNimDeploymentStatus) IsReady() bool { func (s *DynamoComponentDeploymentStatus) IsReady() bool {
for _, condition := range s.Conditions { for _, condition := range s.Conditions {
if condition.Type == DynamoDeploymentConditionTypeAvailable && condition.Status == metav1.ConditionTrue { if condition.Type == DynamoGraphDeploymentConditionTypeAvailable && condition.Status == metav1.ConditionTrue {
return true return true
} }
} }
return false return false
} }
func (s *DynamoNimDeployment) GetSpec() any { func (s *DynamoComponentDeployment) GetSpec() any {
return s.Spec return s.Spec
} }
func (s *DynamoNimDeployment) SetSpec(spec any) { func (s *DynamoComponentDeployment) SetSpec(spec any) {
s.Spec = spec.(DynamoNimDeploymentSpec) s.Spec = spec.(DynamoComponentDeploymentSpec)
} }
...@@ -27,28 +27,26 @@ import ( ...@@ -27,28 +27,26 @@ import (
) )
const ( const (
DynamoNimRequestConditionTypeModelsSeeding = "ModelsSeeding" DynamoComponentRequestConditionTypeModelsSeeding = "ModelsSeeding"
DynamoNimRequestConditionTypeImageBuilding = "ImageBuilding" DynamoComponentRequestConditionTypeImageBuilding = "ImageBuilding"
DynamoNimRequestConditionTypeImageExists = "ImageExists" DynamoComponentRequestConditionTypeImageExists = "ImageExists"
DynamoNimRequestConditionTypeImageExistsChecked = "ImageExistsChecked" DynamoComponentRequestConditionTypeImageExistsChecked = "ImageExistsChecked"
DynamoNimRequestConditionTypeModelsExists = "ModelsExists" DynamoComponentRequestConditionTypeModelsExists = "ModelsExists"
DynamoNimRequestConditionTypeDynamoNimAvailable = "DynamoNimAvailable" DynamoComponentRequestConditionTypeDynamoComponentAvailable = "DynamoComponentAvailable"
) )
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// DynamoNimRequestSpec defines the desired state of DynamoNimRequest // DynamoComponentRequestSpec defines the desired state of DynamoComponentRequest
type DynamoNimRequestSpec struct { type DynamoComponentRequestSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file // Important: Run "make" to regenerate code after modifying this file
// +kubebuilder:validation:Required // +kubebuilder:validation:Required
BentoTag string `json:"bentoTag"` DynamoComponent string `json:"dynamoComponent"`
DownloadURL string `json:"downloadUrl,omitempty"` DownloadURL string `json:"downloadUrl,omitempty"`
ServiceName string `json:"serviceName,omitempty"` ServiceName string `json:"serviceName,omitempty"`
Context *BentoContext `json:"context,omitempty"`
Models []BentoModel `json:"models,omitempty"`
// +kubebuilder:validation:Optional // +kubebuilder:validation:Optional
Image string `json:"image,omitempty"` Image string `json:"image,omitempty"`
...@@ -77,8 +75,8 @@ type DynamoNimRequestSpec struct { ...@@ -77,8 +75,8 @@ type DynamoNimRequestSpec struct {
DownloaderContainerEnvFrom []corev1.EnvFromSource `json:"downloaderContainerEnvFrom,omitempty"` DownloaderContainerEnvFrom []corev1.EnvFromSource `json:"downloaderContainerEnvFrom,omitempty"`
} }
// DynamoNimRequestStatus defines the observed state of DynamoNimRequest // DynamoComponentRequestStatus defines the observed state of DynamoComponentRequest
type DynamoNimRequestStatus struct { type DynamoComponentRequestStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file // Important: Run "make" to regenerate code after modifying this file
Conditions []metav1.Condition `json:"conditions"` Conditions []metav1.Condition `json:"conditions"`
...@@ -87,39 +85,38 @@ type DynamoNimRequestStatus struct { ...@@ -87,39 +85,38 @@ type DynamoNimRequestStatus struct {
//+genclient //+genclient
//+kubebuilder:object:root=true //+kubebuilder:object:root=true
//+kubebuilder:subresource:status //+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Bento-Tag",type="string",JSONPath=".spec.bentoTag",description="Bento Tag" //+kubebuilder:printcolumn:name="DynamoComponent",type="string",JSONPath=".spec.dynamoComponent",description="Dynamo component"
//+kubebuilder:printcolumn:name="Download-Url",type="string",JSONPath=".spec.downloadUrl",description="Download URL" //+kubebuilder:printcolumn:name="Download-Url",type="string",JSONPath=".spec.downloadUrl",description="Download URL"
//+kubebuilder:printcolumn:name="Image",type="string",JSONPath=".spec.image",description="Image"
//+kubebuilder:printcolumn:name="Image-Exists",type="string",JSONPath=".status.conditions[?(@.type=='ImageExists')].status",description="Image Exists" //+kubebuilder:printcolumn:name="Image-Exists",type="string",JSONPath=".status.conditions[?(@.type=='ImageExists')].status",description="Image Exists"
//+kubebuilder:printcolumn:name="Bento-Available",type="string",JSONPath=".status.conditions[?(@.type=='BentoAvailable')].status",description="Bento Available" //+kubebuilder:printcolumn:name="DynamoComponent-Available",type="string",JSONPath=".status.conditions[?(@.type=='DynamoComponentAvailable')].status",description="Dynamo Component Available"
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" //+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// DynamoNimRequest is the Schema for the dynamonimrequests API // DynamoComponentRequest is the Schema for the dynamocomponentrequests API
type DynamoNimRequest struct { type DynamoComponentRequest struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"` metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DynamoNimRequestSpec `json:"spec,omitempty"` Spec DynamoComponentRequestSpec `json:"spec,omitempty"`
Status DynamoNimRequestStatus `json:"status,omitempty"` Status DynamoComponentRequestStatus `json:"status,omitempty"`
} }
//+kubebuilder:object:root=true //+kubebuilder:object:root=true
// DynamoNimRequestList contains a list of DynamoNimRequest // DynamoComponentRequestList contains a list of DynamoComponentRequest
type DynamoNimRequestList struct { type DynamoComponentRequestList struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"` metav1.ListMeta `json:"metadata,omitempty"`
Items []DynamoNimRequest `json:"items"` Items []DynamoComponentRequest `json:"items"`
} }
func init() { func init() {
SchemeBuilder.Register(&DynamoNimRequest{}, &DynamoNimRequestList{}) SchemeBuilder.Register(&DynamoComponentRequest{}, &DynamoComponentRequestList{})
} }
func (s *DynamoNimRequest) GetSpec() any { func (s *DynamoComponentRequest) GetSpec() any {
return s.Spec return s.Spec
} }
func (s *DynamoNimRequest) SetSpec(spec any) { func (s *DynamoComponentRequest) SetSpec(spec any) {
s.Spec = spec.(DynamoNimRequestSpec) s.Spec = spec.(DynamoComponentRequestSpec)
} }
...@@ -29,23 +29,23 @@ import ( ...@@ -29,23 +29,23 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// DynamoDeploymentSpec defines the desired state of DynamoDeployment. // DynamoGraphDeploymentSpec defines the desired state of DynamoGraphDeployment.
type DynamoDeploymentSpec struct { type DynamoGraphDeploymentSpec struct {
// required // required
DynamoNim string `json:"dynamoNim"` DynamoGraph string `json:"dynamoGraph"`
// optional // optional
// key is the name of the service defined in DynamoNim // key is the name of the service defined in DynamoComponent
// value is the DynamoNimDeployment override for that service // value is the DynamoComponentDeployment override for that service
// if not set, the DynamoNimDeployment will be used as is // if not set, the DynamoComponentDeployment will be used as is
// +kubebuilder:validation:Optional // +kubebuilder:validation:Optional
Services map[string]*DynamoNimDeploymentOverridesSpec `json:"services,omitempty"` Services map[string]*DynamoComponentDeploymentOverridesSpec `json:"services,omitempty"`
// Environment variables to be set in the deployment // Environment variables to be set in the deployment
// +kubebuilder:validation:Optional // +kubebuilder:validation:Optional
Envs []corev1.EnvVar `json:"envs,omitempty"` Envs []corev1.EnvVar `json:"envs,omitempty"`
} }
// DynamoDeploymentStatus defines the observed state of DynamoDeployment. // DynamoGraphDeploymentStatus defines the observed state of DynamoGraphDeployment.
type DynamoDeploymentStatus struct { type DynamoGraphDeploymentStatus struct {
State string `json:"state,omitempty"` State string `json:"state,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
} }
...@@ -53,41 +53,41 @@ type DynamoDeploymentStatus struct { ...@@ -53,41 +53,41 @@ type DynamoDeploymentStatus struct {
// +kubebuilder:object:root=true // +kubebuilder:object:root=true
// +kubebuilder:subresource:status // +kubebuilder:subresource:status
// DynamoDeployment is the Schema for the dynamodeployments API. // DynamoGraphDeployment is the Schema for the dynamographdeployments API.
type DynamoDeployment struct { type DynamoGraphDeployment struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"` metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DynamoDeploymentSpec `json:"spec,omitempty"` Spec DynamoGraphDeploymentSpec `json:"spec,omitempty"`
Status DynamoDeploymentStatus `json:"status,omitempty"` Status DynamoGraphDeploymentStatus `json:"status,omitempty"`
} }
func (s *DynamoDeployment) SetState(state string) { func (s *DynamoGraphDeployment) SetState(state string) {
s.Status.State = state s.Status.State = state
} }
// +kubebuilder:object:root=true // +kubebuilder:object:root=true
// DynamoDeploymentList contains a list of DynamoDeployment. // DynamoGraphDeploymentList contains a list of DynamoGraphDeployment.
type DynamoDeploymentList struct { type DynamoGraphDeploymentList struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"` metav1.ListMeta `json:"metadata,omitempty"`
Items []DynamoDeployment `json:"items"` Items []DynamoGraphDeployment `json:"items"`
} }
func init() { func init() {
SchemeBuilder.Register(&DynamoDeployment{}, &DynamoDeploymentList{}) SchemeBuilder.Register(&DynamoGraphDeployment{}, &DynamoGraphDeploymentList{})
} }
func (s *DynamoDeployment) GetSpec() any { func (s *DynamoGraphDeployment) GetSpec() any {
return s.Spec return s.Spec
} }
func (s *DynamoDeployment) SetSpec(spec any) { func (s *DynamoGraphDeployment) SetSpec(spec any) {
s.Spec = spec.(DynamoDeploymentSpec) s.Spec = spec.(DynamoGraphDeploymentSpec)
} }
func (s *DynamoDeployment) SetEndpointStatus(isSecured bool, endpointHost string) { func (s *DynamoGraphDeployment) SetEndpointStatus(isSecured bool, endpointHost string) {
protocol := "http" protocol := "http"
if isSecured { if isSecured {
protocol = "https" protocol = "https"
...@@ -101,7 +101,7 @@ func (s *DynamoDeployment) SetEndpointStatus(isSecured bool, endpointHost string ...@@ -101,7 +101,7 @@ func (s *DynamoDeployment) SetEndpointStatus(isSecured bool, endpointHost string
}) })
} }
func (s *DynamoDeployment) AddStatusCondition(condition metav1.Condition) { func (s *DynamoGraphDeployment) AddStatusCondition(condition metav1.Condition) {
if s.Status.Conditions == nil { if s.Status.Conditions == nil {
s.Status.Conditions = []metav1.Condition{} s.Status.Conditions = []metav1.Condition{}
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment