Commit 602352ce authored by Neelay Shah's avatar Neelay Shah Committed by GitHub
Browse files

chore: rename dynamo (#44)


Co-authored-by: default avatarBiswa Panda <biswa.panda@gmail.com>
parent ecf53ce2
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
import (
"database/sql/driver"
"encoding/json"
)
type DeploymentTargetCanaryRuleType string
const (
DeploymentTargetCanaryRuleTypeWeight DeploymentTargetCanaryRuleType = "weight"
DeploymentTargetCanaryRuleTypeHeader DeploymentTargetCanaryRuleType = "header"
DeploymentTargetCanaryRuleTypeCookie DeploymentTargetCanaryRuleType = "cookie"
)
type DeploymentTargetCanaryRule struct {
Type DeploymentTargetCanaryRuleType `json:"type" enum:"weight,header,cookie"`
Weight *uint `json:"weight"`
Header *string `json:"header"`
Cookie *string `json:"cookie"`
HeaderValue *string `json:"header_value"`
}
type DeploymentTargetCanaryRules []*DeploymentTargetCanaryRule
func (c *DeploymentTargetCanaryRules) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal([]byte(value.(string)), c)
}
func (c *DeploymentTargetCanaryRules) Value() (driver.Value, error) {
if c == nil {
return nil, nil
}
return json.Marshal(c)
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
import (
"database/sql/driver"
"encoding/json"
"errors"
"time"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
compoundaiCommon "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/common"
)
type Duration time.Duration
func (d Duration) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Duration(d).String())
}
func (d *Duration) UnmarshalJSON(b []byte) error {
var v interface{}
if err := json.Unmarshal(b, &v); err != nil {
return err
}
switch value := v.(type) {
case float64:
*d = Duration(time.Duration(value))
return nil
case string:
tmp, err := time.ParseDuration(value)
if err != nil {
return err
}
*d = Duration(tmp)
return nil
default:
return errors.New("invalid duration")
}
}
type DeploymentTargetType string
const (
DeploymentTargetTypeStable DeploymentTargetType = "stable"
DeploymentTargetTypeCanary DeploymentTargetType = "canary"
)
var DeploymentTargetTypeAddrs = map[DeploymentTargetType]string{
DeploymentTargetTypeStable: "stb",
DeploymentTargetTypeCanary: "cnr",
}
type DeploymentTargetResourceItem struct {
CPU string `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
GPU string `json:"gpu,omitempty"`
Custom map[string]string `json:"custom,omitempty"`
}
func (in *DeploymentTargetResourceItem) DeepCopyInto(out *DeploymentTargetResourceItem) {
*out = *in
if in.Custom != nil {
in, out := &in.Custom, &out.Custom
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
type DeploymentTargetResources struct {
Requests *DeploymentTargetResourceItem `json:"requests,omitempty"`
Limits *DeploymentTargetResourceItem `json:"limits,omitempty"`
}
func (in *DeploymentTargetResources) DeepCopy() (out *DeploymentTargetResources) {
if in == nil {
return nil
}
out = new(DeploymentTargetResources)
in.DeepCopyInto(out)
return
}
func (in *DeploymentTargetResources) DeepCopyInto(out *DeploymentTargetResources) {
*out = *in
if in.Requests != nil {
in, out := &in.Requests, &out.Requests
*out = new(DeploymentTargetResourceItem)
(*in).DeepCopyInto(*out)
}
if in.Limits != nil {
in, out := &in.Limits, &out.Limits
*out = new(DeploymentTargetResourceItem)
(*in).DeepCopyInto(*out)
}
}
type HPAMetricType string
const (
HPAMetricTypeMemory HPAMetricType = "memory"
HPAMetricTypeCPU HPAMetricType = "cpu"
HPAMetricTypeGPU HPAMetricType = "gpu"
HPAMetricTypeQPS HPAMetricType = "qps"
)
type HPAMetric struct {
Type HPAMetricType `json:"type"`
Value *resource.Quantity `json:"value"`
}
func (in *HPAMetric) DeepCopy() (out *HPAMetric) {
if in == nil {
return nil
}
out = new(HPAMetric)
in.DeepCopyInto(out)
return
}
func (in *HPAMetric) DeepCopyInto(out *HPAMetric) {
*out = *in
if in.Value != nil {
in, out := &in.Value, &out.Value
*out = new(resource.Quantity)
**out = (*in).DeepCopy()
}
}
type HPAScaleBehavior string
const (
HPAScaleBehaviorDisabled HPAScaleBehavior = "disabled"
HPAScaleBehaviorStable HPAScaleBehavior = "stable"
HPAScaleBehaviorFast HPAScaleBehavior = "fast"
)
type HPAPolicy struct {
Metrics []HPAMetric `json:"metrics,omitempty"`
ScaleDownBehavior *HPAScaleBehavior `json:"scale_down_behavior,omitempty"`
ScaleUpBehavior *HPAScaleBehavior `json:"scale_up_behavior,omitempty"`
}
func (in *HPAPolicy) DeepCopy() (out *HPAPolicy) {
if in == nil {
return nil
}
out = new(HPAPolicy)
in.DeepCopyInto(out)
return
}
func (in *HPAPolicy) DeepCopyInto(out *HPAPolicy) {
*out = *in
if in.Metrics != nil {
in, out := &in.Metrics, &out.Metrics
*out = make([]HPAMetric, len(*in))
copy(*out, *in)
}
if in.ScaleDownBehavior != nil {
out.ScaleDownBehavior = new(HPAScaleBehavior)
*out.ScaleDownBehavior = *in.ScaleDownBehavior
}
if in.ScaleUpBehavior != nil {
out.ScaleUpBehavior = new(HPAScaleBehavior)
*out.ScaleUpBehavior = *in.ScaleUpBehavior
}
}
type DeploymentTargetHPAConf struct {
CPU *int32 `json:"cpu,omitempty"`
GPU *int32 `json:"gpu,omitempty"`
Memory *string `json:"memory,omitempty"`
QPS *int64 `json:"qps,omitempty"`
MinReplicas *int32 `json:"min_replicas,omitempty"`
MaxReplicas *int32 `json:"max_replicas,omitempty"`
Policy *HPAPolicy `json:"policy,omitempty"`
}
func (in *DeploymentTargetHPAConf) DeepCopy() (out *DeploymentTargetHPAConf) {
if in == nil {
return nil
}
out = new(DeploymentTargetHPAConf)
in.DeepCopyInto(out)
return
}
func (in *DeploymentTargetHPAConf) DeepCopyInto(out *DeploymentTargetHPAConf) {
*out = *in
if in.CPU != nil {
out.CPU = new(int32)
*out.CPU = *in.CPU
}
if in.GPU != nil {
out.GPU = new(int32)
*out.GPU = *in.GPU
}
if in.Memory != nil {
out.Memory = new(string)
*out.Memory = *in.Memory
}
if in.QPS != nil {
out.QPS = new(int64)
*out.QPS = *in.QPS
}
if in.MinReplicas != nil {
out.MinReplicas = new(int32)
*out.MinReplicas = *in.MinReplicas
}
if in.MaxReplicas != nil {
out.MaxReplicas = new(int32)
*out.MaxReplicas = *in.MaxReplicas
}
}
type BentoRequestOverrides struct {
ImageBuildTimeout *Duration `json:"imageBuildTimeout,omitempty"`
ImageBuilderExtraPodMetadata *compoundaiCommon.ExtraPodMetadata `json:"imageBuilderExtraPodMetadata,omitempty"`
ImageBuilderExtraPodSpec *compoundaiCommon.ExtraPodSpec `json:"imageBuilderExtraPodSpec,omitempty"`
ImageBuilderExtraContainerEnv []corev1.EnvVar `json:"imageBuilderExtraContainerEnv,omitempty"`
ImageBuilderContainerResources *corev1.ResourceRequirements `json:"imageBuilderContainerResources,omitempty"`
DockerConfigJSONSecretName string `json:"dockerConfigJsonSecretName,omitempty"`
DownloaderContainerEnvFrom []corev1.EnvFromSource `json:"downloaderContainerEnvFrom,omitempty"`
}
type ApiServerBentoDeploymentOverrides struct {
MonitorExporter *compoundaiCommon.MonitorExporterSpec `json:"monitorExporter,omitempty"`
ExtraPodMetadata *compoundaiCommon.ExtraPodMetadata `json:"extraPodMetadata,omitempty"`
ExtraPodSpec *compoundaiCommon.ExtraPodSpec `json:"extraPodSpec,omitempty"`
}
type RunnerBentoDeploymentOverrides struct {
ExtraPodMetadata *compoundaiCommon.ExtraPodMetadata `json:"extraPodMetadata,omitempty"`
ExtraPodSpec *compoundaiCommon.ExtraPodSpec `json:"extraPodSpec,omitempty"`
}
type DeploymentTargetRunnerConfig struct {
ResourceInstance *string `json:"resource_instance,omitempty"`
Resources *DeploymentTargetResources `json:"resources,omitempty"`
HPAConf *DeploymentTargetHPAConf `json:"hpa_conf,omitempty"`
Envs *[]*LabelItemSchema `json:"envs,omitempty"`
EnableStealingTrafficDebugMode *bool `json:"enable_stealing_traffic_debug_mode,omitempty"`
EnableDebugMode *bool `json:"enable_debug_mode,omitempty"`
EnableDebugPodReceiveProductionTraffic *bool `json:"enable_debug_pod_receive_production_traffic,omitempty"`
DeploymentStrategy *DeploymentStrategy `json:"deployment_strategy,omitempty"`
BentoDeploymentOverrides *RunnerBentoDeploymentOverrides `json:"bento_deployment_overrides,omitempty"`
TrafficControl *TrafficControlConfig `json:"traffic_control,omitempty"`
DeploymentColdStartWaitTimeout *Duration `json:"deployment_cold_start_wait_timeout,omitempty"`
}
func (in *DeploymentTargetRunnerConfig) DeepCopy() (out *DeploymentTargetRunnerConfig) {
if in == nil {
return nil
}
out = new(DeploymentTargetRunnerConfig)
in.DeepCopyInto(out)
return
}
func (in *DeploymentTargetRunnerConfig) DeepCopyInto(out *DeploymentTargetRunnerConfig) {
*out = *in
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(DeploymentTargetResources)
(*in).DeepCopyInto(*out)
}
if in.HPAConf != nil {
in, out := &in.HPAConf, &out.HPAConf
*out = new(DeploymentTargetHPAConf)
(*in).DeepCopyInto(*out)
}
if in.Envs != nil {
out.Envs = new([]*LabelItemSchema)
for _, item := range *in.Envs {
newItem := new(LabelItemSchema)
item.DeepCopyInto(newItem)
*out.Envs = append(*out.Envs, newItem)
}
}
}
type DeploymentStrategy string
const (
DeploymentStrategyRollingUpdate DeploymentStrategy = "RollingUpdate"
DeploymentStrategyRecreate DeploymentStrategy = "Recreate"
DeploymentStrategyRampedSlowRollout DeploymentStrategy = "RampedSlowRollout"
DeploymentStrategyBestEffortControlledRollout DeploymentStrategy = "BestEffortControlledRollout"
)
type TrafficControlConfig struct {
Timeout *Duration `json:"timeout,omitempty"`
RequestQueue *RequestQueueConfig `json:"request_queue,omitempty"`
}
type RequestQueueConfig struct {
Enabled *bool `json:"enabled,omitempty"`
MaxConsumeConcurrency *int32 `json:"max_consume_concurrency,omitempty"`
}
type DeploymentTargetConfig struct {
KubeResourceUid string `json:"kubeResourceUid"`
KubeResourceVersion string `json:"kubeResourceVersion"`
ResourceInstance *string `json:"resource_instance,omitempty"`
Resources *DeploymentTargetResources `json:"resources"`
HPAConf *DeploymentTargetHPAConf `json:"hpa_conf,omitempty"`
Envs *[]*LabelItemSchema `json:"envs,omitempty"`
Runners map[string]DeploymentTargetRunnerConfig `json:"runners,omitempty"`
EnableIngress *bool `json:"enable_ingress,omitempty"`
EnableStealingTrafficDebugMode *bool `json:"enable_stealing_traffic_debug_mode,omitempty"`
EnableDebugMode *bool `json:"enable_debug_mode,omitempty"`
EnableDebugPodReceiveProductionTraffic *bool `json:"enable_debug_pod_receive_production_traffic,omitempty"`
DeploymentStrategy *DeploymentStrategy `json:"deployment_strategy,omitempty"`
BentoDeploymentOverrides *ApiServerBentoDeploymentOverrides `json:"bento_deployment_overrides,omitempty"`
BentoRequestOverrides *BentoRequestOverrides `json:"bento_request_overrides,omitempty"`
TrafficControl *TrafficControlConfig `json:"traffic_control,omitempty"`
DeploymentColdStartWaitTimeout *Duration `json:"deployment_cold_start_wait_timeout,omitempty"`
}
func (in *DeploymentTargetConfig) DeepCopy() (out *DeploymentTargetConfig) {
if in == nil {
return nil
}
out = new(DeploymentTargetConfig)
in.DeepCopyInto(out)
return
}
func (in *DeploymentTargetConfig) DeepCopyInto(out *DeploymentTargetConfig) {
*out = *in
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(DeploymentTargetResources)
(*in).DeepCopyInto(*out)
}
if in.HPAConf != nil {
in, out := &in.HPAConf, &out.HPAConf
*out = new(DeploymentTargetHPAConf)
(*in).DeepCopyInto(*out)
}
if in.Envs != nil {
out.Envs = new([]*LabelItemSchema)
for _, item := range *in.Envs {
newItem := new(LabelItemSchema)
item.DeepCopyInto(newItem)
*out.Envs = append(*out.Envs, newItem)
}
}
}
func (c *DeploymentTargetConfig) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal([]byte(value.(string)), c)
}
func (c *DeploymentTargetConfig) Value() (driver.Value, error) {
if c == nil {
return nil, nil
}
return json.Marshal(c)
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
type DockerRegistrySchema struct {
BentosRepositoryURI string `json:"bentosRepositoryURI"`
ModelsRepositoryURI string `json:"modelsRepositoryURI"`
BentosRepositoryURIInCluster string `json:"bentosRepositoryURIInCluster"`
ModelsRepositoryURIInCluster string `json:"modelsRepositoryURIInCluster"`
Server string `json:"server"`
Username string `json:"username"`
Password string `json:"password"`
Secure bool `json:"secure"`
}
type DockerRegistryRefSchema struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Key string `json:"key"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
import (
"database/sql/driver"
"encoding/json"
)
type EventStatus string
const (
EventStatusPending EventStatus = "pending"
EventStatusSuccess EventStatus = "success"
EventStatusFailed EventStatus = "failed"
)
func (e EventStatus) Ptr() *EventStatus {
return &e
}
type EventInfo struct {
ResourceName string `json:"resource_name"`
}
func (c *EventInfo) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal([]byte(value.(string)), c)
}
func (c *EventInfo) Value() (driver.Value, error) {
if c == nil {
return nil, nil
}
return json.Marshal(c)
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
import apiv1 "k8s.io/api/core/v1"
type KubePodActualStatus string
const (
KubePodActualStatusPending KubePodActualStatus = "Pending"
KubePodActualStatusRunning KubePodActualStatus = "Running"
KubePodActualStatusSucceeded KubePodActualStatus = "Succeeded"
KubePodActualStatusFailed KubePodActualStatus = "Failed"
KubePodActualStatusUnknown KubePodActualStatus = "Unknown"
KubePodActualStatusTerminating KubePodActualStatus = "Terminating"
)
type KubePodStatus struct {
Status KubePodActualStatus `json:"status"`
Phase apiv1.PodPhase `json:"phase"`
ContainerStates []apiv1.ContainerState `json:"container_states"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
type LabelItemSchema struct {
Key string `json:"key"`
Value string `json:"value"`
}
func (in *LabelItemSchema) DeepCopy() (out *LabelItemSchema) {
if in == nil {
return nil
}
out = new(LabelItemSchema)
in.DeepCopyInto(out)
return
}
func (in *LabelItemSchema) DeepCopyInto(out *LabelItemSchema) {
*out = *in
}
type LabelItemsSchema []LabelItemSchema
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
type MemberRole string
const (
MemberRoleGuest MemberRole = "guest"
MemberRoleDeveloper MemberRole = "developer"
MemberRoleAdmin MemberRole = "admin"
)
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
import (
"database/sql/driver"
"encoding/json"
)
type ModelUploadStatus string
const (
ModelUploadStatusPending ModelUploadStatus = "pending"
ModelUploadStatusUploading ModelUploadStatus = "uploading"
ModelUploadStatusSuccess ModelUploadStatus = "success"
ModelUploadStatusFailed ModelUploadStatus = "failed"
)
type ModelManifestSchema struct {
BentomlVersion string `json:"bentoml_version"`
ApiVersion string `json:"api_version"`
Module string `json:"module"`
Metadata map[string]interface{} `json:"metadata"`
Context map[string]interface{} `json:"context"`
Options map[string]interface{} `json:"options"`
SizeBytes uint `json:"size_bytes"`
}
func (c *ModelManifestSchema) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal(value.([]byte), c)
}
func (c *ModelManifestSchema) Value() (driver.Value, error) {
if c == nil {
return nil, nil
}
return json.Marshal(c)
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
import (
"database/sql/driver"
"encoding/json"
)
type AWSS3Schema struct {
BentosBucketName string `json:"bentos_bucket_name"`
ModelsBucketName string `json:"models_bucket_name"`
Region string `json:"region"`
}
type AWSECRSchema struct {
AccountId string `json:"account_id"`
BentosRepositoryName string `json:"bentos_repository_name"`
ModelsRepositoryName string `json:"models_repository_name"`
Password string `json:"password"`
Region string `json:"region"`
}
type OrganizationConfigAWSSchema struct {
AccessKeyId string `json:"access_key_id"`
SecretAccessKey string `json:"secret_access_key"`
ECR *AWSECRSchema `json:"ecr"`
S3 *AWSS3Schema `json:"s3"`
}
type OrganizationDockerRegistrySchema struct {
BentosRepositoryURI string `json:"bentos_repository_uri"`
ModelsRepositoryURI string `json:"models_repository_uri"`
Server string `json:"server"`
Username string `json:"username"`
Password string `json:"password"`
Secure bool `json:"secure"`
}
type OrganizationS3Schema struct {
Endpoint string `json:"endpoint"`
AccessKey string `json:"access_key"`
SecretKey string `json:"secret_key"`
Secure bool `json:"secure"`
Region string `json:"region"`
BentosBucketName string `json:"bentos_bucket_name"`
ModelsBucketName string `json:"models_bucket_name"`
}
type OrganizationConfigSchema struct {
MajorClusterUid string `json:"major_cluster_uid"`
AWS *OrganizationConfigAWSSchema `json:"aws,omitempty"`
DockerRegistry *OrganizationDockerRegistrySchema `json:"docker_registry,omitempty"`
S3 *OrganizationS3Schema `json:"s3,omitempty"`
TransmissionStrategy *TransmissionStrategy `json:"transmission_strategy,omitempty"`
}
func (c *OrganizationConfigSchema) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal([]byte(value.(string)), c)
}
func (c *OrganizationConfigSchema) Value() (driver.Value, error) {
if c == nil {
return nil, nil
}
return json.Marshal(c)
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
type ResourceType string
const (
ResourceTypeUser ResourceType = "user"
ResourceTypeOrganization ResourceType = "organization"
ResourceTypeCluster ResourceType = "cluster"
ResourceTypeBentoRepository ResourceType = "bento_repository"
ResourceTypeBento ResourceType = "bento"
ResourceTypeDeployment ResourceType = "deployment"
ResourceTypeDeploymentRevision ResourceType = "deployment_revision"
ResourceTypeTerminalRecord ResourceType = "terminal_record"
ResourceTypeModelRepository ResourceType = "model_repository"
ResourceTypeModel ResourceType = "model"
ResourceTypeLabel ResourceType = "label"
ResourceTypeApiToken ResourceType = "api_token"
ResourceTypeYataiComponent ResourceType = "yatai_component"
)
func (type_ ResourceType) Ptr() *ResourceType {
return &type_
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
type ResourceInstance struct {
ID string `json:"id"`
Name string `json:"name"`
Group string `json:"group"`
Description string `json:"description"`
NodeSelectors map[string]string `json:"node_selectors"`
Resources DeploymentTargetResources `json:"resources"`
Price string `json:"price"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
import (
"github.com/huandu/xstrings"
"github.com/pkg/errors"
)
type Tag string
func (t Tag) Parse() (name, version string, err error) {
name, _, version = xstrings.Partition(string(t), ":")
if version == "" {
err = errors.Errorf("tag %s is invalid", t)
return
}
return
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
import (
"database/sql/driver"
"encoding/json"
)
type RecordType string
const (
RecordTypeInput RecordType = "i"
RecordTypeOutput RecordType = "o"
)
type TerminalRecordEnv struct {
TERM string `json:"term"`
SHELL string `json:"shell"`
}
type TerminalRecordMeta struct {
Version uint `json:"version"`
Width uint16 `json:"width"`
Height uint16 `json:"height"`
Timestamp int64 `json:"timestamp"`
Env *TerminalRecordEnv `json:"env"`
}
func (m *TerminalRecordMeta) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal([]byte(value.(string)), m)
}
func (m *TerminalRecordMeta) Value() (driver.Value, error) {
if m == nil {
return nil, nil
}
return json.Marshal(m)
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
type UserPerm string
const (
UserPermDefault UserPerm = "default"
UserPermAdmin UserPerm = "admin"
)
func UserPermPtr(perm UserPerm) *UserPerm {
return &perm
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package modelschemas
import (
"database/sql/driver"
"encoding/json"
)
type YataiComponentName string
const (
YataiComponentNameDeployment YataiComponentName = "deployment"
YataiComponentNameImageBuilder YataiComponentName = "image-builder"
YataiComponentNameServerless YataiComponentName = "serverless"
YataiComponentNameFunction YataiComponentName = "function"
YataiComponentNameJob YataiComponentName = "job"
)
type YataiComponentManifestSchema struct {
SelectorLabels map[string]string `json:"selector_labels,omitempty"`
LatestCRDVersion string `json:"latest_crd_version,omitempty"`
}
func (c *YataiComponentManifestSchema) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal(value.([]byte), c)
}
func (c *YataiComponentManifestSchema) Value() (driver.Value, error) {
if c == nil {
return nil, nil
}
return json.Marshal(c)
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import (
"time"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
)
type ApiTokenSchema struct {
ResourceSchema
Description string `json:"description"`
User *UserSchema `json:"user"`
Organization *OrganizationSchema `json:"organization"`
Scopes *modelschemas.ApiTokenScopes `json:"scopes"`
ExpiredAt *time.Time `json:"expired_at"`
LastUsedAt *time.Time `json:"last_used_at"`
IsExpired bool `json:"is_expired"`
}
type ApiTokenListSchema struct {
BaseListSchema
Items []*ApiTokenSchema `json:"items"`
}
type ApiTokenFullSchema struct {
ApiTokenSchema
Token string `json:"token"`
}
type UpdateApiTokenSchema struct {
Description *string `json:"description"`
Scopes *modelschemas.ApiTokenScopes `json:"scopes"`
ExpiredAt *time.Time `json:"expired_at"`
LastUsedAt *time.Time `json:"last_used_at"`
}
type CreateApiTokenSchema struct {
Name string `json:"name"`
Description string `json:"description"`
Scopes *modelschemas.ApiTokenScopes `json:"scopes"`
ExpiredAt *time.Time `json:"expired_at"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "time"
type BaseSchema struct {
Uid string `json:"uid"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import (
"time"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
)
type BentoSchema struct {
ResourceSchema
BentoRepositoryUid string `json:"bento_repository_uid"`
Creator *UserSchema `json:"creator"`
Version string `json:"version"`
Description string `json:"description"`
ImageBuildStatus modelschemas.ImageBuildStatus `json:"image_build_status"`
UploadStatus modelschemas.BentoUploadStatus `json:"upload_status"`
UploadStartedAt *time.Time `json:"upload_started_at"`
UploadFinishedAt *time.Time `json:"upload_finished_at"`
UploadFinishedReason string `json:"upload_finished_reason"`
PresignedUploadUrl string `json:"presigned_upload_url"`
PresignedDownloadUrl string `json:"presigned_download_url"`
PresignedUrlsDeprecated bool `json:"presigned_urls_deprecated"`
TransmissionStrategy *modelschemas.TransmissionStrategy `json:"transmission_strategy"`
UploadId string `json:"upload_id"`
Manifest *modelschemas.BentoManifestSchema `json:"manifest"`
BuildAt time.Time `json:"build_at"`
}
type BentoListSchema struct {
BaseListSchema
Items []*BentoSchema `json:"items"`
}
type BentoWithRepositorySchema struct {
BentoSchema
Repository *BentoRepositorySchema `json:"repository"`
}
type BentoWithRepositoryListSchema struct {
BaseListSchema
Items []*BentoWithRepositorySchema `json:"items"`
}
type BentoFullSchema struct {
BentoWithRepositorySchema
Models []*ModelWithRepositorySchema `json:"models"`
}
type CreateBentoSchema struct {
Description string `json:"description"`
Version string `json:"version"`
Manifest *modelschemas.BentoManifestSchema `json:"manifest"`
BuildAt string `json:"build_at"`
Labels modelschemas.LabelItemsSchema `json:"labels"`
}
type UpdateBentoSchema struct {
Description string `json:"description"`
Version string `json:"version"`
Manifest **modelschemas.BentoManifestSchema `json:"manifest"`
BuildAt string `json:"build_at"`
Labels *modelschemas.LabelItemsSchema `json:"labels,omitempty"`
}
type FinishUploadBentoSchema struct {
Status *modelschemas.BentoUploadStatus `json:"status"`
Reason *string `json:"reason"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type BentoRepositorySchema struct {
ResourceSchema
Creator *UserSchema `json:"creator"`
Organization *OrganizationSchema `json:"organization"`
LatestBento *BentoSchema `json:"latest_bento"`
NBentos uint `json:"n_bentos"`
NDeployments uint `json:"n_deployments"`
LatestBentos []*BentoSchema `json:"latest_bentos"`
Description string `json:"description"`
}
type BentoRepositoryListSchema struct {
BaseListSchema
Items []*BentoRepositorySchema `json:"items"`
}
type BentoRepositoryWithLatestDeploymentsSchema struct {
BentoRepositorySchema
LatestDeployments []*DeploymentSchema `json:"latest_deployments"`
}
type BentoRepositoryWithLatestDeploymentsListSchema struct {
BaseListSchema
Items []*BentoRepositoryWithLatestDeploymentsSchema `json:"items"`
}
type CreateBentoRepositorySchema struct {
Name string `json:"name"`
Description string `json:"description"`
Labels modelschemas.LabelItemsSchema `json:"labels"`
}
type UpdateBentoRepositorySchema struct {
Description *string `json:"description"`
Labels *modelschemas.LabelItemsSchema `json:"labels,omitempty"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import (
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
)
type ClusterSchema struct {
ResourceSchema
Creator *UserSchema `json:"creator"`
Description string `json:"description"`
}
type ClusterListSchema struct {
BaseListSchema
Items []*ClusterSchema `json:"items"`
}
type ClusterFullSchema struct {
ClusterSchema
Organization *OrganizationSchema `json:"organization"`
KubeConfig *string `json:"kube_config"`
Config **modelschemas.ClusterConfigSchema `json:"config"`
GrafanaRootPath string `json:"grafana_root_path"`
}
type UpdateClusterSchema struct {
Description *string `json:"description"`
KubeConfig *string `json:"kube_config"`
Config **modelschemas.ClusterConfigSchema `json:"config"`
}
type CreateClusterSchema struct {
Description string `json:"description"`
KubeConfig string `json:"kube_config"`
Config *modelschemas.ClusterConfigSchema `json:"config"`
Name string `json:"name"`
}
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