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