Commit 5ddc7f7d authored by Maksim Khadkevich's avatar Maksim Khadkevich Committed by GitHub
Browse files

feat: moved compoundAI operator, APIserver, and examples (#10)

parent 14ce7e03
# SPDX-FileCopyrightText: Copyright (c) 2024-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.
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin/*
Dockerfile.cross
#temp files
*.go_save
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.out.no-mocks
# Go workspace file
go.work
# Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*
# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.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
# SPDX-FileCopyrightText: Copyright (c) 2024-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.
run:
timeout: 10m
allow-parallel-runners: true
issues:
# don't skip warning about doc comments
# don't exclude the default set of lint
exclude-use-default: false
# restore some of the defaults
# (fill in the rest as needed)
exclude-rules:
- path: "api/*"
linters:
- lll
- path: "internal/*"
linters:
- dupl
- lll
- path: "pkg/compoundai/*"
linters:
- lll
- nakedret
linters:
disable-all: true
enable:
- dupl
- errcheck
- exportloopref
- goconst
- gocyclo
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- prealloc
- staticcheck
- typecheck
- unconvert
- unparam
- unused
# SPDX-FileCopyrightText: Copyright (c) 2024-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.
VERSION 0.8
# Base container for both build and test
deps:
FROM ../../../+golang-base
COPY . /app/operator
WORKDIR /app/operator
RUN go mod download
lint:
FROM +deps
RUN golangci-lint run --config ./.golangci.yml
build:
FROM +deps
RUN CGO_ENABLED=0 go build -o manager ./cmd/main.go
SAVE ARTIFACT manager
test:
FROM +deps
RUN make test
SAVE ARTIFACT cover.out
docker:
ARG CI_REGISTRY_IMAGE=my-registry
ARG CI_COMMIT_SHA=latest
ARG IMAGE_SUFFIX=compoundai-operator
FROM urm.nvidia.com/sw-gpu-ucs-hardened-docker/distroless/go:v3.1.3-amd64
WORKDIR /
COPY +build/manager .
USER 65532:65532
CMD ["./manager"]
SAVE IMAGE --push $CI_REGISTRY_IMAGE/$IMAGE_SUFFIX:$CI_COMMIT_SHA
# SPDX-FileCopyrightText: Copyright (c) 2024-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.
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.
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.29.0
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
# CONTAINER_TOOL defines the container tool to be used for building images.
# Be aware that the target commands are only tested with Docker which is
# scaffolded by default. However, you might want to replace it to use other
# tools. (i.e. podman)
CONTAINER_TOOL ?= docker
# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec
.PHONY: all
all: build
##@ General
# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk command is responsible for reading the
# entire set of makefiles included in this invocation, looking for lines of the
# file as xyz: ## something, and then pretty-format the target and help. Then,
# if there's a line with ##@ something, that gets pretty-printed as a category.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php
.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Development
.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/bases
.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt_" paths="./..."
.PHONY: fmt
fmt: ## Run go fmt against code.
go fmt ./...
.PHONY: vet
vet: ## Run go vet against code.
go vet ./...
.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e | grep -v /test | grep -v /api | grep -v /cmd) -coverprofile cover.out
# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
test-e2e:
go test ./test/e2e/ -v -ginkgo.v
.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter & yamllint
$(GOLANGCI_LINT) run
.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix
##@ Build
.PHONY: build
build: manifests generate fmt vet helm ## Build manager binary.
go build -o bin/manager cmd/main.go
.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
go run ./cmd/main.go
# If you wish to build the manager image targeting other platforms you can use the --platform flag.
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
.PHONY: docker-build
docker-build: ## Build docker image with the manager.
$(CONTAINER_TOOL) build -t ${IMG} .
.PHONY: docker-push
docker-push: ## Push docker image with the manager.
$(CONTAINER_TOOL) push ${IMG}
# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
# - be able to use docker buildx. More info: https://docs.docker.com/build/buildx/
# - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# - be able to push the image to your registry (i.e. if you do not set a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
# To adequately provide solutions that are compatible with multiple platforms, you should consider using this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
docker-buildx: ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- $(CONTAINER_TOOL) buildx create --name project-v3-builder
$(CONTAINER_TOOL) buildx use project-v3-builder
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
- $(CONTAINER_TOOL) buildx rm project-v3-builder
rm Dockerfile.cross
.PHONY: build-installer
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
mkdir -p dist
@if [ -d "config/crd" ]; then \
$(KUSTOMIZE) build config/crd > dist/install.yaml; \
fi
echo "---" >> dist/install.yaml # Add a document separator before appending
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default >> dist/install.yaml
##@ Deployment
ifndef ignore-not-found
ignore-not-found = false
endif
.PHONY: install
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
.PHONY: uninstall
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
.PHONY: undeploy
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
##@ Dependencies
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
## Tool Binaries
KUBECTL ?= kubectl
KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
## Tool Versions
KUSTOMIZE_VERSION ?= v5.5.0
CONTROLLER_TOOLS_VERSION ?= v0.16.4
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.61.0
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
$(KUSTOMIZE): $(LOCALBIN)
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))
.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
.PHONY: envtest
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
$(ENVTEST): $(LOCALBIN)
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary (ideally with version)
# $2 - package url which can be installed
# $3 - specific version of package
define go-install-tool
@[ -f $(1) ] || { \
set -e; \
package=$(2)@$(3) ;\
echo "Downloading $${package}" ;\
GOBIN=$(LOCALBIN) go install $${package} ;\
mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
}
endef
######################### Helmify
HELMIFY ?= $(LOCALBIN)/helmify
.PHONY: helmify
helmify: $(HELMIFY) ## Download helmify locally if necessary.
$(HELMIFY): $(LOCALBIN)
test -s $(LOCALBIN)/helmify || GOBIN=$(LOCALBIN) go install github.com/arttor/helmify/cmd/helmify@v0.4.16
helm: manifests kustomize helmify
$(KUSTOMIZE) build config/default | $(HELMIFY) -image-pull-secrets charts/compoundai-kubernetes-operator
.PHONY: coverage
coverage: test
go tool cover -func=cover.out
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: nvidia.com
layout:
- go.kubebuilder.io/v4
projectName: compoundai-kubernetes-operator
repo: github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/v1alpha1
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: nvidia.com
kind: CompoundAINimDeployment
path: github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: nvidia.com
kind: CompoundAINimRequest
path: github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: nvidia.com
kind: CompoundAINim
path: github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: nvidia.com
kind: CompoundAIDeployment
path: github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/v1alpha1
version: v1alpha1
version: "3"
# Compound AI Kubernetes Operator
The NVIDIA Compound AI Kubernetes Operator uses the [operator framework](https://cloud.redhat.com/blog/introducing-the-operator-framework) within Kubernetes to automate the management of all compound AI resources.
## pre-requisites
NEMO kubernetes operator has been built using [kubebuilder](https://github.com/kubernetes-sigs/kubebuilder)
you need to install it on your machine
### Build
```
make
```
modelschemas and schemasv1 are from https://github.com/bentoml/yatai-schemas
common, yatai-client and conversion are from yatai-deployment operator
\ No newline at end of file
/*
* 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.
*/
// +k8s:deepcopy-gen=package
package common
import (
corev1 "k8s.io/api/core/v1"
)
type ResourceItem struct {
CPU string `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
GPU string `json:"gpu,omitempty"`
Custom map[string]string `json:"custom,omitempty"`
}
type Resources struct {
Requests *ResourceItem `json:"requests,omitempty"`
Limits *ResourceItem `json:"limits,omitempty"`
}
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"`
}
type LabelItemSchema struct {
Key string `json:"key"`
Value string `json:"value"`
}
type MonitorExporterMountSpec struct {
Path string `json:"path,omitempty"`
ReadOnly bool `json:"readOnly,omitempty"`
corev1.VolumeSource `json:",inline"`
}
type MonitorExporterSpec struct {
Enabled bool `json:"enabled,omitempty"`
Output string `json:"output,omitempty"`
Options map[string]string `json:"options,omitempty"`
StructureOptions []corev1.EnvVar `json:"structureOptions,omitempty"`
Mounts []MonitorExporterMountSpec `json:"mounts,omitempty"`
}
type ExtraPodMetadata struct {
Annotations map[string]string `json:"annotations,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
type ExtraPodSpec struct {
SchedulerName string `json:"schedulerName,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
Containers []corev1.Container `json:"containers,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
PriorityClassName string `json:"priorityClassName,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.
*/
//go:build !ignore_autogenerated
/*
Copyright 2024.
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.
*/
// Code generated by controller-gen. DO NOT EDIT.
package common
import (
"k8s.io/api/core/v1"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeploymentTargetHPAConf) DeepCopyInto(out *DeploymentTargetHPAConf) {
*out = *in
if in.CPU != nil {
in, out := &in.CPU, &out.CPU
*out = new(int32)
**out = **in
}
if in.GPU != nil {
in, out := &in.GPU, &out.GPU
*out = new(int32)
**out = **in
}
if in.Memory != nil {
in, out := &in.Memory, &out.Memory
*out = new(string)
**out = **in
}
if in.QPS != nil {
in, out := &in.QPS, &out.QPS
*out = new(int64)
**out = **in
}
if in.MinReplicas != nil {
in, out := &in.MinReplicas, &out.MinReplicas
*out = new(int32)
**out = **in
}
if in.MaxReplicas != nil {
in, out := &in.MaxReplicas, &out.MaxReplicas
*out = new(int32)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentTargetHPAConf.
func (in *DeploymentTargetHPAConf) DeepCopy() *DeploymentTargetHPAConf {
if in == nil {
return nil
}
out := new(DeploymentTargetHPAConf)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExtraPodMetadata) DeepCopyInto(out *ExtraPodMetadata) {
*out = *in
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtraPodMetadata.
func (in *ExtraPodMetadata) DeepCopy() *ExtraPodMetadata {
if in == nil {
return nil
}
out := new(ExtraPodMetadata)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExtraPodSpec) DeepCopyInto(out *ExtraPodSpec) {
*out = *in
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
*out = new(v1.Affinity)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.TopologySpreadConstraints != nil {
in, out := &in.TopologySpreadConstraints, &out.TopologySpreadConstraints
*out = make([]v1.TopologySpreadConstraint, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Containers != nil {
in, out := &in.Containers, &out.Containers
*out = make([]v1.Container, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtraPodSpec.
func (in *ExtraPodSpec) DeepCopy() *ExtraPodSpec {
if in == nil {
return nil
}
out := new(ExtraPodSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LabelItemSchema) DeepCopyInto(out *LabelItemSchema) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelItemSchema.
func (in *LabelItemSchema) DeepCopy() *LabelItemSchema {
if in == nil {
return nil
}
out := new(LabelItemSchema)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MonitorExporterMountSpec) DeepCopyInto(out *MonitorExporterMountSpec) {
*out = *in
in.VolumeSource.DeepCopyInto(&out.VolumeSource)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorExporterMountSpec.
func (in *MonitorExporterMountSpec) DeepCopy() *MonitorExporterMountSpec {
if in == nil {
return nil
}
out := new(MonitorExporterMountSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MonitorExporterSpec) DeepCopyInto(out *MonitorExporterSpec) {
*out = *in
if in.Options != nil {
in, out := &in.Options, &out.Options
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.StructureOptions != nil {
in, out := &in.StructureOptions, &out.StructureOptions
*out = make([]v1.EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Mounts != nil {
in, out := &in.Mounts, &out.Mounts
*out = make([]MonitorExporterMountSpec, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorExporterSpec.
func (in *MonitorExporterSpec) DeepCopy() *MonitorExporterSpec {
if in == nil {
return nil
}
out := new(MonitorExporterSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceItem) DeepCopyInto(out *ResourceItem) {
*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
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceItem.
func (in *ResourceItem) DeepCopy() *ResourceItem {
if in == nil {
return nil
}
out := new(ResourceItem)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Resources) DeepCopyInto(out *Resources) {
*out = *in
if in.Requests != nil {
in, out := &in.Requests, &out.Requests
*out = new(ResourceItem)
(*in).DeepCopyInto(*out)
}
if in.Limits != nil {
in, out := &in.Limits, &out.Limits
*out = new(ResourceItem)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resources.
func (in *Resources) DeepCopy() *Resources {
if in == nil {
return nil
}
out := new(Resources)
in.DeepCopyInto(out)
return out
}
/*
* 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 conversion
import (
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/common"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
)
func ConvertToDeploymentTargetResourceItem(src *common.ResourceItem) (dest *modelschemas.DeploymentTargetResourceItem) {
if src == nil {
return
}
dest = &modelschemas.DeploymentTargetResourceItem{
CPU: src.CPU,
Memory: src.Memory,
GPU: src.GPU,
Custom: src.Custom,
}
return
}
func ConvertToDeploymentTargetResources(src *common.Resources) (dest *modelschemas.DeploymentTargetResources) {
if src == nil {
return
}
dest = &modelschemas.DeploymentTargetResources{
Requests: ConvertToDeploymentTargetResourceItem(src.Requests),
Limits: ConvertToDeploymentTargetResourceItem(src.Limits),
}
return
}
func ConvertFromDeploymentTargetResourceItem(src *modelschemas.DeploymentTargetResourceItem) (dest *common.ResourceItem) {
if src == nil {
return
}
dest = &common.ResourceItem{
CPU: src.CPU,
Memory: src.Memory,
GPU: src.GPU,
Custom: src.Custom,
}
return
}
func ConvertFromDeploymentTargetResources(src *modelschemas.DeploymentTargetResources) (dest *common.Resources) {
if src == nil {
return
}
dest = &common.Resources{
Requests: ConvertFromDeploymentTargetResourceItem(src.Requests),
Limits: ConvertFromDeploymentTargetResourceItem(src.Limits),
}
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 ApiTokenScopeOp string
const (
ApiTokenScopeOpRead ApiTokenScopeOp = "read"
ApiTokenScopeOpWrite ApiTokenScopeOp = "write"
ApiTokenScopeOpOperate ApiTokenScopeOp = "operate"
)
type ApiTokenScope string
const (
ApiTokenScopeApi ApiTokenScope = "api"
)
type ApiTokenScopes []ApiTokenScope
func (c *ApiTokenScopes) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal([]byte(value.(string)), c)
}
func (c *ApiTokenScopes) Value() (driver.Value, error) {
if c == nil {
return nil, nil
}
return json.Marshal(c)
}
func (c *ApiTokenScopes) Contains(scope ApiTokenScope) bool {
for _, s := range *c {
if s == scope {
return true
}
}
return false
}
/*
* 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 TransmissionStrategy string
const (
TransmissionStrategyPresignedURL TransmissionStrategy = "presigned_url"
TransmissionStrategyProxy TransmissionStrategy = "proxy"
)
type BentoUploadStatus string
const (
BentoUploadStatusPending BentoUploadStatus = "pending"
BentoUploadStatusUploading BentoUploadStatus = "uploading"
BentoUploadStatusSuccess BentoUploadStatus = "success"
BentoUploadStatusFailed BentoUploadStatus = "failed"
)
type ImageBuildStatus string
const (
ImageBuildStatusPending ImageBuildStatus = "pending"
ImageBuildStatusBuilding ImageBuildStatus = "building"
ImageBuildStatusSuccess ImageBuildStatus = "success"
ImageBuildStatusFailed ImageBuildStatus = "failed"
)
type BentoApiSchema struct {
Route string `json:"route"`
Doc string `json:"doc"`
Input string `json:"input"`
Output string `json:"output"`
}
type BentoRunnerResourceSchema struct {
CPU *float64 `json:"cpu"`
NvidiaGPU *float64 `json:"nvidia_gpu"`
CustomResources map[string]float64 `json:"custom_resources"`
}
type BentoRunnerSchema struct {
Name string `json:"name"`
RunnableType string `json:"runnable_type"`
Models []string `json:"models"`
ResourceConfig *BentoRunnerResourceSchema `json:"resource_config"`
}
type BentoManifestSchema struct {
Service string `json:"service"`
BentomlVersion string `json:"bentoml_version"`
Apis map[string]BentoApiSchema `json:"apis"`
Models []string `json:"models"`
Runners []BentoRunnerSchema `json:"runners"`
SizeBytes uint `json:"size_bytes"`
}
func (c *BentoManifestSchema) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal(value.([]byte), c)
}
func (c *BentoManifestSchema) 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 ClusterConfigAWSSchema struct {
Region string `json:"region"`
}
type ClusterConfigSchema struct {
DefaultDeploymentKubeNamespace string `json:"default_deployment_kube_namespace"`
IngressIp string `json:"ingress_ip"`
AWS *ClusterConfigAWSSchema `json:"aws"`
ResourceInstances []ResourceInstance `json:"resource_instances"`
}
func (c *ClusterConfigSchema) Scan(value interface{}) error {
if value == nil {
return nil
}
return json.Unmarshal([]byte(value.(string)), c)
}
func (c *ClusterConfigSchema) 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 DeploymentStatus string
const (
DeploymentStatusUnknown DeploymentStatus = "unknown"
DeploymentStatusNonDeployed DeploymentStatus = "non-deployed"
DeploymentStatusRunning DeploymentStatus = "running"
DeploymentStatusUnhealthy DeploymentStatus = "unhealthy"
DeploymentStatusFailed DeploymentStatus = "failed"
DeploymentStatusDeploying DeploymentStatus = "deploying"
DeploymentStatusTerminating DeploymentStatus = "terminating"
DeploymentStatusTerminated DeploymentStatus = "terminated"
DeploymentStatusImageBuilding DeploymentStatus = "image-building"
DeploymentStatusImageBuildFailed DeploymentStatus = "image-build-failed"
DeploymentStatusImageBuildSucceeded DeploymentStatus = "image-build-succeeded"
)
func (d DeploymentStatus) Ptr() *DeploymentStatus {
return &d
}
type DeploymentMode string
const (
DeploymentModeDeployment DeploymentMode = "deployment"
DeploymentModeFunction DeploymentMode = "function"
)
func (d DeploymentMode) Ptr() *DeploymentMode {
return &d
}
/*
* 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 DeploymentRevisionStatus string
const (
DeploymentRevisionStatusActive DeploymentRevisionStatus = "active"
DeploymentRevisionStatusInactive DeploymentRevisionStatus = "inactive"
)
func (d DeploymentRevisionStatus) Ptr() *DeploymentRevisionStatus {
return &d
}
func DeploymentRevisionStatusPtr(status DeploymentRevisionStatus) *DeploymentRevisionStatus {
return status.Ptr()
}
/*
* 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"`
}
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