Full Code of tensorchord/openmodelz for AI

main b574e2bd838c cached
413 files
1.1 MB
354.2k tokens
1456 symbols
1 requests
Download .txt
Showing preview only (1,235K chars total). Download the full file or copy to clipboard to get everything.
Repository: tensorchord/openmodelz
Branch: main
Commit: b574e2bd838c
Files: 413
Total size: 1.1 MB

Directory structure:
gitextract_h_b9vahq/

├── .all-contributorsrc
├── .github/
│   └── workflows/
│       ├── CI.yaml
│       └── publish.yaml
├── .gitignore
├── .goreleaser.yaml
├── LICENSE
├── MANIFEST.in
├── README.md
├── agent/
│   ├── .gitignore
│   ├── Dockerfile
│   ├── Makefile
│   ├── README.md
│   ├── api/
│   │   └── types/
│   │       ├── build.go
│   │       ├── error.go
│   │       ├── event.go
│   │       ├── inference_deployment.go
│   │       ├── inference_deployment_instance.go
│   │       ├── inference_status.go
│   │       ├── info.go
│   │       ├── log.go
│   │       ├── modelz_cloud.go
│   │       ├── namespace.go
│   │       ├── queue.go
│   │       ├── requests.go
│   │       ├── secret.go
│   │       └── server.go
│   ├── client/
│   │   ├── build.go
│   │   ├── client.go
│   │   ├── const.go
│   │   ├── errors.go
│   │   ├── hijack.go
│   │   ├── image_cache_create.go
│   │   ├── inference_create.go
│   │   ├── inference_get.go
│   │   ├── inference_list.go
│   │   ├── inference_remove.go
│   │   ├── inference_scale.go
│   │   ├── inference_update.go
│   │   ├── info.go
│   │   ├── instance_exec.go
│   │   ├── instance_list.go
│   │   ├── log.go
│   │   ├── modelz_cloud.go
│   │   ├── namespace_create.go
│   │   ├── namespace_delete.go
│   │   ├── options.go
│   │   ├── request.go
│   │   ├── server_label_create.go
│   │   ├── server_list.go
│   │   ├── server_node_delete.go
│   │   ├── transport.go
│   │   └── utils.go
│   ├── cmd/
│   │   └── agent/
│   │       └── main.go
│   ├── errdefs/
│   │   ├── defs.go
│   │   ├── doc.go
│   │   ├── helpers.go
│   │   ├── http_helpers.go
│   │   └── is.go
│   ├── pkg/
│   │   ├── app/
│   │   │   ├── config.go
│   │   │   └── root.go
│   │   ├── config/
│   │   │   └── config.go
│   │   ├── consts/
│   │   │   └── consts.go
│   │   ├── docs/
│   │   │   └── docs.go
│   │   ├── event/
│   │   │   ├── event.go
│   │   │   ├── fake.go
│   │   │   ├── suite_test.go
│   │   │   ├── username.go
│   │   │   └── util.go
│   │   ├── k8s/
│   │   │   ├── convert_inference.go
│   │   │   ├── convert_inference_test.go
│   │   │   ├── convert_job.go
│   │   │   ├── convert_pod.go
│   │   │   ├── convert_pod_test.go
│   │   │   ├── generate_image_cache.go
│   │   │   ├── generate_job.go
│   │   │   ├── managed_cluster.go
│   │   │   ├── resolver.go
│   │   │   └── suite_test.go
│   │   ├── log/
│   │   │   ├── factory.go
│   │   │   ├── k8s.go
│   │   │   └── loki.go
│   │   ├── metrics/
│   │   │   ├── exporter.go
│   │   │   └── metrics.go
│   │   ├── prom/
│   │   │   └── prometheus_query.go
│   │   ├── runtime/
│   │   │   ├── build.go
│   │   │   ├── cluster_info_get.go
│   │   │   ├── image_cache.go
│   │   │   ├── inference_create.go
│   │   │   ├── inference_delete.go
│   │   │   ├── inference_exec.go
│   │   │   ├── inference_get.go
│   │   │   ├── inference_instance.go
│   │   │   ├── inference_list.go
│   │   │   ├── inference_replicas.go
│   │   │   ├── inference_update.go
│   │   │   ├── mock/
│   │   │   │   └── mock.go
│   │   │   ├── namespace.go
│   │   │   ├── node.go
│   │   │   ├── runtime.go
│   │   │   ├── server_delete.go
│   │   │   ├── server_label_create.go
│   │   │   ├── server_list.go
│   │   │   ├── util_domain.go
│   │   │   └── util_resource.go
│   │   ├── scaling/
│   │   │   ├── function_scaler.go
│   │   │   ├── ranges.go
│   │   │   ├── retry.go
│   │   │   ├── service_query.go
│   │   │   └── util.go
│   │   ├── server/
│   │   │   ├── error.go
│   │   │   ├── handler_build_create.go
│   │   │   ├── handler_build_get.go
│   │   │   ├── handler_build_list.go
│   │   │   ├── handler_build_logs.go
│   │   │   ├── handler_gradio_proxy.go
│   │   │   ├── handler_healthz.go
│   │   │   ├── handler_healthz_test.go
│   │   │   ├── handler_image_cache.go
│   │   │   ├── handler_inference_create.go
│   │   │   ├── handler_inference_create_test.go
│   │   │   ├── handler_inference_delete.go
│   │   │   ├── handler_inference_delete_test.go
│   │   │   ├── handler_inference_get.go
│   │   │   ├── handler_inference_get_test.go
│   │   │   ├── handler_inference_instance.go
│   │   │   ├── handler_inference_instance_exec.go
│   │   │   ├── handler_inference_list.go
│   │   │   ├── handler_inference_logs.go
│   │   │   ├── handler_inference_proxy.go
│   │   │   ├── handler_inference_scale.go
│   │   │   ├── handler_inference_update.go
│   │   │   ├── handler_info.go
│   │   │   ├── handler_mosec_proxy.go
│   │   │   ├── handler_namespace_create.go
│   │   │   ├── handler_namespace_delete.go
│   │   │   ├── handler_namespace_delete_test.go
│   │   │   ├── handler_namespace_list.go
│   │   │   ├── handler_other_proxy.go
│   │   │   ├── handler_root.go
│   │   │   ├── handler_server_delete.go
│   │   │   ├── handler_server_label_create.go
│   │   │   ├── handler_server_list.go
│   │   │   ├── handler_streamlit_proxy.go
│   │   │   ├── middleware_callid.go
│   │   │   ├── proxy_auth.go
│   │   │   ├── server_factory.go
│   │   │   ├── server_handlerfunc.go
│   │   │   ├── server_init_kubernetes.go
│   │   │   ├── server_init_logs.go
│   │   │   ├── server_init_metrics.go
│   │   │   ├── server_init_modelz_cloud.go
│   │   │   ├── server_init_route.go
│   │   │   ├── server_run.go
│   │   │   ├── server_websocket.go
│   │   │   ├── static/
│   │   │   │   ├── index.html
│   │   │   │   ├── landing.go
│   │   │   │   └── page_loading.go
│   │   │   ├── suite_test.go
│   │   │   ├── user.go
│   │   │   └── validator/
│   │   │       └── validator.go
│   │   └── version/
│   │       └── version.go
│   └── sqlc.yaml
├── autoscaler/
│   ├── .gitignore
│   ├── Dockerfile
│   ├── Makefile
│   ├── cmd/
│   │   └── autoscaler/
│   │       └── main.go
│   └── pkg/
│       ├── autoscaler/
│       │   ├── factory.go
│       │   ├── inferencecache.go
│       │   ├── loadcache.go
│       │   └── scaler.go
│       ├── autoscalerapp/
│       │   └── root.go
│       ├── prom/
│       │   ├── prom.go
│       │   └── types.go
│       ├── server/
│       │   └── status.go
│       └── version/
│           └── version.go
├── go.mod
├── go.sum
├── ingress-operator/
│   ├── .DEREK.yml
│   ├── .dockerignore
│   ├── .gitignore
│   ├── .tools/
│   │   ├── README.md
│   │   ├── code-generator.mod
│   │   └── code-generator.sum
│   ├── .vscode/
│   │   └── settings.json
│   ├── Dockerfile
│   ├── LICENSE
│   ├── Makefile
│   ├── artifacts/
│   │   ├── .gitignore
│   │   ├── crds/
│   │   │   └── tensorchord.ai_inferenceingresses.yaml
│   │   ├── operator-amd64.yaml
│   │   └── operator-rbac.yaml
│   ├── cmd/
│   │   └── ingress-operator/
│   │       └── main.go
│   ├── hack/
│   │   ├── boilerplate.go.txt
│   │   ├── custom-boilerplate.go.txt
│   │   ├── print-codegen-version.sh
│   │   ├── update-codegen.sh
│   │   ├── update-crds.sh
│   │   └── verify-codegen.sh
│   ├── pkg/
│   │   ├── apis/
│   │   │   └── modelzetes/
│   │   │       ├── register.go
│   │   │       └── v1/
│   │   │           ├── doc.go
│   │   │           ├── register.go
│   │   │           ├── types.go
│   │   │           └── zz_generated.deepcopy.go
│   │   ├── app/
│   │   │   ├── config.go
│   │   │   └── root.go
│   │   ├── client/
│   │   │   ├── clientset/
│   │   │   │   └── versioned/
│   │   │   │       ├── clientset.go
│   │   │   │       ├── doc.go
│   │   │   │       ├── fake/
│   │   │   │       │   ├── clientset_generated.go
│   │   │   │       │   ├── doc.go
│   │   │   │       │   └── register.go
│   │   │   │       ├── scheme/
│   │   │   │       │   ├── doc.go
│   │   │   │       │   └── register.go
│   │   │   │       └── typed/
│   │   │   │           └── modelzetes/
│   │   │   │               └── v1/
│   │   │   │                   ├── doc.go
│   │   │   │                   ├── fake/
│   │   │   │                   │   ├── doc.go
│   │   │   │                   │   ├── fake_inferenceingress.go
│   │   │   │                   │   └── fake_modelzetes_client.go
│   │   │   │                   ├── generated_expansion.go
│   │   │   │                   ├── inferenceingress.go
│   │   │   │                   └── modelzetes_client.go
│   │   │   ├── informers/
│   │   │   │   └── externalversions/
│   │   │   │       ├── factory.go
│   │   │   │       ├── generic.go
│   │   │   │       ├── internalinterfaces/
│   │   │   │       │   └── factory_interfaces.go
│   │   │   │       └── modelzetes/
│   │   │   │           ├── interface.go
│   │   │   │           └── v1/
│   │   │   │               ├── inferenceingress.go
│   │   │   │               └── interface.go
│   │   │   └── listers/
│   │   │       └── modelzetes/
│   │   │           └── v1/
│   │   │               ├── expansion_generated.go
│   │   │               └── inferenceingress.go
│   │   ├── config/
│   │   │   └── config.go
│   │   ├── consts/
│   │   │   └── consts.go
│   │   ├── controller/
│   │   │   ├── core.go
│   │   │   ├── core_test.go
│   │   │   └── v1/
│   │   │       ├── controller.go
│   │   │       ├── controller_factory.go
│   │   │       ├── controller_test.go
│   │   │       └── docs.go
│   │   ├── signals/
│   │   │   ├── signal.go
│   │   │   ├── signal_posix.go
│   │   │   └── signal_windows.go
│   │   └── version/
│   │       └── version.go
│   └── vendor.go
├── mdz/
│   ├── .gitignore
│   ├── Makefile
│   ├── README.md
│   ├── cmd/
│   │   └── mdz/
│   │       └── main.go
│   ├── docs/
│   │   ├── cli/
│   │   │   ├── mdz.md
│   │   │   ├── mdz_delete.md
│   │   │   ├── mdz_deploy.md
│   │   │   ├── mdz_exec.md
│   │   │   ├── mdz_list.md
│   │   │   ├── mdz_list_instance.md
│   │   │   ├── mdz_logs.md
│   │   │   ├── mdz_port-forward.md
│   │   │   ├── mdz_scale.md
│   │   │   ├── mdz_server.md
│   │   │   ├── mdz_server_delete.md
│   │   │   ├── mdz_server_destroy.md
│   │   │   ├── mdz_server_join.md
│   │   │   ├── mdz_server_label.md
│   │   │   ├── mdz_server_list.md
│   │   │   ├── mdz_server_start.md
│   │   │   ├── mdz_server_stop.md
│   │   │   └── mdz_version.md
│   │   └── macOS-quickstart.md
│   ├── examples/
│   │   └── bloomz-560m-openai/
│   │       └── README.md
│   ├── hack/
│   │   └── cli-doc-gen/
│   │       └── main.go
│   └── pkg/
│       ├── agentd/
│       │   ├── runtime/
│       │   │   ├── create.go
│       │   │   ├── delete.go
│       │   │   ├── label.go
│       │   │   ├── list.go
│       │   │   ├── proxy.go
│       │   │   └── runtime.go
│       │   └── server/
│       │       ├── error.go
│       │       ├── handler_healthz.go
│       │       ├── handler_inference_create.go
│       │       ├── handler_inference_delete.go
│       │       ├── handler_inference_get.go
│       │       ├── handler_inference_list.go
│       │       ├── handler_inference_logs.go
│       │       ├── handler_inference_proxy.go
│       │       ├── handler_info.go
│       │       ├── middleware_callid.go
│       │       ├── server_factory.go
│       │       ├── server_handlerfunc.go
│       │       ├── server_init_route.go
│       │       └── server_run.go
│       ├── cmd/
│       │   ├── delete.go
│       │   ├── deploy.go
│       │   ├── exec.go
│       │   ├── exec_stream.go
│       │   ├── ioutils/
│       │   │   └── reader.go
│       │   ├── list.go
│       │   ├── list_instance.go
│       │   ├── localagent.go
│       │   ├── logs.go
│       │   ├── portforward.go
│       │   ├── root.go
│       │   ├── scale.go
│       │   ├── server.go
│       │   ├── server_delete.go
│       │   ├── server_destroy.go
│       │   ├── server_join.go
│       │   ├── server_label.go
│       │   ├── server_list.go
│       │   ├── server_start.go
│       │   ├── server_stop.go
│       │   ├── streams/
│       │   │   ├── in.go
│       │   │   ├── out.go
│       │   │   └── stream.go
│       │   └── version.go
│       ├── server/
│       │   ├── agentd_run.go
│       │   ├── engine.go
│       │   ├── gpu-resource.yaml
│       │   ├── gpu_install.go
│       │   ├── k3s-install.sh
│       │   ├── k3s_destroy.go
│       │   ├── k3s_install.go
│       │   ├── k3s_join.go
│       │   ├── k3s_killall.go
│       │   ├── k3s_prepare.go
│       │   ├── nginx-dep.yaml
│       │   ├── nginx_install.go
│       │   ├── openmodelz.yaml
│       │   ├── openmodelz_install.go
│       │   └── registries.yaml
│       ├── telemetry/
│       │   └── telemetry.go
│       ├── term/
│       │   ├── interrupt.go
│       │   └── term.go
│       └── version/
│           └── version.go
├── modelzetes/
│   ├── .dockerignore
│   ├── .gitattributes
│   ├── .gitignore
│   ├── Dockerfile
│   ├── LICENSE
│   ├── Makefile
│   ├── artifacts/
│   │   ├── crds/
│   │   │   └── tensorchord.ai_inferences.yaml
│   │   └── samples/
│   │       └── v2alpha1.yaml
│   ├── buf.yaml
│   ├── cmd/
│   │   └── modelzetes/
│   │       └── main.go
│   ├── hack/
│   │   ├── boilerplate.go.txt
│   │   ├── print-codegen-version.sh
│   │   ├── update-codegen.sh
│   │   ├── update-crds.sh
│   │   └── verify-codegen.sh
│   ├── pkg/
│   │   ├── apis/
│   │   │   └── modelzetes/
│   │   │       ├── register.go
│   │   │       └── v2alpha1/
│   │   │           ├── doc.go
│   │   │           ├── register.go
│   │   │           ├── types.go
│   │   │           └── zz_generated.deepcopy.go
│   │   ├── app/
│   │   │   ├── config.go
│   │   │   └── root.go
│   │   ├── client/
│   │   │   ├── clientset/
│   │   │   │   └── versioned/
│   │   │   │       ├── clientset.go
│   │   │   │       ├── doc.go
│   │   │   │       ├── fake/
│   │   │   │       │   ├── clientset_generated.go
│   │   │   │       │   ├── doc.go
│   │   │   │       │   └── register.go
│   │   │   │       ├── scheme/
│   │   │   │       │   ├── doc.go
│   │   │   │       │   └── register.go
│   │   │   │       └── typed/
│   │   │   │           └── modelzetes/
│   │   │   │               └── v2alpha1/
│   │   │   │                   ├── doc.go
│   │   │   │                   ├── fake/
│   │   │   │                   │   ├── doc.go
│   │   │   │                   │   ├── fake_inference.go
│   │   │   │                   │   └── fake_modelzetes_client.go
│   │   │   │                   ├── generated_expansion.go
│   │   │   │                   ├── inference.go
│   │   │   │                   └── modelzetes_client.go
│   │   │   ├── informers/
│   │   │   │   └── externalversions/
│   │   │   │       ├── factory.go
│   │   │   │       ├── generic.go
│   │   │   │       ├── internalinterfaces/
│   │   │   │       │   └── factory_interfaces.go
│   │   │   │       └── modelzetes/
│   │   │   │           ├── interface.go
│   │   │   │           └── v2alpha1/
│   │   │   │               ├── inference.go
│   │   │   │               └── interface.go
│   │   │   └── listers/
│   │   │       └── modelzetes/
│   │   │           └── v2alpha1/
│   │   │               ├── expansion_generated.go
│   │   │               └── inference.go
│   │   ├── config/
│   │   │   └── config.go
│   │   ├── consts/
│   │   │   └── consts.go
│   │   ├── controller/
│   │   │   ├── annotations_test.go
│   │   │   ├── controller.go
│   │   │   ├── deployment.go
│   │   │   ├── deployment_test.go
│   │   │   ├── deployment_update_test.go
│   │   │   ├── factory.go
│   │   │   ├── framework_test.go
│   │   │   ├── fromconfig.go
│   │   │   ├── replicas_test.go
│   │   │   ├── secrets.go
│   │   │   ├── secrets_test.go
│   │   │   ├── service.go
│   │   │   └── service_test.go
│   │   ├── k8s/
│   │   │   ├── config.go
│   │   │   ├── errors.go
│   │   │   ├── factory.go
│   │   │   ├── factory_test.go
│   │   │   ├── instance.go
│   │   │   ├── instance_test.go
│   │   │   ├── log.go
│   │   │   ├── logs.go
│   │   │   ├── probes.go
│   │   │   ├── probes_test.go
│   │   │   ├── proxy.go
│   │   │   ├── proxy_test.go
│   │   │   ├── secrets.go
│   │   │   ├── secrets_factory_test.go
│   │   │   ├── securityContext.go
│   │   │   ├── securityContext_test.go
│   │   │   └── utils.go
│   │   ├── pointer/
│   │   │   └── ptr.go
│   │   ├── signals/
│   │   │   ├── signal.go
│   │   │   ├── signal_posix.go
│   │   │   └── signal_windows.go
│   │   └── version/
│   │       └── version.go
│   └── vendor.go
├── pyproject.toml
├── setup.py
└── typos.toml

================================================
FILE CONTENTS
================================================

================================================
FILE: .all-contributorsrc
================================================
{
  "projectName": "openmodelz",
  "projectOwner": "tensorchord",
  "repoType": "github",
  "repoHost": "https://github.com",
  "files": [
    "README.md"
  ],
  "imageSize": 70,
  "commit": true,
  "commitConvention": "angular",
  "contributorsSortAlphabetically": true,
  "contributors": [
    {
      "login": "gaocegege",
      "name": "Ce Gao",
      "avatar_url": "https://avatars.githubusercontent.com/u/5100735?v=4",
      "profile": "https://github.com/gaocegege",
      "contributions": [
        "code",
        "review",
        "tutorial"
      ]
    },
    {
      "login": "tddschn",
      "name": "Teddy Xinyuan Chen",
      "avatar_url": "https://avatars.githubusercontent.com/u/45612704?v=4",
      "profile": "https://github.com/tddschn",
      "contributions": [
        "doc"
      ]
    },
    {
      "login": "VoVAllen",
      "name": "Jinjing Zhou",
      "avatar_url": "https://avatars.githubusercontent.com/u/8686776?v=4",
      "profile": "https://github.com/VoVAllen",
      "contributions": [
        "question",
        "bug",
        "ideas"
      ]
    },
    {
      "login": "kemingy",
      "name": "Keming",
      "avatar_url": "https://avatars.githubusercontent.com/u/12974685?v=4",
      "profile": "https://blog.mapotofu.org/",
      "contributions": [
        "code",
        "design",
        "infra"
      ]
    },
    {
      "login": "cutecutecat",
      "name": "cutecutecat",
      "avatar_url": "https://avatars.githubusercontent.com/u/19801166?v=4",
      "profile": "https://github.com/cutecutecat",
      "contributions": [
        "ideas"
      ]
    },
    {
      "login": "xieydd",
      "name": "xieydd",
      "avatar_url": "https://avatars.githubusercontent.com/u/20329697?v=4",
      "profile": "https://xieydd.github.io/",
      "contributions": [
        "ideas"
      ]
    },
    {
      "login": "Xuanwo",
      "name": "Xuanwo",
      "avatar_url": "https://avatars.githubusercontent.com/u/5351546?v=4",
      "profile": "https://xuanwo.io/",
      "contributions": [
        "content",
        "design",
        "ideas"
      ]
    },
    {
      "login": "Zheaoli",
      "name": "Nadeshiko Manju",
      "avatar_url": "https://avatars.githubusercontent.com/u/7054676?v=4",
      "profile": "http://manjusaka.itscoder.com/",
      "contributions": [
        "bug",
        "design",
        "ideas"
      ]
    },
    {
      "login": "zwpaper",
      "name": "Wei Zhang",
      "avatar_url": "https://avatars.githubusercontent.com/u/3764335?v=4",
      "profile": "https://page.codespaper.com",
      "contributions": [
        "code"
      ]
    }
  ],
  "contributorsPerLine": 7,
  "commitType": "docs"
}


================================================
FILE: .github/workflows/CI.yaml
================================================
name: CI

on:
  push:
    branches:
      - main
    paths:
      - '.github/workflows/**'
      - '**.go'
      - '**/Makefile'
      - 'go.**'
  pull_request:
    paths:
      - '.github/workflows/**'
      - '**.go'
      - '**/Makefile'
      - 'go.**'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  typos-check:
    name: Spell Check with Typos
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Actions Repository
        uses: actions/checkout@v3
      - name: Check spelling with custom config file
        uses: crate-ci/typos@v1.16.2
        with:
          config: ./typos.toml
  test:
    name: test
    strategy:
      matrix:
        os: [ubuntu-latest]
        dir: ["agent", "autoscaler", "ingress-operator", "mdz", "modelzetes"]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Check out code
        uses: actions/checkout@v3
      - name: Setup Go
        uses: actions/setup-go@v4
        with:
          go-version: 1.19
      - uses: actions/cache@v3
        with:
          path: |
            ~/.cache/go-build
            ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-
      - name: test
        run: |
          cd ${{ matrix.dir }}
          make fmt
          git diff --exit-code || (echo 'Please run "make fmt" to format code' && exit 1);
          make
          go test -race -coverprofile=${{ matrix.dir }}.out -covermode=atomic ./...
      - name: Upload coverage report
        uses: actions/upload-artifact@v3
        with:
          name: ${{ matrix.dir }}-out
          path: ${{ matrix.dir }}/${{ matrix.dir }}.out
  report:
    needs:
      - test
      - typos-check
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v3
      - name: Setup Go
        uses: actions/setup-go@v4
        with:
          go-version: 1.19
      - name: Install bins
        run: |
          go install github.com/mattn/goveralls@latest
      - name: Get agent coverage report
        uses: actions/download-artifact@v3
        with:
          name: agent-out
          path: merge
      - name: Get autoscaler coverage report
        uses: actions/download-artifact@v3
        with:
          name: autoscaler-out
          path: merge
      - name: Get ingress-operator coverage report
        uses: actions/download-artifact@v3
        with:
          name: ingress-operator-out
          path: merge
      - name: Get mdz coverage report
        uses: actions/download-artifact@v3
        with:
          name: mdz-out
          path: merge
      - name: Get modelzetes coverage report
        uses: actions/download-artifact@v3
        with:
          name: modelzetes-out
          path: merge
      - name: Merge all coverage reports
        uses: cutecutecat/go-cover-merge@v1
        with:
          input_dir: merge
          output_file: final.out
      - name: Send coverage
        env:
          COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          goveralls -coverprofile=final.out -service=github


================================================
FILE: .github/workflows/publish.yaml
================================================
name: release

on:
  release:
    types: [published]
  pull_request:
    paths:
    - '.github/workflows/release.yml'
    - '.goreleaser/'
    - '.goreleaser.yaml'

jobs:
  goreleaser:
    if: github.repository == 'tensorchord/openmodelz'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Set up Go
        uses: actions/setup-go@v4
        with:
          go-version: 1.19
      - name: Docker Login
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERIO_USERNAME }}
          password: ${{ secrets.DOCKERIO_TOKEN }}
      - name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v4
        with:
          distribution: goreleaser
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: upload gobin
        uses: actions/upload-artifact@v3
        with:
          name: gobin_${{ github.event.release.tag_name }}
          retention-days: 1
          path: |
            dist/mdz_linux_amd64_v1/mdz
          if-no-files-found: error
  pypi_publish:
    needs: goreleaser
    # only trigger on main repo when tag starts with v
    if: github.repository == 'tensorchord/openmodelz' && startsWith(github.ref, 'refs/tags/v')
    runs-on: ${{ matrix.os }}
    timeout-minutes: 20
    strategy:
      matrix:
        os: [ubuntu-20.04]
    steps:
    - uses: actions/checkout@v3
    - name: Get gobin
      uses: actions/download-artifact@v3
      with:
        name: gobin_${{ github.event.release.tag_name }}
        path: dist/
    - name: Configure linux build environment
      if: runner.os == 'Linux'
      run: |
        mkdir -p mdz/bin
        mv dist/mdz mdz/bin/mdz
        chmod +x mdz/bin/mdz
    - name: Build wheels
      uses: pypa/cibuildwheel@v2.14.1
    - name: Build source distribution
      if: runner.os == 'Linux' # Only release source under linux to avoid conflict
      run: |
        python -m pip install wheel setuptools_scm
        python setup.py sdist
        mv dist/*.tar.gz wheelhouse/
    - name: Upload to PyPI
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
      run: |
        python -m pip install --upgrade pip
        python -m pip install twine
        python -m twine upload wheelhouse/*


================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
_version.txt
_version.py
wheelhouse/

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
.ruff_cache/
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
#   For a library or package, you might want to ignore these files since the code is
#   intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
#   install all needed dependencies.
#Pipfile.lock

# poetry
#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
#   in version control.
#   https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
#  and can be added to the global gitignore or merged into this file.  For a more nuclear
#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work


================================================
FILE: .goreleaser.yaml
================================================
project_name: openmodelz
builds:
  - env:
      - CGO_ENABLED=0
    goos:
      - linux
    goarch:
      - amd64
    id: modelzetes
    main: ./cmd/modelzetes/main.go
    dir: ./modelzetes
    binary: modelzetes
    ldflags:
      - -s -w
      - -X github.com/tensorchord/openmodelz/modelzetes/pkg/version.version={{ .Version }}
      - -X github.com/tensorchord/openmodelz/modelzetes/pkg/version.buildDate={{ .Date }}
      - -X github.com/tensorchord/openmodelz/modelzetes/pkg/version.gitCommit={{ .Commit }}
      - -X github.com/tensorchord/openmodelz/modelzetes/pkg/version.gitTreeState=clean
      - -X github.com/tensorchord/openmodelz/modelzetes/pkg/version.gitTag={{ .Tag }}
  - env:
      - CGO_ENABLED=0
    goos:
      - linux
    goarch:
      - amd64
    id: agent
    main: ./cmd/agent/main.go
    dir: ./agent
    binary: agent
    ldflags:
      - -s -w
      - -X github.com/tensorchord/openmodelz/agent/pkg/version.version={{ .Version }}
      - -X github.com/tensorchord/openmodelz/agent/pkg/version.buildDate={{ .Date }}
      - -X github.com/tensorchord/openmodelz/agent/pkg/version.gitCommit={{ .Commit }}
      - -X github.com/tensorchord/openmodelz/agent/pkg/version.gitTreeState=clean
      - -X github.com/tensorchord/openmodelz/agent/pkg/version.gitTag={{ .Tag }}
  - env:
      - CGO_ENABLED=0
    goos:
      - linux
    goarch:
      - amd64
    id: mdz
    main: ./cmd/mdz/main.go
    dir: ./mdz
    binary: mdz
    ldflags:
      - -s -w
      - -X github.com/tensorchord/openmodelz/mdz/pkg/version.version={{ .Version }}
      - -X github.com/tensorchord/openmodelz/mdz/pkg/version.buildDate={{ .Date }}
      - -X github.com/tensorchord/openmodelz/mdz/pkg/version.gitCommit={{ .Commit }}
      - -X github.com/tensorchord/openmodelz/mdz/pkg/version.gitTreeState=clean
      - -X github.com/tensorchord/openmodelz/mdz/pkg/version.gitTag={{ .Tag }}
  - env:
      - CGO_ENABLED=0
    goos:
      - linux
    goarch:
      - amd64
    id: autoscaler
    main: ./cmd/autoscaler/main.go
    dir: ./autoscaler
    binary: autoscaler
    ldflags:
      - -s -w
      - -X github.com/tensorchord/openmodelz/autoscaler/pkg/version.version={{ .Version }}
      - -X github.com/tensorchord/openmodelz/autoscaler/pkg/version.buildDate={{ .Date }}
      - -X github.com/tensorchord/openmodelz/autoscaler/pkg/version.gitCommit={{ .Commit }}
      - -X github.com/tensorchord/openmodelz/autoscaler/pkg/version.gitTreeState=clean
      - -X github.com/tensorchord/openmodelz/autoscaler/pkg/version.gitTag={{ .Tag }}
  - env:
      - CGO_ENABLED=0
    goos:
      - linux
    goarch:
      - amd64
    id: ingress-operator
    main: ./cmd/ingress-operator/main.go
    dir: ./ingress-operator
    binary: ingress-operator
    ldflags:
      - -s -w
      - -X github.com/tensorchord/openmodelz/ingress-operator/pkg/version.version={{ .Version }}
      - -X github.com/tensorchord/openmodelz/ingress-operator/pkg/version.buildDate={{ .Date }}
      - -X github.com/tensorchord/openmodelz/ingress-operator/pkg/version.gitCommit={{ .Commit }}
      - -X github.com/tensorchord/openmodelz/ingress-operator/pkg/version.gitTreeState=clean
      - -X github.com/tensorchord/openmodelz/ingress-operator/pkg/version.gitTag={{ .Tag }}
archives:
  - id: mdz
    format: binary
    builds:
      - mdz
    name_template: >-
      {{ .Binary }}_{{ .Version }}_{{- title .Os }}_
      {{- if eq .Arch "amd64" }}x86_64
      {{- else if eq .Arch "386" }}i386
      {{- else }}{{ .Arch }}{{ end }}
checksum:
  name_template: 'checksums.txt'
snapshot:
  name_template: "{{ incpatch .Version }}-next"
changelog:
  use: github
  sort: asc
  groups:
    - title: 'Exciting New Features 🎉'
      regexp: "^.*feat.*"
      order: 0
    - title: 'Bug Fix 🛠'
      regexp: "^.*(Fix|fix|bug).*"
      order: 1
    - title: 'Refactor 🏗️'
      regexp: "^.*refact.*"
      order: 2
    - title: 'Documentation 🖊️'
      regexp: "^.*docs.*"
      order: 3
    - title: 'Others:'
      order: 999
dockers:
- image_templates:
  - "modelzai/openmodelz-modelzetes:v{{ .Version }}-amd64"
  use: buildx
  dockerfile: modelzetes/Dockerfile
  ids:
  - modelzetes
  build_flag_templates:
  - "--platform=linux/amd64"
# - image_templates:
#   - "modelzai/modelzetes:v{{ .Version }}-arm64v8"
#   use: buildx
#   goarch: arm64
#   ids:
#   - modelzetes
#   dockerfile: modelzetes/Dockerfile
#   build_flag_templates:
#   - "--platform=linux/arm64/v8"

- image_templates:
  - "modelzai/openmodelz-agent:v{{ .Version }}-amd64"
  use: buildx
  dockerfile: agent/Dockerfile
  ids:
  - agent
  build_flag_templates:
  - "--platform=linux/amd64"
# - image_templates:
#   - "modelzai/modelz-agent:v{{ .Version }}-arm64v8"
#   use: buildx
#   goarch: arm64
#   ids:
#   - agent
#   dockerfile: agent/Dockerfile
#   build_flag_templates:
#   - "--platform=linux/arm64/v8"

- image_templates:
  - "modelzai/openmodelz-autoscaler:v{{ .Version }}-amd64"
  use: buildx
  dockerfile: autoscaler/Dockerfile
  ids:
  - autoscaler
  build_flag_templates:
  - "--platform=linux/amd64"
# - image_templates:
#   - "modelzai/modelz-autoscaler:v{{ .Version }}-arm64v8"
#   use: buildx
#   goarch: arm64
#   ids:
#   - autoscaler
#   dockerfile: autoscaler/Dockerfile
#   build_flag_templates:
#   - "--platform=linux/arm64/v8"

- image_templates:
  - "modelzai/openmodelz-ingress-operator:v{{ .Version }}-amd64"
  use: buildx
  dockerfile: ingress-operator/Dockerfile
  ids:
  - ingress-operator
  build_flag_templates:
  - "--platform=linux/amd64"

docker_manifests:
- name_template: modelzai/openmodelz-modelzetes:v{{ .Version }}
  image_templates:
  - modelzai/openmodelz-modelzetes:v{{ .Version }}-amd64
  # - modelzai/modelzetes:v{{ .Version }}-arm64v8
- name_template: modelzai/openmodelz-agent:v{{ .Version }}
  image_templates:
  - modelzai/openmodelz-agent:v{{ .Version }}-amd64
  # - modelzai/modelz-agent:v{{ .Version }}-arm64v8
- name_template: modelzai/openmodelz-autoscaler:v{{ .Version }}
  image_templates:
  - modelzai/openmodelz-autoscaler:v{{ .Version }}-amd64
  # - modelzai/modelz-autoscaler:v{{ .Version }}-arm64v8
- name_template: modelzai/openmodelz-ingress-operator:v{{ .Version }}
  image_templates:
  - modelzai/openmodelz-ingress-operator:v{{ .Version }}-amd64
  # - modelzai/ingress-operator:v{{ .Version }}-arm64v8


================================================
FILE: LICENSE
================================================

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   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.


================================================
FILE: MANIFEST.in
================================================
prune autoscaler
prune ingress-operator
prune modelzetes
prune .github
include LICENSE
include README.md
include .goreleaser.yaml
include mdz/Makefile mdz/go.mod mdz/go.sum mdz/LICENSE
graft mdz/pkg
graft mdz/cmd
prune mdz/bin
prune mdz/docs
prune mdz/examples
graft agent/pkg
prune agent/bin


================================================
FILE: README.md
================================================
<div align="center">

# OpenModelZ

</div>

<p align=center>
<a href="https://discord.gg/KqswhpVgdU"><img alt="discord invitation link" src="https://dcbadge.vercel.app/api/server/KqswhpVgdU?style=flat"></a>
<a href="https://twitter.com/TensorChord"><img src="https://img.shields.io/twitter/follow/tensorchord?style=social" alt="trackgit-views" /></a>
<a href="https://docs.open.modelz.ai"><img src="https://img.shields.io/badge/docs.open.modelz.ai-455946.svg?style=socail&logo=googlechrome&logoColor=white" alt="docs" /></a>
<a href="https://github.com/tensorchord/openmodelz#contributors-"><img alt="all-contributors" src="https://img.shields.io/github/all-contributors/tensorchord/openmodelz/main"></a>
<a href="https://github.com/tensorchord/openmodelz/actions/workflows/CI.yaml"><img alt="CI" src="https://github.com/tensorchord/openmodelz/actions/workflows/CI.yaml/badge.svg"></a>
<a href="https://badge.fury.io/py/openmodelz"><img src="https://badge.fury.io/py/openmodelz.svg" alt="PyPI version" height="20"></a>
<a href='https://coveralls.io/github/tensorchord/openmodelz'><img src='https://coveralls.io/repos/github/tensorchord/openmodelz/badge.svg' alt='Coverage Status' /></a>
</p>

## What is OpenModelZ?

OpenModelZ ( `mdz` ) is tool to deploy your models to any cluster (GCP, AWS, Lambda labs, your home lab, or even a single machine).

Getting models into production is hard for data scientists and SREs. You need to configure the monitoring, logging, and scaling infrastructure, with the right security and permissions. And then setup the domain, SSL, and load balancer. This can take weeks or months of work even for a single model deployment.

You can now use mdz deploy to effortlessly deploy your models. OpenModelZ handles all the infrastructure setup for you. Each deployment gets a public subdomain, like `http://jupyter-9pnxd.2.242.22.143.modelz.live`, making it easily accessible.

<p align=center>
<img src="https://user-images.githubusercontent.com/5100735/260630222-46e26e54-50c6-43ba-b3ea-2e64dd276f87.png" alt="OpenModelZ" width="1000"/>
</p>

## Benefits

OpenModelZ provides the following features out-of-the-box:

- 📈 **Auto-scaling from 0**: The number of inference servers could be scaled based on the workload. You could start from 0 and scale it up to 10+ replicas easily.
- 📦 **Support any machine learning framework**: You could deploy any machine learning framework (e.g. [vLLM](https://github.com/vllm-project/vllm)/[triton-inference-server](https://github.com/triton-inference-server/server)/[mosec](https://github.com/mosecorg/mosec) etc.) with a single command. Besides, you could also deploy your own custom inference server.
- 🔬 **Gradio/Streamlit/Jupyter support**: We provide a robust prototyping environment with support for [Gradio](https://gradio.app), [Streamlit](https://streamlit.io/), [jupyter](https://jupyter.org/) and so on. You could visualize your model's performance and debug it easily in the notebook, or deploy a web app for your model with a single command.
- 🏃 **Start from a single machine to a cluster of machines**: You could start from a single machine and scale it up to a cluster of machines without any hassle, with a single command `mdz server start`.
- 🚀 **Public accessible subdomain for each deployment** ( optional ) : We provision a separate subdomain for each deployment without any extra cost and effort, making each deployment easily accessible from the outside.

OpenModelZ is the foundational component of the ModelZ platform available at [modelz.ai](https://modelz.ai).

## How it works

Get a server (could be a cloud VM, a home lab, or even a single machine) and run the `mdz server start` command. OpenModelZ will bootstrap the server for you.

```text
$ mdz server start
🚧 Creating the server...
🚧 Initializing the load balancer...
🚧 Initializing the GPU resource...
🚧 Initializing the server...
🚧 Waiting for the server to be ready...
🐋 Checking if the server is running...
🐳 The server is running at http://146.235.213.84.modelz.live
🎉 You could set the environment variable to get started!

export MDZ_URL=http://146.235.213.84.modelz.live
$ export MDZ_URL=http://146.235.213.84.modelz.live
```

Then you could deploy your model with a single command `mdz deploy` and get the endpoint:

```
$ mdz deploy --image modelzai/gradio-stable-diffusion:23.03 --name sdw --port 7860 --gpu 1
Inference sd is created
$ mdz list
 NAME  ENDPOINT                                                 STATUS  INVOCATIONS  REPLICAS 
 sdw   http://sdw-qh2n0y28ybqc36oc.146.235.213.84.modelz.live   Ready           174  1/1      
       http://146.235.213.84.modelz.live/inference/sdw.default                                
```

## Quick Start 🚀

### Install `mdz`

You can install OpenModelZ using the following command:

```text copy
pip install openmodelz
```

You could verify the installation by running the following command:

```text copy
mdz
```

Once you've installed the `mdz` you can start deploying models and experimenting with them.

### Bootstrap `mdz`

It's super easy to bootstrap the `mdz` server. You just need to find a server (could be a cloud VM, a home lab, or even a single machine) and run the `mdz server start` command.

> Notice: We may require the root permission to bootstrap the `mdz` server on port 80.

```
$ mdz server start
🚧 Creating the server...
🚧 Initializing the load balancer...
🚧 Initializing the GPU resource...
🚧 Initializing the server...
🚧 Waiting for the server to be ready...
🐋 Checking if the server is running...
Agent:
 Version:       v0.0.13
 Build Date:    2023-07-19T09:12:55Z
 Git Commit:    84d0171640453e9272f78a63e621392e93ef6bbb
 Git State:     clean
 Go Version:    go1.19.10
 Compiler:      gc
 Platform:      linux/amd64
🐳 The server is running at http://192.168.71.93.modelz.live
🎉 You could set the environment variable to get started!

export MDZ_URL=http://192.168.71.93.modelz.live
```

The internal IP address will be used as the default endpoint of your deployments. You could provide the public IP address of your server to the `mdz server start` command to make it accessible from the outside world.

```bash
# Provide the public IP as an argument
$ mdz server start 1.2.3.4
```

You could also specify the registry mirror to speed up the image pulling process. Here is an example:

```bash /--mirror-endpoints/
$ mdz server start --mirror-endpoints https://docker.mirrors.sjtug.sjtu.edu.cn
```

### Create your first UI-based deployment

Once you've bootstrapped the `mdz` server, you can start deploying your first applications. We will use jupyter notebook as an example in this tutorial. You could use any docker image as your deployment.

```text
$ mdz deploy --image jupyter/minimal-notebook:lab-4.0.3 --name jupyter --port 8888 --command "jupyter notebook --ip='*' --NotebookApp.token='' --NotebookApp.password=''"
Inference jupyter is created
$ mdz list
 NAME     ENDPOINT                                                   STATUS  INVOCATIONS  REPLICAS
 jupyter  http://jupyter-9pnxdkeb6jsfqkmq.192.168.71.93.modelz.live  Ready           488  1/1
          http://192.168.71.93/inference/jupyter.default                                                                         
```

You could access the deployment by visiting the endpoint URL. The endpoint will be automatically generated for each deployment with the following format: `<name>-<random-string>.<ip>.modelz.live`.

It is `http://jupyter-9pnxdkeb6jsfqkmq.192.168.71.93.modelz.live` in this case. The endpoint could be accessed from the outside world as well if you've provided the public IP address of your server to the `mdz server start` command. 

![jupyter notebook](./images/jupyter.png)

### Create your first OpenAI compatible API server

You could also create API-based deployments. We will use [OpenAI compatible API server with Bloomz 560M](https://github.com/tensorchord/modelz-llm#run-the-self-hosted-api-server) as an example in this tutorial.

```text
$ mdz deploy --image modelzai/llm-bloomz-560m:23.07.4 --name simple-server
Inference simple-server is created
$ mdz list
 NAME           ENDPOINT                                                         STATUS  INVOCATIONS  REPLICAS 
 jupyter        http://jupyter-9pnxdkeb6jsfqkmq.192.168.71.93.modelz.live        Ready           488  1/1      
                http://192.168.71.93/inference/jupyter.default                                                 
 simple-server  http://simple-server-lagn8m9m8648q6kx.192.168.71.93.modelz.live  Ready             0  1/1      
                http://192.168.71.93/inference/simple-server.default                                           
```

You could use OpenAI python package and the endpoint `http://simple-server-lagn8m9m8648q6kx.192.168.71.93.modelz.live` in this case, to interact with the deployment.

```python
import openai
openai.api_base="http://simple-server-lagn8m9m8648q6kx.192.168.71.93.modelz.live"
openai.api_key="any"

# create a chat completion
chat_completion = openai.ChatCompletion.create(model="bloomz", messages=[
    {"role": "user", "content": "Who are you?"},
    {"role": "assistant", "content": "I am a student"},
    {"role": "user", "content": "What do you learn?"},
], max_tokens=100)
```

### Scale your deployment

You could scale your deployment by using the `mdz scale` command.

```text /scale/
$ mdz scale simple-server --replicas 3
```

The requests will be load balanced between the replicas of your deployment. 

You could also tell the `mdz` to **autoscale your deployment** based on the inflight requests. Please check out the [Autoscaling](https://docs.open.modelz.ai/deployment/autoscale) documentation for more details.

### Debug your deployment

Sometimes you may want to debug your deployment. You could use the `mdz logs` command to get the logs of your deployment.

```text /logs/
$ mdz logs simple-server
simple-server-6756dd67ff-4bf4g: 10.42.0.1 - - [27/Jul/2023 02:32:16] "GET / HTTP/1.1" 200 -
simple-server-6756dd67ff-4bf4g: 10.42.0.1 - - [27/Jul/2023 02:32:16] "GET / HTTP/1.1" 200 -
simple-server-6756dd67ff-4bf4g: 10.42.0.1 - - [27/Jul/2023 02:32:17] "GET / HTTP/1.1" 200 -
```

You could also use the `mdz exec` command to execute a command in the container of your deployment. You do not need to ssh into the server to do that.

```text /exec/
$ mdz exec simple-server ps
PID   USER     TIME   COMMAND
    1 root       0:00 /usr/bin/dumb-init /bin/sh -c python3 -m http.server 80
    7 root       0:00 /bin/sh -c python3 -m http.server 80
    8 root       0:00 python3 -m http.server 80
    9 root       0:00 ps
```

```text /exec/
$ mdz exec simple-server -ti bash
bash-4.4# 
```

Or you could port-forward the deployment to your local machine and debug it locally.

```text /port-forward/
$ mdz port-forward simple-server 7860
Forwarding inference simple-server to local port 7860
```

### Add more servers

You could add more servers to your cluster by using the `mdz server join` command. The `mdz` server will be bootstrapped on the server and join the cluster automatically.

```text /join/
$ mdz server join <internal ip address of the previous server>
$ mdz server list
 NAME   PHASE  ALLOCATABLE      CAPACITY        
 node1  Ready  cpu: 16          cpu: 16         
               mem: 32784748Ki  mem: 32784748Ki 
               gpu: 1           gpu: 1      
 node2  Ready  cpu: 16          cpu: 16         
               mem: 32784748Ki  mem: 32784748Ki 
               gpu: 1           gpu: 1      
```

### Label your servers

You could label your servers to deploy your models to specific servers. For example, you could label your servers with `gpu=true` and deploy your models to servers with GPUs.

```text /--node-labels gpu=true,type=nvidia-a100/
$ mdz server label node3 gpu=true type=nvidia-a100
$ mdz deploy ... --node-labels gpu=true,type=nvidia-a100
```

## Architecture

OpenModelZ is inspired by the [k3s](https://github.com/k3s-io/k3s) and [OpenFaaS](https://github.com/openfaas), but designed specifically for machine learning deployment. We keep the core of the system **simple, and easy to extend**.

You do not need to read this section if you just want to deploy your models. But if you want to understand how OpenModelZ works, this section is for you.

<p align=center>
<img src="https://user-images.githubusercontent.com/5100735/260627792-2e89f6b8-006c-4807-84a3-29b6785af812.png" alt="OpenModelZ" width="500"/>
</p>

OpenModelZ is composed of two components:

- Data Plane: The data plane is responsible for the servers. You could use `mdz server` to manage the servers. The data plane is designed to be **stateless** and **scalable**. You could easily scale the data plane by adding more servers to the cluster. It uses k3s under the hood, to support VMs, bare-metal, and IoT devices (in the future). You could also deploy OpenModelZ on a existing kubernetes cluster.
- Control Plane: The control plane is responsible for the deployments. It manages the deployments and the underlying resources.

A request will be routed to the inference servers by the load balancer. And the autoscaler will scale the number of inference servers based on the workload. We provide a domain `*.modelz.live` by default, with the help of a [wildcard DNS server](https://github.com/cunnie/sslip.io) to support the public accessible subdomain for each deployment. You could also use your own domain.

You could check out the [architecture](https://docs.open.modelz.ai/architecture) documentation for more details.

## Roadmap 🗂️

Please checkout [ROADMAP](https://docs.open.modelz.ai/community).

## Contribute 😊

We welcome all kinds of contributions from the open-source community, individuals, and partners.

- Join our [discord community](https://discord.gg/KqswhpVgdU)!

## Contributors ✨

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/gaocegege"><img src="https://avatars.githubusercontent.com/u/5100735?v=4?s=70" width="70px;" alt="Ce Gao"/><br /><sub><b>Ce Gao</b></sub></a><br /><a href="https://github.com/tensorchord/openmodelz/commits?author=gaocegege" title="Code">💻</a> <a href="https://github.com/tensorchord/openmodelz/pulls?q=is%3Apr+reviewed-by%3Agaocegege" title="Reviewed Pull Requests">👀</a> <a href="#tutorial-gaocegege" title="Tutorials">✅</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/VoVAllen"><img src="https://avatars.githubusercontent.com/u/8686776?v=4?s=70" width="70px;" alt="Jinjing Zhou"/><br /><sub><b>Jinjing Zhou</b></sub></a><br /><a href="#question-VoVAllen" title="Answering Questions">💬</a> <a href="https://github.com/tensorchord/openmodelz/issues?q=author%3AVoVAllen" title="Bug reports">🐛</a> <a href="#ideas-VoVAllen" title="Ideas, Planning, & Feedback">🤔</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://blog.mapotofu.org/"><img src="https://avatars.githubusercontent.com/u/12974685?v=4?s=70" width="70px;" alt="Keming"/><br /><sub><b>Keming</b></sub></a><br /><a href="https://github.com/tensorchord/openmodelz/commits?author=kemingy" title="Code">💻</a> <a href="#design-kemingy" title="Design">🎨</a> <a href="#infra-kemingy" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
      <td align="center" valign="top" width="14.28%"><a href="http://manjusaka.itscoder.com/"><img src="https://avatars.githubusercontent.com/u/7054676?v=4?s=70" width="70px;" alt="Nadeshiko Manju"/><br /><sub><b>Nadeshiko Manju</b></sub></a><br /><a href="https://github.com/tensorchord/openmodelz/issues?q=author%3AZheaoli" title="Bug reports">🐛</a> <a href="#design-Zheaoli" title="Design">🎨</a> <a href="#ideas-Zheaoli" title="Ideas, Planning, & Feedback">🤔</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/tddschn"><img src="https://avatars.githubusercontent.com/u/45612704?v=4?s=70" width="70px;" alt="Teddy Xinyuan Chen"/><br /><sub><b>Teddy Xinyuan Chen</b></sub></a><br /><a href="https://github.com/tensorchord/openmodelz/commits?author=tddschn" title="Documentation">📖</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://page.codespaper.com"><img src="https://avatars.githubusercontent.com/u/3764335?v=4?s=70" width="70px;" alt="Wei Zhang"/><br /><sub><b>Wei Zhang</b></sub></a><br /><a href="https://github.com/tensorchord/openmodelz/commits?author=zwpaper" title="Code">💻</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://xuanwo.io/"><img src="https://avatars.githubusercontent.com/u/5351546?v=4?s=70" width="70px;" alt="Xuanwo"/><br /><sub><b>Xuanwo</b></sub></a><br /><a href="#content-Xuanwo" title="Content">🖋</a> <a href="#design-Xuanwo" title="Design">🎨</a> <a href="#ideas-Xuanwo" title="Ideas, Planning, & Feedback">🤔</a></td>
    </tr>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/cutecutecat"><img src="https://avatars.githubusercontent.com/u/19801166?v=4?s=70" width="70px;" alt="cutecutecat"/><br /><sub><b>cutecutecat</b></sub></a><br /><a href="#ideas-cutecutecat" title="Ideas, Planning, & Feedback">🤔</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://xieydd.github.io/"><img src="https://avatars.githubusercontent.com/u/20329697?v=4?s=70" width="70px;" alt="xieydd"/><br /><sub><b>xieydd</b></sub></a><br /><a href="#ideas-xieydd" title="Ideas, Planning, & Feedback">🤔</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

## Acknowledgements 🙏

- [K3s](https://github.com/k3s-io/k3s) for the single control-plane binary and process.
- [OpenFaaS](https://github.com/openfaas) for their work on serverless function services. It laid the foundation for OpenModelZ.
- [sslip.io](https://github.com/cunnie/sslip.io) for the wildcard DNS service. It makes it possible to access the server from the outside world without any setup.


================================================
FILE: agent/.gitignore
================================================
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
*.report

# Dependency directories (remove the comment below to include it)
vendor/

# Go workspace file
go.work

.vscode/*
.idea

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

__debug_bin
bin/
debug-bin/
/build.envd
.ipynb_checkpoints/
cover.html

cmd/test/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
wheelhouse/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
.demo/
pkg/docs/swagger.*


================================================
FILE: agent/Dockerfile
================================================
FROM ubuntu:22.04

LABEL maintainer="modelz-support@tensorchord.ai"
RUN apt-get -qq update \
    && apt-get -qq install -y --no-install-recommends ca-certificates curl

COPY agent /usr/bin/agent
ENTRYPOINT ["/usr/bin/agent"]


================================================
FILE: agent/Makefile
================================================
# Copyright 2022 TensorChord Inc.
#
# The old school Makefile, following are required targets. The Makefile is written
# to allow building multiple binaries. You are free to add more targets or change
# existing implementations, as long as the semantics are preserved.
#
#   make              - default to 'build' target
#   make lint         - code analysis
#   make test         - run unit test (or plus integration test)
#   make build        - alias to build-local target
#   make build-local  - build local binary targets
#   make build-linux  - build linux binary targets
#   make container    - build containers
#   $ docker login registry -u username -p xxxxx
#   make push         - push containers
#   make clean        - clean up targets
#
# Not included but recommended targets:
#   make e2e-test
#
# The makefile is also responsible to populate project version information.
#

#
# Tweak the variables based on your project.
#

# This repo's root import path (under GOPATH).
ROOT := github.com/tensorchord/openmodelz/agent

# Target binaries. You can build multiple binaries for a single project.
TARGETS := agent

# Container image prefix and suffix added to targets.
# The final built images are:
#   $[REGISTRY]/$[IMAGE_PREFIX]$[TARGET]$[IMAGE_SUFFIX]:$[VERSION]
# $[REGISTRY] is an item from $[REGISTRIES], $[TARGET] is an item from $[TARGETS].
IMAGE_PREFIX ?= $(strip )
IMAGE_SUFFIX ?= $(strip )

# Container registries.
REGISTRY ?= ghcr.io/tensorchord

# Container registry for base images.
BASE_REGISTRY ?= docker.io
BASE_REGISTRY_USER ?= modelzai

# Disable CGO by default.
CGO_ENABLED ?= 0

#
# These variables should not need tweaking.
#

# It's necessary to set this because some environments don't link sh -> bash.
export SHELL := bash

# It's necessary to set the errexit flags for the bash shell.
export SHELLOPTS := errexit

PACKAGE_NAME := github.com/tensorchord/openmodelz/agent
GOLANG_CROSS_VERSION  ?= v1.17.6

# Project main package location (can be multiple ones).
CMD_DIR := ./cmd

# Project output directory.
OUTPUT_DIR := ./bin
DEBUG_DIR := ./debug-bin

# Build directory.
BUILD_DIR := ./build

# Current version of the project.
VERSION ?= $(shell git describe --match 'v[0-9]*' --always --tags --abbrev=0)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
GITSHA ?= $(shell git rev-parse --short HEAD)

# Track code version with Docker Label.
DOCKER_LABELS ?= git-describe="$(shell date -u +v%Y%m%d)-$(shell git describe --tags --always --dirty)"

# Golang standard bin directory.
GOPATH ?= $(shell go env GOPATH)
GOROOT ?= $(shell go env GOROOT)
BIN_DIR := $(GOPATH)/bin
GOLANGCI_LINT := $(BIN_DIR)/golangci-lint

# check if we need embed the dashboard
DASHBOARD_BUILD ?= debug

# Default golang flags used in build and test
# -mod=vendor: force go to use the vendor files instead of using the `$GOPATH/pkg/mod`
# -p: the number of programs that can be run in parallel
# -count: run each test and benchmark 1 times. Set this flag to disable test cache
export GOFLAGS ?= -count=1

#
# Define all targets. At least the following commands are required:
#

# All targets.
.PHONY: help lint test build container push addlicense debug debug-local build-local generate clean test-local addlicense-install release build-image

.DEFAULT_GOAL:=build

build: build-local  ## Build the release version

help:  ## Display this help
	@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf "  \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

debug: debug-local  ## Build the debug version

# more info about `GOGC` env: https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
lint: $(GOLANGCI_LINT)  ## Lint GO code
	@$(GOLANGCI_LINT) run

$(GOLANGCI_LINT):
	curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin

mockgen-install:
	go install github.com/golang/mock/mockgen@v1.6.0

addlicense-install:
	go install github.com/google/addlicense@latest

# https://github.com/swaggo/swag/pull/1322, we should use master instead of latest for now.
swag-install:
	go install github.com/swaggo/swag/cmd/swag@v1.8.7

build-local:
	@for target in $(TARGETS); do                                                      \
	  CGO_ENABLED=$(CGO_ENABLED) go build -tags $(DASHBOARD_BUILD)  -trimpath -v -o $(OUTPUT_DIR)/$${target}     \
	    -ldflags "-s -w -X $(ROOT)/pkg/version.version=$(VERSION) -X $(ROOT)/pkg/version.buildDate=$(BUILD_DATE) -X $(ROOT)/pkg/version.gitCommit=$(GIT_COMMIT) -X $(ROOT)/pkg/version.gitTreeState=$(GIT_TREE_STATE)"                     \
	    $(CMD_DIR)/$${target};                                                         \
	done

# It is used by vscode to attach into the process.
debug-local:
	@for target in $(TARGETS); do                                                      \
	  CGO_ENABLED=$(CGO_ENABLED) go build -tags $(DASHBOARD_BUILD) -trimpath                                    \
	  	-v -o $(DEBUG_DIR)/$${target}                                                  \
	  	-gcflags='all=-N -l'                                                           \
	    $(CMD_DIR)/$${target};                                                         \
	done

addlicense: addlicense-install  ## Add license to GO code files
	addlicense -l mpl -c "TensorChord Inc." $$(find . -type f -name '*.go' | grep -v pkg/docs/docs.go)

test-local:
	@go test -tags=$(DASHBOARD_BUILD) -v -race -coverprofile=coverage.out ./...

test:  ## Run the tests
	@go test -tags=$(DASHBOARD_BUILD) -race -coverprofile=coverage.out ./...
	@go tool cover -func coverage.out | tail -n 1 | awk '{ print "Total coverage: " $$3 }'

clean:  ## Clean the outputs and artifacts
	@-rm -vrf ${OUTPUT_DIR}
	@-rm -vrf ${DEBUG_DIR}
	@-rm -vrf build dist .eggs *.egg-info

fmt: swag-install ## Run go fmt against code.
	go fmt ./...
	swag fmt

vet: ## Run go vet against code.
	go vet ./...

swag: swag-install
	swag init -g ./cmd/agent/main.go --parseDependency --output ./pkg/docs 

build-image: build-local
	docker build -t ${BASE_REGISTRY}/${BASE_REGISTRY_USER}/openmodelz-agent:dev -f Dockerfile ./bin
	docker push ${BASE_REGISTRY}/${BASE_REGISTRY_USER}/openmodelz-agent:dev

release:
	@if [ ! -f ".release-env" ]; then \
		echo "\033[91m.release-env is required for release\033[0m";\
		exit 1;\
	fi
	docker run \
		--rm \
		--privileged \
		-e CGO_ENABLED=1 \
		--env-file .release-env \
		-v /var/run/docker.sock:/var/run/docker.sock \
		-v `pwd`:/go/src/$(PACKAGE_NAME) \
		-v `pwd`/sysroot:/sysroot \
		-w /go/src/$(PACKAGE_NAME) \
		goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
		release --rm-dist

generate: mockgen-install swag
	@mockgen -source pkg/runtime/runtime.go -destination pkg/runtime/mock/mock.go -package mock


================================================
FILE: agent/README.md
================================================
<div align="center">

# OpenModelZ Agent

</div>

<p align=center>
<a href="https://discord.gg/KqswhpVgdU"><img alt="discord invitation link" src="https://dcbadge.vercel.app/api/server/KqswhpVgdU?style=flat"></a>
<a href="https://twitter.com/TensorChord"><img src="https://img.shields.io/twitter/follow/tensorchord?style=social" alt="trackgit-views" /></a>
</p>

## Installation

```
pip install openmodelz
```

## Architecture

Please check out [Architecture](https://docs.open.modelz.ai/architecture) documentation.


================================================
FILE: agent/api/types/build.go
================================================
package types

type Build struct {
	Spec   BuildSpec   `json:"spec"`
	Status BuildStatus `json:"status,omitempty"`
}

type BuildSpec struct {
	Name                string `json:"name,omitempty"`
	Namespace           string `json:"namespace,omitempty"`
	GitRepositorySource `json:",inline,omitempty"`
	DockerSource        `json:",inline,omitempty"`
	BuildTarget         BuildTarget `json:",inline,omitempty"`
}

type DockerSource struct {
	ArtifactImage    string `json:"image,omitempty"`
	ArtifactImageTag string `json:"image_tag,omitempty"`
	AuthN            AuthN  `json:"authn,omitempty"`
	SecretID         string `json:"secret_id,omitempty"`
}

type BuildTarget struct {
	// directory is the target directory name.
	// Must not contain or start with '..'.  If '.' is supplied, the volume directory will be the
	// git repository.  Otherwise, if specified, the volume will contain the git repository in
	// the subdirectory with the given name.
	// +optional
	Directory string `json:"directory,omitempty"`

	Builder          BuilderType `json:"builder,omitempty"`
	ArtifactImage    string      `json:"image,omitempty"`
	ArtifactImageTag string      `json:"image_tag,omitempty"`
	Digest           string      `json:"digest,omitempty"`

	Duration      string `json:"duration,omitempty"`
	Registry      string `json:"registry,omitempty"`
	RegistryToken string `json:"registry_token,omitempty"`
}

type AuthN struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Token    string `json:"token,omitempty"`
}

type BuildStatus struct {
	Phase BuildPhase `json:"phase,omitempty"`
}

type BuildPhase string

const (
	BuildPhasePending   BuildPhase = "Pending"
	BuildPhaseRunning   BuildPhase = "Running"
	BuildPhaseSucceeded BuildPhase = "Succeeded"
	BuildPhaseFailed    BuildPhase = "Failed"
)

type BuilderType string

const (
	BuilderTypeDockerfile BuilderType = "Dockerfile"
	BuilderTypeENVD       BuilderType = "envd"
	BuilderTypeImage      BuilderType = "image"
)

type GitRepositorySource struct {
	// repository is the URL
	Repository string `json:"repository"`
	Branch     string `json:"branch,omitempty"`
	// revision is the commit hash for the specified revision.
	// +optional
	Revision string `json:"revision,omitempty"`
}


================================================
FILE: agent/api/types/error.go
================================================
package types

type ErrorResponse struct {
	Message string `json:"message"`
}


================================================
FILE: agent/api/types/event.go
================================================
package types

import "time"

const (
	DeploymentCreateEvent     = "deployment-create"
	DeploymentUpdateEvent     = "deployment-update"
	DeploymentDeleteEvent     = "deployment-delete"
	DeploymentScaleUpEvent    = "deployment-scale-up"
	DeploymentScaleDownEvent  = "deployment-scale-down"
	DeploymentScaleBlockEvent = "deployment-scale-block"
	PodCreateEvent            = "pod-create"
	PodReadyEvent             = "pod-ready"
	PodTimeoutEvent           = "pod-timeout"
)

type DeploymentEvent struct {
	ID           string    `json:"id"`
	CreatedAt    time.Time `json:"created_at"`
	UserID       string    `json:"user_id"`
	DeploymentID string    `json:"deployment_id"`
	EventType    string    `json:"event_type"`
	Message      string    `json:"message"`
}


================================================
FILE: agent/api/types/inference_deployment.go
================================================
package types

// InferenceDeployment represents a request to create or update a Model.
type InferenceDeployment struct {
	Spec   InferenceDeploymentSpec   `json:"spec"`
	Status InferenceDeploymentStatus `json:"status,omitempty"`
}

type InferenceDeploymentSpec struct {
	// Name is the name of the inference.
	Name string `json:"name"`

	// Namespace for the inference.
	Namespace string `json:"namespace,omitempty"`

	// Scaling is the scaling configuration for the inference.
	Scaling *ScalingConfig `json:"scaling,omitempty"`

	// Framework is the inference framework.
	Framework Framework `json:"framework,omitempty"`

	// Image is a fully-qualified container image
	Image string `json:"image"`

	// Port is the port exposed by the inference.
	Port *int32 `json:"port,omitempty"`

	// HTTPProbePath is the path of the http probe.
	HTTPProbePath *string `json:"http_probe_path,omitempty"`

	// Command to run when starting the
	Command *string `json:"command,omitempty"`

	// EnvVars can be provided to set environment variables for the inference runtime.
	EnvVars map[string]string `json:"envVars,omitempty"`

	// Constraints are the constraints for the inference.
	Constraints []string `json:"constraints,omitempty"`

	// Secrets list of secrets to be made available to inference.
	Secrets []string `json:"secrets,omitempty"`

	// Labels are key-value pairs that may be attached to the inference.
	Labels map[string]string `json:"labels,omitempty"`

	// Annotations are key-value pairs that may be attached to the inference.
	Annotations map[string]string `json:"annotations,omitempty"`

	// Resources are the compute resource requirements.
	Resources *ResourceRequirements `json:"resources,omitempty"`
}

// Framework is the inference framework. It is only used to set the default port
// and command. For example, if the framework is "gradio", the default port is
// 7860 and the default command is "python app.py". You could override these
// defaults by setting the port and command fields and framework to `other`.
type Framework string

const (
	FrameworkGradio    Framework = "gradio"
	FrameworkStreamlit Framework = "streamlit"
	FrameworkMosec     Framework = "mosec"
	FrameworkOther     Framework = "other"
)

type ScalingConfig struct {
	// MinReplicas is the lower limit for the number of replicas to which the
	// autoscaler can scale down. It defaults to 0.
	MinReplicas *int32 `json:"min_replicas,omitempty"`
	// MaxReplicas is the upper limit for the number of replicas to which the
	// autoscaler can scale up. It cannot be less that minReplicas. It defaults
	// to 1.
	MaxReplicas *int32 `json:"max_replicas,omitempty"`
	// TargetLoad is the target load. In capacity mode, it is the expected number of the inflight requests per replica.
	TargetLoad *int32 `json:"target_load,omitempty"`
	// Type is the scaling type. It can be either "capacity" or "rps". Default is "capacity".
	Type *ScalingType `json:"type,omitempty"`
	// ZeroDuration is the duration (in seconds) of zero load before scaling down to zero. Default is 5 minutes.
	ZeroDuration *int32 `json:"zero_duration,omitempty"`
	// StartupDuration is the duration (in seconds) of startup time.
	StartupDuration *int32 `json:"startup_duration,omitempty"`
}

type ScalingType string

const (
	ScalingTypeCapacity ScalingType = "capacity"
	ScalingTypeRPS      ScalingType = "rps"
)

// ResourceRequirements describes the compute resource requirements.
type ResourceRequirements struct {
	// Limits describes the maximum amount of compute resources allowed.
	// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
	// +optional
	Limits ResourceList `json:"limits,omitempty" protobuf:"bytes,1,rep,name=limits,casttype=ResourceList,castkey=ResourceName"`
	// Requests describes the minimum amount of compute resources required.
	// If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
	// otherwise to an implementation-defined value.
	// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
	// +optional
	Requests ResourceList `json:"requests,omitempty" protobuf:"bytes,2,rep,name=requests,casttype=ResourceList,castkey=ResourceName"`
}

// ResourceList is a set of (resource name, quantity) pairs.
type ResourceList map[ResourceName]Quantity

type ResourceName string

const (
	ResourceCPU    ResourceName = "cpu"
	ResourceMemory ResourceName = "memory"
	ResourceGPU    ResourceName = "gpu"
)

type Quantity string

const (
	RuntimeClassNvidia string = "nvidia"
)

type ImageCache struct {
	// Name is the name of the inference.
	Name           string `json:"name"`
	Namespace      string `json:"namespace"`
	Image          string `json:"image"`
	ForceFullCache bool   `json:"force_full_cache"`
	NodeSelector   string `json:"node_selector"`
}


================================================
FILE: agent/api/types/inference_deployment_instance.go
================================================
package types

import "time"

type InferenceDeploymentInstance struct {
	Spec   InferenceDeploymentInstanceSpec   `json:"spec,omitempty"`
	Status InferenceDeploymentInstanceStatus `json:"status,omitempty"`
}

type InferenceDeploymentInstanceSpec struct {
	Namespace      string `json:"namespace,omitempty"`
	Name           string `json:"name,omitempty"`
	OwnerReference string `json:"owner_reference,omitempty"`
}

type InferenceDeploymentInstanceStatus struct {
	Phase     InstancePhase `json:"phase,omitempty"`
	StartTime time.Time     `json:"createdAt,omitempty"`
	Reason    string        `json:"reason,omitempty"`
	Message   string        `json:"message,omitempty"`
}

type InstancePhase string

const (
	InstancePhaseScheduling   InstancePhase = "Scheduling"
	InstancePhasePending      InstancePhase = "Pending"
	InstancePhaseRunning      InstancePhase = "Running"
	InstancePhaseFailed       InstancePhase = "Failed"
	InstancePhaseSucceeded    InstancePhase = "Succeeded"
	InstancePhaseUnknown      InstancePhase = "Unknown"
	InstancePhaseCreating     InstancePhase = "Creating"
	InstancePhaseInitializing InstancePhase = "Initializing"
)


================================================
FILE: agent/api/types/inference_status.go
================================================
package types

import "time"

// InferenceDeploymentStatus exported for system/inferences endpoint
type InferenceDeploymentStatus struct {
	Phase Phase `json:"phase,omitempty"`

	// InvocationCount count of invocations
	InvocationCount int32 `json:"invocationCount,omitempty"`

	// Replicas desired within the cluster
	Replicas int32 `json:"replicas,omitempty"`

	// AvailableReplicas is the count of replicas ready to receive
	// invocations as reported by the faas-provider
	AvailableReplicas int32 `json:"availableReplicas,omitempty"`

	// CreatedAt is the time read back from the faas backend's
	// data store for when the function or its container was created.
	CreatedAt *time.Time `json:"createdAt,omitempty"`

	// Usage represents CPU and RAM used by all of the
	// functions' replicas. Divide by AvailableReplicas for an
	// average value per replica.
	Usage *InferenceUsage `json:"usage,omitempty"`

	// EventMessage record human readable message indicating details about the event of deployment.
	EventMessage string `json:"eventMessage,omitempty"`
}

type Phase string

const (
	// PhaseReady is the state of an inference when it is ready to
	// receive invocations.
	PhaseReady Phase = "Ready"

	// PhaseScaling is the state of an inference when scales.
	PhaseScaling Phase = "Scaling"

	PhaseTerminating Phase = "Terminating"

	PhaseNoReplicas Phase = "NoReplicas"

	PhaseNotReady Phase = "NotReady"

	PhaseBuilding Phase = "Building"

	PhaseOptimizing Phase = "Optimizing"
)

// InferenceUsage represents CPU and RAM used by all of the
// functions' replicas.
//
// CPU is measured in seconds consumed since the last measurement
// RAM is measured in total bytes consumed
type InferenceUsage struct {
	// CPU is the increase in CPU usage since the last measurement
	// equivalent to Kubernetes' concept of millicores.
	CPU float64 `json:"cpu,omitempty"`

	//TotalMemoryBytes is the total memory usage in bytes.
	TotalMemoryBytes float64 `json:"totalMemoryBytes,omitempty"`

	GPU float64 `json:"gpu,omitempty"`
}


================================================
FILE: agent/api/types/info.go
================================================
package types

// ProviderInfo provides information about the configured provider
type ProviderInfo struct {
	Name          string       `json:"provider"`
	Version       *VersionInfo `json:"version"`
	Orchestration string       `json:"orchestration"`
}

// VersionInfo provides the commit message, sha and release version number
type VersionInfo struct {
	Version      string `json:"version,omitempty"`
	BuildDate    string `json:"build_date,omitempty"`
	GitCommit    string `json:"git_commit,omitempty"`
	GitTag       string `json:"git_tag,omitempty"`
	GitTreeState string `json:"git_tree_state,omitempty"`
	GoVersion    string `json:"go_version,omitempty"`
	Compiler     string `json:"compiler,omitempty"`
	Platform     string `json:"platform,omitempty"`
}


================================================
FILE: agent/api/types/log.go
================================================
package types

import "time"

type LogRequest struct {
	Namespace string `form:"namespace" json:"namespace,omitempty"`
	Name      string `form:"name" json:"name,omitempty"`
	// Instance is the optional pod name, that allows you to request logs from a specific instance
	Instance string `form:"instance" json:"instance,omitempty"`
	// Follow is allows the user to request a stream of logs until the timeout
	Follow bool `form:"follow" json:"follow,omitempty"`
	// Tail sets the maximum number of log messages to return, <=0 means unlimited
	Tail  int    `form:"tail" json:"tail,omitempty"`
	Since string `form:"since" json:"since,omitempty"`
	// End is the end time of the log stream
	End string `form:"end" json:"end,omitempty"`
}

// Message is a specific log message from a function container log stream
type Message struct {
	// Name is the function name
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	// instance is the name/id of the specific function instance
	Instance string `json:"instance"`
	// Timestamp is the timestamp of when the log message was recorded
	Timestamp time.Time `json:"timestamp"`
	// Text is the raw log message content
	Text string `json:"text"`
}


================================================
FILE: agent/api/types/modelz_cloud.go
================================================
package types

import "time"

const (
	ClusterStatusInit    = "init"
	ClusterStatusActive  = "active"
	ClusterStatusUnknown = "unknown"
)

const (
	DailEndPointSuffix = "/api/v1/clusteragent/connect"
)

type AgentToken struct {
	UID         string `json:"uid,omitempty"`
	Token       string `json:"token,omitempty"`
	ClusterName string `json:"cluster_name,omitempty"`
}

type ManagedCluster struct {
	Name              string    `json:"name,omitempty"`
	ID                string    `json:"id,omitempty"`
	TokenID           string    `json:"token_id,omitempty"`
	Version           string    `json:"version,omitempty"`
	KubernetesVersion string    `json:"kubernetes_version,omitempty"`
	Platform          string    `json:"platform,omitempty"`
	Status            string    `json:"status,omitempty"`
	CreatedAt         time.Time `json:"created_at,omitempty"`
	UpdatedAt         time.Time `json:"updated_at,omitempty"`
	Region            string    `json:"region,omitempty"`
	ServerResources   string    `json:"server_resources,omitempty"`
	PrometheusURL     string    `json:"prometheus_url,omitempty"`
}

type APIKeyMap map[string]string

type NamespaceList struct {
	Items []string `json:"items,omitempty"`
}


================================================
FILE: agent/api/types/namespace.go
================================================
package types

type NamespaceRequest struct {
	Name string `json:"name,omitempty"`
}


================================================
FILE: agent/api/types/queue.go
================================================
package types

import (
	"net/http"
	"net/url"
)

// Request for asynchronous processing
type QueueRequest struct {
	// Header from HTTP request
	Header http.Header

	// Host from HTTP request
	Host string

	// Body from HTTP request to use for invocation
	Body []byte

	// Method from HTTP request
	Method string

	// Path from HTTP request
	Path string

	// QueryString from HTTP request
	QueryString string

	// Function name to invoke
	Function string

	// QueueName to publish the request to, leave blank
	// for default.
	QueueName string

	// Used by queue worker to submit a result
	CallbackURL *url.URL `json:"CallbackUrl"`
}

// RequestQueuer can public a request to be executed asynchronously
type RequestQueuer interface {
	Queue(req *QueueRequest) error
}


================================================
FILE: agent/api/types/requests.go
================================================
// Copyright (c) Alex Ellis 2017. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

package types

// ScaleServiceRequest scales the service to the requested replcia count.
type ScaleServiceRequest struct {
	ServiceName  string `json:"serviceName"`
	Replicas     uint64 `json:"replicas"`
	EventMessage string `json:"eventMessage"`
	Attempt      int    `json:"attempt"`
}

// DeleteFunctionRequest delete a deployed function
type DeleteFunctionRequest struct {
	FunctionName string `json:"functionName"`
}


================================================
FILE: agent/api/types/secret.go
================================================
package types

// Secret for underlying orchestrator
type Secret struct {
	// Name of the secret
	Name string `json:"name"`

	// Namespace if applicable for the secret
	Namespace string `json:"namespace,omitempty"`

	// Value is a string representing the string's value
	Value string `json:"value,omitempty"`

	// RawValue can be used to provide binary data when
	// Value is not set
	RawValue []byte `json:"rawValue,omitempty"`
}


================================================
FILE: agent/api/types/server.go
================================================
package types

type Server struct {
	Spec   ServerSpec   `json:"spec,omitempty"`
	Status ServerStatus `json:"status,omitempty"`
}

type ServerSpec struct {
	Name   string            `json:"name,omitempty"`
	Labels map[string]string `json:"labels,omitempty"`
}

type ServerStatus struct {
	Allocatable ResourceList   `json:"allocatable,omitempty"`
	Capacity    ResourceList   `json:"capacity,omitempty"`
	Phase       string         `json:"phase,omitempty"`
	System      NodeSystemInfo `json:"system,omitempty"`
}

// NodeSystemInfo is a set of ids/uuids to uniquely identify the node.
type NodeSystemInfo struct {
	// MachineID reported by the node. For unique machine identification
	// in the cluster this field is preferred. Learn more from man(5)
	// machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html
	MachineID string `json:"machineID" protobuf:"bytes,1,opt,name=machineID"`
	// Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).
	KernelVersion string `json:"kernelVersion" protobuf:"bytes,4,opt,name=kernelVersion"`
	// OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).
	OSImage string `json:"osImage" protobuf:"bytes,5,opt,name=osImage"`
	// The Operating System reported by the node
	OperatingSystem string `json:"operatingSystem" protobuf:"bytes,9,opt,name=operatingSystem"`
	// The Architecture reported by the node
	Architecture string `json:"architecture" protobuf:"bytes,10,opt,name=architecture"`
	// The Resource Type reported by the node
	ResourceType string `json:"resourceType" protobuf:"bytes,11,opt,name=resourceType"`
}


================================================
FILE: agent/client/build.go
================================================
package client

import (
	"context"
	"encoding/json"
	"fmt"
	"net/url"

	"github.com/sirupsen/logrus"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

func (cli *Client) BuildCreate(ctx context.Context, namespace string, build types.Build) error {
	build.Spec.Namespace = namespace
	logrus.Debugf("create new build: %s", build)

	val := url.Values{}
	resp, err := cli.post(ctx, gatewayBuildControlPlanePath, val, build, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return wrapResponseError(err, resp, "build", build.Spec.Name)
	}

	return nil
}

func (cli *Client) BuildGet(ctx context.Context, namespace, name string) (types.Build, error) {
	val := url.Values{}
	val.Add("namespace", namespace)
	build := types.Build{}
	resp, err := cli.get(
		ctx, fmt.Sprintf(gatewayBuildInstanceControlPlanePath, name), val, nil)
	defer ensureReaderClosed(resp)
	if err != nil {
		logrus.Infof("failed to query build.get: %s", err)
		return build, wrapResponseError(err, resp, "build", name)
	}

	err = json.NewDecoder(resp.body).Decode(&build)
	if err != nil {
		logrus.Infof("failed to decode build: %s", err)
		return build, wrapResponseError(err, resp, "build", name)
	}
	return build, nil
}

func (cli *Client) BuildList(ctx context.Context, namespace string) ([]types.Build, error) {
	val := url.Values{}
	val.Add("namespace", namespace)
	resp, err := cli.get(ctx, gatewayBuildControlPlanePath, val, nil)
	defer ensureReaderClosed(resp)
	if err != nil {
		logrus.Infof("failed to query build.list: %s", err)
		return nil, wrapResponseError(err, resp, "build", namespace)
	}

	var builds []types.Build
	err = json.NewDecoder(resp.body).Decode(&builds)
	if err != nil {
		logrus.Infof("failed to decode builds: %s", err)
		return nil, wrapResponseError(err, resp, "build", namespace)
	}
	return builds, nil
}


================================================
FILE: agent/client/client.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"net/http"
	"net/url"
	"path"
	"strings"

	"github.com/cockroachdb/errors"
	"github.com/docker/go-connections/sockets"
)

// Refer to github.com/docker/docker/client

// ErrRedirect is the error returned by checkRedirect when the request is non-GET.
var ErrRedirect = errors.New("unexpected redirect in response")

// Client is the API client that performs all operations
// against a docker server.
type Client struct {
	// scheme sets the scheme for the client
	scheme string
	// host holds the server address to connect to
	host string
	// proto holds the client protocol i.e. unix.
	proto string
	// addr holds the client address.
	addr string
	// basePath holds the path to prepend to the requests.
	basePath string
	// client used to send and receive http requests.
	client *http.Client
	// version of the server to talk to.
	version string
	// custom http headers configured by users.
	customHTTPHeaders map[string]string
	// manualOverride is set to true when the version was set by users.
	manualOverride bool

	// negotiateVersion indicates if the client should automatically negotiate
	// the API version to use when making requests. API version negotiation is
	// performed on the first request, after which negotiated is set to "true"
	// so that subsequent requests do not re-negotiate.
	negotiateVersion bool

	// negotiated indicates that API version negotiation took place
	negotiated bool
}

// NewClientWithOpts initializes a new API client with a default HTTPClient, and
// default API host and version. It also initializes the custom HTTP headers to
// add to each request.
//
// It takes an optional list of Opt functional arguments, which are applied in
// the order they're provided, which allows modifying the defaults when creating
// the client. For example, the following initializes a client that configures
// itself with values from environment variables (client.FromEnv), and has
// automatic API version negotiation enabled (client.WithAPIVersionNegotiation()).
//
//	cli, err := client.NewClientWithOpts(
//		client.FromEnv,
//		client.WithAPIVersionNegotiation(),
//	)
func NewClientWithOpts(ops ...Opt) (*Client, error) {
	client, err := defaultHTTPClient(DefaultModelzGatewayHost)
	if err != nil {
		return nil, err
	}
	c := &Client{
		host:     DefaultModelzGatewayHost,
		version:  "",
		client:   client,
		proto:    defaultProto,
		addr:     defaultAddr,
		basePath: apiBasePath,
	}

	for _, op := range ops {
		if err := op(c); err != nil {
			return nil, err
		}
	}

	if c.scheme == "" {
		c.scheme = "http"

		tlsConfig := resolveTLSConfig(c.client.Transport)
		if tlsConfig != nil {
			// TODO(stevvooe): This isn't really the right way to write clients in Go.
			// `NewClient` should probably only take an `*http.Client` and work from there.
			// Unfortunately, the model of having a host-ish/url-thingy as the connection
			// string has us confusing protocol and transport layers. We continue doing
			// this to avoid breaking existing clients but this should be addressed.
			c.scheme = "https"
		}
	}

	return c, nil
}

func defaultHTTPClient(host string) (*http.Client, error) {
	hostURL, err := ParseHostURL(host)
	if err != nil {
		return nil, err
	}
	transport := &http.Transport{}
	_ = sockets.ConfigureTransport(transport, hostURL.Scheme, hostURL.Host)
	return &http.Client{
		Transport:     transport,
		CheckRedirect: CheckRedirectKeepHeader,
	}, nil
}

// CheckRedirect specifies the policy for dealing with redirect responses:
// If the request is non-GET return ErrRedirect, otherwise use the last response.
//
// Go 1.8 changes behavior for HTTP redirects (specifically 301, 307, and 308)
// in the client. The envd client (and by extension envd API client) can be
// made to send a request like POST /containers//start where what would normally
// be in the name section of the URL is empty. This triggers an HTTP 301 from
// the daemon.
//
// In go 1.8 this 301 will be converted to a GET request, and ends up getting
// a 404 from the daemon. This behavior change manifests in the client in that
// before, the 301 was not followed and the client did not generate an error,
// but now results in a message like Error response from daemon: page not found.
func CheckRedirect(req *http.Request, via []*http.Request) error {
	if via[0].Method == http.MethodGet {
		return http.ErrUseLastResponse
	}
	return ErrRedirect
}

func CheckRedirectKeepHeader(req *http.Request, via []*http.Request) error {
	req.Header = via[0].Header.Clone()
	return nil
}

// DaemonHost returns the host address used by the client
func (cli *Client) DaemonHost() string {
	return cli.host
}

// HTTPClient returns a copy of the HTTP client bound to the server
func (cli *Client) HTTPClient() *http.Client {
	c := *cli.client
	return &c
}

// ParseHostURL parses a url string, validates the string is a host url, and
// returns the parsed URL
func ParseHostURL(host string) (*url.URL, error) {
	protoAddrParts := strings.SplitN(host, "://", 2)
	if len(protoAddrParts) == 1 {
		return nil, errors.Errorf("unable to parse docker host `%s`", host)
	}

	var basePath string
	proto, addr := protoAddrParts[0], protoAddrParts[1]
	if proto == "tcp" {
		parsed, err := url.Parse("tcp://" + addr)
		if err != nil {
			return nil, err
		}
		addr = parsed.Host
		basePath = parsed.Path
	}
	return &url.URL{
		Scheme: proto,
		Host:   addr,
		Path:   basePath,
	}, nil
}

// Close the transport used by the client
func (cli *Client) Close() error {
	if t, ok := cli.client.Transport.(*http.Transport); ok {
		t.CloseIdleConnections()
	}
	return nil
}

// getAPIPath returns the versioned request path to call the api.
// It appends the query parameters to the path if they are not empty.
func (cli *Client) getAPIPath(ctx context.Context, p string, query url.Values) string {
	var apiPath string
	if cli.version != "" {
		v := strings.TrimPrefix(cli.version, "v")
		apiPath = path.Join(cli.basePath, "/v"+v, p)
	} else {
		apiPath = path.Join(cli.basePath, p)
	}
	return (&url.URL{Path: apiPath, RawQuery: query.Encode()}).String()
}


================================================
FILE: agent/client/const.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

const DefaultModelzGatewayHost = "http://0.0.0.0:8080"

const defaultProto = "http"
const defaultAddr = "0.0.0.0:8080"

// Base path for api, distinguish from frontend pages
const apiBasePath = ""

const (
	gatewayInferControlPlanePath                      = "/system/inferences"
	gatewayInferScaleControlPath                      = "/system/scale-inference"
	gatewayInferInstanceControlPlanePath              = "/system/inference/%s/instances"
	gatewayInferInstanceExecControlPlanePath          = "/system/inference/%s/instance/%s/exec"
	gatewayServerControlPlanePath                     = "/system/servers"
	gatewayServerLabelCreateControlPlanePath          = "/system/server/%s/labels"
	gatewayServerNodeDeleteControlPlanePath           = "/system/server/%s/delete"
	gatewayNamespaceControlPlanePath                  = "/system/namespaces"
	gatewayBuildControlPlanePath                      = "/system/build"
	gatewayBuildInstanceControlPlanePath              = "/system/build/%s"
	gatewayImageCacheControlPlanePath                 = "/system/image-cache"
	modelzCloudClusterControlPlanePath                = "/api/v1/users/%s/clusters/%s"
	modelzCloudClusterWithUserControlPlanePath        = "/api/v1/users/%s/clusters"
	modelzCloudClusterAPIKeyControlPlanePath          = "/api/v1/users/%s/clusters/%s/api_keys"
	modelzCloudClusterNamespaceControlPlanePath       = "/api/v1/users/%s/clusters/%s/namespaces"
	modelzCloudClusterDeploymentControlPlanePath      = "/api/v1/users/%s/clusters/%s/deployments/%s/agent"
	modelzCloudClusterDeploymentEventControlPlanePath = "/api/v1/users/%s/clusters/%s/deployments/%s/event"
)

const (
	// EnvOverrideHost is the name of the environment variable that can be used
	// to override the default host to connect to (DefaultEnvdServerHost).
	//
	// This env-var is read by FromEnv and WithHostFromEnv and when set to a
	// non-empty value, takes precedence over the default host (which is platform
	// specific), or any host already set.
	EnvOverrideHost = "MODELZ_GATEWAY_HOST"

	// EnvOverrideCertPath is the name of the environment variable that can be
	// used to specify the directory from which to load the TLS certificates
	// (ca.pem, cert.pem, key.pem) from. These certificates are used to configure
	// the Client for a TCP connection protected by TLS client authentication.
	//
	// TLS certificate verification is enabled by default if the Client is configured
	// to use a TLS connection. Refer to EnvTLSVerify below to learn how to
	// disable verification for testing purposes.
	//
	//
	// For local access to the API, it is recommended to connect with the daemon
	// using the default local socket connection (on Linux), or the named pipe
	// (on Windows).
	//
	// If you need to access the API of a remote daemon, consider using an SSH
	// (ssh://) connection, which is easier to set up, and requires no additional
	// configuration if the host is accessible using ssh.
	EnvOverrideCertPath = "ENVD_SERVER_CERT_PATH"

	// EnvTLSVerify is the name of the environment variable that can be used to
	// enable or disable TLS certificate verification. When set to a non-empty
	// value, TLS certificate verification is enabled, and the client is configured
	// to use a TLS connection, using certificates from the default directories
	// (within `~/.envd`); refer to EnvOverrideCertPath above for additional
	// details.
	//
	//
	// Before setting up your client and daemon to use a TCP connection with TLS
	// client authentication, consider using one of the alternatives mentioned
	// in EnvOverrideCertPath above.
	//
	// Disabling TLS certificate verification (for testing purposes)
	//
	// TLS certificate verification is enabled by default if the Client is configured
	// to use a TLS connection, and it is highly recommended to keep verification
	// enabled to prevent machine-in-the-middle attacks.
	//
	// Set the "ENVD_SERVER_TLS_VERIFY" environment to an empty string ("") to
	// disable TLS certificate verification. Disabling verification is insecure,
	// so should only be done for testing purposes. From the Go documentation
	// (https://pkg.go.dev/crypto/tls#Config):
	//
	// InsecureSkipVerify controls whether a client verifies the server's
	// certificate chain and host name. If InsecureSkipVerify is true, crypto/tls
	// accepts any certificate presented by the server and any host name in that
	// certificate. In this mode, TLS is susceptible to machine-in-the-middle
	// attacks unless custom verification is used. This should be used only for
	// testing or in combination with VerifyConnection or VerifyPeerCertificate.
	EnvTLSVerify = "ENVD_SERVER_TLS_VERIFY"
)


================================================
FILE: agent/client/errors.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client // import "github.com/docker/docker/client"

import (
	"fmt"
	"net/http"

	"github.com/cockroachdb/errors"

	"github.com/tensorchord/openmodelz/agent/errdefs"
)

// errConnectionFailed implements an error returned when connection failed.
type errConnectionFailed struct {
	host string
}

// Error returns a string representation of an errConnectionFailed
func (err errConnectionFailed) Error() string {
	if err.host == "" {
		return "Cannot connect to the backend"
	}
	return fmt.Sprintf("Cannot connect at %s", err.host)
}

// IsErrConnectionFailed returns true if the error is caused by connection failed.
func IsErrConnectionFailed(err error) bool {
	return errors.As(err, &errConnectionFailed{})
}

// ErrorConnectionFailed returns an error with host in the error message when connection to docker daemon failed.
func ErrorConnectionFailed(host string) error {
	return errConnectionFailed{host: host}
}

// Deprecated: use the errdefs.NotFound() interface instead. Kept for backward compatibility
type notFound interface {
	error
	NotFound() bool
}

// IsErrNotFound returns true if the error is a NotFound error, which is returned
// by the API when some object is not found.
func IsErrNotFound(err error) bool {
	if errdefs.IsNotFound(err) {
		return true
	}
	var e notFound
	return errors.As(err, &e)
}

type objectNotFoundError struct {
	object string
	id     string
}

func (e objectNotFoundError) NotFound() {}

func (e objectNotFoundError) Error() string {
	return fmt.Sprintf("Error: No such %s: %s", e.object, e.id)
}

// IsErrUnauthorized returns true if the error is caused
// when a remote registry authentication fails
//
// Deprecated: use errdefs.IsUnauthorized
func IsErrUnauthorized(err error) bool {
	return errdefs.IsUnauthorized(err)
}

type pluginPermissionDenied struct {
	name string
}

func (e pluginPermissionDenied) Error() string {
	return "Permission denied while installing plugin " + e.name
}

// IsErrNotImplemented returns true if the error is a NotImplemented error.
// This is returned by the API when a requested feature has not been
// implemented.
//
// Deprecated: use errdefs.IsNotImplemented
func IsErrNotImplemented(err error) bool {
	return errdefs.IsNotImplemented(err)
}

func wrapResponseError(err error, resp serverResponse, object, id string) error {
	switch {
	case err == nil:
		return nil
	case resp.statusCode == http.StatusNotFound:
		return objectNotFoundError{object: object, id: id}
	case resp.statusCode == http.StatusNotImplemented:
		return errdefs.NotImplemented(err)
	default:
		return err
	}
}


================================================
FILE: agent/client/hijack.go
================================================
package client // import "docker.io/go-docker"

import (
	"net/url"

	"github.com/gorilla/websocket"
	"golang.org/x/net/context"
)

// HijackedResponse holds connection information for a hijacked request.
type HijackedResponse struct {
	Conn *websocket.Conn
}

// Close closes the hijacked connection and reader.
func (h *HijackedResponse) Close() {
	h.Conn.Close()
}

// postHijacked sends a POST request and hijacks the connection.
func (cli *Client) websocket(ctx context.Context, path string, query url.Values, headers map[string][]string) (HijackedResponse, error) {
	apiPath := cli.getAPIPath(ctx, path, nil)

	scheme := "ws"
	if cli.scheme == "https" {
		scheme = "wss"
	}

	apiURL := url.URL{
		Scheme:   scheme,
		Host:     cli.addr,
		Path:     apiPath,
		RawQuery: query.Encode(),
	}
	c, _, err := websocket.DefaultDialer.DialContext(ctx, apiURL.String(), nil)
	if err != nil {
		return HijackedResponse{}, err
	}

	return HijackedResponse{Conn: c}, err
}

func (h HijackedResponse) Read(p []byte) (int, error) {
	// Read message from websocket connection.
	tm := &TerminalMessage{}
	if err := h.Conn.ReadJSON(tm); err != nil {
		return 0, err
	}
	if tm.Op != "stdout" {
		return 0, nil
	}
	return copy(p, tm.Data), nil
}

func (h HijackedResponse) Write(p []byte) (int, error) {
	// Write message to websocket connection.
	tm := &TerminalMessage{
		Op:   "stdin",
		Data: string(p),
	}
	if err := h.Conn.WriteJSON(tm); err != nil {
		return 0, err
	}
	return len(p), nil
}

// TerminalMessage is the messaging protocol between ShellController and TerminalSession.
//
// OP      DIRECTION  FIELD(S) USED  DESCRIPTION
// ---------------------------------------------------------------------
// bind    fe->be     SessionID      Id sent back from TerminalResponse
// stdin   fe->be     Data           Keystrokes/paste buffer
// resize  fe->be     Rows, Cols     New terminal size
// stdout  be->fe     Data           Output from the process
// toast   be->fe     Data           OOB message to be shown to the user
type TerminalMessage struct {
	ID   string `json:"id,omitempty"`
	Op   string `json:"op,omitempty"`
	Data string `json:"data,omitempty"`
	Rows uint16 `json:"rows,omitempty"`
	Cols uint16 `json:"cols,omitempty"`
}


================================================
FILE: agent/client/image_cache_create.go
================================================
package client

import (
	"context"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

func (cli *Client) ImageCacheCreate(ctx context.Context, namespace string,
	imageCache *types.ImageCache) error {
	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)

	resp, err := cli.post(ctx, gatewayImageCacheControlPlanePath, urlValues, imageCache, nil)
	defer ensureReaderClosed(resp)
	if err != nil {
		return wrapResponseError(err, resp, "imagecache", imageCache.Name)
	}

	return wrapResponseError(err, resp, "imagecache", imageCache.Name)
}


================================================
FILE: agent/client/inference_create.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// InferenceCreate creates the inference.
func (cli *Client) InferenceCreate(ctx context.Context, namespace string,
	inference types.InferenceDeployment) (types.InferenceDeployment, error) {
	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)

	resp, err := cli.post(ctx, gatewayInferControlPlanePath, urlValues, inference, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return inference, wrapResponseError(err, resp, "inference", inference.Spec.Name)
	}

	return inference, wrapResponseError(err, resp, "inference", inference.Spec.Name)
}


================================================
FILE: agent/client/inference_get.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"encoding/json"
	"fmt"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// InferenceGet gets the inference.
func (cli *Client) InferenceGet(ctx context.Context, namespace, name string) (types.InferenceDeployment, error) {
	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)

	url := fmt.Sprintf("/system/inference/%s", name)
	resp, err := cli.get(ctx, url, urlValues, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return types.InferenceDeployment{},
			wrapResponseError(err, resp, "inference", name)
	}

	var inference types.InferenceDeployment
	err = json.NewDecoder(resp.body).Decode(&inference)
	if err != nil {
		return types.InferenceDeployment{},
			wrapResponseError(err, resp, "inference", name)
	}

	return inference, wrapResponseError(err, resp, "inference", name)
}


================================================
FILE: agent/client/inference_list.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"encoding/json"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// InferenceList lists the inferences.
func (cli *Client) InferenceList(ctx context.Context, namespace string) ([]types.InferenceDeployment, error) {
	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)

	resp, err := cli.get(ctx, gatewayInferControlPlanePath, urlValues, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return nil,
			wrapResponseError(err, resp, "inferences with namespace", namespace)
	}

	var inferences []types.InferenceDeployment
	err = json.NewDecoder(resp.body).Decode(&inferences)

	return inferences, err
}


================================================
FILE: agent/client/inference_remove.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// InferenceRemove removes the inference.
func (cli *Client) InferenceRemove(ctx context.Context, namespace string,
	name string) error {

	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)

	req := types.DeleteFunctionRequest{
		FunctionName: name,
	}

	resp, err := cli.delete(ctx, gatewayInferControlPlanePath, urlValues, req, nil)
	defer ensureReaderClosed(resp)
	return wrapResponseError(err, resp, "inference", name)
}


================================================
FILE: agent/client/inference_scale.go
================================================
package client

import (
	"context"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// InferenceScale scales the inference.
func (cli *Client) InferenceScale(ctx context.Context, namespace string,
	name string, replicas int, eventMessage string) error {

	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)

	req := types.ScaleServiceRequest{
		ServiceName:  name,
		Replicas:     uint64(replicas),
		EventMessage: eventMessage,
	}

	resp, err := cli.post(ctx, gatewayInferScaleControlPath, urlValues, req, nil)
	defer ensureReaderClosed(resp)
	return wrapResponseError(err, resp, "inference", name)
}


================================================
FILE: agent/client/inference_update.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// DeploymentUpdate creates the deployment.
func (cli *Client) DeploymentUpdate(ctx context.Context, namespace string,
	inference types.InferenceDeployment) (types.InferenceDeployment, error) {

	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)

	resp, err := cli.put(ctx, gatewayInferControlPlanePath, urlValues, inference, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return inference,
			wrapResponseError(err, resp, "inference", inference.Spec.Name)
	}

	return inference, wrapResponseError(err, resp, "inference", inference.Spec.Name)
}


================================================
FILE: agent/client/info.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"encoding/json"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// InfoGet gets the agent info.
func (cli *Client) InfoGet(ctx context.Context) (types.ProviderInfo, error) {
	resp, err := cli.get(ctx, "/system/info", nil, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return types.ProviderInfo{},
			wrapResponseError(err, resp, "info", "system")
	}

	var info types.ProviderInfo
	err = json.NewDecoder(resp.body).Decode(&info)
	if err != nil {
		return types.ProviderInfo{},
			wrapResponseError(err, resp, "info", "system")
	}

	return info, wrapResponseError(err, resp, "info", "system")
}


================================================
FILE: agent/client/instance_exec.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"fmt"
	"io"
	"net/url"
	"strings"
)

// InstanceExec executes command in the instance.
func (cli *Client) InstanceExec(ctx context.Context,
	namespace, inferenceName, instance string, command []string, tty bool) (string, error) {
	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)
	urlValues.Add("tty", fmt.Sprintf("%v", tty))
	urlValues.Add("command", strings.Join(command, ","))

	urlPath := fmt.Sprintf(gatewayInferInstanceExecControlPlanePath, inferenceName, instance)

	resp, err := cli.get(ctx, urlPath, urlValues, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return "",
			wrapResponseError(err, resp, "instances with namespace", namespace)
	}

	res, err := io.ReadAll(resp.body)
	if err != nil {
		return "", wrapResponseError(err, resp, "instances with namespace", namespace)
	}

	return string(res), wrapResponseError(err, resp, "instances with namespace", namespace)
}

// InstanceExec executes command in the instance.
func (cli *Client) InstanceExecTTY(ctx context.Context,
	namespace, inferenceName, instance string, command []string,
) (HijackedResponse, error) {
	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)
	urlValues.Add("tty", "true")
	urlValues.Add("command", strings.Join(command, ","))

	urlPath := fmt.Sprintf(gatewayInferInstanceExecControlPlanePath, inferenceName, instance)

	resp, err := cli.websocket(ctx, urlPath, urlValues, nil)
	if err != nil {
		return HijackedResponse{}, wrapResponseError(err, serverResponse{}, "instances with namespace", namespace)
	}

	return resp, nil
}


================================================
FILE: agent/client/instance_list.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"encoding/json"
	"fmt"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// InstanceList lists the deployment instances.
func (cli *Client) InstanceList(ctx context.Context,
	namespace, inferenceName string) ([]types.InferenceDeploymentInstance, error) {
	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)

	urlPath := fmt.Sprintf(gatewayInferInstanceControlPlanePath, inferenceName)

	resp, err := cli.get(ctx, urlPath, urlValues, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return nil,
			wrapResponseError(err, resp, "instances with namespace", namespace)
	}

	var instances []types.InferenceDeploymentInstance
	err = json.NewDecoder(resp.body).Decode(&instances)

	return instances, wrapResponseError(err, resp, "instances with namespace", namespace)
}


================================================
FILE: agent/client/log.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"bufio"
	"context"
	"encoding/json"
	"fmt"
	"net/url"
	"strings"

	"github.com/sirupsen/logrus"
	"github.com/tensorchord/openmodelz/agent/api/types"
)

const LogBufferSize = 128

// DeploymentLogGet gets the deployment logs.
func (cli *Client) DeploymentLogGet(ctx context.Context, namespace, name string,
	since string, tail int, end string, follow bool) (
	<-chan types.Message, error) {
	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)
	urlValues.Add("name", name)

	if since != "" {
		urlValues.Add("since", since)
	}

	if end != "" {
		urlValues.Add("end", end)
	}

	if tail != 0 {
		urlValues.Add("tail", fmt.Sprintf("%d", tail))
	}

	if follow {
		urlValues.Add("follow", "true")
	}

	resp, err := cli.get(ctx, "/system/logs/inference", urlValues, nil)

	if err != nil {
		return nil, wrapResponseError(err, resp, "deployment logs", name)
	}

	stream := make(chan types.Message, LogBufferSize)
	var log types.Message
	scanner := bufio.NewScanner(resp.body)
	go func() {
		defer ensureReaderClosed(resp)
		defer close(stream)
		for scanner.Scan() {
			err = json.Unmarshal(scanner.Bytes(), &log)
			if err != nil {
				logrus.Warnf("failed to decode %s log: %v | %s | [%s]", name, err, scanner.Text(), scanner.Err())
				return
				// continue
			}
			stream <- log
		}
	}()

	return stream, err
}

func (cli *Client) BuildLogGet(ctx context.Context, namespace, name, since string,
	tail int) ([]types.Message, error) {
	urlValues := url.Values{}
	urlValues.Add("namespace", namespace)
	urlValues.Add("name", name)

	if since != "" {
		urlValues.Add("since", since)
	}
	if tail != 0 {
		urlValues.Add("tail", fmt.Sprintf("%d", tail))
	}

	resp, err := cli.get(ctx, "/system/logs/build", urlValues, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return nil,
			wrapResponseError(err, resp, "build logs", name)
	}

	var log types.Message
	logs := []types.Message{}
	scanner := bufio.NewScanner(resp.body)
	for scanner.Scan() {
		err = json.NewDecoder(strings.NewReader(scanner.Text())).Decode(&log)
		if err != nil {
			return nil, wrapResponseError(err, resp, "build logs", name)
		}
		logs = append(logs, log)
	}

	return logs, err
}


================================================
FILE: agent/client/modelz_cloud.go
================================================
package client

import (
	"context"
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
	"time"

	"github.com/sirupsen/logrus"
	"github.com/tensorchord/openmodelz/agent/api/types"
	"github.com/tensorchord/openmodelz/agent/pkg/consts"
	"k8s.io/apimachinery/pkg/util/wait"
)

func (cli *Client) WaitForAPIServerReady() error {
	err := wait.PollImmediateWithContext(context.Background(), time.Second, consts.DefaultAPIServerReadyTimeout, func(ctx context.Context) (bool, error) {
		err, healthStatus := cli.waitForAPIServerReady(ctx)
		if err != nil || healthStatus != http.StatusOK {
			logrus.Warn("APIServer isn't ready yet, Waiting a little while.")
			return false, err
		}
		return true, nil
	})
	if err != nil {
		return fmt.Errorf("failed to wait for apiserver ready, %v", err)
	}
	return nil
}

func (cli *Client) waitForAPIServerReady(ctx context.Context) (error, int) {
	urlValues := url.Values{}
	resp, err := cli.get(ctx, "/healthz", urlValues, nil)
	if err != nil {
		return wrapResponseError(err, resp, "check apiserver is ready", ""), resp.statusCode
	}
	defer ensureReaderClosed(resp)
	return nil, resp.statusCode
}

func (cli *Client) RegisterAgent(ctx context.Context, token string, cluster *types.ManagedCluster) error {
	urlValues := url.Values{}
	agentToken, err := ParseAgentToken(token)
	if err != nil {
		return err
	}
	urlPath := fmt.Sprintf(modelzCloudClusterWithUserControlPlanePath, agentToken.UID)
	headers := make(map[string][]string)
	headers["Authorization"] = []string{"Bearer " + agentToken.Token}
	cluster.Name = agentToken.ClusterName

	resp, err := cli.post(ctx, urlPath, urlValues, cluster, headers)
	if err != nil {
		return wrapResponseError(err, resp, "register agent to modelz cloud", agentToken.UID)
	}
	defer ensureReaderClosed(resp)

	err = json.NewDecoder(resp.body).Decode(&cluster)
	if err != nil {
		return err
	}
	return nil
}

func (cli *Client) UpdateAgentStatus(ctx context.Context, apiServerReady <-chan struct{}, token string, cluster types.ManagedCluster) error {
	<-apiServerReady
	urlValues := url.Values{}
	agentToken, err := ParseAgentToken(token)
	if err != nil {
		return err
	}
	urlPath := fmt.Sprintf(modelzCloudClusterControlPlanePath, agentToken.UID, cluster.ID)
	headers := make(map[string][]string)
	headers["Authorization"] = []string{"Bearer " + agentToken.Token}

	resp, err := cli.put(ctx, urlPath, urlValues, cluster, headers)
	if err != nil {
		return wrapResponseError(err, resp, "update agent status to modelz cloud", agentToken.UID)
	}
	defer ensureReaderClosed(resp)

	if resp.statusCode == 200 {
		return nil
	}
	return fmt.Errorf("failed to update agent status to modelz cloud, status code: %d", resp.statusCode)
}

func (cli *Client) GetAPIKeys(ctx context.Context, apiServerReady <-chan struct{}, token string, cluster string) (types.APIKeyMap, error) {
	<-apiServerReady
	urlValues := url.Values{}
	agentToken, err := ParseAgentToken(token)
	keys := types.APIKeyMap{}
	if err != nil {
		return keys, err
	}
	headers := make(map[string][]string)
	headers["Authorization"] = []string{"Bearer " + agentToken.Token}

	urlPath := fmt.Sprintf(modelzCloudClusterAPIKeyControlPlanePath, agentToken.UID, cluster)
	resp, err := cli.get(ctx, urlPath, urlValues, headers)
	if err != nil {
		return keys, wrapResponseError(err, resp, "get api keys from modelz cloud", agentToken.UID)
	}
	defer ensureReaderClosed(resp)

	err = json.NewDecoder(resp.body).Decode(&keys)
	if err != nil {
		return keys, err
	}
	return keys, nil
}

func (cli *Client) GetNamespaces(ctx context.Context, apiServerReady <-chan struct{}, token string, cluster string) (types.NamespaceList, error) {
	<-apiServerReady
	urlValues := url.Values{}
	agentToken, err := ParseAgentToken(token)
	ns := types.NamespaceList{}
	if err != nil {
		return ns, err
	}
	urlValues.Add("login_name", agentToken.UID)
	headers := make(map[string][]string)
	headers["Authorization"] = []string{"Bearer " + agentToken.Token}

	resp, err := cli.get(ctx, fmt.Sprintf(modelzCloudClusterNamespaceControlPlanePath, agentToken.UID, cluster), urlValues, headers)
	if err != nil {
		return ns, wrapResponseError(err, resp, "get namespaces from modelz cloud", agentToken.UID)
	}
	defer ensureReaderClosed(resp)

	err = json.NewDecoder(resp.body).Decode(&ns)
	if err != nil {
		return ns, err
	}

	ns.Items = append(ns.Items, GetNamespaceByUserID(agentToken.UID))
	return ns, nil
}

func (cli *Client) GetUIDFromDeploymentID(ctx context.Context, token string, cluster string, deployment string) (string, error) {
	urlValues := url.Values{}
	agentToken, err := ParseAgentToken(token)
	if err != nil {
		return "", err
	}
	headers := make(map[string][]string)
	headers["Authorization"] = []string{"Bearer " + agentToken.Token}
	urlPath := fmt.Sprintf(modelzCloudClusterDeploymentControlPlanePath, agentToken.UID, cluster, deployment)

	resp, err := cli.get(ctx, urlPath, urlValues, headers)
	if err != nil {
		return "", err
	}
	defer ensureReaderClosed(resp)

	var uid string
	err = json.NewDecoder(resp.body).Decode(&uid)
	if err != nil {
		return "", err
	}

	if resp.statusCode == 200 {
		return uid, nil
	}
	return "", fmt.Errorf("failed to get uid from deployment id, status code: %d", resp.statusCode)
}

func (cli *Client) CreateDeploymentEvent(ctx context.Context, token string, event types.DeploymentEvent) error {
	urlValues := url.Values{}
	agentToken, err := ParseAgentToken(token)
	if err != nil {
		return err
	}
	headers := make(map[string][]string)
	headers["Authorization"] = []string{"Bearer " + agentToken.Token}
	urlPath := fmt.Sprintf(modelzCloudClusterDeploymentEventControlPlanePath, agentToken.UID, agentToken.ClusterName, event.DeploymentID)

	resp, err := cli.post(ctx, urlPath, urlValues, event, headers)
	if err != nil {
		return err
	}
	defer ensureReaderClosed(resp)

	if resp.statusCode == http.StatusCreated {
		return nil
	}
	return fmt.Errorf("failed to create deployment event, status code: %d", resp.statusCode)
}


================================================
FILE: agent/client/namespace_create.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// NamespaceCreate creates the namespace.
func (cli *Client) NamespaceCreate(ctx context.Context,
	namespace string) error {
	req := types.NamespaceRequest{
		Name: namespace,
	}

	urlValues := url.Values{}

	resp, err := cli.post(ctx, gatewayNamespaceControlPlanePath, urlValues, req, nil)
	defer ensureReaderClosed(resp)

	return wrapResponseError(err, resp, "namespace", namespace)
}


================================================
FILE: agent/client/namespace_delete.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// NamespaceDelete deletes the namespace.
func (cli *Client) NamespaceDelete(ctx context.Context,
	namespace string) error {
	req := types.NamespaceRequest{
		Name: namespace,
	}

	urlValues := url.Values{}

	resp, err := cli.delete(ctx, gatewayNamespaceControlPlanePath, urlValues, req, nil)
	defer ensureReaderClosed(resp)

	return wrapResponseError(err, resp, "namespace", namespace)
}


================================================
FILE: agent/client/options.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"net"
	"net/http"
	"os"
	"path/filepath"
	"time"

	"github.com/cockroachdb/errors"
	"github.com/docker/go-connections/sockets"
	"github.com/docker/go-connections/tlsconfig"
)

// Opt is a configuration option to initialize a client
type Opt func(*Client) error

// FromEnv configures the client with values from environment variables.
//
// FromEnv uses the following environment variables:
//
// ENVD_SERVER_HOST (EnvOverrideHost) to set the URL to the docker server.
//
// ENVD_SERVER_CERT_PATH (EnvOverrideCertPath) to specify the directory from which to
// load the TLS certificates (ca.pem, cert.pem, key.pem).
//
// ENVD_SERVER_TLS_VERIFY (EnvTLSVerify) to enable or disable TLS verification (off by
// default).
func FromEnv(c *Client) error {
	// TODO(gaocegege): Support:
	// ENVD_SERVER_API_VERSION (EnvOverrideAPIVersion) to set the version of the API to
	// use, leave empty for latest.
	//
	ops := []Opt{
		WithTLSClientConfigFromEnv(),
		WithHostFromEnv(),
	}
	for _, op := range ops {
		if err := op(c); err != nil {
			return err
		}
	}
	return nil
}

// WithDialContext applies the dialer to the client transport. This can be
// used to set the Timeout and KeepAlive settings of the client.
func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) Opt {
	return func(c *Client) error {
		if transport, ok := c.client.Transport.(*http.Transport); ok {
			transport.DialContext = dialContext
			return nil
		}
		return errors.Errorf("cannot apply dialer to transport: %T", c.client.Transport)
	}
}

// WithHost overrides the client host with the specified one.
func WithHost(host string) Opt {
	return func(c *Client) error {
		hostURL, err := ParseHostURL(host)
		if err != nil {
			return err
		}
		c.host = host
		c.proto = hostURL.Scheme
		c.addr = hostURL.Host
		c.basePath = hostURL.Path
		if transport, ok := c.client.Transport.(*http.Transport); ok {
			return sockets.ConfigureTransport(transport, c.proto, c.addr)
		}
		return errors.Errorf("cannot apply host to transport: %T", c.client.Transport)
	}
}

// WithHostFromEnv overrides the client host with the host specified in the
// DOCKER_HOST (EnvOverrideHost) environment variable. If DOCKER_HOST is not set,
// or set to an empty value, the host is not modified.
func WithHostFromEnv() Opt {
	return func(c *Client) error {
		if host := os.Getenv(EnvOverrideHost); host != "" {
			return WithHost(host)(c)
		}
		return nil
	}
}

// WithHTTPClient overrides the client http client with the specified one
func WithHTTPClient(client *http.Client) Opt {
	return func(c *Client) error {
		if client != nil {
			c.client = client
		}
		return nil
	}
}

// WithTimeout configures the time limit for requests made by the HTTP client
func WithTimeout(timeout time.Duration) Opt {
	return func(c *Client) error {
		c.client.Timeout = timeout
		return nil
	}
}

// WithHTTPHeaders overrides the client default http headers
func WithHTTPHeaders(headers map[string]string) Opt {
	return func(c *Client) error {
		c.customHTTPHeaders = headers
		return nil
	}
}

// WithScheme overrides the client scheme with the specified one
func WithScheme(scheme string) Opt {
	return func(c *Client) error {
		c.scheme = scheme
		return nil
	}
}

// WithTLSClientConfig applies a tls config to the client transport.
func WithTLSClientConfig(cacertPath, certPath, keyPath string) Opt {
	return func(c *Client) error {
		opts := tlsconfig.Options{
			CAFile:             cacertPath,
			CertFile:           certPath,
			KeyFile:            keyPath,
			ExclusiveRootPools: true,
		}
		config, err := tlsconfig.Client(opts)
		if err != nil {
			return errors.Wrap(err, "failed to create tls config")
		}
		if transport, ok := c.client.Transport.(*http.Transport); ok {
			transport.TLSClientConfig = config
			return nil
		}
		return errors.Errorf("cannot apply tls config to transport: %T", c.client.Transport)
	}
}

// WithTLSClientConfigFromEnv configures the client's TLS settings with the
// settings in the DOCKER_CERT_PATH and DOCKER_TLS_VERIFY environment variables.
// If DOCKER_CERT_PATH is not set or empty, TLS configuration is not modified.
//
// WithTLSClientConfigFromEnv uses the following environment variables:
//
// DOCKER_CERT_PATH (EnvOverrideCertPath) to specify the directory from which to
// load the TLS certificates (ca.pem, cert.pem, key.pem).
//
// DOCKER_TLS_VERIFY (EnvTLSVerify) to enable or disable TLS verification (off by
// default).
func WithTLSClientConfigFromEnv() Opt {
	return func(c *Client) error {
		dockerCertPath := os.Getenv(EnvOverrideCertPath)
		if dockerCertPath == "" {
			return nil
		}
		options := tlsconfig.Options{
			CAFile:             filepath.Join(dockerCertPath, "ca.pem"),
			CertFile:           filepath.Join(dockerCertPath, "cert.pem"),
			KeyFile:            filepath.Join(dockerCertPath, "key.pem"),
			InsecureSkipVerify: os.Getenv(EnvTLSVerify) == "",
		}
		tlsc, err := tlsconfig.Client(options)
		if err != nil {
			return err
		}

		c.client = &http.Client{
			Transport:     &http.Transport{TLSClientConfig: tlsc},
			CheckRedirect: CheckRedirect,
		}
		return nil
	}
}

// WithVersion overrides the client version with the specified one. If an empty
// version is specified, the value will be ignored to allow version negotiation.
func WithVersion(version string) Opt {
	return func(c *Client) error {
		if version != "" {
			c.version = version
			c.manualOverride = true
		}
		return nil
	}
}


================================================
FILE: agent/client/request.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"io"
	"net"
	"net/http"
	"net/url"
	"os"
	"strings"

	"github.com/cockroachdb/errors"
	"github.com/sirupsen/logrus"

	"github.com/tensorchord/openmodelz/agent/errdefs"
)

// serverResponse is a wrapper for http API responses.
type serverResponse struct {
	body       io.ReadCloser
	header     http.Header
	statusCode int
	reqURL     *url.URL
}

// head sends an http request to the docker API using the method HEAD.
func (cli *Client) head(ctx context.Context, path string, query url.Values, headers map[string][]string) (serverResponse, error) {
	return cli.sendRequest(ctx, http.MethodHead, path, query, nil, headers)
}

// get sends an http request to the docker API using the method GET with a specific Go context.
func (cli *Client) get(ctx context.Context, path string, query url.Values, headers map[string][]string) (serverResponse, error) {
	return cli.sendRequest(ctx, http.MethodGet, path, query, nil, headers)
}

// post sends an http request to the docker API using the method POST with a specific Go context.
func (cli *Client) post(ctx context.Context, path string, query url.Values, obj interface{}, headers map[string][]string) (serverResponse, error) {
	body, headers, err := encodeBody(obj, headers)
	if err != nil {
		return serverResponse{}, err
	}
	return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers)
}

func (cli *Client) postRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers map[string][]string) (serverResponse, error) {
	return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers)
}

func (cli *Client) put(ctx context.Context, path string, query url.Values, obj interface{}, headers map[string][]string) (serverResponse, error) {
	body, headers, err := encodeBody(obj, headers)
	if err != nil {
		return serverResponse{}, err
	}
	return cli.sendRequest(ctx, http.MethodPut, path, query, body, headers)
}

// putRaw sends an http request to the docker API using the method PUT.
func (cli *Client) putRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers map[string][]string) (serverResponse, error) {
	return cli.sendRequest(ctx, http.MethodPut, path, query, body, headers)
}

// delete sends an http request to the docker API using the method DELETE.
func (cli *Client) delete(ctx context.Context, path string, query url.Values, obj interface{}, headers map[string][]string) (serverResponse, error) {
	body, headers, err := encodeBody(obj, headers)
	if err != nil {
		return serverResponse{}, err
	}
	return cli.sendRequest(ctx, http.MethodDelete, path, query, body, headers)
}

type headers map[string][]string

func encodeBody(obj interface{}, headers headers) (io.Reader, headers, error) {
	if obj == nil {
		return nil, headers, nil
	}

	body, err := encodeData(obj)
	if err != nil {
		return nil, headers, err
	}
	if headers == nil {
		headers = make(map[string][]string)
	}
	headers["Content-Type"] = []string{"application/json"}
	return body, headers, nil
}

func (cli *Client) buildRequest(method, path string, body io.Reader, headers headers) (*http.Request, error) {
	expectedPayload := (method == http.MethodPost || method == http.MethodPut)
	if expectedPayload && body == nil {
		body = bytes.NewReader([]byte{})
	}

	req, err := http.NewRequest(method, path, body)
	if err != nil {
		return nil, err
	}
	req = cli.addHeaders(req, headers)

	if cli.proto == "unix" || cli.proto == "npipe" {
		// For local communications, it doesn't matter what the host is. We just
		// need a valid and meaningful host name.
		req.Host = "modelz"
	}

	req.URL.Host = cli.addr
	req.URL.Scheme = cli.scheme

	if expectedPayload && req.Header.Get("Content-Type") == "" {
		req.Header.Set("Content-Type", "text/plain")
	}

	logrus.Debugf("Sending HTTP request to %s\n", req.URL.String())
	logrus.Debugf("Request Headers: %v\n", req.Header)
	logrus.Debugf("Request Body: %v\n", body)
	return req, nil
}

func (cli *Client) sendRequest(ctx context.Context, method, path string, query url.Values, body io.Reader, headers headers) (serverResponse, error) {
	req, err := cli.buildRequest(method, cli.getAPIPath(ctx, path, query), body, headers)
	if err != nil {
		return serverResponse{}, errors.Wrap(err, "failed to build request")
	}

	resp, err := cli.doRequest(ctx, req)
	switch {
	case errors.Is(err, context.Canceled):
		return serverResponse{}, errdefs.Cancelled(err)
	case errors.Is(err, context.DeadlineExceeded):
		return serverResponse{}, errdefs.Deadline(err)
	case err == nil:
		err = cli.checkResponseErr(resp)
	}
	return resp, errdefs.FromStatusCode(err, resp.statusCode)
}

func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResponse, error) {
	serverResp := serverResponse{statusCode: -1, reqURL: req.URL}

	req = req.WithContext(ctx)
	resp, err := cli.client.Do(req)
	if err != nil {
		if cli.scheme != "https" && strings.Contains(err.Error(), "malformed HTTP response") {
			return serverResp, fmt.Errorf("%v.\n* Are you trying to connect to a TLS-enabled daemon without TLS?", err)
		}

		if cli.scheme == "https" && strings.Contains(err.Error(), "bad certificate") {
			return serverResp, errors.Wrap(err, "the server probably has client authentication (--tlsverify) enabled; check your TLS client certification settings")
		}

		// Don't decorate context sentinel errors; users may be comparing to
		// them directly.
		if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
			return serverResp, err
		}

		if nErr, ok := err.(*url.Error); ok {
			if nErr, ok := nErr.Err.(*net.OpError); ok {
				if os.IsPermission(nErr.Err) {
					return serverResp, errors.Wrapf(err, "permission denied while trying to connect to the modelz agent server socket at %v", cli.host)
				}
			}
		}

		if err, ok := err.(net.Error); ok {
			if err.Timeout() {
				return serverResp, ErrorConnectionFailed(cli.host)
			}
			if strings.Contains(err.Error(), "connection refused") || strings.Contains(err.Error(), "dial unix") {
				return serverResp, ErrorConnectionFailed(cli.host)
			}
		}

		return serverResp, errors.Wrap(err, "error during connect")
	}

	if resp != nil {
		serverResp.statusCode = resp.StatusCode
		serverResp.body = resp.Body
		serverResp.header = resp.Header
	}
	return serverResp, nil
}

func (cli *Client) checkResponseErr(serverResp serverResponse) error {
	if serverResp.statusCode >= 200 && serverResp.statusCode < 400 {
		return nil
	}

	var body []byte
	var err error
	if serverResp.body != nil {
		bodyMax := 1 * 1024 * 1024 // 1 MiB
		bodyR := &io.LimitedReader{
			R: serverResp.body,
			N: int64(bodyMax),
		}
		body, err = io.ReadAll(bodyR)
		if err != nil {
			return err
		}
		if bodyR.N == 0 {
			return fmt.Errorf("request returned %s with a message (> %d bytes) for API route and version %s, check if the server supports the requested API version", http.StatusText(serverResp.statusCode), bodyMax, serverResp.reqURL)
		}
	}
	if len(body) == 0 {
		return fmt.Errorf("request returned %s for API route and version %s, check if the server supports the requested API version", http.StatusText(serverResp.statusCode), serverResp.reqURL)
	}

	errorMessage := strings.TrimSpace(string(body))

	return errors.Wrap(errors.New(errorMessage), "Error response from gateway")
}

func (cli *Client) addHeaders(req *http.Request, headers headers) *http.Request {
	// Add CLI Config's HTTP Headers BEFORE we set the Docker headers
	// then the user can't change OUR headers
	for k, v := range cli.customHTTPHeaders {
		req.Header.Set(k, v)
	}

	for k, v := range headers {
		req.Header[http.CanonicalHeaderKey(k)] = v
	}
	return req
}

func encodeData(data interface{}) (*bytes.Buffer, error) {
	params := bytes.NewBuffer(nil)
	if data != nil {
		if err := json.NewEncoder(params).Encode(data); err != nil {
			return nil, err
		}
	}
	return params, nil
}

func ensureReaderClosed(response serverResponse) {
	if response.body != nil {
		// Drain up to 512 bytes and close the body to let the Transport reuse the connection
		io.CopyN(io.Discard, response.body, 512)
		response.body.Close()
	}
}


================================================
FILE: agent/client/server_label_create.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"fmt"
	"net/url"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// ServerLabelCreate create the labels for the servers.
func (cli *Client) ServerLabelCreate(ctx context.Context, name string,
	labels map[string]string) error {
	req := types.ServerSpec{
		Name:   name,
		Labels: labels,
	}

	urlValues := url.Values{}

	resp, err := cli.post(ctx,
		fmt.Sprintf(gatewayServerLabelCreateControlPlanePath, name), urlValues, req, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return wrapResponseError(err, resp, "server", name)
	}

	return wrapResponseError(err, resp, "server", name)
}


================================================
FILE: agent/client/server_list.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"encoding/json"

	"github.com/tensorchord/openmodelz/agent/api/types"
)

// ServerList lists the servers.
func (cli *Client) ServerList(ctx context.Context) ([]types.Server, error) {
	resp, err := cli.get(ctx, gatewayServerControlPlanePath, nil, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return nil,
			wrapResponseError(err, resp, "servers", "")
	}

	var servers []types.Server
	err = json.NewDecoder(resp.body).Decode(&servers)

	return servers, wrapResponseError(err, resp, "servers", "")
}


================================================
FILE: agent/client/server_node_delete.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client

import (
	"context"
	"fmt"
	"net/url"
)

// ServerLabelCreate create the labels for the servers.
func (cli *Client) ServerNodeDelete(ctx context.Context, name string) error {
	urlValues := url.Values{}

	resp, err := cli.delete(ctx,
		fmt.Sprintf(gatewayServerNodeDeleteControlPlanePath, name), urlValues, nil, nil)
	defer ensureReaderClosed(resp)

	if err != nil {
		return wrapResponseError(err, resp, "server-delete", name)
	}

	return wrapResponseError(err, resp, "server-delete", name)
}


================================================
FILE: agent/client/transport.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package client // import "github.com/docker/docker/client"

import (
	"crypto/tls"
	"net/http"
)

// resolveTLSConfig attempts to resolve the TLS configuration from the
// RoundTripper.
func resolveTLSConfig(transport http.RoundTripper) *tls.Config {
	switch tr := transport.(type) {
	case *http.Transport:
		return tr.TLSClientConfig
	default:
		return nil
	}
}


================================================
FILE: agent/client/utils.go
================================================
package client

import (
	"fmt"
	"strings"

	"github.com/cockroachdb/errors"
	"github.com/tensorchord/openmodelz/agent/api/types"
)

const (
	DefaultPrefix = "modelz-"
)

func ParseAgentToken(token string) (types.AgentToken, error) {
	agentToken := types.AgentToken{}
	if token == "" {
		return agentToken, errors.New("agent token is empty")
	}

	strings := strings.Split(token, ":")
	if len(strings) != 3 {
		return agentToken, errors.New("invalid agent token")
	}
	agentToken.ClusterName = strings[0]
	agentToken.UID = strings[1]
	agentToken.Token = strings[2]

	return agentToken, nil
}

func GetNamespaceByUserID(uid string) string {
	return fmt.Sprintf("%s%s", DefaultPrefix, uid)
}

func GetUserIDFromNamespace(ns string) (string, error) {
	if len(ns) < 8 {
		return "", fmt.Errorf("namespace too short")
	}

	if ns[:len(DefaultPrefix)] != DefaultPrefix {
		return "", fmt.Errorf("namespace does not start with ")
	}

	return ns[7:], nil
}


================================================
FILE: agent/cmd/agent/main.go
================================================
package main

import (
	"fmt"
	"os"

	"github.com/sirupsen/logrus"
	"github.com/urfave/cli/v2"

	"github.com/tensorchord/openmodelz/agent/pkg/app"
	"github.com/tensorchord/openmodelz/agent/pkg/version"
)

func run(args []string) error {
	cli.VersionPrinter = func(c *cli.Context) {
		fmt.Println(c.App.Name, version.Package, c.App.Version, version.Revision)
	}

	app := app.New()
	return app.Run(args)
}

func handleErr(err error) {
	if err == nil {
		return
	}

	logrus.Error(err)
	os.Exit(1)
}

// @title       modelz cluster agent
// @version     v0.0.23
// @description modelz kubernetes cluster agent

// @contact.name  modelz support
// @contact.url   https://github.com/tensorchord/openmodelz
// @contact.email modelz-support@tensorchord.ai

// @host     localhost:8081
// @BasePath /
// @schemes  http
func main() {
	err := run(os.Args)
	handleErr(err)
}


================================================
FILE: agent/errdefs/defs.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package errdefs // import "github.com/docker/docker/errdefs"

// ErrNotFound signals that the requested object doesn't exist
type ErrNotFound interface {
	NotFound()
}

// ErrInvalidParameter signals that the user input is invalid
type ErrInvalidParameter interface {
	InvalidParameter()
}

// ErrConflict signals that some internal state conflicts with the requested action and can't be performed.
// A change in state should be able to clear this error.
type ErrConflict interface {
	Conflict()
}

// ErrUnauthorized is used to signify that the user is not authorized to perform a specific action
type ErrUnauthorized interface {
	Unauthorized()
}

// ErrUnavailable signals that the requested action/subsystem is not available.
type ErrUnavailable interface {
	Unavailable()
}

// ErrForbidden signals that the requested action cannot be performed under any circumstances.
// When a ErrForbidden is returned, the caller should never retry the action.
type ErrForbidden interface {
	Forbidden()
}

// ErrSystem signals that some internal error occurred.
// An example of this would be a failed mount request.
type ErrSystem interface {
	System()
}

// ErrNotModified signals that an action can't be performed because it's already in the desired state
type ErrNotModified interface {
	NotModified()
}

// ErrNotImplemented signals that the requested action/feature is not implemented on the system as configured.
type ErrNotImplemented interface {
	NotImplemented()
}

// ErrUnknown signals that the kind of error that occurred is not known.
type ErrUnknown interface {
	Unknown()
}

// ErrCancelled signals that the action was cancelled.
type ErrCancelled interface {
	Cancelled()
}

// ErrDeadline signals that the deadline was reached before the action completed.
type ErrDeadline interface {
	DeadlineExceeded()
}

// ErrDataLoss indicates that data was lost or there is data corruption.
type ErrDataLoss interface {
	DataLoss()
}


================================================
FILE: agent/errdefs/doc.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

// Package errdefs defines a set of error interfaces that packages should use for communicating classes of errors.
// Errors that cross the package boundary should implement one (and only one) of these interfaces.
//
// Packages should not reference these interfaces directly, only implement them.
// To check if a particular error implements one of these interfaces, there are helper
// functions provided (e.g. `Is<SomeError>`) which can be used rather than asserting the interfaces directly.
// If you must assert on these interfaces, be sure to check the causal chain (`err.Cause()`).
package errdefs // import "github.com/docker/docker/errdefs"


================================================
FILE: agent/errdefs/helpers.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package errdefs // import "github.com/docker/docker/errdefs"

import "context"

type errNotFound struct{ error }

func (errNotFound) NotFound() {}

func (e errNotFound) Cause() error {
	return e.error
}

func (e errNotFound) Unwrap() error {
	return e.error
}

// NotFound is a helper to create an error of the class with the same name from any error type
func NotFound(err error) error {
	if err == nil || IsNotFound(err) {
		return err
	}
	return errNotFound{err}
}

type errInvalidParameter struct{ error }

func (errInvalidParameter) InvalidParameter() {}

func (e errInvalidParameter) Cause() error {
	return e.error
}

func (e errInvalidParameter) Unwrap() error {
	return e.error
}

// InvalidParameter is a helper to create an error of the class with the same name from any error type
func InvalidParameter(err error) error {
	if err == nil || IsInvalidParameter(err) {
		return err
	}
	return errInvalidParameter{err}
}

type errConflict struct{ error }

func (errConflict) Conflict() {}

func (e errConflict) Cause() error {
	return e.error
}

func (e errConflict) Unwrap() error {
	return e.error
}

// Conflict is a helper to create an error of the class with the same name from any error type
func Conflict(err error) error {
	if err == nil || IsConflict(err) {
		return err
	}
	return errConflict{err}
}

type errUnauthorized struct{ error }

func (errUnauthorized) Unauthorized() {}

func (e errUnauthorized) Cause() error {
	return e.error
}

func (e errUnauthorized) Unwrap() error {
	return e.error
}

// Unauthorized is a helper to create an error of the class with the same name from any error type
func Unauthorized(err error) error {
	if err == nil || IsUnauthorized(err) {
		return err
	}
	return errUnauthorized{err}
}

type errUnavailable struct{ error }

func (errUnavailable) Unavailable() {}

func (e errUnavailable) Cause() error {
	return e.error
}

func (e errUnavailable) Unwrap() error {
	return e.error
}

// Unavailable is a helper to create an error of the class with the same name from any error type
func Unavailable(err error) error {
	if err == nil || IsUnavailable(err) {
		return err
	}
	return errUnavailable{err}
}

type errForbidden struct{ error }

func (errForbidden) Forbidden() {}

func (e errForbidden) Cause() error {
	return e.error
}

func (e errForbidden) Unwrap() error {
	return e.error
}

// Forbidden is a helper to create an error of the class with the same name from any error type
func Forbidden(err error) error {
	if err == nil || IsForbidden(err) {
		return err
	}
	return errForbidden{err}
}

type errSystem struct{ error }

func (errSystem) System() {}

func (e errSystem) Cause() error {
	return e.error
}

func (e errSystem) Unwrap() error {
	return e.error
}

// System is a helper to create an error of the class with the same name from any error type
func System(err error) error {
	if err == nil || IsSystem(err) {
		return err
	}
	return errSystem{err}
}

type errNotModified struct{ error }

func (errNotModified) NotModified() {}

func (e errNotModified) Cause() error {
	return e.error
}

func (e errNotModified) Unwrap() error {
	return e.error
}

// NotModified is a helper to create an error of the class with the same name from any error type
func NotModified(err error) error {
	if err == nil || IsNotModified(err) {
		return err
	}
	return errNotModified{err}
}

type errNotImplemented struct{ error }

func (errNotImplemented) NotImplemented() {}

func (e errNotImplemented) Cause() error {
	return e.error
}

func (e errNotImplemented) Unwrap() error {
	return e.error
}

// NotImplemented is a helper to create an error of the class with the same name from any error type
func NotImplemented(err error) error {
	if err == nil || IsNotImplemented(err) {
		return err
	}
	return errNotImplemented{err}
}

type errUnknown struct{ error }

func (errUnknown) Unknown() {}

func (e errUnknown) Cause() error {
	return e.error
}

func (e errUnknown) Unwrap() error {
	return e.error
}

// Unknown is a helper to create an error of the class with the same name from any error type
func Unknown(err error) error {
	if err == nil || IsUnknown(err) {
		return err
	}
	return errUnknown{err}
}

type errCancelled struct{ error }

func (errCancelled) Cancelled() {}

func (e errCancelled) Cause() error {
	return e.error
}

func (e errCancelled) Unwrap() error {
	return e.error
}

// Cancelled is a helper to create an error of the class with the same name from any error type
func Cancelled(err error) error {
	if err == nil || IsCancelled(err) {
		return err
	}
	return errCancelled{err}
}

type errDeadline struct{ error }

func (errDeadline) DeadlineExceeded() {}

func (e errDeadline) Cause() error {
	return e.error
}

func (e errDeadline) Unwrap() error {
	return e.error
}

// Deadline is a helper to create an error of the class with the same name from any error type
func Deadline(err error) error {
	if err == nil || IsDeadline(err) {
		return err
	}
	return errDeadline{err}
}

type errDataLoss struct{ error }

func (errDataLoss) DataLoss() {}

func (e errDataLoss) Cause() error {
	return e.error
}

func (e errDataLoss) Unwrap() error {
	return e.error
}

// DataLoss is a helper to create an error of the class with the same name from any error type
func DataLoss(err error) error {
	if err == nil || IsDataLoss(err) {
		return err
	}
	return errDataLoss{err}
}

// FromContext returns the error class from the passed in context
func FromContext(ctx context.Context) error {
	e := ctx.Err()
	if e == nil {
		return nil
	}

	if e == context.Canceled {
		return Cancelled(e)
	}
	if e == context.DeadlineExceeded {
		return Deadline(e)
	}
	return Unknown(e)
}


================================================
FILE: agent/errdefs/http_helpers.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package errdefs // import "github.com/docker/docker/errdefs"

import (
	"net/http"

	"github.com/sirupsen/logrus"
)

// FromStatusCode creates an errdef error, based on the provided HTTP status-code
func FromStatusCode(err error, statusCode int) error {
	if err == nil {
		return err
	}
	switch statusCode {
	case http.StatusNotFound:
		err = NotFound(err)
	case http.StatusBadRequest:
		err = InvalidParameter(err)
	case http.StatusConflict:
		err = Conflict(err)
	case http.StatusUnauthorized:
		err = Unauthorized(err)
	case http.StatusServiceUnavailable:
		err = Unavailable(err)
	case http.StatusForbidden:
		err = Forbidden(err)
	case http.StatusNotModified:
		err = NotModified(err)
	case http.StatusNotImplemented:
		err = NotImplemented(err)
	case http.StatusInternalServerError:
		if !IsSystem(err) && !IsUnknown(err) && !IsDataLoss(err) && !IsDeadline(err) && !IsCancelled(err) {
			err = System(err)
		}
	default:
		logrus.WithError(err).WithFields(logrus.Fields{
			"module":      "api",
			"status_code": statusCode,
		}).Debug("FIXME: Got an status-code for which error does not match any expected type!!!")

		switch {
		case statusCode >= 200 && statusCode < 400:
			// it's a client error
		case statusCode >= 400 && statusCode < 500:
			err = InvalidParameter(err)
		case statusCode >= 500 && statusCode < 600:
			err = System(err)
		default:
			err = Unknown(err)
		}
	}
	return err
}


================================================
FILE: agent/errdefs/is.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package errdefs // import "github.com/docker/docker/errdefs"

type causer interface {
	Cause() error
}

func getImplementer(err error) error {
	switch e := err.(type) {
	case
		ErrNotFound,
		ErrInvalidParameter,
		ErrConflict,
		ErrUnauthorized,
		ErrUnavailable,
		ErrForbidden,
		ErrSystem,
		ErrNotModified,
		ErrNotImplemented,
		ErrCancelled,
		ErrDeadline,
		ErrDataLoss,
		ErrUnknown:
		return err
	case causer:
		return getImplementer(e.Cause())
	default:
		return err
	}
}

// IsNotFound returns if the passed in error is an ErrNotFound
func IsNotFound(err error) bool {
	_, ok := getImplementer(err).(ErrNotFound)
	return ok
}

// IsInvalidParameter returns if the passed in error is an ErrInvalidParameter
func IsInvalidParameter(err error) bool {
	_, ok := getImplementer(err).(ErrInvalidParameter)
	return ok
}

// IsConflict returns if the passed in error is an ErrConflict
func IsConflict(err error) bool {
	_, ok := getImplementer(err).(ErrConflict)
	return ok
}

// IsUnauthorized returns if the passed in error is an ErrUnauthorized
func IsUnauthorized(err error) bool {
	_, ok := getImplementer(err).(ErrUnauthorized)
	return ok
}

// IsUnavailable returns if the passed in error is an ErrUnavailable
func IsUnavailable(err error) bool {
	_, ok := getImplementer(err).(ErrUnavailable)
	return ok
}

// IsForbidden returns if the passed in error is an ErrForbidden
func IsForbidden(err error) bool {
	_, ok := getImplementer(err).(ErrForbidden)
	return ok
}

// IsSystem returns if the passed in error is an ErrSystem
func IsSystem(err error) bool {
	_, ok := getImplementer(err).(ErrSystem)
	return ok
}

// IsNotModified returns if the passed in error is a NotModified error
func IsNotModified(err error) bool {
	_, ok := getImplementer(err).(ErrNotModified)
	return ok
}

// IsNotImplemented returns if the passed in error is an ErrNotImplemented
func IsNotImplemented(err error) bool {
	_, ok := getImplementer(err).(ErrNotImplemented)
	return ok
}

// IsUnknown returns if the passed in error is an ErrUnknown
func IsUnknown(err error) bool {
	_, ok := getImplementer(err).(ErrUnknown)
	return ok
}

// IsCancelled returns if the passed in error is an ErrCancelled
func IsCancelled(err error) bool {
	_, ok := getImplementer(err).(ErrCancelled)
	return ok
}

// IsDeadline returns if the passed in error is an ErrDeadline
func IsDeadline(err error) bool {
	_, ok := getImplementer(err).(ErrDeadline)
	return ok
}

// IsDataLoss returns if the passed in error is an ErrDataLoss
func IsDataLoss(err error) bool {
	_, ok := getImplementer(err).(ErrDataLoss)
	return ok
}


================================================
FILE: agent/pkg/app/config.go
================================================
package app

import (
	"github.com/urfave/cli/v2"

	"github.com/tensorchord/openmodelz/agent/pkg/config"
)

func configFromCLI(c *cli.Context) config.Config {
	cfg := config.New()

	// server
	cfg.Server.Dev = c.Bool(flagDev)
	cfg.Server.ServerPort = c.Int(flagServerPort)
	cfg.Server.ReadTimeout = c.Duration(flagServerReadTimeout)
	cfg.Server.WriteTimeout = c.Duration(flagServerWriteTimeout)

	// kubernetes
	cfg.KubeConfig.Kubeconfig = c.String(flagKubeConfig)
	cfg.KubeConfig.MasterURL = c.String(flagMasterURL)
	cfg.KubeConfig.QPS = c.Int(flagQPS)
	cfg.KubeConfig.Burst = c.Int(flagBurst)
	cfg.KubeConfig.ResyncPeriod = c.Duration(flagResyncPeriod)

	// inference ingress
	cfg.Ingress.IngressEnabled = c.Bool(flagIngressEnabled)
	cfg.Ingress.Domain = c.String(flagIngressDomain)
	cfg.Ingress.AnyIPToDomain = c.Bool(flagIngressAnyIPToDomain)
	cfg.Ingress.Namespace = c.String(flagIngressNamespace)
	cfg.Ingress.TLSEnabled = c.Bool(flagIngressTLSEnabled)

	// inference
	cfg.Inference.LogTimeout = c.Duration(flagInferenceLogTimeout)
	cfg.Inference.CacheTTL = c.Duration(flagInferenceCacheTTL)

	// build
	cfg.Build.BuildEnabled = c.Bool(flagBuildEnabled)
	cfg.Build.BuilderImage = c.String(flagBuilderImage)
	cfg.Build.BuildkitdAddress = c.String(flagBuildkitdAddress)
	cfg.Build.BuildCtlBin = c.String(flagBuildCtlBin)
	cfg.Build.BuildRegistry = c.String(flagBuildRegistry)
	cfg.Build.BuildRegistryToken = c.String(flagBuildRegistryToken)
	cfg.Build.BuildImagePullSecret = c.String(flagBuildImagePullSecret)

	// loki
	cfg.Logs.Timeout = c.Duration(flagLogsTimeout)
	cfg.Logs.LokiURL = c.String(flagLogsLokiURL)
	cfg.Logs.LokiUser = c.String(flaglogsLokiUser)
	cfg.Logs.LokiToken = c.String(flagLogsLokiToken)

	// metrics
	cfg.Metrics.PollingInterval = c.Duration(flagMetricsPollingInterval)
	cfg.Metrics.ServerPort = c.Int(flagMetricsPort)
	cfg.Metrics.PrometheusHost = c.String(flagMetricsPrometheusHost)
	cfg.Metrics.PrometheusPort = c.Int(flagMetricsPrometheusPort)

	// modelz cloud
	cfg.ModelZCloud.Enabled = c.Bool(flagModelZCloudEnabled)
	cfg.ModelZCloud.URL = c.String(flagModelZCloudURL)
	cfg.ModelZCloud.AgentToken = c.String(flagModelZCloudAgentToken)
	cfg.ModelZCloud.HeartbeatInterval = c.Duration(flagModelZCloudAgentHeartbeatInterval)
	cfg.ModelZCloud.Region = c.String(flagModelZCloudRegion)
	cfg.ModelZCloud.UnifiedAPIKey = c.String(flagModelZCloudUnifiedAPIKey)
	cfg.ModelZCloud.UpstreamTimeout = c.Duration(flagModelZCloudUpstreamTimeout)
	cfg.ModelZCloud.MaxIdleConnections = c.Int(flagModelZCloudMaxIdleConnections)
	cfg.ModelZCloud.MaxIdleConnectionsPerHost = c.Int(flagModelZCloudMaxIdleConnectionsPerHost)
	cfg.ModelZCloud.EventEnabled = c.Bool(flagModelZCloudEventEnabled)
	return cfg
}


================================================
FILE: agent/pkg/app/root.go
================================================
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

package app

import (
	"time"

	"github.com/cockroachdb/errors"
	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
	cli "github.com/urfave/cli/v2"

	"github.com/tensorchord/openmodelz/agent/pkg/server"
	"github.com/tensorchord/openmodelz/agent/pkg/version"
)

const (
	flagDebug = "debug"
	flagDev   = "dev"

	// server
	flagServerPort         = "server-port"
	flagServerReadTimeout  = "server-read-timeout"
	flagServerWriteTimeout = "server-write-timeout"

	// kubernetes
	flagMasterURL    = "master-url"
	flagKubeConfig   = "kube-config"
	flagQPS          = "kube-qps"
	flagBurst        = "kube-burst"
	flagResyncPeriod = "kube-resync-period"

	// inference ingress
	flagIngressEnabled       = "ingress-enabled"
	flagIngressDomain        = "ingress-domain"
	flagIngressNamespace     = "ingress-namespace"
	flagIngressAnyIPToDomain = "ingress-any-ip-to-domain"
	flagIngressTLSEnabled    = "ingress-tls-enabled"

	// inference
	flagInferenceLogTimeout = "inference-log-timeout"
	flagInferenceCacheTTL   = "inference-cache-ttl"

	// build
	flagBuildEnabled         = "build-enabled"
	flagBuilderImage         = "builder-image"
	flagBuildkitdAddress     = "buildkitd-address"
	flagBuildCtlBin          = "buildctl-bin"
	flagBuildRegistry        = "build-registry"
	flagBuildRegistryToken   = "build-registry-token"
	flagBuildImagePullSecret = "build-image-pull-secret"

	// metrics
	flagMetricsPollingInterval = "metrics-polling-interval"
	flagMetricsPort            = "metrics-port"
	flagMetricsPrometheusHost  = "metrics-prometheus-host"
	flagMetricsPrometheusPort  = "metrics-prometheus-port"

	// logs
	flagLogsTimeout   = "logs-timeout"
	flagLogsLokiURL   = "logs-loki-url"
	flaglogsLokiUser  = "logs-loki-user"
	flagLogsLokiToken = "logs-loki-token"

	// modelz cloud
	flagModelZCloudEnabled                   = "modelz-cloud-enabled"
	flagModelZCloudURL                       = "modelz-cloud-url"
	flagModelZCloudAgentToken                = "modelz-cloud-agent-token"
	flagModelZCloudAgentHeartbeatInterval    = "modelz-cloud-agent-heartbeat-interval"
	flagModelZCloudRegion                    = "modelz-cloud-region"
	flagModelZCloudUnifiedAPIKey             = "modelz-cloud-unified-api-key"
	flagModelZCloudUpstreamTimeout           = "modelz-cloud-upstream-timeout"
	flagModelZCloudMaxIdleConnections        = "modelz-cloud-max-idle-connections"
	flagModelZCloudMaxIdleConnectionsPerHost = "modelz-cloud-max-idle-connections-per-host"
	flagModelZCloudEventEnabled              = "modelz-cloud-event-enabled"
)

type App struct {
	*cli.App
}

func New() App {
	internalApp := cli.NewApp()
	internalApp.EnableBashCompletion = true
	internalApp.Name = "modelz-agent"
	internalApp.Usage = "Cluster agent for modelz"
	internalApp.HideHelpCommand = true
	internalApp.HideVersion = false
	internalApp.Version = version.GetVersion().String()
	internalApp.Flags = []cli.Flag{
		&cli.BoolFlag{
			Name:  flagDebug,
			Usage: "enable debug output in logs",
		},
		&cli.BoolFlag{
			Name:  flagDev,
			Usage: "enable development mode",
		},
		&cli.IntFlag{
			Name:    flagServerPort,
			Value:   8080,
			Usage:   "port to listen on",
			EnvVars: []string{"MODELZ_AGENT_SERVER_PORT"},
			Aliases: []string{"p"},
		},
		&cli.DurationFlag{
			Name: flagServerReadTimeout,
			Usage: "maximum duration before timing out read of the request, " +
				"including the body",
			Value:   305 * time.Second,
			EnvVars: []string{"MODELZ_AGENT_SERVER_READ_TIMEOUT"},
			Aliases: []string{"srt"},
		},
		&cli.DurationFlag{
			Name: flagServerWriteTimeout,
			Usage: "maximum duration before timing out write of the response, " +
				"including the body",
			Value:   305 * time.Second,
			EnvVars: []string{"MODELZ_AGENT_SERVER_WRITE_TIMEOUT"},
			Aliases: []string{"swt"},
		},
		&cli.StringFlag{
			Name:    flagMasterURL,
			Usage:   "URL to master for kubernetes cluster",
			EnvVars: []string{"MODELZ_AGENT_MASTER_URL"},
			Aliases: []string{"mu"},
		},
		&cli.StringFlag{
			Name:    flagKubeConfig,
			Usage:   "Path to kubeconfig file. If not provided, will use in-cluster config",
			EnvVars: []string{"MODELZ_AGENT_KUBE_CONFIG"},
			Aliases: []string{"kc"},
		},
		&cli.IntFlag{
			Name:    flagQPS,
			Usage:   "QPS for kubernetes client",
			Value:   100,
			EnvVars: []string{"MODELZ_AGENT_KUBE_QPS"},
			Aliases: []string{"kq"},
		},
		&cli.IntFlag{
			Name:    flagBurst,
			Value:   250,
			Usage:   "Burst for kubernetes client",
			EnvVars: []string{"MODELZ_AGENT_KUBE_BURST"},
			Aliases: []string{"kb"},
		},
		&cli.DurationFlag{
			Name:    flagResyncPeriod,
			Value:   time.Hour,
			Usage:   "Resync period for kubernetes client",
			EnvVars: []string{"MODELZ_AGENT_KUBE_RESYNC_PERIOD"},
			Aliases: []string{"kr"},
		},
		&cli.BoolFlag{
			Name: flagIngressEnabled,
			Usage: "Enable inference ingress. " +
				"If enabled, the agent will create ingress for each inference",
			Value:   false,
			EnvVars: []string{"MODELZ_AGENT_INGRESS_ENABLED"},
			Aliases: []string{"ie"},
		},
		&cli.StringFlag{
			Name:    flagIngressDomain,
			Usage:   "Domain for inference ingress",
			Value:   "cloud.modelz.dev",
			EnvVars: []string{"MODELZ_AGENT_INGRESS_DOMAIN"},
			Aliases: []string{"id"},
		},
		&cli.StringFlag{
			Name:    flagIngressNamespace,
			Usage:   "Namespace for inference ingress",
			Value:   "default",
			EnvVars: []string{"MODELZ_AGENT_INGRESS_NAMESPACE"},
			Aliases: []string{"in"},
		},
		&cli.BoolFlag{
			Name: flagIngressAnyIPToDomain,
			Usage: "Enable any ip to domain. " +
				"If enabled, the agent will create ingress for each inference",
			Value:   false,
			EnvVars: []string{"MODELZ_AGENT_INGRESS_ANY_IP_TO_DOMAIN"},
			Aliases: []string{"iad"},
		},
		&cli.BoolFlag{
			Name:    flagIngressTLSEnabled,
			Usage:   "Enable TLS for inference ingress. ",
			Value:   true,
			EnvVars: []string{"MODELZ_AGENT_INGRESS_TLS_ENABLED"},
			Aliases: []string{"it"},
		},
		&cli.DurationFlag{
			Name: flagInferenceLogTimeout,
			Usage: "Timeout for inference log streaming. " +
				"If the inference log has not been updated in this time, " +
				"the connection will be closed.",
			Value:   time.Minute,
			EnvVars: []string{"MODELZ_AGENT_INFERENCE_LOG_TIMEOUT"},
			Aliases: []string{"ilt"},
		},
		&cli.DurationFlag{
			Name:    flagInferenceCacheTTL,
			Usage:   "Time to live for inference cache. ",
			Value:   time.Millisecond * 500,
			EnvVars: []string{"MODELZ_AGENT_INFERENCE_CACHE_TTL"},
			Aliases: []string{"ict"},
		},
		&cli.BoolFlag{
			Name:   flagBuildEnabled,
			Hidden: true,
			Usage: "Enable model build. " +
				"If enabled, the agent will build inference server image",
			Value:   false,
			EnvVars: []string{"MODELZ_AGENT_BUILD_ENABLED"},
			Aliases: []string{"be"},
		},
		&cli.StringFlag{
			Name:   flagBuilderImage,
			Hidden: true,
			Usage: "Image to use for building models. " +
				"Must be a valid docker image reference.",
			EnvVars: []string{"MODELZ_AGENT_BUILDER_IMAGE"},
			Aliases: []string{"bi"},
		},
		&cli.StringFlag{
			Name:   flagBuildkitdAddress,
			Hidden: true,
			Usage: "Address of buildkitd server. " +
				"Must be a valid tcp address.",
			EnvVars: []string{"MODELZ_AGENT_BUILDKITD_ADDRESS"},
			Aliases: []string{"ba"},
		},
		&cli.StringFlag{
			Name:   flagBuildCtlBin,
			Hidden: true,
			Usage: "Path to buildctl binary. " +
				"Must be a valid path to a binary.",
			EnvVars: []string{"MODELZ_AGENT_BUILDCTL_BIN"},
			Aliases: []string{"bb"},
		},
		&cli.StringFlag{
			Name:    flagBuildRegistry,
			Hidden:  true,
			Usage:   "Registry to use for building models. ",
			EnvVars: []string{"MODELZ_AGENT_BUILD_REGISTRY"},
			Aliases: []string{"br"},
		},
		&cli.StringFlag{
			Name:    flagBuildRegistryToken,
			Hidden:  true,
			Usage:   "Token to use for building models. ",
			EnvVars: []string{"MODELZ_AGENT_BUILD_REGISTRY_TOKEN"},
			Aliases: []string{"bt"},
		},
		&cli.StringFlag{
			Name:    flagBuildImagePullSecret,
			Hidden:  true,
			Usage:   "Image pull secret to use for building models.",
			EnvVars: []string{"MODELZ_AGENT_BUILD_IMAGE_PULL_SECRET"},
			Aliases: []string{"bp"},
			Value:   "dockerhub-secret",
		},
		&cli.DurationFlag{
			Name:    flagMetricsPollingInterval,
			Usage:   "Interval to poll metrics from kubernetes",
			Value:   time.Second * 5,
			EnvVars: []string{"MODELZ_AGENT_METRICS_POLLING_INTERVAL"},
			Aliases: []string{"mpi"},
		},
		&cli.IntFlag{
			Name:    flagMetricsPort,
			Usage:   "Port to expose metrics on. ",
			Value:   8082,
			EnvVars: []string{"MODELZ_AGENT_METRICS_PORT"},
			Aliases: []string{"mp"},
		},
		&cli.StringFlag{
			Name:    flagMetricsPrometheusHost,
			Value:   "localhost",
			Usage:   "Host to expose prometheus metrics on. ",
			EnvVars: []string{"MODELZ_AGENT_METRICS_PROMETHEUS_HOST"},
			Aliases: []string{"mph"},
		},
		&cli.IntFlag{
			Name:    flagMetricsPrometheusPort,
			Usage:   "Port to expose prometheus metrics on. ",
			Value:   9090,
			EnvVars: []string{"MODELZ_AGENT_METRICS_PROMETHEUS_PORT"},
			Aliases: []string{"mpp"},
		},
		&cli.DurationFlag{
			Name:    flagLogsTimeout,
			Usage:   "request timeout to query the logs",
			Value:   time.Second * 5,
			EnvVars: []string{"MODELZ_AGENT_LOGS_TIMEOUT"},
		},
		&cli.StringFlag{
			Name:    flagLogsLokiURL,
			Hidden:  true,
			Usage:   "Loki service URL",
			EnvVars: []string{"MODELZ_AGENT_LOGS_LOKI_URL"},
		},
		&cli.StringFlag{
			Name:    flaglogsLokiUser,
			Hidden:  true,
			Usage:   "Loki service auth user",
			EnvVars: []string{"MODELZ_AGENT_LOGS_LOKI_USER"},
		},
		&cli.StringFlag{
			Name:    flagLogsLokiToken,
			Hidden:  true,
			Usage:   "Loki service auth token",
			EnvVars: []string{"MODELZ_AGENT_LOGS_LOKI_TOKEN"},
		},
		&cli.BoolFlag{
			Name:    flagModelZCloudEnabled,
			Usage:   "Enable modelz cloud, agent as modelz cloud agent",
			Value:   false,
			EnvVars: []string{"MODELZ_AGENT_MODELZ_CLOUD_ENABLED"},
			Aliases: []string{"mzc"},
		},
		&cli.StringFlag{
			Name:    flagModelZCloudURL,
			Usage:   "Modelz cloud URL",
			EnvVars: []string{"MODELZ_AGENT_MODELZ_CLOUD_URL"},
			Aliases: []string{"mzu"},
			Value:   "https://cloud.modelz.ai",
		},
		&cli.StringFlag{
			Name:    flagModelZCloudAgentToken,
			Usage:   "Modelz cloud agent token",
			EnvVars: []string{"MODELZ_CLOUD_AGENT_TOKEN"},
			Aliases: []string{"mzt"},
		},
		&cli.DurationFlag{
			Name:    flagModelZCloudAgentHeartbeatInterval,
			Usage:   "Modelz cloud agent heartbeat interval",
			EnvVars: []string{"MODELZ_CLOUD_AGENT_HEARTBEAT_INTERVAL"},
			Aliases: []string{"mzh"},
			Value:   time.Minute * 1,
		},
		&cli.StringFlag{
			Name:    flagModelZCloudRegion,
			Usage:   "Modelz cloud agent region",
			EnvVars: []string{"MODELZ_CLOUD_AGENT_REGION"},
			Aliases: []string{"mzr"},
			Value:   "us-central1",
		},
		&cli.StringFlag{
			Name:    flagModelZCloudUnifiedAPIKey,
			Usage:   "Modelz cloud agent unified api key",
			EnvVars: []string{"MODELZ_CLOUD_AGENT_UNIFIED_API_KEY"},
			Aliases: []string{"mzua"},
		},
		&cli.DurationFlag{
			Name:    flagModelZCloudUpstreamTimeout,
			Usage:   "upstream timeout",
			EnvVars: []string{"MODELZ_UPSTREAM_TIMEOUT"},
			Aliases: []string{"ut"},
			Value:   300 * time.Second,
		},
		&cli.IntFlag{
			Name:    flagModelZCloudMaxIdleConnections,
			Usage:   "max idle connections",
			EnvVars: []string{"MODELZ_MAX_IDLE_CONNECTIONS"},
			Aliases: []string{"mic"},
			Value:   1024,
		},
		&cli.IntFlag{
			Name:    flagModelZCloudMaxIdleConnectionsPerHost,
			Usage:   "max idle connections per host",
			EnvVars: []string{"MODELZ_MAX_IDLE_CONNECTIONS_PER_HOST"},
			Aliases: []string{"mich"},
			Value:   1024,
		},
		&cli.BoolFlag{
			Name:    flagModelZCloudEventEnabled,
			Usage:   "Enable event logging for modelz cloud.",
			Value:   false,
			EnvVars: []string{"MODELZ_AGENT_MODELZ_CLOUD_EVENT_ENABLED"},
			Aliases: []string{"mze"},
		},
	}
	internalApp.Action = runServer

	// Deal with debug flag.
	var debugEnabled bool

	internalApp.Before = func(context *cli.Context) error {
		debugEnabled = context.Bool(flagDebug)

		if debugEnabled {
			logrus.SetReportCaller(true)
			logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true})
			logrus.SetLevel(logrus.DebugLevel)
			gin.SetMode(gin.DebugMode)
		} else {
			logrus.SetFormatter(&logrus.JSONFormatter{})
		}

		return nil
	}
	return App{
		App: internalApp,
	}
}

func runServer(clicontext *cli.Context) error {
	c := configFromCLI(clicontext)

	if clicontext.Bool(flagDebug) {
		logrus.Debug("debug mode enabled")
		cfgString, _ := c.GetString()
		logrus.WithField("config", cfgString).Debug("config")
	}

	if err := c.Validate(); err != nil {
		if clicontext.Bool(flagDebug) {
			logrus.WithError(err).Error("invalid config")
		} else {
			return errors.Wrap(err, "invalid config")
		}
	}

	s, err := server.New(c)
	if err != nil {
		return errors.Wrap(err, "failed to create server")
	}

	return s.Run()
}


================================================
FILE: agent/pkg/config/config.go
================================================
package config

import (
	"encoding/json"
	"errors"
	"time"
)

type Config struct {
	Server      ServerConfig      `json:"server,omitempty"`
	KubeConfig  KubeConfig        `json:"kube_config,omitempty"`
	Ingress     IngressConfig     `json:"ingress,omitempty"`
	Inference   InferenceConfig   `json:"inference,omitempty"`
	Build       BuildConfig       `json:"build,omitempty"`
	Metrics     MetricsConfig     `json:"metrics,omitempty"`
	Logs        LogsConfig        `json:"logs,omitempty"`
	ModelZCloud ModelZCloudConfig `json:"modelz_cloud,omitempty"`
}

type ModelZCloudConfig struct {
	Enabled bool `json:"enabled,omitempty"`
	// URL of apiserver
	URL                       string            `json:"url,omitempty"`
	AgentToken                string            `json:"agent_token,omitempty"`
	HeartbeatInterval         time.Duration     `json:"heartbeat_interval,omitempty"`
	ID                        string            `json:"id,omitempty"`
	Name                      string            `json:"name,omitempty"`
	TokenID                   string            `json:"token_id,omitempty"`
	Region                    string            `json:"region,omitempty"`
	APIKeys                   map[string]string `json:"api_keys,omitempty"`
	UserNamespaces            []string          `json:"user_namespaces,omitempty"`
	UnifiedAPIKey             string            `json:"unified_api_key,omitempty"`
	UpstreamTimeout           time.Duration     `json:"upstream_timeout,omitempty"`
	MaxIdleConnections        int               `json:"max_idle_connections,omitempty"`
	MaxIdleConnectionsPerHost int               `json:"max_idle_connections_per_host,omitempty"`
	EventEnabled              bool              `json:"event_enabled,omitempty"`
}

type LogsConfig struct {
	Timeout   time.Duration `json:"timeout,omitempty"`
	LokiURL   string        `json:"loki_url,omitempty"`
	LokiUser  string        `json:"loki_user,omitempty"`
	LokiToken string        `json:"loki_token,omitempty"`
}

type ServerConfig struct {
	Dev          bool          `json:"dev,omitempty"`
	ServerPort   int           `json:"server_port,omitempty"`
	ReadTimeout  time.Duration `json:"read_timeout,omitempty"`
	WriteTimeout time.Duration `json:"write_timeout,omitempty"`
}

type MetricsConfig struct {
	PollingInterval time.Duration `json:"polling_interval,omitempty"`
	ServerPort      int           `json:"server_port,omitempty"`
	PrometheusPort  int           `json:"prometheus_port,omitempty"`
	PrometheusHost  string        `json:"prometheus_host,omitempty"`
}

type BuildConfig struct {
	BuildEnabled         bool   `json:"build_enabled,omitempty"`
	BuilderImage         string `json:"builder_image,omitempty"`
	BuildkitdAddress     string `json:"buildkitd_address,omitempty"`
	BuildCtlBin          string `json:"build_ctl_bin,omitempty"`
	BuildRegistry        string `json:"build_registry,omitempty"`
	BuildRegistryToken   string `json:"build_registry_token,omitempty"`
	BuildImagePullSecret string `json:"build_image_pull_secret,omitempty"`
}

type InferenceConfig struct {
	LogTimeout time.Duration `json:"log_timeout,omitempty"`
	CacheTTL   time.Duration `json:"cache_ttl,omitempty"`
}

type IngressConfig struct {
	IngressEnabled bool   `json:"ingress_enabled,omitempty"`
	Domain         string `json:"domain,omitempty"`
	Namespace      string `json:"namespace,omitempty"`
	AnyIPToDomain  bool   `json:"any_ip_to_domain,omitempty"`
	TLSEnabled     bool   `json:"tls_enabled,omitempty"`
}

type KubeConfig struct {
	Kubeconfig   string        `json:"kubeconfig,omitempty"`
	MasterURL    string        `json:"master_url,omitempty"`
	QPS          int           `json:"qps,omitempty"`
	Burst        int           `json:"burst,omitempty"`
	ResyncPeriod time.Duration `json:"resync_period,omitempty"`
}

func New() Config {
	return Config{
		KubeConfig: KubeConfig{},
		Ingress:    IngressConfig{},
		Inference:  InferenceConfig{},
		Build:      BuildConfig{},
		Metrics:    MetricsConfig{},
		Logs:       LogsConfig{},
	}
}

func (c Config) GetString() (string, error) {
	bytes, err := json.Marshal(c)
	return string(bytes), err
}

func (c Config) Validate() error {
	if c.Server.ServerPort == 0 ||
		c.Server.ReadTimeout == 0 ||
		c.Server.WriteTimeout == 0 {
		return errors.New("server config is required")
	}

	if c.Inference.LogTimeout == 0 {
		return errors.New("inference log timeout is required")
	}

	if c.Build.BuildEnabled {
		if c.Build.BuildkitdAddress == "" ||
			c.Build.BuilderImage == "" ||
			c.Build.BuildRegistryToken == "" ||
			c.Build.BuildRegistry == "" ||
			c.Build.BuildCtlBin == "" ||
			c.Build.BuildImagePullSecret == "" {
			return errors.New("build config is required")
		}
	}

	if c.Metrics.ServerPort == 0 ||
		c.Metrics.PollingInterval == 0 ||
		c.Metrics.PrometheusHost == "" ||
		c.Metrics.PrometheusPort == 0 {
		return errors.New("metrics config is required")
	}

	if c.Ingress.IngressEnabled {
		if c.Ingress.Namespace == "" {
			return errors.New("ingress namespace is required")
		}
		if !c.Ingress.AnyIPToDomain && c.Ingress.Domain == "" {
			return errors.New("ingress domain is required")
		}
	}

	if c.ModelZCloud.Enabled {
		if c.ModelZCloud.URL == "" ||
			c.ModelZCloud.AgentToken == "" ||
			c.ModelZCloud.HeartbeatInterval == 0 {
			return errors.New("modelz cloud config is required")
		}
	}
	return nil
}


================================================
FILE: agent/pkg/consts/consts.go
================================================
package consts

import "time"

const (
	Domain        = "modelz.live"
	DefaultPrefix = "modelz-"
	APIKEY_PREFIX = "mzi-"
)
const DefaultAPIServerReadyTimeout = 15 * time.Minute


================================================
FILE: agent/pkg/docs/docs.go
================================================
// Package docs GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
package docs

import "github.com/swaggo/swag"

const docTemplate = `{
    "schemes": {{ marshal .Schemes }},
    "swagger": "2.0",
    "info": {
        "description": "{{escape .Description}}",
        "title": "{{.Title}}",
        "contact": {
            "name": "modelz support",
            "url": "https://github.com/tensorchord/openmodelz",
            "email": "modelz-support@tensorchord.ai"
        },
        "version": "{{.Version}}"
    },
    "host": "{{.Host}}",
    "basePath": "{{.BasePath}}",
    "paths": {
        "/gradio/{id}": {
            "get": {
                "description": "Reverse proxy to the backend gradio.",
                "consumes": [
                    "*/*"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Reverse proxy to the backend gradio.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Deployment ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            },
            "post": {
                "description": "Reverse proxy to the backend gradio.",
                "consumes": [
                    "*/*"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Reverse proxy to the backend gradio.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Deployment ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            }
        },
        "/healthz": {
            "get": {
                "description": "Healthz",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "system"
                ],
                "summary": "Healthz",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/inference/{name}": {
            "get": {
                "description": "Inference proxy.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference-proxy"
                ],
                "summary": "Inference.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "inference id",
                        "name": "name",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "303": {
                        "description": "See Other"
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "404": {
                        "description": "Not Found"
                    },
                    "500": {
                        "description": "Internal Server Error"
                    }
                }
            },
            "put": {
                "description": "Inference proxy.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference-proxy"
                ],
                "summary": "Inference.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "inference id",
                        "name": "name",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "303": {
                        "description": "See Other"
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "404": {
                        "description": "Not Found"
                    },
                    "500": {
                        "description": "Internal Server Error"
                    }
                }
            },
            "post": {
                "description": "Inference proxy.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference-proxy"
                ],
                "summary": "Inference.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "inference id",
                        "name": "name",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "303": {
                        "description": "See Other"
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "404": {
                        "description": "Not Found"
                    },
                    "500": {
                        "description": "Internal Server Error"
                    }
                }
            },
            "delete": {
                "description": "Inference proxy.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference-proxy"
                ],
                "summary": "Inference.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "inference id",
                        "name": "name",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "303": {
                        "description": "See Other"
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "404": {
                        "description": "Not Found"
                    },
                    "500": {
                        "description": "Internal Server Error"
                    }
                }
            }
        },
        "/mosec/{id}": {
            "get": {
                "description": "Proxy to the backend mosec.",
                "consumes": [
                    "*/*"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Proxy to the backend mosec.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Deployment ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            }
        },
        "/mosec/{id}/inference": {
            "post": {
                "description": "Proxy to the backend mosec.",
                "consumes": [
                    "*/*"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Proxy to the backend mosec.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Deployment ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            }
        },
        "/mosec/{id}/metrics": {
            "get": {
                "description": "Proxy to the backend mosec.",
                "consumes": [
                    "*/*"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Proxy to the backend mosec.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Deployment ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            }
        },
        "/other/{id}": {
            "get": {
                "description": "Reverse proxy to the backend other.",
                "consumes": [
                    "*/*"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Reverse proxy to the backend other.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Deployment ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            },
            "post": {
                "description": "Reverse proxy to the backend other.",
                "consumes": [
                    "*/*"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Reverse proxy to the backend other.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Deployment ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            }
        },
        "/streamlit/{id}": {
            "get": {
                "description": "Reverse proxy to streamlit.",
                "consumes": [
                    "*/*"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Reverse proxy to streamlit.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Deployment ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            },
            "post": {
                "description": "Reverse proxy to streamlit.",
                "consumes": [
                    "*/*"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Reverse proxy to streamlit.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Deployment ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created"
                    }
                }
            }
        },
        "/system/build": {
            "get": {
                "description": "List the builds.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "build"
                ],
                "summary": "List the builds.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Namespace",
                        "name": "namespace",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/types.Build"
                            }
                        }
                    }
                }
            },
            "post": {
                "description": "Create the build.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "build"
                ],
                "summary": "Create the build.",
                "parameters": [
                    {
                        "description": "build",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/types.Build"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/types.Build"
                        }
                    }
                }
            }
        },
        "/system/build/{name}": {
            "get": {
                "description": "Get the build by name.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "build"
                ],
                "summary": "Get the build by name.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Namespace",
                        "name": "namespace",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "inference id",
                        "name": "name",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/types.Build"
                        }
                    }
                }
            }
        },
        "/system/image-cache": {
            "post": {
                "description": "Create the image cache.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "image-cache"
                ],
                "summary": "Create the image cache.",
                "parameters": [
                    {
                        "description": "image-cache",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/types.ImageCache"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/types.ImageCache"
                        }
                    }
                }
            }
        },
        "/system/inference/{name}": {
            "get": {
                "description": "Get the inference by name.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Get the inference by name.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Namespace",
                        "name": "namespace",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "inference id",
                        "name": "name",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/types.InferenceDeployment"
                        }
                    }
                }
            }
        },
        "/system/inference/{name}/instance/{instance}": {
            "post": {
                "description": "Attach to the inference instance.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Attach to the inference instance.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Namespace",
                        "name": "namespace",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Name",
                        "name": "name",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Instance name",
                        "name": "instance",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/types.InferenceDeployment"
                            }
                        }
                    }
                }
            }
        },
        "/system/inference/{name}/instances": {
            "get": {
                "description": "List the inference instances.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "List the inference instances.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Namespace",
                        "name": "namespace",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Name",
                        "name": "name",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/types.InferenceDeployment"
                            }
                        }
                    }
                }
            }
        },
        "/system/inferences": {
            "get": {
                "description": "List the inferences.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "List the inferences.",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Namespace",
                        "name": "namespace",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/types.InferenceDeployment"
                            }
                        }
                    }
                }
            },
            "put": {
                "description": "Update the inferences.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Update the inferences.",
                "parameters": [
                    {
                        "description": "query params",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/types.InferenceDeployment"
                        }
                    },
                    {
                        "type": "string",
                        "description": "Namespace",
                        "name": "namespace",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "schema": {
                            "$ref": "#/definitions/types.InferenceDeployment"
                        }
                    }
                }
            },
            "post": {
                "description": "Create the inferences.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "inference"
                ],
                "summary": "Create the inferences.",
                "parameters": [
                    {
                        "description": "query params",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/types.InferenceDeployment"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
         
Download .txt
gitextract_h_b9vahq/

├── .all-contributorsrc
├── .github/
│   └── workflows/
│       ├── CI.yaml
│       └── publish.yaml
├── .gitignore
├── .goreleaser.yaml
├── LICENSE
├── MANIFEST.in
├── README.md
├── agent/
│   ├── .gitignore
│   ├── Dockerfile
│   ├── Makefile
│   ├── README.md
│   ├── api/
│   │   └── types/
│   │       ├── build.go
│   │       ├── error.go
│   │       ├── event.go
│   │       ├── inference_deployment.go
│   │       ├── inference_deployment_instance.go
│   │       ├── inference_status.go
│   │       ├── info.go
│   │       ├── log.go
│   │       ├── modelz_cloud.go
│   │       ├── namespace.go
│   │       ├── queue.go
│   │       ├── requests.go
│   │       ├── secret.go
│   │       └── server.go
│   ├── client/
│   │   ├── build.go
│   │   ├── client.go
│   │   ├── const.go
│   │   ├── errors.go
│   │   ├── hijack.go
│   │   ├── image_cache_create.go
│   │   ├── inference_create.go
│   │   ├── inference_get.go
│   │   ├── inference_list.go
│   │   ├── inference_remove.go
│   │   ├── inference_scale.go
│   │   ├── inference_update.go
│   │   ├── info.go
│   │   ├── instance_exec.go
│   │   ├── instance_list.go
│   │   ├── log.go
│   │   ├── modelz_cloud.go
│   │   ├── namespace_create.go
│   │   ├── namespace_delete.go
│   │   ├── options.go
│   │   ├── request.go
│   │   ├── server_label_create.go
│   │   ├── server_list.go
│   │   ├── server_node_delete.go
│   │   ├── transport.go
│   │   └── utils.go
│   ├── cmd/
│   │   └── agent/
│   │       └── main.go
│   ├── errdefs/
│   │   ├── defs.go
│   │   ├── doc.go
│   │   ├── helpers.go
│   │   ├── http_helpers.go
│   │   └── is.go
│   ├── pkg/
│   │   ├── app/
│   │   │   ├── config.go
│   │   │   └── root.go
│   │   ├── config/
│   │   │   └── config.go
│   │   ├── consts/
│   │   │   └── consts.go
│   │   ├── docs/
│   │   │   └── docs.go
│   │   ├── event/
│   │   │   ├── event.go
│   │   │   ├── fake.go
│   │   │   ├── suite_test.go
│   │   │   ├── username.go
│   │   │   └── util.go
│   │   ├── k8s/
│   │   │   ├── convert_inference.go
│   │   │   ├── convert_inference_test.go
│   │   │   ├── convert_job.go
│   │   │   ├── convert_pod.go
│   │   │   ├── convert_pod_test.go
│   │   │   ├── generate_image_cache.go
│   │   │   ├── generate_job.go
│   │   │   ├── managed_cluster.go
│   │   │   ├── resolver.go
│   │   │   └── suite_test.go
│   │   ├── log/
│   │   │   ├── factory.go
│   │   │   ├── k8s.go
│   │   │   └── loki.go
│   │   ├── metrics/
│   │   │   ├── exporter.go
│   │   │   └── metrics.go
│   │   ├── prom/
│   │   │   └── prometheus_query.go
│   │   ├── runtime/
│   │   │   ├── build.go
│   │   │   ├── cluster_info_get.go
│   │   │   ├── image_cache.go
│   │   │   ├── inference_create.go
│   │   │   ├── inference_delete.go
│   │   │   ├── inference_exec.go
│   │   │   ├── inference_get.go
│   │   │   ├── inference_instance.go
│   │   │   ├── inference_list.go
│   │   │   ├── inference_replicas.go
│   │   │   ├── inference_update.go
│   │   │   ├── mock/
│   │   │   │   └── mock.go
│   │   │   ├── namespace.go
│   │   │   ├── node.go
│   │   │   ├── runtime.go
│   │   │   ├── server_delete.go
│   │   │   ├── server_label_create.go
│   │   │   ├── server_list.go
│   │   │   ├── util_domain.go
│   │   │   └── util_resource.go
│   │   ├── scaling/
│   │   │   ├── function_scaler.go
│   │   │   ├── ranges.go
│   │   │   ├── retry.go
│   │   │   ├── service_query.go
│   │   │   └── util.go
│   │   ├── server/
│   │   │   ├── error.go
│   │   │   ├── handler_build_create.go
│   │   │   ├── handler_build_get.go
│   │   │   ├── handler_build_list.go
│   │   │   ├── handler_build_logs.go
│   │   │   ├── handler_gradio_proxy.go
│   │   │   ├── handler_healthz.go
│   │   │   ├── handler_healthz_test.go
│   │   │   ├── handler_image_cache.go
│   │   │   ├── handler_inference_create.go
│   │   │   ├── handler_inference_create_test.go
│   │   │   ├── handler_inference_delete.go
│   │   │   ├── handler_inference_delete_test.go
│   │   │   ├── handler_inference_get.go
│   │   │   ├── handler_inference_get_test.go
│   │   │   ├── handler_inference_instance.go
│   │   │   ├── handler_inference_instance_exec.go
│   │   │   ├── handler_inference_list.go
│   │   │   ├── handler_inference_logs.go
│   │   │   ├── handler_inference_proxy.go
│   │   │   ├── handler_inference_scale.go
│   │   │   ├── handler_inference_update.go
│   │   │   ├── handler_info.go
│   │   │   ├── handler_mosec_proxy.go
│   │   │   ├── handler_namespace_create.go
│   │   │   ├── handler_namespace_delete.go
│   │   │   ├── handler_namespace_delete_test.go
│   │   │   ├── handler_namespace_list.go
│   │   │   ├── handler_other_proxy.go
│   │   │   ├── handler_root.go
│   │   │   ├── handler_server_delete.go
│   │   │   ├── handler_server_label_create.go
│   │   │   ├── handler_server_list.go
│   │   │   ├── handler_streamlit_proxy.go
│   │   │   ├── middleware_callid.go
│   │   │   ├── proxy_auth.go
│   │   │   ├── server_factory.go
│   │   │   ├── server_handlerfunc.go
│   │   │   ├── server_init_kubernetes.go
│   │   │   ├── server_init_logs.go
│   │   │   ├── server_init_metrics.go
│   │   │   ├── server_init_modelz_cloud.go
│   │   │   ├── server_init_route.go
│   │   │   ├── server_run.go
│   │   │   ├── server_websocket.go
│   │   │   ├── static/
│   │   │   │   ├── index.html
│   │   │   │   ├── landing.go
│   │   │   │   └── page_loading.go
│   │   │   ├── suite_test.go
│   │   │   ├── user.go
│   │   │   └── validator/
│   │   │       └── validator.go
│   │   └── version/
│   │       └── version.go
│   └── sqlc.yaml
├── autoscaler/
│   ├── .gitignore
│   ├── Dockerfile
│   ├── Makefile
│   ├── cmd/
│   │   └── autoscaler/
│   │       └── main.go
│   └── pkg/
│       ├── autoscaler/
│       │   ├── factory.go
│       │   ├── inferencecache.go
│       │   ├── loadcache.go
│       │   └── scaler.go
│       ├── autoscalerapp/
│       │   └── root.go
│       ├── prom/
│       │   ├── prom.go
│       │   └── types.go
│       ├── server/
│       │   └── status.go
│       └── version/
│           └── version.go
├── go.mod
├── go.sum
├── ingress-operator/
│   ├── .DEREK.yml
│   ├── .dockerignore
│   ├── .gitignore
│   ├── .tools/
│   │   ├── README.md
│   │   ├── code-generator.mod
│   │   └── code-generator.sum
│   ├── .vscode/
│   │   └── settings.json
│   ├── Dockerfile
│   ├── LICENSE
│   ├── Makefile
│   ├── artifacts/
│   │   ├── .gitignore
│   │   ├── crds/
│   │   │   └── tensorchord.ai_inferenceingresses.yaml
│   │   ├── operator-amd64.yaml
│   │   └── operator-rbac.yaml
│   ├── cmd/
│   │   └── ingress-operator/
│   │       └── main.go
│   ├── hack/
│   │   ├── boilerplate.go.txt
│   │   ├── custom-boilerplate.go.txt
│   │   ├── print-codegen-version.sh
│   │   ├── update-codegen.sh
│   │   ├── update-crds.sh
│   │   └── verify-codegen.sh
│   ├── pkg/
│   │   ├── apis/
│   │   │   └── modelzetes/
│   │   │       ├── register.go
│   │   │       └── v1/
│   │   │           ├── doc.go
│   │   │           ├── register.go
│   │   │           ├── types.go
│   │   │           └── zz_generated.deepcopy.go
│   │   ├── app/
│   │   │   ├── config.go
│   │   │   └── root.go
│   │   ├── client/
│   │   │   ├── clientset/
│   │   │   │   └── versioned/
│   │   │   │       ├── clientset.go
│   │   │   │       ├── doc.go
│   │   │   │       ├── fake/
│   │   │   │       │   ├── clientset_generated.go
│   │   │   │       │   ├── doc.go
│   │   │   │       │   └── register.go
│   │   │   │       ├── scheme/
│   │   │   │       │   ├── doc.go
│   │   │   │       │   └── register.go
│   │   │   │       └── typed/
│   │   │   │           └── modelzetes/
│   │   │   │               └── v1/
│   │   │   │                   ├── doc.go
│   │   │   │                   ├── fake/
│   │   │   │                   │   ├── doc.go
│   │   │   │                   │   ├── fake_inferenceingress.go
│   │   │   │                   │   └── fake_modelzetes_client.go
│   │   │   │                   ├── generated_expansion.go
│   │   │   │                   ├── inferenceingress.go
│   │   │   │                   └── modelzetes_client.go
│   │   │   ├── informers/
│   │   │   │   └── externalversions/
│   │   │   │       ├── factory.go
│   │   │   │       ├── generic.go
│   │   │   │       ├── internalinterfaces/
│   │   │   │       │   └── factory_interfaces.go
│   │   │   │       └── modelzetes/
│   │   │   │           ├── interface.go
│   │   │   │           └── v1/
│   │   │   │               ├── inferenceingress.go
│   │   │   │               └── interface.go
│   │   │   └── listers/
│   │   │       └── modelzetes/
│   │   │           └── v1/
│   │   │               ├── expansion_generated.go
│   │   │               └── inferenceingress.go
│   │   ├── config/
│   │   │   └── config.go
│   │   ├── consts/
│   │   │   └── consts.go
│   │   ├── controller/
│   │   │   ├── core.go
│   │   │   ├── core_test.go
│   │   │   └── v1/
│   │   │       ├── controller.go
│   │   │       ├── controller_factory.go
│   │   │       ├── controller_test.go
│   │   │       └── docs.go
│   │   ├── signals/
│   │   │   ├── signal.go
│   │   │   ├── signal_posix.go
│   │   │   └── signal_windows.go
│   │   └── version/
│   │       └── version.go
│   └── vendor.go
├── mdz/
│   ├── .gitignore
│   ├── Makefile
│   ├── README.md
│   ├── cmd/
│   │   └── mdz/
│   │       └── main.go
│   ├── docs/
│   │   ├── cli/
│   │   │   ├── mdz.md
│   │   │   ├── mdz_delete.md
│   │   │   ├── mdz_deploy.md
│   │   │   ├── mdz_exec.md
│   │   │   ├── mdz_list.md
│   │   │   ├── mdz_list_instance.md
│   │   │   ├── mdz_logs.md
│   │   │   ├── mdz_port-forward.md
│   │   │   ├── mdz_scale.md
│   │   │   ├── mdz_server.md
│   │   │   ├── mdz_server_delete.md
│   │   │   ├── mdz_server_destroy.md
│   │   │   ├── mdz_server_join.md
│   │   │   ├── mdz_server_label.md
│   │   │   ├── mdz_server_list.md
│   │   │   ├── mdz_server_start.md
│   │   │   ├── mdz_server_stop.md
│   │   │   └── mdz_version.md
│   │   └── macOS-quickstart.md
│   ├── examples/
│   │   └── bloomz-560m-openai/
│   │       └── README.md
│   ├── hack/
│   │   └── cli-doc-gen/
│   │       └── main.go
│   └── pkg/
│       ├── agentd/
│       │   ├── runtime/
│       │   │   ├── create.go
│       │   │   ├── delete.go
│       │   │   ├── label.go
│       │   │   ├── list.go
│       │   │   ├── proxy.go
│       │   │   └── runtime.go
│       │   └── server/
│       │       ├── error.go
│       │       ├── handler_healthz.go
│       │       ├── handler_inference_create.go
│       │       ├── handler_inference_delete.go
│       │       ├── handler_inference_get.go
│       │       ├── handler_inference_list.go
│       │       ├── handler_inference_logs.go
│       │       ├── handler_inference_proxy.go
│       │       ├── handler_info.go
│       │       ├── middleware_callid.go
│       │       ├── server_factory.go
│       │       ├── server_handlerfunc.go
│       │       ├── server_init_route.go
│       │       └── server_run.go
│       ├── cmd/
│       │   ├── delete.go
│       │   ├── deploy.go
│       │   ├── exec.go
│       │   ├── exec_stream.go
│       │   ├── ioutils/
│       │   │   └── reader.go
│       │   ├── list.go
│       │   ├── list_instance.go
│       │   ├── localagent.go
│       │   ├── logs.go
│       │   ├── portforward.go
│       │   ├── root.go
│       │   ├── scale.go
│       │   ├── server.go
│       │   ├── server_delete.go
│       │   ├── server_destroy.go
│       │   ├── server_join.go
│       │   ├── server_label.go
│       │   ├── server_list.go
│       │   ├── server_start.go
│       │   ├── server_stop.go
│       │   ├── streams/
│       │   │   ├── in.go
│       │   │   ├── out.go
│       │   │   └── stream.go
│       │   └── version.go
│       ├── server/
│       │   ├── agentd_run.go
│       │   ├── engine.go
│       │   ├── gpu-resource.yaml
│       │   ├── gpu_install.go
│       │   ├── k3s-install.sh
│       │   ├── k3s_destroy.go
│       │   ├── k3s_install.go
│       │   ├── k3s_join.go
│       │   ├── k3s_killall.go
│       │   ├── k3s_prepare.go
│       │   ├── nginx-dep.yaml
│       │   ├── nginx_install.go
│       │   ├── openmodelz.yaml
│       │   ├── openmodelz_install.go
│       │   └── registries.yaml
│       ├── telemetry/
│       │   └── telemetry.go
│       ├── term/
│       │   ├── interrupt.go
│       │   └── term.go
│       └── version/
│           └── version.go
├── modelzetes/
│   ├── .dockerignore
│   ├── .gitattributes
│   ├── .gitignore
│   ├── Dockerfile
│   ├── LICENSE
│   ├── Makefile
│   ├── artifacts/
│   │   ├── crds/
│   │   │   └── tensorchord.ai_inferences.yaml
│   │   └── samples/
│   │       └── v2alpha1.yaml
│   ├── buf.yaml
│   ├── cmd/
│   │   └── modelzetes/
│   │       └── main.go
│   ├── hack/
│   │   ├── boilerplate.go.txt
│   │   ├── print-codegen-version.sh
│   │   ├── update-codegen.sh
│   │   ├── update-crds.sh
│   │   └── verify-codegen.sh
│   ├── pkg/
│   │   ├── apis/
│   │   │   └── modelzetes/
│   │   │       ├── register.go
│   │   │       └── v2alpha1/
│   │   │           ├── doc.go
│   │   │           ├── register.go
│   │   │           ├── types.go
│   │   │           └── zz_generated.deepcopy.go
│   │   ├── app/
│   │   │   ├── config.go
│   │   │   └── root.go
│   │   ├── client/
│   │   │   ├── clientset/
│   │   │   │   └── versioned/
│   │   │   │       ├── clientset.go
│   │   │   │       ├── doc.go
│   │   │   │       ├── fake/
│   │   │   │       │   ├── clientset_generated.go
│   │   │   │       │   ├── doc.go
│   │   │   │       │   └── register.go
│   │   │   │       ├── scheme/
│   │   │   │       │   ├── doc.go
│   │   │   │       │   └── register.go
│   │   │   │       └── typed/
│   │   │   │           └── modelzetes/
│   │   │   │               └── v2alpha1/
│   │   │   │                   ├── doc.go
│   │   │   │                   ├── fake/
│   │   │   │                   │   ├── doc.go
│   │   │   │                   │   ├── fake_inference.go
│   │   │   │                   │   └── fake_modelzetes_client.go
│   │   │   │                   ├── generated_expansion.go
│   │   │   │                   ├── inference.go
│   │   │   │                   └── modelzetes_client.go
│   │   │   ├── informers/
│   │   │   │   └── externalversions/
│   │   │   │       ├── factory.go
│   │   │   │       ├── generic.go
│   │   │   │       ├── internalinterfaces/
│   │   │   │       │   └── factory_interfaces.go
│   │   │   │       └── modelzetes/
│   │   │   │           ├── interface.go
│   │   │   │           └── v2alpha1/
│   │   │   │               ├── inference.go
│   │   │   │               └── interface.go
│   │   │   └── listers/
│   │   │       └── modelzetes/
│   │   │           └── v2alpha1/
│   │   │               ├── expansion_generated.go
│   │   │               └── inference.go
│   │   ├── config/
│   │   │   └── config.go
│   │   ├── consts/
│   │   │   └── consts.go
│   │   ├── controller/
│   │   │   ├── annotations_test.go
│   │   │   ├── controller.go
│   │   │   ├── deployment.go
│   │   │   ├── deployment_test.go
│   │   │   ├── deployment_update_test.go
│   │   │   ├── factory.go
│   │   │   ├── framework_test.go
│   │   │   ├── fromconfig.go
│   │   │   ├── replicas_test.go
│   │   │   ├── secrets.go
│   │   │   ├── secrets_test.go
│   │   │   ├── service.go
│   │   │   └── service_test.go
│   │   ├── k8s/
│   │   │   ├── config.go
│   │   │   ├── errors.go
│   │   │   ├── factory.go
│   │   │   ├── factory_test.go
│   │   │   ├── instance.go
│   │   │   ├── instance_test.go
│   │   │   ├── log.go
│   │   │   ├── logs.go
│   │   │   ├── probes.go
│   │   │   ├── probes_test.go
│   │   │   ├── proxy.go
│   │   │   ├── proxy_test.go
│   │   │   ├── secrets.go
│   │   │   ├── secrets_factory_test.go
│   │   │   ├── securityContext.go
│   │   │   ├── securityContext_test.go
│   │   │   └── utils.go
│   │   ├── pointer/
│   │   │   └── ptr.go
│   │   ├── signals/
│   │   │   ├── signal.go
│   │   │   ├── signal_posix.go
│   │   │   └── signal_windows.go
│   │   └── version/
│   │       └── version.go
│   └── vendor.go
├── pyproject.toml
├── setup.py
└── typos.toml
Download .txt
SYMBOL INDEX (1456 symbols across 305 files)

FILE: agent/api/types/build.go
  type Build (line 3) | type Build struct
  type BuildSpec (line 8) | type BuildSpec struct
  type DockerSource (line 16) | type DockerSource struct
  type BuildTarget (line 23) | type BuildTarget struct
  type AuthN (line 41) | type AuthN struct
  type BuildStatus (line 47) | type BuildStatus struct
  type BuildPhase (line 51) | type BuildPhase
  constant BuildPhasePending (line 54) | BuildPhasePending   BuildPhase = "Pending"
  constant BuildPhaseRunning (line 55) | BuildPhaseRunning   BuildPhase = "Running"
  constant BuildPhaseSucceeded (line 56) | BuildPhaseSucceeded BuildPhase = "Succeeded"
  constant BuildPhaseFailed (line 57) | BuildPhaseFailed    BuildPhase = "Failed"
  type BuilderType (line 60) | type BuilderType
  constant BuilderTypeDockerfile (line 63) | BuilderTypeDockerfile BuilderType = "Dockerfile"
  constant BuilderTypeENVD (line 64) | BuilderTypeENVD       BuilderType = "envd"
  constant BuilderTypeImage (line 65) | BuilderTypeImage      BuilderType = "image"
  type GitRepositorySource (line 68) | type GitRepositorySource struct

FILE: agent/api/types/error.go
  type ErrorResponse (line 3) | type ErrorResponse struct

FILE: agent/api/types/event.go
  constant DeploymentCreateEvent (line 6) | DeploymentCreateEvent     = "deployment-create"
  constant DeploymentUpdateEvent (line 7) | DeploymentUpdateEvent     = "deployment-update"
  constant DeploymentDeleteEvent (line 8) | DeploymentDeleteEvent     = "deployment-delete"
  constant DeploymentScaleUpEvent (line 9) | DeploymentScaleUpEvent    = "deployment-scale-up"
  constant DeploymentScaleDownEvent (line 10) | DeploymentScaleDownEvent  = "deployment-scale-down"
  constant DeploymentScaleBlockEvent (line 11) | DeploymentScaleBlockEvent = "deployment-scale-block"
  constant PodCreateEvent (line 12) | PodCreateEvent            = "pod-create"
  constant PodReadyEvent (line 13) | PodReadyEvent             = "pod-ready"
  constant PodTimeoutEvent (line 14) | PodTimeoutEvent           = "pod-timeout"
  type DeploymentEvent (line 17) | type DeploymentEvent struct

FILE: agent/api/types/inference_deployment.go
  type InferenceDeployment (line 4) | type InferenceDeployment struct
  type InferenceDeploymentSpec (line 9) | type InferenceDeploymentSpec struct
  type Framework (line 57) | type Framework
  constant FrameworkGradio (line 60) | FrameworkGradio    Framework = "gradio"
  constant FrameworkStreamlit (line 61) | FrameworkStreamlit Framework = "streamlit"
  constant FrameworkMosec (line 62) | FrameworkMosec     Framework = "mosec"
  constant FrameworkOther (line 63) | FrameworkOther     Framework = "other"
  type ScalingConfig (line 66) | type ScalingConfig struct
  type ScalingType (line 84) | type ScalingType
  constant ScalingTypeCapacity (line 87) | ScalingTypeCapacity ScalingType = "capacity"
  constant ScalingTypeRPS (line 88) | ScalingTypeRPS      ScalingType = "rps"
  type ResourceRequirements (line 92) | type ResourceRequirements struct
  type ResourceList (line 106) | type ResourceList
  type ResourceName (line 108) | type ResourceName
  constant ResourceCPU (line 111) | ResourceCPU    ResourceName = "cpu"
  constant ResourceMemory (line 112) | ResourceMemory ResourceName = "memory"
  constant ResourceGPU (line 113) | ResourceGPU    ResourceName = "gpu"
  type Quantity (line 116) | type Quantity
  constant RuntimeClassNvidia (line 119) | RuntimeClassNvidia string = "nvidia"
  type ImageCache (line 122) | type ImageCache struct

FILE: agent/api/types/inference_deployment_instance.go
  type InferenceDeploymentInstance (line 5) | type InferenceDeploymentInstance struct
  type InferenceDeploymentInstanceSpec (line 10) | type InferenceDeploymentInstanceSpec struct
  type InferenceDeploymentInstanceStatus (line 16) | type InferenceDeploymentInstanceStatus struct
  type InstancePhase (line 23) | type InstancePhase
  constant InstancePhaseScheduling (line 26) | InstancePhaseScheduling   InstancePhase = "Scheduling"
  constant InstancePhasePending (line 27) | InstancePhasePending      InstancePhase = "Pending"
  constant InstancePhaseRunning (line 28) | InstancePhaseRunning      InstancePhase = "Running"
  constant InstancePhaseFailed (line 29) | InstancePhaseFailed       InstancePhase = "Failed"
  constant InstancePhaseSucceeded (line 30) | InstancePhaseSucceeded    InstancePhase = "Succeeded"
  constant InstancePhaseUnknown (line 31) | InstancePhaseUnknown      InstancePhase = "Unknown"
  constant InstancePhaseCreating (line 32) | InstancePhaseCreating     InstancePhase = "Creating"
  constant InstancePhaseInitializing (line 33) | InstancePhaseInitializing InstancePhase = "Initializing"

FILE: agent/api/types/inference_status.go
  type InferenceDeploymentStatus (line 6) | type InferenceDeploymentStatus struct
  type Phase (line 32) | type Phase
  constant PhaseReady (line 37) | PhaseReady Phase = "Ready"
  constant PhaseScaling (line 40) | PhaseScaling Phase = "Scaling"
  constant PhaseTerminating (line 42) | PhaseTerminating Phase = "Terminating"
  constant PhaseNoReplicas (line 44) | PhaseNoReplicas Phase = "NoReplicas"
  constant PhaseNotReady (line 46) | PhaseNotReady Phase = "NotReady"
  constant PhaseBuilding (line 48) | PhaseBuilding Phase = "Building"
  constant PhaseOptimizing (line 50) | PhaseOptimizing Phase = "Optimizing"
  type InferenceUsage (line 58) | type InferenceUsage struct

FILE: agent/api/types/info.go
  type ProviderInfo (line 4) | type ProviderInfo struct
  type VersionInfo (line 11) | type VersionInfo struct

FILE: agent/api/types/log.go
  type LogRequest (line 5) | type LogRequest struct
  type Message (line 20) | type Message struct

FILE: agent/api/types/modelz_cloud.go
  constant ClusterStatusInit (line 6) | ClusterStatusInit    = "init"
  constant ClusterStatusActive (line 7) | ClusterStatusActive  = "active"
  constant ClusterStatusUnknown (line 8) | ClusterStatusUnknown = "unknown"
  constant DailEndPointSuffix (line 12) | DailEndPointSuffix = "/api/v1/clusteragent/connect"
  type AgentToken (line 15) | type AgentToken struct
  type ManagedCluster (line 21) | type ManagedCluster struct
  type APIKeyMap (line 36) | type APIKeyMap
  type NamespaceList (line 38) | type NamespaceList struct

FILE: agent/api/types/namespace.go
  type NamespaceRequest (line 3) | type NamespaceRequest struct

FILE: agent/api/types/queue.go
  type QueueRequest (line 9) | type QueueRequest struct
  type RequestQueuer (line 40) | type RequestQueuer interface

FILE: agent/api/types/requests.go
  type ScaleServiceRequest (line 7) | type ScaleServiceRequest struct
  type DeleteFunctionRequest (line 15) | type DeleteFunctionRequest struct

FILE: agent/api/types/secret.go
  type Secret (line 4) | type Secret struct

FILE: agent/api/types/server.go
  type Server (line 3) | type Server struct
  type ServerSpec (line 8) | type ServerSpec struct
  type ServerStatus (line 13) | type ServerStatus struct
  type NodeSystemInfo (line 21) | type NodeSystemInfo struct

FILE: agent/client/build.go
  method BuildCreate (line 14) | func (cli *Client) BuildCreate(ctx context.Context, namespace string, bu...
  method BuildGet (line 29) | func (cli *Client) BuildGet(ctx context.Context, namespace, name string)...
  method BuildList (line 49) | func (cli *Client) BuildList(ctx context.Context, namespace string) ([]t...

FILE: agent/client/client.go
  type Client (line 25) | type Client struct
    method DaemonHost (line 145) | func (cli *Client) DaemonHost() string {
    method HTTPClient (line 150) | func (cli *Client) HTTPClient() *http.Client {
    method Close (line 181) | func (cli *Client) Close() error {
    method getAPIPath (line 190) | func (cli *Client) getAPIPath(ctx context.Context, p string, query url...
  function NewClientWithOpts (line 69) | func NewClientWithOpts(ops ...Opt) (*Client, error) {
  function defaultHTTPClient (line 106) | func defaultHTTPClient(host string) (*http.Client, error) {
  function CheckRedirect (line 132) | func CheckRedirect(req *http.Request, via []*http.Request) error {
  function CheckRedirectKeepHeader (line 139) | func CheckRedirectKeepHeader(req *http.Request, via []*http.Request) err...
  function ParseHostURL (line 157) | func ParseHostURL(host string) (*url.URL, error) {

FILE: agent/client/const.go
  constant DefaultModelzGatewayHost (line 7) | DefaultModelzGatewayHost = "http://0.0.0.0:8080"
  constant defaultProto (line 9) | defaultProto = "http"
  constant defaultAddr (line 10) | defaultAddr = "0.0.0.0:8080"
  constant apiBasePath (line 13) | apiBasePath = ""
  constant gatewayInferControlPlanePath (line 16) | gatewayInferControlPlanePath                      = "/system/inferences"
  constant gatewayInferScaleControlPath (line 17) | gatewayInferScaleControlPath                      = "/system/scale-infer...
  constant gatewayInferInstanceControlPlanePath (line 18) | gatewayInferInstanceControlPlanePath              = "/system/inference/%...
  constant gatewayInferInstanceExecControlPlanePath (line 19) | gatewayInferInstanceExecControlPlanePath          = "/system/inference/%...
  constant gatewayServerControlPlanePath (line 20) | gatewayServerControlPlanePath                     = "/system/servers"
  constant gatewayServerLabelCreateControlPlanePath (line 21) | gatewayServerLabelCreateControlPlanePath          = "/system/server/%s/l...
  constant gatewayServerNodeDeleteControlPlanePath (line 22) | gatewayServerNodeDeleteControlPlanePath           = "/system/server/%s/d...
  constant gatewayNamespaceControlPlanePath (line 23) | gatewayNamespaceControlPlanePath                  = "/system/namespaces"
  constant gatewayBuildControlPlanePath (line 24) | gatewayBuildControlPlanePath                      = "/system/build"
  constant gatewayBuildInstanceControlPlanePath (line 25) | gatewayBuildInstanceControlPlanePath              = "/system/build/%s"
  constant gatewayImageCacheControlPlanePath (line 26) | gatewayImageCacheControlPlanePath                 = "/system/image-cache"
  constant modelzCloudClusterControlPlanePath (line 27) | modelzCloudClusterControlPlanePath                = "/api/v1/users/%s/cl...
  constant modelzCloudClusterWithUserControlPlanePath (line 28) | modelzCloudClusterWithUserControlPlanePath        = "/api/v1/users/%s/cl...
  constant modelzCloudClusterAPIKeyControlPlanePath (line 29) | modelzCloudClusterAPIKeyControlPlanePath          = "/api/v1/users/%s/cl...
  constant modelzCloudClusterNamespaceControlPlanePath (line 30) | modelzCloudClusterNamespaceControlPlanePath       = "/api/v1/users/%s/cl...
  constant modelzCloudClusterDeploymentControlPlanePath (line 31) | modelzCloudClusterDeploymentControlPlanePath      = "/api/v1/users/%s/cl...
  constant modelzCloudClusterDeploymentEventControlPlanePath (line 32) | modelzCloudClusterDeploymentEventControlPlanePath = "/api/v1/users/%s/cl...
  constant EnvOverrideHost (line 42) | EnvOverrideHost = "MODELZ_GATEWAY_HOST"
  constant EnvOverrideCertPath (line 61) | EnvOverrideCertPath = "ENVD_SERVER_CERT_PATH"
  constant EnvTLSVerify (line 92) | EnvTLSVerify = "ENVD_SERVER_TLS_VERIFY"

FILE: agent/client/errors.go
  type errConnectionFailed (line 17) | type errConnectionFailed struct
    method Error (line 22) | func (err errConnectionFailed) Error() string {
  function IsErrConnectionFailed (line 30) | func IsErrConnectionFailed(err error) bool {
  function ErrorConnectionFailed (line 35) | func ErrorConnectionFailed(host string) error {
  type notFound (line 40) | type notFound interface
  function IsErrNotFound (line 47) | func IsErrNotFound(err error) bool {
  type objectNotFoundError (line 55) | type objectNotFoundError struct
    method NotFound (line 60) | func (e objectNotFoundError) NotFound() {}
    method Error (line 62) | func (e objectNotFoundError) Error() string {
  function IsErrUnauthorized (line 70) | func IsErrUnauthorized(err error) bool {
  type pluginPermissionDenied (line 74) | type pluginPermissionDenied struct
    method Error (line 78) | func (e pluginPermissionDenied) Error() string {
  function IsErrNotImplemented (line 87) | func IsErrNotImplemented(err error) bool {
  function wrapResponseError (line 91) | func wrapResponseError(err error, resp serverResponse, object, id string...

FILE: agent/client/hijack.go
  type HijackedResponse (line 11) | type HijackedResponse struct
    method Close (line 16) | func (h *HijackedResponse) Close() {
    method Read (line 43) | func (h HijackedResponse) Read(p []byte) (int, error) {
    method Write (line 55) | func (h HijackedResponse) Write(p []byte) (int, error) {
  method websocket (line 21) | func (cli *Client) websocket(ctx context.Context, path string, query url...
  type TerminalMessage (line 76) | type TerminalMessage struct

FILE: agent/client/image_cache_create.go
  method ImageCacheCreate (line 10) | func (cli *Client) ImageCacheCreate(ctx context.Context, namespace string,

FILE: agent/client/inference_create.go
  method InferenceCreate (line 15) | func (cli *Client) InferenceCreate(ctx context.Context, namespace string,

FILE: agent/client/inference_get.go
  method InferenceGet (line 17) | func (cli *Client) InferenceGet(ctx context.Context, namespace, name str...

FILE: agent/client/inference_list.go
  method InferenceList (line 16) | func (cli *Client) InferenceList(ctx context.Context, namespace string) ...

FILE: agent/client/inference_remove.go
  method InferenceRemove (line 15) | func (cli *Client) InferenceRemove(ctx context.Context, namespace string,

FILE: agent/client/inference_scale.go
  method InferenceScale (line 11) | func (cli *Client) InferenceScale(ctx context.Context, namespace string,

FILE: agent/client/inference_update.go
  method DeploymentUpdate (line 15) | func (cli *Client) DeploymentUpdate(ctx context.Context, namespace string,

FILE: agent/client/info.go
  method InfoGet (line 15) | func (cli *Client) InfoGet(ctx context.Context) (types.ProviderInfo, err...

FILE: agent/client/instance_exec.go
  method InstanceExec (line 16) | func (cli *Client) InstanceExec(ctx context.Context,
  method InstanceExecTTY (line 42) | func (cli *Client) InstanceExecTTY(ctx context.Context,

FILE: agent/client/instance_list.go
  method InstanceList (line 17) | func (cli *Client) InstanceList(ctx context.Context,

FILE: agent/client/log.go
  constant LogBufferSize (line 19) | LogBufferSize = 128
  method DeploymentLogGet (line 22) | func (cli *Client) DeploymentLogGet(ctx context.Context, namespace, name...
  method BuildLogGet (line 71) | func (cli *Client) BuildLogGet(ctx context.Context, namespace, name, sin...

FILE: agent/client/modelz_cloud.go
  method WaitForAPIServerReady (line 17) | func (cli *Client) WaitForAPIServerReady() error {
  method waitForAPIServerReady (line 32) | func (cli *Client) waitForAPIServerReady(ctx context.Context) (error, in...
  method RegisterAgent (line 42) | func (cli *Client) RegisterAgent(ctx context.Context, token string, clus...
  method UpdateAgentStatus (line 66) | func (cli *Client) UpdateAgentStatus(ctx context.Context, apiServerReady...
  method GetAPIKeys (line 89) | func (cli *Client) GetAPIKeys(ctx context.Context, apiServerReady <-chan...
  method GetNamespaces (line 114) | func (cli *Client) GetNamespaces(ctx context.Context, apiServerReady <-c...
  method GetUIDFromDeploymentID (line 141) | func (cli *Client) GetUIDFromDeploymentID(ctx context.Context, token str...
  method CreateDeploymentEvent (line 169) | func (cli *Client) CreateDeploymentEvent(ctx context.Context, token stri...

FILE: agent/client/namespace_create.go
  method NamespaceCreate (line 15) | func (cli *Client) NamespaceCreate(ctx context.Context,

FILE: agent/client/namespace_delete.go
  method NamespaceDelete (line 15) | func (cli *Client) NamespaceDelete(ctx context.Context,

FILE: agent/client/options.go
  type Opt (line 21) | type Opt
  function FromEnv (line 34) | func FromEnv(c *Client) error {
  function WithDialContext (line 53) | func WithDialContext(dialContext func(ctx context.Context, network, addr...
  function WithHost (line 64) | func WithHost(host string) Opt {
  function WithHostFromEnv (line 84) | func WithHostFromEnv() Opt {
  function WithHTTPClient (line 94) | func WithHTTPClient(client *http.Client) Opt {
  function WithTimeout (line 104) | func WithTimeout(timeout time.Duration) Opt {
  function WithHTTPHeaders (line 112) | func WithHTTPHeaders(headers map[string]string) Opt {
  function WithScheme (line 120) | func WithScheme(scheme string) Opt {
  function WithTLSClientConfig (line 128) | func WithTLSClientConfig(cacertPath, certPath, keyPath string) Opt {
  function WithTLSClientConfigFromEnv (line 159) | func WithTLSClientConfigFromEnv() Opt {
  function WithVersion (line 186) | func WithVersion(version string) Opt {

FILE: agent/client/request.go
  type serverResponse (line 26) | type serverResponse struct
  method head (line 34) | func (cli *Client) head(ctx context.Context, path string, query url.Valu...
  method get (line 39) | func (cli *Client) get(ctx context.Context, path string, query url.Value...
  method post (line 44) | func (cli *Client) post(ctx context.Context, path string, query url.Valu...
  method postRaw (line 52) | func (cli *Client) postRaw(ctx context.Context, path string, query url.V...
  method put (line 56) | func (cli *Client) put(ctx context.Context, path string, query url.Value...
  method putRaw (line 65) | func (cli *Client) putRaw(ctx context.Context, path string, query url.Va...
  method delete (line 70) | func (cli *Client) delete(ctx context.Context, path string, query url.Va...
  type headers (line 78) | type headers
  function encodeBody (line 80) | func encodeBody(obj interface{}, headers headers) (io.Reader, headers, e...
  method buildRequest (line 96) | func (cli *Client) buildRequest(method, path string, body io.Reader, hea...
  method sendRequest (line 127) | func (cli *Client) sendRequest(ctx context.Context, method, path string,...
  method doRequest (line 145) | func (cli *Client) doRequest(ctx context.Context, req *http.Request) (se...
  method checkResponseErr (line 193) | func (cli *Client) checkResponseErr(serverResp serverResponse) error {
  method addHeaders (line 223) | func (cli *Client) addHeaders(req *http.Request, headers headers) *http....
  function encodeData (line 236) | func encodeData(data interface{}) (*bytes.Buffer, error) {
  function ensureReaderClosed (line 246) | func ensureReaderClosed(response serverResponse) {

FILE: agent/client/server_label_create.go
  method ServerLabelCreate (line 16) | func (cli *Client) ServerLabelCreate(ctx context.Context, name string,

FILE: agent/client/server_list.go
  method ServerList (line 15) | func (cli *Client) ServerList(ctx context.Context) ([]types.Server, erro...

FILE: agent/client/server_node_delete.go
  method ServerNodeDelete (line 14) | func (cli *Client) ServerNodeDelete(ctx context.Context, name string) er...

FILE: agent/client/transport.go
  function resolveTLSConfig (line 14) | func resolveTLSConfig(transport http.RoundTripper) *tls.Config {

FILE: agent/client/utils.go
  constant DefaultPrefix (line 12) | DefaultPrefix = "modelz-"
  function ParseAgentToken (line 15) | func ParseAgentToken(token string) (types.AgentToken, error) {
  function GetNamespaceByUserID (line 32) | func GetNamespaceByUserID(uid string) string {
  function GetUserIDFromNamespace (line 36) | func GetUserIDFromNamespace(ns string) (string, error) {

FILE: agent/cmd/agent/main.go
  function run (line 14) | func run(args []string) error {
  function handleErr (line 23) | func handleErr(err error) {
  function main (line 43) | func main() {

FILE: agent/errdefs/defs.go
  type ErrNotFound (line 8) | type ErrNotFound interface
  type ErrInvalidParameter (line 13) | type ErrInvalidParameter interface
  type ErrConflict (line 19) | type ErrConflict interface
  type ErrUnauthorized (line 24) | type ErrUnauthorized interface
  type ErrUnavailable (line 29) | type ErrUnavailable interface
  type ErrForbidden (line 35) | type ErrForbidden interface
  type ErrSystem (line 41) | type ErrSystem interface
  type ErrNotModified (line 46) | type ErrNotModified interface
  type ErrNotImplemented (line 51) | type ErrNotImplemented interface
  type ErrUnknown (line 56) | type ErrUnknown interface
  type ErrCancelled (line 61) | type ErrCancelled interface
  type ErrDeadline (line 66) | type ErrDeadline interface
  type ErrDataLoss (line 71) | type ErrDataLoss interface

FILE: agent/errdefs/helpers.go
  type errNotFound (line 9) | type errNotFound struct
    method NotFound (line 11) | func (errNotFound) NotFound() {}
    method Cause (line 13) | func (e errNotFound) Cause() error {
    method Unwrap (line 17) | func (e errNotFound) Unwrap() error {
  function NotFound (line 22) | func NotFound(err error) error {
  type errInvalidParameter (line 29) | type errInvalidParameter struct
    method InvalidParameter (line 31) | func (errInvalidParameter) InvalidParameter() {}
    method Cause (line 33) | func (e errInvalidParameter) Cause() error {
    method Unwrap (line 37) | func (e errInvalidParameter) Unwrap() error {
  function InvalidParameter (line 42) | func InvalidParameter(err error) error {
  type errConflict (line 49) | type errConflict struct
    method Conflict (line 51) | func (errConflict) Conflict() {}
    method Cause (line 53) | func (e errConflict) Cause() error {
    method Unwrap (line 57) | func (e errConflict) Unwrap() error {
  function Conflict (line 62) | func Conflict(err error) error {
  type errUnauthorized (line 69) | type errUnauthorized struct
    method Unauthorized (line 71) | func (errUnauthorized) Unauthorized() {}
    method Cause (line 73) | func (e errUnauthorized) Cause() error {
    method Unwrap (line 77) | func (e errUnauthorized) Unwrap() error {
  function Unauthorized (line 82) | func Unauthorized(err error) error {
  type errUnavailable (line 89) | type errUnavailable struct
    method Unavailable (line 91) | func (errUnavailable) Unavailable() {}
    method Cause (line 93) | func (e errUnavailable) Cause() error {
    method Unwrap (line 97) | func (e errUnavailable) Unwrap() error {
  function Unavailable (line 102) | func Unavailable(err error) error {
  type errForbidden (line 109) | type errForbidden struct
    method Forbidden (line 111) | func (errForbidden) Forbidden() {}
    method Cause (line 113) | func (e errForbidden) Cause() error {
    method Unwrap (line 117) | func (e errForbidden) Unwrap() error {
  function Forbidden (line 122) | func Forbidden(err error) error {
  type errSystem (line 129) | type errSystem struct
    method System (line 131) | func (errSystem) System() {}
    method Cause (line 133) | func (e errSystem) Cause() error {
    method Unwrap (line 137) | func (e errSystem) Unwrap() error {
  function System (line 142) | func System(err error) error {
  type errNotModified (line 149) | type errNotModified struct
    method NotModified (line 151) | func (errNotModified) NotModified() {}
    method Cause (line 153) | func (e errNotModified) Cause() error {
    method Unwrap (line 157) | func (e errNotModified) Unwrap() error {
  function NotModified (line 162) | func NotModified(err error) error {
  type errNotImplemented (line 169) | type errNotImplemented struct
    method NotImplemented (line 171) | func (errNotImplemented) NotImplemented() {}
    method Cause (line 173) | func (e errNotImplemented) Cause() error {
    method Unwrap (line 177) | func (e errNotImplemented) Unwrap() error {
  function NotImplemented (line 182) | func NotImplemented(err error) error {
  type errUnknown (line 189) | type errUnknown struct
    method Unknown (line 191) | func (errUnknown) Unknown() {}
    method Cause (line 193) | func (e errUnknown) Cause() error {
    method Unwrap (line 197) | func (e errUnknown) Unwrap() error {
  function Unknown (line 202) | func Unknown(err error) error {
  type errCancelled (line 209) | type errCancelled struct
    method Cancelled (line 211) | func (errCancelled) Cancelled() {}
    method Cause (line 213) | func (e errCancelled) Cause() error {
    method Unwrap (line 217) | func (e errCancelled) Unwrap() error {
  function Cancelled (line 222) | func Cancelled(err error) error {
  type errDeadline (line 229) | type errDeadline struct
    method DeadlineExceeded (line 231) | func (errDeadline) DeadlineExceeded() {}
    method Cause (line 233) | func (e errDeadline) Cause() error {
    method Unwrap (line 237) | func (e errDeadline) Unwrap() error {
  function Deadline (line 242) | func Deadline(err error) error {
  type errDataLoss (line 249) | type errDataLoss struct
    method DataLoss (line 251) | func (errDataLoss) DataLoss() {}
    method Cause (line 253) | func (e errDataLoss) Cause() error {
    method Unwrap (line 257) | func (e errDataLoss) Unwrap() error {
  function DataLoss (line 262) | func DataLoss(err error) error {
  function FromContext (line 270) | func FromContext(ctx context.Context) error {

FILE: agent/errdefs/http_helpers.go
  function FromStatusCode (line 14) | func FromStatusCode(err error, statusCode int) error {

FILE: agent/errdefs/is.go
  type causer (line 7) | type causer interface
  function getImplementer (line 11) | func getImplementer(err error) error {
  function IsNotFound (line 36) | func IsNotFound(err error) bool {
  function IsInvalidParameter (line 42) | func IsInvalidParameter(err error) bool {
  function IsConflict (line 48) | func IsConflict(err error) bool {
  function IsUnauthorized (line 54) | func IsUnauthorized(err error) bool {
  function IsUnavailable (line 60) | func IsUnavailable(err error) bool {
  function IsForbidden (line 66) | func IsForbidden(err error) bool {
  function IsSystem (line 72) | func IsSystem(err error) bool {
  function IsNotModified (line 78) | func IsNotModified(err error) bool {
  function IsNotImplemented (line 84) | func IsNotImplemented(err error) bool {
  function IsUnknown (line 90) | func IsUnknown(err error) bool {
  function IsCancelled (line 96) | func IsCancelled(err error) bool {
  function IsDeadline (line 102) | func IsDeadline(err error) bool {
  function IsDataLoss (line 108) | func IsDataLoss(err error) bool {

FILE: agent/pkg/app/config.go
  function configFromCLI (line 9) | func configFromCLI(c *cli.Context) config.Config {

FILE: agent/pkg/app/root.go
  constant flagDebug (line 20) | flagDebug = "debug"
  constant flagDev (line 21) | flagDev   = "dev"
  constant flagServerPort (line 24) | flagServerPort         = "server-port"
  constant flagServerReadTimeout (line 25) | flagServerReadTimeout  = "server-read-timeout"
  constant flagServerWriteTimeout (line 26) | flagServerWriteTimeout = "server-write-timeout"
  constant flagMasterURL (line 29) | flagMasterURL    = "master-url"
  constant flagKubeConfig (line 30) | flagKubeConfig   = "kube-config"
  constant flagQPS (line 31) | flagQPS          = "kube-qps"
  constant flagBurst (line 32) | flagBurst        = "kube-burst"
  constant flagResyncPeriod (line 33) | flagResyncPeriod = "kube-resync-period"
  constant flagIngressEnabled (line 36) | flagIngressEnabled       = "ingress-enabled"
  constant flagIngressDomain (line 37) | flagIngressDomain        = "ingress-domain"
  constant flagIngressNamespace (line 38) | flagIngressNamespace     = "ingress-namespace"
  constant flagIngressAnyIPToDomain (line 39) | flagIngressAnyIPToDomain = "ingress-any-ip-to-domain"
  constant flagIngressTLSEnabled (line 40) | flagIngressTLSEnabled    = "ingress-tls-enabled"
  constant flagInferenceLogTimeout (line 43) | flagInferenceLogTimeout = "inference-log-timeout"
  constant flagInferenceCacheTTL (line 44) | flagInferenceCacheTTL   = "inference-cache-ttl"
  constant flagBuildEnabled (line 47) | flagBuildEnabled         = "build-enabled"
  constant flagBuilderImage (line 48) | flagBuilderImage         = "builder-image"
  constant flagBuildkitdAddress (line 49) | flagBuildkitdAddress     = "buildkitd-address"
  constant flagBuildCtlBin (line 50) | flagBuildCtlBin          = "buildctl-bin"
  constant flagBuildRegistry (line 51) | flagBuildRegistry        = "build-registry"
  constant flagBuildRegistryToken (line 52) | flagBuildRegistryToken   = "build-registry-token"
  constant flagBuildImagePullSecret (line 53) | flagBuildImagePullSecret = "build-image-pull-secret"
  constant flagMetricsPollingInterval (line 56) | flagMetricsPollingInterval = "metrics-polling-interval"
  constant flagMetricsPort (line 57) | flagMetricsPort            = "metrics-port"
  constant flagMetricsPrometheusHost (line 58) | flagMetricsPrometheusHost  = "metrics-prometheus-host"
  constant flagMetricsPrometheusPort (line 59) | flagMetricsPrometheusPort  = "metrics-prometheus-port"
  constant flagLogsTimeout (line 62) | flagLogsTimeout   = "logs-timeout"
  constant flagLogsLokiURL (line 63) | flagLogsLokiURL   = "logs-loki-url"
  constant flaglogsLokiUser (line 64) | flaglogsLokiUser  = "logs-loki-user"
  constant flagLogsLokiToken (line 65) | flagLogsLokiToken = "logs-loki-token"
  constant flagModelZCloudEnabled (line 68) | flagModelZCloudEnabled                   = "modelz-cloud-enabled"
  constant flagModelZCloudURL (line 69) | flagModelZCloudURL                       = "modelz-cloud-url"
  constant flagModelZCloudAgentToken (line 70) | flagModelZCloudAgentToken                = "modelz-cloud-agent-token"
  constant flagModelZCloudAgentHeartbeatInterval (line 71) | flagModelZCloudAgentHeartbeatInterval    = "modelz-cloud-agent-heartbeat...
  constant flagModelZCloudRegion (line 72) | flagModelZCloudRegion                    = "modelz-cloud-region"
  constant flagModelZCloudUnifiedAPIKey (line 73) | flagModelZCloudUnifiedAPIKey             = "modelz-cloud-unified-api-key"
  constant flagModelZCloudUpstreamTimeout (line 74) | flagModelZCloudUpstreamTimeout           = "modelz-cloud-upstream-timeout"
  constant flagModelZCloudMaxIdleConnections (line 75) | flagModelZCloudMaxIdleConnections        = "modelz-cloud-max-idle-connec...
  constant flagModelZCloudMaxIdleConnectionsPerHost (line 76) | flagModelZCloudMaxIdleConnectionsPerHost = "modelz-cloud-max-idle-connec...
  constant flagModelZCloudEventEnabled (line 77) | flagModelZCloudEventEnabled              = "modelz-cloud-event-enabled"
  type App (line 80) | type App struct
  function New (line 84) | func New() App {
  function runServer (line 410) | func runServer(clicontext *cli.Context) error {

FILE: agent/pkg/config/config.go
  type Config (line 9) | type Config struct
    method GetString (line 102) | func (c Config) GetString() (string, error) {
    method Validate (line 107) | func (c Config) Validate() error {
  type ModelZCloudConfig (line 20) | type ModelZCloudConfig struct
  type LogsConfig (line 39) | type LogsConfig struct
  type ServerConfig (line 46) | type ServerConfig struct
  type MetricsConfig (line 53) | type MetricsConfig struct
  type BuildConfig (line 60) | type BuildConfig struct
  type InferenceConfig (line 70) | type InferenceConfig struct
  type IngressConfig (line 75) | type IngressConfig struct
  type KubeConfig (line 83) | type KubeConfig struct
  function New (line 91) | func New() Config {

FILE: agent/pkg/consts/consts.go
  constant Domain (line 6) | Domain        = "modelz.live"
  constant DefaultPrefix (line 7) | DefaultPrefix = "modelz-"
  constant APIKEY_PREFIX (line 8) | APIKEY_PREFIX = "mzi-"
  constant DefaultAPIServerReadyTimeout (line 10) | DefaultAPIServerReadyTimeout = 15 * time.Minute

FILE: agent/pkg/docs/docs.go
  constant docTemplate (line 7) | docTemplate = `{
  function init (line 1756) | func init() {

FILE: agent/pkg/event/event.go
  type Interface (line 12) | type Interface interface
  type EventRecorder (line 16) | type EventRecorder struct
    method CreateDeploymentEvent (line 28) | func (e *EventRecorder) CreateDeploymentEvent(namespace, deployment, e...
  function NewEventRecorder (line 21) | func NewEventRecorder(client *client.Client, token string) Interface {

FILE: agent/pkg/event/fake.go
  type Fake (line 3) | type Fake struct
    method CreateDeploymentEvent (line 10) | func (f *Fake) CreateDeploymentEvent(namespace, deployment, event, mes...
  function NewFake (line 6) | func NewFake() Interface {

FILE: agent/pkg/event/suite_test.go
  function TestBuilder (line 10) | func TestBuilder(t *testing.T) {

FILE: agent/pkg/event/username.go
  constant DefaultPrefix (line 6) | DefaultPrefix = "modelz-"
  function getUserIDFromNamespace (line 9) | func getUserIDFromNamespace(ns string) (string, error) {

FILE: agent/pkg/event/util.go
  function NullStringBuilder (line 7) | func NullStringBuilder(String string, Valid bool) sql.NullString {

FILE: agent/pkg/k8s/convert_inference.go
  function AsInferenceDeployment (line 11) | func AsInferenceDeployment(inf *v2alpha1.Inference, item *appsv1.Deploym...
  function AsResourceList (line 66) | func AsResourceList(resources v1.ResourceList) types.ResourceList {
  function AsStatusPhase (line 86) | func AsStatusPhase(item *appsv1.Deployment) types.Phase {

FILE: agent/pkg/k8s/convert_job.go
  function AsBuild (line 9) | func AsBuild(job v1.Job) (types.Build, error) {

FILE: agent/pkg/k8s/convert_pod.go
  function MakeLabelSelector (line 10) | func MakeLabelSelector(name string) map[string]string {
  function InstanceFromPod (line 16) | func InstanceFromPod(pod v1.Pod) *types.InferenceDeploymentInstance {

FILE: agent/pkg/k8s/generate_image_cache.go
  function MakeImageCache (line 15) | func MakeImageCache(req types.ImageCache, inference *modelzetes.Inferenc...

FILE: agent/pkg/k8s/generate_job.go
  function MakeBuild (line 17) | func MakeBuild(req types.Build, inference *v2alpha1.Inference, builderIm...
  function buildEnvsForImage (line 121) | func buildEnvsForImage(req types.Build) []corev1.EnvVar {
  function buildEnvsForDockerfileOrEnvd (line 161) | func buildEnvsForDockerfileOrEnvd(req types.Build, buildkitdAddr, buildc...

FILE: agent/pkg/k8s/managed_cluster.go
  function GetKubernetesVersion (line 8) | func GetKubernetesVersion(client kubernetes.Interface) (*version.Info, e...

FILE: agent/pkg/k8s/resolver.go
  type Resolver (line 23) | type Resolver interface
  function NewPortForwardingResolver (line 28) | func NewPortForwardingResolver(cfg *rest.Config, cli kubernetes.Interfac...
  function NewEndpointResolver (line 36) | func NewEndpointResolver(lister corelister.EndpointsLister) Resolver {
  type PortForwardingResolver (line 42) | type PortForwardingResolver struct
    method Resolve (line 48) | func (e *PortForwardingResolver) Resolve(namespace, name string) (url....
    method Close (line 92) | func (e *PortForwardingResolver) Close(url url.URL) {
  type EndpointResolver (line 106) | type EndpointResolver struct
    method Resolve (line 110) | func (e EndpointResolver) Resolve(namespace, name string) (url.URL, er...
    method Close (line 147) | func (e EndpointResolver) Close(url.URL) {

FILE: agent/pkg/k8s/suite_test.go
  function TestBuilder (line 10) | func TestBuilder(t *testing.T) {

FILE: agent/pkg/log/factory.go
  type Requester (line 10) | type Requester interface

FILE: agent/pkg/log/k8s.go
  constant podInformerResync (line 28) | podInformerResync = 5 * time.Second
  constant defaultLogSince (line 31) | defaultLogSince = 5 * time.Minute
  constant LogBufferSize (line 34) | LogBufferSize = 500 * 2
  type K8sAPIRequestor (line 38) | type K8sAPIRequestor struct
    method Query (line 48) | func (k *K8sAPIRequestor) Query(ctx context.Context,
  function NewK8sAPIRequestor (line 42) | func NewK8sAPIRequestor(client kubernetes.Interface) Requester {
  function getLogs (line 101) | func getLogs(ctx context.Context, client kubernetes.Interface, functionN...
  function podLogs (line 140) | func podLogs(ctx context.Context, i v1.PodInterface, pod, container,
  function startFunctionPodInformer (line 197) | func startFunctionPodInformer(ctx context.Context, client kubernetes.Int...
  function parseSince (line 250) | func parseSince(r *time.Time) *int64 {
  function extractTimestampAndMsg (line 260) | func extractTimestampAndMsg(logText string) (string, time.Time) {
  function withLabels (line 277) | func withLabels(selector string) internalinterfaces.TweakListOptionsFunc {
  type podLoggerEventHandler (line 283) | type podLoggerEventHandler struct
    method OnAdd (line 289) | func (h *podLoggerEventHandler) OnAdd(obj interface{}, isInitialList b...
    method OnUpdate (line 295) | func (h *podLoggerEventHandler) OnUpdate(oldObj, newObj interface{}) {
    method OnDelete (line 299) | func (h *podLoggerEventHandler) OnDelete(obj interface{}) {

FILE: agent/pkg/log/loki.go
  constant lokiQueryRangePath (line 21) | lokiQueryRangePath = "/loki/api/v1/query_range"
  type RangeQueryResponse (line 24) | type RangeQueryResponse struct
  type LokiAPIRequestor (line 41) | type LokiAPIRequestor struct
    method Query (line 58) | func (l *LokiAPIRequestor) Query(ctx context.Context, r types.LogReque...
    method getLogs (line 72) | func (l *LokiAPIRequestor) getLogs(ctx context.Context, since *time.Time,
  function NewLokiAPIRequestor (line 48) | func NewLokiAPIRequestor(url, user, token string) Requester {

FILE: agent/pkg/metrics/exporter.go
  type Exporter (line 21) | type Exporter struct
    method Describe (line 39) | func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
    method Collect (line 50) | func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
    method StartServiceWatcher (line 94) | func (e *Exporter) StartServiceWatcher(
  function NewExporter (line 29) | func NewExporter(options MetricOptions, r runtime.Runtime) *Exporter {

FILE: agent/pkg/metrics/metrics.go
  type MetricOptions (line 15) | type MetricOptions struct
  type ServiceMetricOptions (line 29) | type ServiceMetricOptions struct
  function RegisterExporter (line 38) | func RegisterExporter(exporter *Exporter) {
  function PrometheusHandler (line 45) | func PrometheusHandler() http.Handler {
  function BuildMetricsOptions (line 50) | func BuildMetricsOptions() MetricOptions {

FILE: agent/pkg/prom/prometheus_query.go
  type PrometheusQuery (line 16) | type PrometheusQuery struct
    method AddMetrics (line 35) | func (p PrometheusQuery) AddMetrics(inferences []types.InferenceDeploy...
    method Fetch (line 51) | func (q PrometheusQuery) Fetch(query string) (*VectorQueryResponse, er...
  type PrometheusQueryFetcher (line 22) | type PrometheusQueryFetcher interface
  function NewPrometheusQuery (line 27) | func NewPrometheusQuery(host string, port int, client *http.Client) Prom...
  type VectorQueryResponse (line 86) | type VectorQueryResponse struct
  function mixIn (line 99) | func mixIn(inferences []types.InferenceDeployment, metrics *VectorQueryR...

FILE: agent/pkg/runtime/build.go
  method BuildList (line 17) | func (r generalRuntime) BuildList(ctx context.Context, namespace string) (
  method BuildCreate (line 43) | func (r generalRuntime) BuildCreate(ctx context.Context,
  method BuildGet (line 59) | func (r generalRuntime) BuildGet(ctx context.Context, namespace, buildNa...

FILE: agent/pkg/runtime/cluster_info_get.go
  method GetClusterInfo (line 11) | func (r generalRuntime) GetClusterInfo(cluster *types.ManagedCluster) er...

FILE: agent/pkg/runtime/image_cache.go
  method ImageCacheCreate (line 13) | func (r generalRuntime) ImageCacheCreate(ctx context.Context, req types....

FILE: agent/pkg/runtime/inference_create.go
  method InferenceCreate (line 20) | func (r generalRuntime) InferenceCreate(ctx context.Context,
  function makeInference (line 135) | func makeInference(request types.InferenceDeployment) (*v2alpha1.Inferen...
  function makeIngress (line 182) | func makeIngress(request types.InferenceDeployment, cfg config.IngressCo...

FILE: agent/pkg/runtime/inference_delete.go
  method InferenceDelete (line 14) | func (r generalRuntime) InferenceDelete(ctx context.Context, namespace,
  function deleteInference (line 47) | func deleteInference(ctx context.Context,

FILE: agent/pkg/runtime/inference_exec.go
  constant writeWait (line 25) | writeWait = 10 * time.Second
  constant endOfTransmission (line 27) | endOfTransmission = "\u0004"
  method InferenceExec (line 30) | func (r generalRuntime) InferenceExec(ctx *gin.Context, namespace, insta...
  type PtyHandler (line 97) | type PtyHandler interface
  type TerminalMessage (line 112) | type TerminalMessage struct
  type TerminalSession (line 121) | type TerminalSession struct
    method Next (line 130) | func (t *TerminalSession) Next() *remotecommand.TerminalSize {
    method Read (line 141) | func (t *TerminalSession) Read(p []byte) (int, error) {
    method Write (line 165) | func (t *TerminalSession) Write(p []byte) (int, error) {
    method Close (line 180) | func (t *TerminalSession) Close() error {
  function newTerminalSession (line 185) | func newTerminalSession(id string, r *http.Request, w http.ResponseWrite...

FILE: agent/pkg/runtime/inference_get.go
  method InferenceGet (line 16) | func (r generalRuntime) InferenceGet(namespace, inferenceName string) (
  method InferenceGetCRD (line 22) | func (r generalRuntime) InferenceGetCRD(namespace, name string) (*apis.I...
  function inferenceGet (line 34) | func inferenceGet(namespace string, inferenceName string,

FILE: agent/pkg/runtime/inference_instance.go
  method InferenceInstanceList (line 13) | func (r generalRuntime) InferenceInstanceList(namespace, inferenceName s...
  function getInstances (line 18) | func getInstances(functionNamespace string, functionName string,

FILE: agent/pkg/runtime/inference_list.go
  method InferenceList (line 20) | func (r generalRuntime) InferenceList(namespace string) ([]types.Inferen...
  function inferenceList (line 33) | func inferenceList(functionNamespace string,
  function getInferences (line 67) | func getInferences(inferences []*mv2alpha1.Inference, deploys []*appsv1....

FILE: agent/pkg/runtime/inference_replicas.go
  method InferenceScale (line 13) | func (r generalRuntime) InferenceScale(ctx context.Context, namespace st...

FILE: agent/pkg/runtime/inference_update.go
  method InferenceUpdate (line 15) | func (r generalRuntime) InferenceUpdate(ctx context.Context, namespace s...
  function updateInference (line 31) | func updateInference(

FILE: agent/pkg/runtime/mock/mock.go
  type MockRuntime (line 19) | type MockRuntime struct
    method EXPECT (line 37) | func (m *MockRuntime) EXPECT() *MockRuntimeMockRecorder {
    method BuildCreate (line 42) | func (m *MockRuntime) BuildCreate(ctx context.Context, req types.Build...
    method BuildGet (line 56) | func (m *MockRuntime) BuildGet(ctx context.Context, namespace, buildNa...
    method BuildList (line 71) | func (m *MockRuntime) BuildList(ctx context.Context, namespace string)...
    method GetClusterInfo (line 86) | func (m *MockRuntime) GetClusterInfo(cluster *types.ManagedCluster) er...
    method ImageCacheCreate (line 100) | func (m *MockRuntime) ImageCacheCreate(ctx context.Context, req types....
    method InferenceCreate (line 114) | func (m *MockRuntime) InferenceCreate(ctx context.Context, req types.I...
    method InferenceDelete (line 128) | func (m *MockRuntime) InferenceDelete(ctx context.Context, namespace, ...
    method InferenceExec (line 142) | func (m *MockRuntime) InferenceExec(ctx *gin.Context, namespace, insta...
    method InferenceGet (line 156) | func (m *MockRuntime) InferenceGet(namespace, inferenceName string) (*...
    method InferenceGetCRD (line 171) | func (m *MockRuntime) InferenceGetCRD(namespace, name string) (*v2alph...
    method InferenceInstanceList (line 186) | func (m *MockRuntime) InferenceInstanceList(namespace, inferenceName s...
    method InferenceList (line 201) | func (m *MockRuntime) InferenceList(namespace string) ([]types.Inferen...
    method InferenceScale (line 216) | func (m *MockRuntime) InferenceScale(ctx context.Context, namespace st...
    method InferenceUpdate (line 230) | func (m *MockRuntime) InferenceUpdate(ctx context.Context, namespace s...
    method NamespaceCreate (line 244) | func (m *MockRuntime) NamespaceCreate(ctx context.Context, name string...
    method NamespaceDelete (line 258) | func (m *MockRuntime) NamespaceDelete(ctx context.Context, name string...
    method NamespaceGet (line 272) | func (m *MockRuntime) NamespaceGet(ctx context.Context, name string) b...
    method NamespaceList (line 286) | func (m *MockRuntime) NamespaceList(ctx context.Context) ([]string, er...
    method ServerDeleteNode (line 301) | func (m *MockRuntime) ServerDeleteNode(ctx context.Context, name strin...
    method ServerLabelCreate (line 315) | func (m *MockRuntime) ServerLabelCreate(ctx context.Context, name stri...
    method ServerList (line 329) | func (m *MockRuntime) ServerList(ctx context.Context) ([]types.Server,...
  type MockRuntimeMockRecorder (line 25) | type MockRuntimeMockRecorder struct
    method BuildCreate (line 50) | func (mr *MockRuntimeMockRecorder) BuildCreate(ctx, req, inference, bu...
    method BuildGet (line 65) | func (mr *MockRuntimeMockRecorder) BuildGet(ctx, namespace, buildName ...
    method BuildList (line 80) | func (mr *MockRuntimeMockRecorder) BuildList(ctx, namespace interface{...
    method GetClusterInfo (line 94) | func (mr *MockRuntimeMockRecorder) GetClusterInfo(cluster interface{})...
    method ImageCacheCreate (line 108) | func (mr *MockRuntimeMockRecorder) ImageCacheCreate(ctx, req, inferenc...
    method InferenceCreate (line 122) | func (mr *MockRuntimeMockRecorder) InferenceCreate(ctx, req, cfg, even...
    method InferenceDelete (line 136) | func (mr *MockRuntimeMockRecorder) InferenceDelete(ctx, namespace, inf...
    method InferenceExec (line 150) | func (mr *MockRuntimeMockRecorder) InferenceExec(ctx, namespace, insta...
    method InferenceGet (line 165) | func (mr *MockRuntimeMockRecorder) InferenceGet(namespace, inferenceNa...
    method InferenceGetCRD (line 180) | func (mr *MockRuntimeMockRecorder) InferenceGetCRD(namespace, name int...
    method InferenceInstanceList (line 195) | func (mr *MockRuntimeMockRecorder) InferenceInstanceList(namespace, in...
    method InferenceList (line 210) | func (mr *MockRuntimeMockRecorder) InferenceList(namespace interface{}...
    method InferenceScale (line 224) | func (mr *MockRuntimeMockRecorder) InferenceScale(ctx, namespace, req,...
    method InferenceUpdate (line 238) | func (mr *MockRuntimeMockRecorder) InferenceUpdate(ctx, namespace, req...
    method NamespaceCreate (line 252) | func (mr *MockRuntimeMockRecorder) NamespaceCreate(ctx, name interface...
    method NamespaceDelete (line 266) | func (mr *MockRuntimeMockRecorder) NamespaceDelete(ctx, name interface...
    method NamespaceGet (line 280) | func (mr *MockRuntimeMockRecorder) NamespaceGet(ctx, name interface{})...
    method NamespaceList (line 295) | func (mr *MockRuntimeMockRecorder) NamespaceList(ctx interface{}) *gom...
    method ServerDeleteNode (line 309) | func (mr *MockRuntimeMockRecorder) ServerDeleteNode(ctx, name interfac...
    method ServerLabelCreate (line 323) | func (mr *MockRuntimeMockRecorder) ServerLabelCreate(ctx, name, spec i...
    method ServerList (line 338) | func (mr *MockRuntimeMockRecorder) ServerList(ctx interface{}) *gomock...
  function NewMockRuntime (line 30) | func NewMockRuntime(ctrl *gomock.Controller) *MockRuntime {

FILE: agent/pkg/runtime/namespace.go
  method NamespaceList (line 15) | func (r generalRuntime) NamespaceList(ctx context.Context) ([]string, er...
  method NamespaceCreate (line 35) | func (r generalRuntime) NamespaceCreate(ctx context.Context, name string...
  method NamespaceGet (line 57) | func (r generalRuntime) NamespaceGet(ctx context.Context, name string) b...
  method NamespaceDelete (line 66) | func (r generalRuntime) NamespaceDelete(ctx context.Context, name string...

FILE: agent/pkg/runtime/node.go
  method ListServerResource (line 11) | func (r generalRuntime) ListServerResource() ([]string, error) {

FILE: agent/pkg/runtime/runtime.go
  type Runtime (line 28) | type Runtime interface
  type generalRuntime (line 60) | type generalRuntime struct
  function New (line 82) | func New(clientConfig *rest.Config,

FILE: agent/pkg/runtime/server_delete.go
  method ServerDeleteNode (line 11) | func (r generalRuntime) ServerDeleteNode(ctx context.Context, name strin...

FILE: agent/pkg/runtime/server_label_create.go
  method ServerLabelCreate (line 13) | func (r generalRuntime) ServerLabelCreate(ctx context.Context, name stri...

FILE: agent/pkg/runtime/server_list.go
  method ServerList (line 16) | func (r generalRuntime) ServerList(ctx context.Context) ([]types.Server,...
  function getServers (line 33) | func getServers(nodes []v1.Node) []types.Server {
  function getServer (line 41) | func getServer(n v1.Node) types.Server {

FILE: agent/pkg/runtime/util_domain.go
  constant AnnotationDomain (line 10) | AnnotationDomain = "ai.tensorchord.domain"
  constant stdLen (line 15) | stdLen = 16
  function makeDomain (line 21) | func makeDomain(name, baseDomain string) (string, error) {

FILE: agent/pkg/runtime/util_resource.go
  function createResources (line 11) | func createResources(request types.InferenceDeployment) (corev1.Resource...

FILE: agent/pkg/scaling/function_scaler.go
  constant maxPollCount (line 17) | maxPollCount = 1000
  constant retries (line 18) | retries      = 20
  constant pollInterval (line 19) | pollInterval = time.Millisecond * 100
  function NewInferenceScaler (line 24) | func NewInferenceScaler(r runtime.Runtime,
  type InferenceScaler (line 42) | type InferenceScaler struct
    method get (line 58) | func (s *InferenceScaler) get(
    method Scale (line 96) | func (s *InferenceScaler) Scale(ctx context.Context,
  type FunctionScaleResult (line 51) | type FunctionScaleResult struct

FILE: agent/pkg/scaling/ranges.go
  type ScaleType (line 5) | type ScaleType
  constant DefaultMinReplicas (line 9) | DefaultMinReplicas = 1
  constant DefaultMaxReplicas (line 12) | DefaultMaxReplicas = 5
  constant DefaultZeroDuration (line 14) | DefaultZeroDuration = 3 * time.Minute
  constant DefaultScalingFactor (line 17) | DefaultScalingFactor = 10
  constant ScaleTypeRPS (line 19) | ScaleTypeRPS      ScaleType = "rps"
  constant ScaleTypeCapacity (line 20) | ScaleTypeCapacity ScaleType = "capacity"
  constant MinScaleLabel (line 23) | MinScaleLabel = "ai.tensorchord.scale.min"
  constant MaxScaleLabel (line 26) | MaxScaleLabel = "ai.tensorchord.scale.max"
  constant ScalingFactorLabel (line 29) | ScalingFactorLabel = "ai.tensorchord.scale.factor"
  constant TargetLoadLabel (line 32) | TargetLoadLabel = "ai.tensorchord.scale.target"
  constant ZeroDurationLabel (line 35) | ZeroDurationLabel = "ai.tensorchord.scale.zero-duration"
  constant ScaleTypeLabel (line 38) | ScaleTypeLabel = "ai.tensorchord.scale.type"
  constant FrameworkLabel (line 40) | FrameworkLabel = "ai.tensorchord.framework"

FILE: agent/pkg/scaling/retry.go
  type routine (line 8) | type routine
  function Retry (line 10) | func Retry(r routine, label string, attempts int, interval time.Duration...

FILE: agent/pkg/scaling/service_query.go
  type ServiceQuery (line 9) | type ServiceQuery interface
  type ServiceQueryResponse (line 15) | type ServiceQueryResponse struct

FILE: agent/pkg/scaling/util.go
  function AsServerQueryResponse (line 9) | func AsServerQueryResponse(inf *types.InferenceDeployment) (*ServiceQuer...

FILE: agent/pkg/server/error.go
  type Error (line 12) | type Error struct
    method Error (line 26) | func (e *Error) Error() string {
  function NewError (line 47) | func NewError(code int, err error, op string) error {
  function errFromErrDefs (line 56) | func errFromErrDefs(err error, op string) error {

FILE: agent/pkg/server/handler_build_create.go
  method handleBuildCreate (line 20) | func (s *Server) handleBuildCreate(c *gin.Context) error {

FILE: agent/pkg/server/handler_build_get.go
  method handleBuildGet (line 21) | func (s *Server) handleBuildGet(c *gin.Context) error {

FILE: agent/pkg/server/handler_build_list.go
  method handleBuildList (line 20) | func (s *Server) handleBuildList(c *gin.Context) error {

FILE: agent/pkg/server/handler_build_logs.go
  method handleBuildLogs (line 22) | func (s *Server) handleBuildLogs(c *gin.Context) error {

FILE: agent/pkg/server/handler_gradio_proxy.go
  method proxyGradio (line 29) | func (s *Server) proxyGradio(c *gin.Context) error {

FILE: agent/pkg/server/handler_healthz.go
  method handleHealthz (line 16) | func (s *Server) handleHealthz(c *gin.Context) error {

FILE: agent/pkg/server/handler_image_cache.go
  method handleImageCacheCreate (line 18) | func (s *Server) handleImageCacheCreate(c *gin.Context) error {

FILE: agent/pkg/server/handler_inference_create.go
  method handleInferenceCreate (line 21) | func (s *Server) handleInferenceCreate(c *gin.Context) error {

FILE: agent/pkg/server/handler_inference_delete.go
  method handleInferenceDelete (line 21) | func (s *Server) handleInferenceDelete(c *gin.Context) error {

FILE: agent/pkg/server/handler_inference_get.go
  method handleInferenceGet (line 21) | func (s *Server) handleInferenceGet(c *gin.Context) error {

FILE: agent/pkg/server/handler_inference_instance.go
  method handleInferenceInstance (line 21) | func (s *Server) handleInferenceInstance(c *gin.Context) error {

FILE: agent/pkg/server/handler_inference_instance_exec.go
  method handleInferenceInstanceExec (line 24) | func (s *Server) handleInferenceInstanceExec(c *gin.Context) error {

FILE: agent/pkg/server/handler_inference_list.go
  method handleInferenceList (line 20) | func (s *Server) handleInferenceList(c *gin.Context) error {

FILE: agent/pkg/server/handler_inference_logs.go
  method handleInferenceLogs (line 30) | func (s *Server) handleInferenceLogs(c *gin.Context) error {
  method getLogsFromRequester (line 34) | func (s Server) getLogsFromRequester(c *gin.Context, requester log.Reque...

FILE: agent/pkg/server/handler_inference_proxy.go
  method handleInferenceProxy (line 34) | func (s *Server) handleInferenceProxy(c *gin.Context) error {
  method forward (line 89) | func (s *Server) forward(c *gin.Context, namespace, name string) (int, e...
  function getNamespaceAndName (line 135) | func getNamespaceAndName(name string) (string, string, error) {

FILE: agent/pkg/server/handler_inference_scale.go
  method handleInferenceScale (line 22) | func (s *Server) handleInferenceScale(c *gin.Context) error {

FILE: agent/pkg/server/handler_inference_update.go
  method handleInferenceUpdate (line 21) | func (s *Server) handleInferenceUpdate(c *gin.Context) error {

FILE: agent/pkg/server/handler_info.go
  method handleInfo (line 19) | func (s *Server) handleInfo(c *gin.Context) error {

FILE: agent/pkg/server/handler_mosec_proxy.go
  method proxyMosec (line 21) | func (s *Server) proxyMosec(c *gin.Context) error {

FILE: agent/pkg/server/handler_namespace_create.go
  method handleNamespaceCreate (line 18) | func (s *Server) handleNamespaceCreate(c *gin.Context) error {

FILE: agent/pkg/server/handler_namespace_delete.go
  method handleNamespaceDelete (line 18) | func (s *Server) handleNamespaceDelete(c *gin.Context) error {

FILE: agent/pkg/server/handler_namespace_list.go
  method handleNamespaceList (line 16) | func (s *Server) handleNamespaceList(c *gin.Context) error {

FILE: agent/pkg/server/handler_other_proxy.go
  method proxyOther (line 25) | func (s *Server) proxyOther(c *gin.Context) error {

FILE: agent/pkg/server/handler_root.go
  method handleRoot (line 8) | func (s *Server) handleRoot(c *gin.Context) error {

FILE: agent/pkg/server/handler_server_delete.go
  method handleServerDelete (line 18) | func (s *Server) handleServerDelete(c *gin.Context) error {

FILE: agent/pkg/server/handler_server_label_create.go
  method handleServerLabelCreate (line 20) | func (s *Server) handleServerLabelCreate(c *gin.Context) error {

FILE: agent/pkg/server/handler_server_list.go
  method handleServerList (line 17) | func (s *Server) handleServerList(c *gin.Context) error {

FILE: agent/pkg/server/handler_streamlit_proxy.go
  method proxyStreamlit (line 29) | func (s *Server) proxyStreamlit(c *gin.Context) error {

FILE: agent/pkg/server/middleware_callid.go
  method middlewareCallID (line 11) | func (s Server) middlewareCallID(c *gin.Context) error {

FILE: agent/pkg/server/proxy_auth.go
  method proxyAuth (line 14) | func (s *Server) proxyAuth(c *gin.Context) (string, string, error) {
  method proxyNoAuth (line 59) | func (s *Server) proxyNoAuth(c *gin.Context) (string, string, error) {
  method validateAPIKey (line 74) | func (s *Server) validateAPIKey(key string) (string, bool) {
  method validateUnifiedKey (line 106) | func (s *Server) validateUnifiedKey(key string) bool {

FILE: agent/pkg/server/server_factory.go
  type Server (line 25) | type Server struct
  function New (line 56) | func New(c config.Config) (Server, error) {

FILE: agent/pkg/server/server_handlerfunc.go
  type HandlerFunc (line 11) | type HandlerFunc
  function WrapHandler (line 13) | func WrapHandler(handler HandlerFunc) gin.HandlerFunc {

FILE: agent/pkg/server/server_init_kubernetes.go
  method initKubernetesResources (line 32) | func (s *Server) initKubernetesResources() error {
  method podStartWatch (line 134) | func (s *Server) podStartWatch(pods kubeinformersv1.PodInformer, client ...
  function podWatchEventLog (line 184) | func podWatchEventLog(recorder event.Interface, obj *v1.Pod, event strin...

FILE: agent/pkg/server/server_init_logs.go
  method initLogs (line 7) | func (s *Server) initLogs() {

FILE: agent/pkg/server/server_init_metrics.go
  method initMetrics (line 9) | func (s *Server) initMetrics() error {

FILE: agent/pkg/server/server_init_modelz_cloud.go
  method initModelZCloud (line 13) | func (s *Server) initModelZCloud(url, token, region string) error {

FILE: agent/pkg/server/server_init_route.go
  constant endpointInferencePlural (line 13) | endpointInferencePlural = "/inferences"
  constant endpointInference (line 14) | endpointInference       = "/inference"
  constant endpointServerPlural (line 15) | endpointServerPlural    = "/servers"
  constant endpointServer (line 16) | endpointServer          = "/server"
  constant endpointScaleInference (line 17) | endpointScaleInference  = "/scale-inference"
  constant endpointInfo (line 18) | endpointInfo            = "/info"
  constant endpointLogPlural (line 19) | endpointLogPlural       = "/logs"
  constant endpointNamespacePlural (line 20) | endpointNamespacePlural = "/namespaces"
  constant endpointHealthz (line 21) | endpointHealthz         = "/healthz"
  constant endpointBuild (line 22) | endpointBuild           = "/build"
  constant endpointImageCache (line 23) | endpointImageCache      = "/image-cache"
  method registerRoutes (line 26) | func (s *Server) registerRoutes() {
  method registerMetricsRoutes (line 111) | func (s *Server) registerMetricsRoutes() {

FILE: agent/pkg/server/server_run.go
  method Run (line 18) | func (s *Server) Run() error {
  function ContainString (line 131) | func ContainString(target string, strs []string) bool {

FILE: agent/pkg/server/server_websocket.go
  method connect (line 14) | func (s *Server) connect(apiServerReady <-chan struct{}) {
  function retry (line 63) | func retry(sleep time.Duration, f func() error) {

FILE: agent/pkg/server/static/landing.go
  type htmlStruct (line 14) | type htmlStruct struct
  function RenderLoadingPage (line 18) | func RenderLoadingPage() (*bytes.Buffer, error) {

FILE: agent/pkg/server/static/page_loading.go
  constant htmlDeploymentTemplate (line 10) | htmlDeploymentTemplate = `<html lang="en"><head><meta http-equiv="refres...
  type htmlDeploymentStruct (line 39) | type htmlDeploymentStruct struct
  function RenderDeploymentLoadingPage (line 47) | func RenderDeploymentLoadingPage(framework, id, statusString, deployment...

FILE: agent/pkg/server/suite_test.go
  function mkContext (line 25) | func mkContext(method string, path string, header map[string][]string, b...
  function mkJsonBodyContext (line 40) | func mkJsonBodyContext(method string, path string, header map[string][]s...
  function setQuery (line 48) | func setQuery(c *gin.Context, query map[string]string) {
  function setParam (line 56) | func setParam(c *gin.Context, param map[string]string) {
  function TestBuilder (line 62) | func TestBuilder(t *testing.T) {

FILE: agent/pkg/server/user.go
  method getUIDFromDeploymentID (line 9) | func (s *Server) getUIDFromDeploymentID(ctx context.Context, id string) ...

FILE: agent/pkg/server/validator/validator.go
  constant defaultMinReplicas (line 13) | defaultMinReplicas     = 0
  constant defaultMaxReplicas (line 14) | defaultMaxReplicas     = 1
  constant maxReplicas (line 15) | maxReplicas            = 5
  constant defaultTargetLoad (line 16) | defaultTargetLoad      = 100
  constant defaultZeroDuration (line 17) | defaultZeroDuration    = 300
  constant defaultStartupDuration (line 18) | defaultStartupDuration = 600
  constant defaultBuildDuration (line 19) | defaultBuildDuration   = "40m"
  constant defaultHTTPProbePath (line 20) | defaultHTTPProbePath   = "/"
  type Validator (line 27) | type Validator struct
    method ValidateService (line 38) | func (v Validator) ValidateService(service string) error {
    method DefaultDeployRequest (line 48) | func (v Validator) DefaultDeployRequest(request *types.InferenceDeploy...
    method ValidateDeployRequest (line 89) | func (v Validator) ValidateDeployRequest(request *types.InferenceDeplo...
    method ValidateBuildRequest (line 117) | func (v Validator) ValidateBuildRequest(request *types.Build) error {
    method ValidateImageCacheRequest (line 129) | func (v Validator) ValidateImageCacheRequest(request *types.ImageCache...
    method DefaultBuildRequest (line 148) | func (v Validator) DefaultBuildRequest(request *types.Build) {
  function New (line 31) | func New() *Validator {

FILE: agent/pkg/version/version.go
  type Version (line 46) | type Version struct
    method String (line 57) | func (v Version) String() string {
  function SetGitTagForE2ETest (line 62) | func SetGitTagForE2ETest(tag string) {
  function GetAgentVersion (line 67) | func GetAgentVersion() string {
  function GetVersion (line 96) | func GetVersion() Version {
  function UserAgent (line 115) | func UserAgent() string {

FILE: autoscaler/cmd/autoscaler/main.go
  function run (line 14) | func run(args []string) error {
  function handleErr (line 23) | func handleErr(err error) {
  function main (line 31) | func main() {

FILE: autoscaler/pkg/autoscaler/factory.go
  type Opt (line 15) | type Opt struct
  function New (line 25) | func New(opt Opt) (*Scaler, error) {

FILE: autoscaler/pkg/autoscaler/inferencecache.go
  type Inference (line 9) | type Inference struct
  type InferenceCache (line 14) | type InferenceCache struct
    method Set (line 24) | func (i *InferenceCache) Set(key string, inference Inference) {
    method Get (line 28) | func (i *InferenceCache) Get(key string, expireTime time.Duration) (ty...
  function newInferenceCache (line 18) | func newInferenceCache() *InferenceCache {

FILE: autoscaler/pkg/autoscaler/loadcache.go
  type LoadCache (line 6) | type LoadCache struct
    method Get (line 23) | func (l *LoadCache) Get(key string) (Load, bool) {
    method Set (line 28) | func (l *LoadCache) Set(key string, load Load) {
  type Load (line 10) | type Load struct
  function newLoadCache (line 17) | func newLoadCache() *LoadCache {

FILE: autoscaler/pkg/autoscaler/scaler.go
  type Scaler (line 19) | type Scaler struct
    method AutoScale (line 40) | func (s *Scaler) AutoScale(interval time.Duration) {
    method GetLoadMetrics (line 338) | func (s *Scaler) GetLoadMetrics() {
    method GetRestartMetrics (line 415) | func (s *Scaler) GetRestartMetrics() ([]*prom.TimeSeries, error) {
  function newScaler (line 27) | func newScaler(c *client.Client,

FILE: autoscaler/pkg/autoscalerapp/root.go
  type EnvdServerApp (line 19) | type EnvdServerApp struct
  function New (line 23) | func New() EnvdServerApp {
  function runServer (line 101) | func runServer(clicontext *cli.Context) error {

FILE: autoscaler/pkg/prom/prom.go
  type PrometheusQuery (line 18) | type PrometheusQuery struct
    method Fetch (line 38) | func (q PrometheusQuery) Fetch(query string) (*VectorQueryResponse, er...
    method Query (line 75) | func (q PrometheusQuery) Query(query string, time time.Time) ([]*TimeS...
  type PrometheusQueryFetcher (line 24) | type PrometheusQueryFetcher interface
  function NewPrometheusQuery (line 29) | func NewPrometheusQuery(host string, port int, client *http.Client) Prom...
  function convertPromResultsToTimeSeries (line 96) | func convertPromResultsToTimeSeries(value prommodel.Value) ([]*TimeSerie...

FILE: autoscaler/pkg/prom/types.go
  type VectorQueryResponse (line 8) | type VectorQueryResponse struct
  type TimeSeries (line 21) | type TimeSeries struct
    method SetLabels (line 51) | func (ts *TimeSeries) SetLabels(labels []Label) {
    method SetSamples (line 55) | func (ts *TimeSeries) SetSamples(samples []Sample) {
    method AppendLabel (line 59) | func (ts *TimeSeries) AppendLabel(key, val string) {
    method AppendSample (line 63) | func (ts *TimeSeries) AppendSample(timestamp int64, val float64) {
    method SortSampleAsc (line 67) | func (ts *TimeSeries) SortSampleAsc() {
  type Sample (line 30) | type Sample struct
    method String (line 43) | func (s *Sample) String() string {
  type Label (line 38) | type Label struct
    method String (line 47) | func (l *Label) String() string {
  function NewTimeSeries (line 77) | func NewTimeSeries() *TimeSeries {

FILE: autoscaler/pkg/server/status.go
  function getInfo (line 17) | func getInfo(w http.ResponseWriter, r *http.Request) {
  function RunInfoServe (line 31) | func RunInfoServe() {

FILE: autoscaler/pkg/version/version.go
  type Version (line 46) | type Version struct
    method String (line 57) | func (v Version) String() string {
  function SetGitTagForE2ETest (line 62) | func SetGitTagForE2ETest(tag string) {
  function GetEnvdVersion (line 67) | func GetEnvdVersion() string {
  function GetVersion (line 96) | func GetVersion() Version {
  function UserAgent (line 115) | func UserAgent() string {

FILE: ingress-operator/cmd/ingress-operator/main.go
  function run (line 17) | func run(args []string) error {
  function handleErr (line 27) | func handleErr(err error) {
  function main (line 36) | func main() {

FILE: ingress-operator/pkg/apis/modelzetes/register.go
  constant GroupName (line 4) | GroupName = "tensorchord.ai"

FILE: ingress-operator/pkg/apis/modelzetes/v1/register.go
  function Resource (line 15) | func Resource(resource string) schema.GroupResource {
  function init (line 26) | func init() {
  function addKnownTypes (line 34) | func addKnownTypes(scheme *runtime.Scheme) error {

FILE: ingress-operator/pkg/apis/modelzetes/v1/types.go
  type InferenceIngress (line 13) | type InferenceIngress struct
  type InferenceIngressSpec (line 22) | type InferenceIngressSpec struct
    method UseTLS (line 60) | func (f *InferenceIngressSpec) UseTLS() bool {
  type InferenceIngressTLS (line 51) | type InferenceIngressTLS struct
  type ObjectReference (line 65) | type ObjectReference struct
  type InferenceIngressList (line 75) | type InferenceIngressList struct

FILE: ingress-operator/pkg/apis/modelzetes/v1/zz_generated.deepcopy.go
  method DeepCopyInto (line 19) | func (in *InferenceIngress) DeepCopyInto(out *InferenceIngress) {
  method DeepCopy (line 28) | func (in *InferenceIngress) DeepCopy() *InferenceIngress {
  method DeepCopyObject (line 38) | func (in *InferenceIngress) DeepCopyObject() runtime.Object {
  method DeepCopyInto (line 46) | func (in *InferenceIngressList) DeepCopyInto(out *InferenceIngressList) {
  method DeepCopy (line 61) | func (in *InferenceIngressList) DeepCopy() *InferenceIngressList {
  method DeepCopyObject (line 71) | func (in *InferenceIngressList) DeepCopyObject() runtime.Object {
  method DeepCopyInto (line 79) | func (in *InferenceIngressSpec) DeepCopyInto(out *InferenceIngressSpec) {
  method DeepCopy (line 90) | func (in *InferenceIngressSpec) DeepCopy() *InferenceIngressSpec {
  method DeepCopyInto (line 100) | func (in *InferenceIngressTLS) DeepCopyInto(out *InferenceIngressTLS) {
  method DeepCopy (line 107) | func (in *InferenceIngressTLS) DeepCopy() *InferenceIngressTLS {
  method DeepCopyInto (line 117) | func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {
  method DeepCopy (line 123) | func (in *ObjectReference) DeepCopy() *ObjectReference {

FILE: ingress-operator/pkg/app/config.go
  function configFromCLI (line 9) | func configFromCLI(c *cli.Context) config.Config {

FILE: ingress-operator/pkg/app/root.go
  constant flagDebug (line 21) | flagDebug = "debug"
  constant flagMasterURL (line 24) | flagMasterURL    = "master-url"
  constant flagKubeConfig (line 25) | flagKubeConfig   = "kube-config"
  constant flagQPS (line 26) | flagQPS          = "kube-qps"
  constant flagBurst (line 27) | flagBurst        = "kube-burst"
  constant flagResyncPeriod (line 28) | flagResyncPeriod = "kube-resync-period"
  constant flagControllerThreads (line 31) | flagControllerThreads = "controller-thread-count"
  constant flagNamespace (line 32) | flagNamespace         = "namespace"
  constant flagHost (line 33) | flagHost              = "host"
  type App (line 36) | type App struct
  function New (line 40) | func New() App {
  function runServer (line 132) | func runServer(clicontext *cli.Context) error {

FILE: ingress-operator/pkg/client/clientset/versioned/clientset.go
  type Interface (line 20) | type Interface interface
  type Clientset (line 27) | type Clientset struct
    method TensorchordV1 (line 33) | func (c *Clientset) TensorchordV1() tensorchordv1.TensorchordV1Interfa...
    method Discovery (line 38) | func (c *Clientset) Discovery() discovery.DiscoveryInterface {
  function NewForConfig (line 48) | func NewForConfig(c *rest.Config) (*Clientset, error) {
  function NewForConfigOrDie (line 72) | func NewForConfigOrDie(c *rest.Config) *Clientset {
  function New (line 81) | func New(c rest.Interface) *Clientset {

FILE: ingress-operator/pkg/client/clientset/versioned/fake/clientset_generated.go
  function NewSimpleClientset (line 26) | func NewSimpleClientset(objects ...runtime.Object) *Clientset {
  type Clientset (line 53) | type Clientset struct
    method Discovery (line 59) | func (c *Clientset) Discovery() discovery.DiscoveryInterface {
    method Tracker (line 63) | func (c *Clientset) Tracker() testing.ObjectTracker {
    method TensorchordV1 (line 73) | func (c *Clientset) TensorchordV1() tensorchordv1.TensorchordV1Interfa...

FILE: ingress-operator/pkg/client/clientset/versioned/fake/register.go
  function init (line 43) | func init() {

FILE: ingress-operator/pkg/client/clientset/versioned/scheme/register.go
  function init (line 43) | func init() {

FILE: ingress-operator/pkg/client/clientset/versioned/typed/modelzetes/v1/fake/fake_inferenceingress.go
  type FakeInferenceIngresses (line 24) | type FakeInferenceIngresses struct
    method Get (line 34) | func (c *FakeInferenceIngresses) Get(ctx context.Context, name string,...
    method List (line 45) | func (c *FakeInferenceIngresses) List(ctx context.Context, opts v1.Lis...
    method Watch (line 67) | func (c *FakeInferenceIngresses) Watch(ctx context.Context, opts v1.Li...
    method Create (line 74) | func (c *FakeInferenceIngresses) Create(ctx context.Context, inference...
    method Update (line 85) | func (c *FakeInferenceIngresses) Update(ctx context.Context, inference...
    method Delete (line 96) | func (c *FakeInferenceIngresses) Delete(ctx context.Context, name stri...
    method DeleteCollection (line 104) | func (c *FakeInferenceIngresses) DeleteCollection(ctx context.Context,...
    method Patch (line 112) | func (c *FakeInferenceIngresses) Patch(ctx context.Context, name strin...

FILE: ingress-operator/pkg/client/clientset/versioned/typed/modelzetes/v1/fake/fake_modelzetes_client.go
  type FakeTensorchordV1 (line 17) | type FakeTensorchordV1 struct
    method InferenceIngresses (line 21) | func (c *FakeTensorchordV1) InferenceIngresses(namespace string) v1.In...
    method RESTClient (line 27) | func (c *FakeTensorchordV1) RESTClient() rest.Interface {

FILE: ingress-operator/pkg/client/clientset/versioned/typed/modelzetes/v1/generated_expansion.go
  type InferenceIngressExpansion (line 11) | type InferenceIngressExpansion interface

FILE: ingress-operator/pkg/client/clientset/versioned/typed/modelzetes/v1/inferenceingress.go
  type InferenceIngressesGetter (line 25) | type InferenceIngressesGetter interface
  type InferenceIngressInterface (line 30) | type InferenceIngressInterface interface
  type inferenceIngresses (line 43) | type inferenceIngresses struct
    method Get (line 57) | func (c *inferenceIngresses) Get(ctx context.Context, name string, opt...
    method List (line 70) | func (c *inferenceIngresses) List(ctx context.Context, opts metav1.Lis...
    method Watch (line 87) | func (c *inferenceIngresses) Watch(ctx context.Context, opts metav1.Li...
    method Create (line 102) | func (c *inferenceIngresses) Create(ctx context.Context, inferenceIngr...
    method Update (line 115) | func (c *inferenceIngresses) Update(ctx context.Context, inferenceIngr...
    method Delete (line 129) | func (c *inferenceIngresses) Delete(ctx context.Context, name string, ...
    method DeleteCollection (line 140) | func (c *inferenceIngresses) DeleteCollection(ctx context.Context, opt...
    method Patch (line 156) | func (c *inferenceIngresses) Patch(ctx context.Context, name string, p...
  function newInferenceIngresses (line 49) | func newInferenceIngresses(c *TensorchordV1Client, namespace string) *in...

FILE: ingress-operator/pkg/client/clientset/versioned/typed/modelzetes/v1/modelzetes_client.go
  type TensorchordV1Interface (line 17) | type TensorchordV1Interface interface
  type TensorchordV1Client (line 23) | type TensorchordV1Client struct
    method InferenceIngresses (line 27) | func (c *TensorchordV1Client) InferenceIngresses(namespace string) Inf...
    method RESTClient (line 74) | func (c *TensorchordV1Client) RESTClient() rest.Interface {
  function NewForConfig (line 32) | func NewForConfig(c *rest.Config) (*TensorchordV1Client, error) {
  function NewForConfigOrDie (line 46) | func NewForConfigOrDie(c *rest.Config) *TensorchordV1Client {
  function New (line 55) | func New(c rest.Interface) *TensorchordV1Client {
  function setConfigDefaults (line 59) | func setConfigDefaults(config *rest.Config) error {

FILE: ingress-operator/pkg/client/informers/externalversions/factory.go
  type SharedInformerOption (line 26) | type SharedInformerOption
  type sharedInformerFactory (line 28) | type sharedInformerFactory struct
    method Start (line 101) | func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
    method WaitForCacheSync (line 114) | func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{...
    method InformerFor (line 137) | func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFun...
    method Tensorchord (line 168) | func (f *sharedInformerFactory) Tensorchord() modelzetes.Interface {
  function WithCustomResyncConfig (line 43) | func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) Sh...
  function WithTweakListOptions (line 53) | func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListO...
  function WithNamespace (line 61) | func WithNamespace(namespace string) SharedInformerOption {
  function NewSharedInformerFactory (line 69) | func NewSharedInformerFactory(client versioned.Interface, defaultResync ...
  function NewFilteredSharedInformerFactory (line 77) | func NewFilteredSharedInformerFactory(client versioned.Interface, defaul...
  function NewSharedInformerFactoryWithOptions (line 82) | func NewSharedInformerFactoryWithOptions(client versioned.Interface, def...
  type SharedInformerFactory (line 160) | type SharedInformerFactory interface

FILE: ingress-operator/pkg/client/informers/externalversions/generic.go
  type GenericInformer (line 21) | type GenericInformer interface
  type genericInformer (line 26) | type genericInformer struct
    method Informer (line 32) | func (f *genericInformer) Informer() cache.SharedIndexInformer {
    method Lister (line 37) | func (f *genericInformer) Lister() cache.GenericLister {
  method ForResource (line 43) | func (f *sharedInformerFactory) ForResource(resource schema.GroupVersion...

FILE: ingress-operator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go
  type NewInformerFunc (line 21) | type NewInformerFunc
  type SharedInformerFactory (line 24) | type SharedInformerFactory interface
  type TweakListOptionsFunc (line 30) | type TweakListOptionsFunc

FILE: ingress-operator/pkg/client/informers/externalversions/modelzetes/interface.go
  type Interface (line 17) | type Interface interface
  type group (line 22) | type group struct
    method V1 (line 34) | func (g *group) V1() v1.Interface {
  function New (line 29) | func New(f internalinterfaces.SharedInformerFactory, namespace string, t...

FILE: ingress-operator/pkg/client/informers/externalversions/modelzetes/v1/inferenceingress.go
  type InferenceIngressInformer (line 27) | type InferenceIngressInformer interface
  type inferenceIngressInformer (line 32) | type inferenceIngressInformer struct
    method defaultInformer (line 70) | func (f *inferenceIngressInformer) defaultInformer(client versioned.In...
    method Informer (line 74) | func (f *inferenceIngressInformer) Informer() cache.SharedIndexInformer {
    method Lister (line 78) | func (f *inferenceIngressInformer) Lister() v1.InferenceIngressLister {
  function NewInferenceIngressInformer (line 41) | func NewInferenceIngressInformer(client versioned.Interface, namespace s...
  function NewFilteredInferenceIngressInformer (line 48) | func NewFilteredInferenceIngressInformer(client versioned.Interface, nam...

FILE: ingress-operator/pkg/client/informers/externalversions/modelzetes/v1/interface.go
  type Interface (line 16) | type Interface interface
  type version (line 21) | type version struct
    method InferenceIngresses (line 33) | func (v *version) InferenceIngresses() InferenceIngressInformer {
  function New (line 28) | func New(f internalinterfaces.SharedInformerFactory, namespace string, t...

FILE: ingress-operator/pkg/client/listers/modelzetes/v1/expansion_generated.go
  type InferenceIngressListerExpansion (line 13) | type InferenceIngressListerExpansion interface
  type InferenceIngressNamespaceListerExpansion (line 17) | type InferenceIngressNamespaceListerExpansion interface

FILE: ingress-operator/pkg/client/listers/modelzetes/v1/inferenceingress.go
  type InferenceIngressLister (line 20) | type InferenceIngressLister interface
  type inferenceIngressLister (line 30) | type inferenceIngressLister struct
    method List (line 40) | func (s *inferenceIngressLister) List(selector labels.Selector) (ret [...
    method InferenceIngresses (line 48) | func (s *inferenceIngressLister) InferenceIngresses(namespace string) ...
  function NewInferenceIngressLister (line 35) | func NewInferenceIngressLister(indexer cache.Indexer) InferenceIngressLi...
  type InferenceIngressNamespaceLister (line 54) | type InferenceIngressNamespaceLister interface
  type inferenceIngressNamespaceLister (line 66) | type inferenceIngressNamespaceLister struct
    method List (line 72) | func (s inferenceIngressNamespaceLister) List(selector labels.Selector...
    method Get (line 80) | func (s inferenceIngressNamespaceLister) Get(name string) (*v1.Inferen...

FILE: ingress-operator/pkg/config/config.go
  type Config (line 9) | type Config struct
    method GetString (line 32) | func (c Config) GetString() (string, error) {
    method Validate (line 37) | func (c Config) Validate() error {
  type ControllerConfig (line 14) | type ControllerConfig struct
  type KubeConfig (line 20) | type KubeConfig struct
  function New (line 28) | func New() Config {

FILE: ingress-operator/pkg/consts/consts.go
  constant KeyCert (line 4) | KeyCert           = "cert"
  constant EnvironmentPrefix (line 5) | EnvironmentPrefix = "MODELZ"

FILE: ingress-operator/pkg/controller/core.go
  constant AgentName (line 32) | AgentName = "ingress-operator"
  constant FaasIngressKind (line 33) | FaasIngressKind = "InferenceIngress"
  constant OpenfaasWorkloadPort (line 34) | OpenfaasWorkloadPort = 8080
  constant SuccessSynced (line 38) | SuccessSynced = "Synced"
  constant ErrResourceExists (line 41) | ErrResourceExists = "ErrResourceExists"
  constant MessageResourceExists (line 44) | MessageResourceExists = "Resource %q already exists and is not managed b...
  constant MessageResourceSynced (line 47) | MessageResourceSynced = "FunctionIngress synced successfully"
  type BaseController (line 52) | type BaseController struct
    method Run (line 66) | func (c BaseController) Run(threadiness int, stopCh <-chan struct{}) e...
    method runWorker (line 94) | func (c BaseController) runWorker(ctx context.Context) func() {
    method processNextWorkItem (line 103) | func (c BaseController) processNextWorkItem(ctx context.Context) bool {
    method EnqueueFunction (line 137) | func (c *BaseController) EnqueueFunction(obj interface{}) {
    method HandleObject (line 152) | func (c BaseController) HandleObject(obj interface{}) {
    method SetupEventHandlers (line 188) | func (c BaseController) SetupEventHandlers(
  function GetClass (line 232) | func GetClass(ingressType string) string {
  function GetIssuerKind (line 244) | func GetIssuerKind(issuerType string) string {
  function MakeAnnotations (line 253) | func MakeAnnotations(fni *faasv1.InferenceIngress, host string) map[stri...
  function MakeOwnerRef (line 306) | func MakeOwnerRef(fni *faasv1.InferenceIngress) []metav1.OwnerReference {
  function CheckCustomResourceType (line 317) | func CheckCustomResourceType(obj interface{}) (faasv1.InferenceIngress, ...
  function IngressNeedsUpdate (line 327) | func IngressNeedsUpdate(old, fni *faasv1.InferenceIngress) bool {
  function EventRecorder (line 332) | func EventRecorder(client kubernetes.Interface) record.EventRecorder {

FILE: ingress-operator/pkg/controller/core_test.go
  function TestMakeAnnotations (line 11) | func TestMakeAnnotations(t *testing.T) {

FILE: ingress-operator/pkg/controller/v1/controller.go
  type SyncHandler (line 32) | type SyncHandler struct
    method handler (line 87) | func (h SyncHandler) handler(ctx context.Context, key string) error {
  function NewController (line 48) | func NewController(
  function makeRules (line 201) | func makeRules(fni *faasv1.InferenceIngress, host string) []netv1.Ingres...
  function makeTLS (line 248) | func makeTLS(fni *faasv1.InferenceIngress) []netv1.IngressTLS {

FILE: ingress-operator/pkg/controller/v1/controller_factory.go
  function New (line 20) | func New(c config.Config, stopCh <-chan struct{}) (*controller.BaseContr...
  function getPreferredAvailableAPIs (line 79) | func getPreferredAvailableAPIs(client kubernetes.Interface, kind string)...
  type Capabilities (line 104) | type Capabilities
    method Has (line 106) | func (c Capabilities) Has(wanted string) bool {
    method String (line 110) | func (c Capabilities) String() string {

FILE: ingress-operator/pkg/controller/v1/controller_test.go
  function Test_makeRules_Nginx_RootPath_HasRegex (line 14) | func Test_makeRules_Nginx_RootPath_HasRegex(t *testing.T) {
  function Test_makeRules_Nginx_RootPath_IsRootWithBypassMode (line 45) | func Test_makeRules_Nginx_RootPath_IsRootWithBypassMode(t *testing.T) {
  function Test_makeRules_Nginx_PathOverride (line 80) | func Test_makeRules_Nginx_PathOverride(t *testing.T) {
  function Test_makeRules_Traefik_RootPath_TrimsRegex (line 106) | func Test_makeRules_Traefik_RootPath_TrimsRegex(t *testing.T) {
  function Test_makeRules_Traefik_NestedPath_TrimsRegex_And_TrailingSlash (line 130) | func Test_makeRules_Traefik_NestedPath_TrimsRegex_And_TrailingSlash(t *t...
  function Test_makeTLS (line 155) | func Test_makeTLS(t *testing.T) {

FILE: ingress-operator/pkg/signals/signal.go
  function SetupSignalHandler (line 13) | func SetupSignalHandler() (stopCh <-chan struct{}) {

FILE: ingress-operator/pkg/version/version.go
  type Version (line 46) | type Version struct
    method String (line 57) | func (v Version) String() string {
  function SetGitTagForE2ETest (line 62) | func SetGitTagForE2ETest(tag string) {
  function GetEnvdVersion (line 67) | func GetEnvdVersion() string {
  function GetVersion (line 96) | func GetVersion() Version {
  function UserAgent (line 115) | func UserAgent() string {

FILE: ingress-operator/vendor.go
  function main (line 18) | func main() {}

FILE: mdz/cmd/mdz/main.go
  function main (line 8) | func main() {

FILE: mdz/hack/cli-doc-gen/main.go
  function main (line 11) | func main() {

FILE: mdz/pkg/agentd/runtime/create.go
  method InferenceCreate (line 18) | func (r *Runtime) InferenceCreate(ctx context.Context, req types.Inferen...

FILE: mdz/pkg/agentd/runtime/delete.go
  method InferenceDelete (line 10) | func (r *Runtime) InferenceDelete(ctx context.Context, name string) error {

FILE: mdz/pkg/agentd/runtime/label.go
  constant labelVendor (line 6) | labelVendor = "ai.modelz.open.vendor"
  constant valueVendor (line 7) | valueVendor = "openmodelz"
  constant labelName (line 9) | labelName = "ai.modelz.open.name"
  function expectedLabels (line 12) | func expectedLabels(inf types.InferenceDeployment) map[string]string {

FILE: mdz/pkg/agentd/runtime/list.go
  method InferenceList (line 11) | func (r *Runtime) InferenceList(ns string) ([]types.InferenceDeployment,...

FILE: mdz/pkg/agentd/runtime/proxy.go
  method InfereceProxy (line 15) | func (r *Runtime) InfereceProxy(c *gin.Context, name string) error {

FILE: mdz/pkg/agentd/runtime/runtime.go
  type Runtime (line 11) | type Runtime struct
  constant Localhost (line 18) | Localhost = "127.0.0.1"
  function New (line 21) | func New() (*Runtime, error) {

FILE: mdz/pkg/agentd/server/error.go
  type Error (line 12) | type Error struct
    method Error (line 26) | func (e *Error) Error() string {
  function NewError (line 47) | func NewError(code int, err error, op string) error {
  function errFromErrDefs (line 56) | func errFromErrDefs(err error, op string) error {

FILE: mdz/pkg/agentd/server/handler_healthz.go
  method handleHealthz (line 16) | func (s *Server) handleHealthz(c *gin.Context) error {

FILE: mdz/pkg/agentd/server/handler_inference_create.go
  method handleInferenceCreate (line 19) | func (s *Server) handleInferenceCreate(c *gin.Context) error {

FILE: mdz/pkg/agentd/server/handler_inference_delete.go
  method handleInferenceDelete (line 21) | func (s *Server) handleInferenceDelete(c *gin.Context) error {

FILE: mdz/pkg/agentd/server/handler_inference_get.go
  method handleInferenceGet (line 21) | func (s *Server) handleInferenceGet(c *gin.Context) error {

FILE: mdz/pkg/agentd/server/handler_inference_list.go
  method handleInferenceList (line 20) | func (s *Server) handleInferenceList(c *gin.Context) error {

FILE: mdz/pkg/agentd/server/handler_inference_logs.go
  method handleInferenceLogs (line 21) | func (s *Server) handleInferenceLogs(c *gin.Context) error {

FILE: mdz/pkg/agentd/server/handler_inference_proxy.go
  method handleInferenceProxy (line 21) | func (s *Server) handleInferenceProxy(c *gin.Context) error {
  function getNamespaceAndName (line 37) | func getNamespaceAndName(name string) (string, string, error) {

FILE: mdz/pkg/agentd/server/handler_info.go
  method handleInfo (line 19) | func (s *Server) handleInfo(c *gin.Context) error {

FILE: mdz/pkg/agentd/server/middleware_callid.go
  method middlewareCallID (line 11) | func (s Server) middlewareCallID(c *gin.Context) error {

FILE: mdz/pkg/agentd/server/server_factory.go
  type Server (line 13) | type Server struct
  function New (line 21) | func New() (*Server, error) {

FILE: mdz/pkg/agentd/server/server_handlerfunc.go
  type HandlerFunc (line 11) | type HandlerFunc
  function WrapHandler (line 13) | func WrapHandler(handler HandlerFunc) gin.HandlerFunc {

FILE: mdz/pkg/agentd/server/server_init_route.go
  constant endpointInferencePlural (line 9) | endpointInferencePlural = "/inferences"
  constant endpointInference (line 10) | endpointInference       = "/inference"
  constant endpointScaleInference (line 11) | endpointScaleInference  = "/scale-inference"
  constant endpointInfo (line 12) | endpointInfo            = "/info"
  constant endpointLogPlural (line 13) | endpointLogPlural       = "/logs"
  constant endpointNamespacePlural (line 14) | endpointNamespacePlural = "/namespaces"
  constant endpointHealthz (line 15) | endpointHealthz         = "/healthz"
  constant endpointBuild (line 16) | endpointBuild           = "/build"
  method registerRoutes (line 19) | func (s *Server) registerRoutes() {

FILE: mdz/pkg/agentd/server/server_run.go
  method Run (line 16) | func (s *Server) Run(port int) error {

FILE: mdz/pkg/cmd/delete.go
  function init (line 20) | func init() {
  function commandDelete (line 32) | func commandDelete(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/deploy.go
  function init (line 40) | func init() {
  function commandDeploy (line 63) | func commandDeploy(cmd *cobra.Command, args []string) error {
  function int32Ptr (line 135) | func int32Ptr(i int32) *int32 { return &i }

FILE: mdz/pkg/cmd/exec.go
  function init (line 38) | func init() {
  function commandExec (line 53) | func commandExec(cmd *cobra.Command, args []string) error {
  function isAvailableShell (line 169) | func isAvailableShell(shell string) bool {
  type mdzCli (line 178) | type mdzCli struct
    method In (line 192) | func (c mdzCli) In() *streams.In {
    method Out (line 196) | func (c mdzCli) Out() *streams.Out {
    method Err (line 200) | func (c mdzCli) Err() io.Writer {
  function newMDZCLI (line 184) | func newMDZCLI() *mdzCli {

FILE: mdz/pkg/cmd/exec_stream.go
  type Streams (line 19) | type Streams interface
  type hijackedIOStreamer (line 31) | type hijackedIOStreamer struct
    method stream (line 47) | func (h *hijackedIOStreamer) stream(ctx context.Context) error {
    method setupInput (line 81) | func (h *hijackedIOStreamer) setupInput() (restore func(), err error) {
    method beginOutputStream (line 118) | func (h *hijackedIOStreamer) beginOutputStream(restoreInput func()) <-...
    method beginInputStream (line 149) | func (h *hijackedIOStreamer) beginInputStream(restoreInput func()) (do...
  function setRawTerminal (line 186) | func setRawTerminal(streams Streams) error {
  function restoreTerminal (line 193) | func restoreTerminal(streams Streams, in io.Closer) error {

FILE: mdz/pkg/cmd/ioutils/reader.go
  type ReadCloserWrapper (line 16) | type ReadCloserWrapper struct
    method Close (line 22) | func (r *ReadCloserWrapper) Close() error {
  function NewReadCloserWrapper (line 27) | func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser {
  type readerErrWrapper (line 34) | type readerErrWrapper struct
    method Read (line 39) | func (r *readerErrWrapper) Read(p []byte) (int, error) {
  function NewReaderErrWrapper (line 48) | func NewReaderErrWrapper(r io.Reader, closer func()) io.Reader {
  type OnEOFReader (line 57) | type OnEOFReader struct
    method Read (line 62) | func (r *OnEOFReader) Read(p []byte) (n int, err error) {
    method Close (line 71) | func (r *OnEOFReader) Close() error {
    method runFunc (line 77) | func (r *OnEOFReader) runFunc() {
  type cancelReadCloser (line 86) | type cancelReadCloser struct
    method Read (line 135) | func (p *cancelReadCloser) Read(buf []byte) (n int, err error) {
    method closeWithError (line 141) | func (p *cancelReadCloser) closeWithError(err error) {
    method Close (line 148) | func (p *cancelReadCloser) Close() error {
  function NewCancelReadCloser (line 95) | func NewCancelReadCloser(ctx context.Context, in io.ReadCloser) io.ReadC...

FILE: mdz/pkg/cmd/list.go
  constant annotationDomain (line 15) | annotationDomain = "ai.tensorchord.domain"
  function init (line 37) | func init() {
  function commandList (line 51) | func commandList(cmd *cobra.Command, args []string) error {
  type byName (line 120) | type byName
    method Len (line 122) | func (a byName) Len() int           { return len(a) }
    method Swap (line 123) | func (a byName) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
    method Less (line 124) | func (a byName) Less(i, j int) bool { return a[i].Spec.Name < a[j].Spe...
  function getEndpoint (line 126) | func getEndpoint(inf types.InferenceDeployment) string {

FILE: mdz/pkg/cmd/list_instance.go
  function init (line 30) | func init() {
  function commandListInstance (line 44) | func commandListInstance(cmd *cobra.Command, args []string) error {
  type byInstanceName (line 94) | type byInstanceName
    method Len (line 96) | func (a byInstanceName) Len() int           { return len(a) }
    method Swap (line 97) | func (a byInstanceName) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
    method Less (line 98) | func (a byInstanceName) Less(i, j int) bool { return a[i].Spec.Name < ...

FILE: mdz/pkg/cmd/localagent.go
  function init (line 25) | func init() {
  function commandLocalAgent (line 38) | func commandLocalAgent(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/logs.go
  function init (line 27) | func init() {
  function commandLogs (line 43) | func commandLogs(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/portforward.go
  function init (line 26) | func init() {
  function commandForward (line 38) | func commandForward(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/root.go
  function Execute (line 47) | func Execute() {
  function init (line 54) | func init() {
  function commandInit (line 81) | func commandInit(cmd *cobra.Command, args []string) error {
  function commandInitLog (line 105) | func commandInitLog(cmd *cobra.Command, args []string) error {
  function GenMarkdownTree (line 114) | func GenMarkdownTree(dir string) error {

FILE: mdz/pkg/cmd/scale.go
  function init (line 28) | func init() {
  function commandScale (line 48) | func commandScale(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/server.go
  function init (line 26) | func init() {

FILE: mdz/pkg/cmd/server_delete.go
  function init (line 15) | func init() {
  function commandServerDelete (line 19) | func commandServerDelete(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/server_destroy.go
  function init (line 20) | func init() {
  function commandServerDestroy (line 32) | func commandServerDestroy(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/server_join.go
  function init (line 22) | func init() {
  function commandServerJoin (line 38) | func commandServerJoin(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/server_label.go
  function init (line 25) | func init() {
  function commandServerLabel (line 37) | func commandServerLabel(cmd *cobra.Command, args []string) error {
  function parseNodeLabels (line 54) | func parseNodeLabels(labels []string) (map[string]string, error) {

FILE: mdz/pkg/cmd/server_list.go
  function init (line 33) | func init() {
  function commandServerList (line 47) | func commandServerList(cmd *cobra.Command, args []string) error {
  function labelsString (line 104) | func labelsString(labels map[string]string) string {
  function prettyByteSize (line 115) | func prettyByteSize(quantity string) (string, error) {
  function resourceListString (line 130) | func resourceListString(l types.ResourceList) string {

FILE: mdz/pkg/cmd/server_start.go
  function init (line 40) | func init() {
  function preRunE (line 70) | func preRunE(cmd *cobra.Command, args []string) error {
  function commandServerStart (line 85) | func commandServerStart(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/server_stop.go
  function init (line 20) | func init() {
  function commandServerStop (line 32) | func commandServerStop(cmd *cobra.Command, args []string) error {

FILE: mdz/pkg/cmd/streams/in.go
  type In (line 14) | type In struct
    method Read (line 20) | func (i *In) Read(p []byte) (int, error) {
    method Close (line 25) | func (i *In) Close() error {
    method SetRawTerminal (line 32) | func (i *In) SetRawTerminal() (err error) {
    method CheckTty (line 42) | func (i *In) CheckTty(attachStdin, ttyMode bool) error {
  function NewIn (line 57) | func NewIn(in io.ReadCloser) *In {

FILE: mdz/pkg/cmd/streams/out.go
  type Out (line 14) | type Out struct
    method Write (line 19) | func (o *Out) Write(p []byte) (int, error) {
    method SetRawTerminal (line 29) | func (o *Out) SetRawTerminal() (err error) {
    method GetTtySize (line 39) | func (o *Out) GetTtySize() (height uint, width uint) {
  function NewOut (line 54) | func NewOut(out io.Writer) *Out {

FILE: mdz/pkg/cmd/streams/stream.go
  type commonStream (line 7) | type commonStream struct
    method FD (line 14) | func (s *commonStream) FD() uintptr {
    method IsTerminal (line 19) | func (s *commonStream) IsTerminal() bool {
    method RestoreTerminal (line 24) | func (s *commonStream) RestoreTerminal() {
    method SetIsTerminal (line 33) | func (s *commonStream) SetIsTerminal(isTerminal bool) {

FILE: mdz/pkg/cmd/version.go
  function init (line 19) | func init() {
  function commandVersion (line 31) | func commandVersion(cmd *cobra.Command, args []string) error {
  function printServerVersion (line 49) | func printServerVersion(cmd *cobra.Command) error {

FILE: mdz/pkg/server/agentd_run.go
  type agentDRunStep (line 9) | type agentDRunStep struct
    method Run (line 15) | func (s *agentDRunStep) Run() error {
    method Verify (line 36) | func (s *agentDRunStep) Verify() error {

FILE: mdz/pkg/server/engine.go
  constant AgentPort (line 10) | AgentPort = 31112
  type Options (line 13) | type Options struct
  type ModelZCloud (line 26) | type ModelZCloud struct
  type Mirror (line 33) | type Mirror struct
    method Configured (line 38) | func (m *Mirror) Configured() bool {
  type Runtime (line 42) | type Runtime
  type Engine (line 49) | type Engine struct
    method Run (line 139) | func (e *Engine) Run() (*Result, error) {
  type Result (line 54) | type Result struct
  function NewStart (line 58) | func NewStart(o Options) (*Engine, error) {
  function NewStop (line 99) | func NewStop(o Options) (*Engine, error) {
  function NewDestroy (line 111) | func NewDestroy(o Options) (*Engine, error) {
  function NewJoin (line 123) | func NewJoin(o Options) (*Engine, error) {
  type Step (line 134) | type Step interface

FILE: mdz/pkg/server/gpu_install.go
  type gpuInstallStep (line 18) | type gpuInstallStep struct
    method hasNvidiaToolkit (line 23) | func (s *gpuInstallStep) hasNvidiaToolkit() bool {
    method hasNvidiaDevice (line 43) | func (s *gpuInstallStep) hasNvidiaDevice() bool {
    method Run (line 52) | func (s *gpuInstallStep) Run() error {
    method Verify (line 94) | func (s *gpuInstallStep) Verify() error {

FILE: mdz/pkg/server/k3s_destroy.go
  type k3sDestroyAllStep (line 10) | type k3sDestroyAllStep struct
    method Run (line 14) | func (s *k3sDestroyAllStep) Run() error {
    method Verify (line 36) | func (s *k3sDestroyAllStep) Verify() error {

FILE: mdz/pkg/server/k3s_install.go
  type k3sInstallStep (line 15) | type k3sInstallStep struct
    method Run (line 19) | func (s *k3sInstallStep) Run() error {
    method Verify (line 72) | func (s *k3sInstallStep) Verify() error {

FILE: mdz/pkg/server/k3s_join.go
  type k3sJoinStep (line 11) | type k3sJoinStep struct
    method Run (line 15) | func (s *k3sJoinStep) Run() error {
    method Verify (line 64) | func (s *k3sJoinStep) Verify() error {

FILE: mdz/pkg/server/k3s_killall.go
  type k3sKillAllStep (line 10) | type k3sKillAllStep struct
    method Run (line 14) | func (s *k3sKillAllStep) Run() error {
    method Verify (line 36) | func (s *k3sKillAllStep) Verify() error {

FILE: mdz/pkg/server/k3s_prepare.go
  constant mirrorPath (line 16) | mirrorPath = "/etc/rancher/k3s"
  constant mirrorFile (line 17) | mirrorFile = "registries.yaml"
  type k3sPrepare (line 20) | type k3sPrepare struct
    method Run (line 24) | func (s *k3sPrepare) Run() error {
    method Verify (line 64) | func (s *k3sPrepare) Verify() error {

FILE: mdz/pkg/server/nginx_install.go
  type nginxInstallStep (line 15) | type nginxInstallStep struct
    method Run (line 19) | func (s *nginxInstallStep) Run() error {
    method Verify (line 55) | func (s *nginxInstallStep) Verify() error {

FILE: mdz/pkg/server/openmodelz_install.go
  type openModelZInstallStep (line 22) | type openModelZInstallStep struct
    method Run (line 26) | func (s *openModelZInstallStep) Run() error {
    method Verify (line 108) | func (s *openModelZInstallStep) Verify() error {

FILE: mdz/pkg/telemetry/telemetry.go
  type TelemetryField (line 19) | type TelemetryField
  type Telemetry (line 21) | type Telemetry interface
  type defaultTelemetry (line 25) | type defaultTelemetry struct
    method init (line 67) | func (t *defaultTelemetry) init() error {
    method dumpConfig (line 87) | func (t *defaultTelemetry) dumpConfig() error {
    method loadConfig (line 103) | func (t *defaultTelemetry) loadConfig() error {
    method Idnetify (line 117) | func (t *defaultTelemetry) Idnetify() {
    method Record (line 148) | func (t *defaultTelemetry) Record(command string, fields ...TelemetryF...
  constant telemetryToken (line 31) | telemetryToken = "65WHA9bxCNX74K3HjgplMOmsio9LkYSI"
  function init (line 39) | func init() {
  function GetTelemetry (line 47) | func GetTelemetry() Telemetry {
  function Initialize (line 51) | func Initialize(enabled bool) error {
  function AddField (line 142) | func AddField(name string, value interface{}) TelemetryField {

FILE: mdz/pkg/term/interrupt.go
  type Handler (line 33) | type Handler struct
    method Close (line 62) | func (h *Handler) Close() {
    method Signal (line 73) | func (h *Handler) Signal(s os.Signal) {
    method Run (line 88) | func (h *Handler) Run(fn func() error) error {
  function Chain (line 43) | func Chain(handler *Handler, notify ...func()) *Handler {
  function New (line 54) | func New(final func(os.Signal), notify ...func()) *Handler {

FILE: mdz/pkg/term/term.go
  type SafeFunc (line 28) | type SafeFunc
  type TTY (line 33) | type TTY struct
    method IsTerminalIn (line 64) | func (t TTY) IsTerminalIn() bool {
    method IsTerminalOut (line 70) | func (t TTY) IsTerminalOut() bool {
    method Safe (line 112) | func (t TTY) Safe(fn SafeFunc) error {
  function NewTTY (line 54) | func NewTTY() *TTY {
  function IsTerminal (line 75) | func IsTerminal(i interface{}) bool {
  function AllowsColorOutput (line 82) | func AllowsColorOutput(w io.Writer) bool {

FILE: mdz/pkg/version/version.go
  type Version (line 48) | type Version struct
    method String (line 59) | func (v Version) String() string {
  function SetGitTagForE2ETest (line 64) | func SetGitTagForE2ETest(tag string) {
  function GetOpenModelzVersion (line 69) | func GetOpenModelzVersion() string {
  function GetVersion (line 98) | func GetVersion() Version {
  function UserAgent (line 117) | func UserAgent() string {

FILE: modelzetes/cmd/modelzetes/main.go
  function run (line 14) | func run(args []string) error {
  function handleErr (line 24) | func handleErr(err error) {
  function main (line 33) | func main() {

FILE: modelzetes/pkg/apis/modelzetes/register.go
  constant GroupName (line 4) | GroupName = "tensorchord.ai"

FILE: modelzetes/pkg/apis/modelzetes/v2alpha1/register.go
  function Resource (line 15) | func Resource(resource string) schema.GroupResource {
  function init (line 27) | func init() {
  function addKnownTypes (line 35) | func addKnownTypes(scheme *runtime.Scheme) error {

FILE: modelzetes/pkg/apis/modelzetes/v2alpha1/types.go
  type Inference (line 14) | type Inference struct
  type InferenceSpec (line 22) | type InferenceSpec struct
  type Framework (line 67) | type Framework
  constant FrameworkGradio (line 70) | FrameworkGradio    Framework = "gradio"
  constant FrameworkStreamlit (line 71) | FrameworkStreamlit Framework = "streamlit"
  constant FrameworkMosec (line 72) | FrameworkMosec     Framework = "mosec"
  constant FrameworkOther (line 73) | FrameworkOther     Framework = "other"
  type ScalingConfig (line 76) | type ScalingConfig struct
  type ScalingType (line 94) | type ScalingType
  constant ScalingTypeCapacity (line 97) | ScalingTypeCapacity ScalingType = "capacity"
  constant ScalingTypeRPS (line 98) | ScalingTypeRPS      ScalingType = "rps"
  type InferenceList (line 104) | type InferenceList struct

FILE: modelzetes/pkg/apis/modelzetes/v2alpha1/zz_generated.deepcopy.go
  method DeepCopyInto (line 20) | func (in *Inference) DeepCopyInto(out *Inference) {
  method DeepCopy (line 29) | func (in *Inference) DeepCopy() *Inference {
  method DeepCopyObject (line 39) | func (in *Inference) DeepCopyObject() runtime.Object {
  method DeepCopyInto (line 47) | func (in *InferenceList) DeepCopyInto(out *InferenceList) {
  method DeepCopy (line 62) | func (in *InferenceList) DeepCopy() *InferenceList {
  method DeepCopyObject (line 72) | func (in *InferenceList) DeepCopyObject() runtime.Object {
  method DeepCopyInto (line 80) | func (in *InferenceSpec) DeepCopyInto(out *InferenceSpec) {
  method DeepCopy (line 142) | func (in *InferenceSpec) DeepCopy() *InferenceSpec {
  method DeepCopyInto (line 152) | func (in *ScalingConfig) DeepCopyInto(out *ScalingConfig) {
  method DeepCopy (line 188) | func (in *ScalingConfig) DeepCopy() *ScalingConfig {

FILE: modelzetes/pkg/app/config.go
  function configFromCLI (line 9) | func configFromCLI(c *cli.Context) config.Config {

FILE: modelzetes/pkg/app/root.go
  constant flagDebug (line 21) | flagDebug = "debug"
  constant flagMetricsServerPort (line 24) | flagMetricsServerPort = "metrics-server-port"
  constant flagMasterURL (line 27) | flagMasterURL    = "master-url"
  constant flagKubeConfig (line 28) | flagKubeConfig   = "kube-config"
  constant flagQPS (line 29) | flagQPS          = "kube-qps"
  constant flagBurst (line 30) | flagBurst        = "kube-burst"
  constant flagResyncPeriod (line 31) | flagResyncPeriod = "kube-resync-period"
  constant flagControllerThreads (line 34) | flagControllerThreads = "controller-thread-count"
  constant flagHuggingfaceEndpoint (line 37) | flagHuggingfaceEndpoint = "huggingface-endpoint"
  constant flagProbeReadinessInitialDelaySeconds (line 40) | flagProbeReadinessInitialDelaySeconds = "probe-readiness-initial-delay-s...
  constant flagProbeReadinessPeriodSeconds (line 41) | flagProbeReadinessPeriodSeconds       = "probe-readiness-period-seconds"
  constant flagProbeReadinessTimeoutSeconds (line 42) | flagProbeReadinessTimeoutSeconds      = "probe-readiness-timeout-seconds"
  constant flagProbeLivenessInitialDelaySeconds (line 44) | flagProbeLivenessInitialDelaySeconds = "probe-liveness-initial-delay-sec...
  constant flagProbeLivenessPeriodSeconds (line 45) | flagProbeLivenessPeriodSeconds       = "probe-liveness-period-seconds"
  constant flagProbeLivenessTimeoutSeconds (line 46) | flagProbeLivenessTimeoutSeconds      = "probe-liveness-timeout-seconds"
  constant flagProbeStartupInitialDelaySeconds (line 48) | flagProbeStartupInitialDelaySeconds = "probe-startup-initial-delay-seconds"
  constant flagProbeStartupPeriodSeconds (line 49) | flagProbeStartupPeriodSeconds       = "probe-startup-period-seconds"
  constant flagProbeStartupTimeoutSeconds (line 50) | flagProbeStartupTimeoutSeconds      = "probe-startup-timeout-seconds"
  constant flagInferenceImagePullPolicy (line 53) | flagInferenceImagePullPolicy         = "inference-image-pull-policy"
  constant flagInferenceSetUpRuntimeClassNvidia (line 54) | flagInferenceSetUpRuntimeClassNvidia = "inference-set-up-runtime-class-n...
  type App (line 57) | type App struct
  function New (line 61) | func New() App {
  function runServer (line 229) | func runServer(clicontext *cli.Context) error {

FILE: modelzetes/pkg/client/clientset/versioned/clientset.go
  type Interface (line 21) | type Interface interface
  type Clientset (line 27) | type Clientset struct
    method TensorchordV2alpha1 (line 33) | func (c *Clientset) TensorchordV2alpha1() tensorchordv2alpha1.Tensorch...
    method Discovery (line 38) | func (c *Clientset) Discovery() discovery.DiscoveryInterface {
  function NewForConfig (line 50) | func NewForConfig(c *rest.Config) (*Clientset, error) {
  function NewForConfigAndClient (line 70) | func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Cl...
  function NewForConfigOrDie (line 95) | func NewForConfigOrDie(c *rest.Config) *Clientset {
  function New (line 104) | func New(c rest.Interface) *Clientset {

FILE: modelzetes/pkg/client/clientset/versioned/fake/clientset_generated.go
  function NewSimpleClientset (line 26) | func NewSimpleClientset(objects ...runtime.Object) *Clientset {
  type Clientset (line 53) | type Clientset struct
    method Discovery (line 59) | func (c *Clientset) Discovery() discovery.DiscoveryInterface {
    method Tracker (line 63) | func (c *Clientset) Tracker() testing.ObjectTracker {
    method TensorchordV2alpha1 (line 73) | func (c *Clientset) TensorchordV2alpha1() tensorchordv2alpha1.Tensorch...

FILE: modelzetes/pkg/client/clientset/versioned/fake/register.go
  function init (line 43) | func init() {

FILE: modelzetes/pkg/client/clientset/versioned/scheme/register.go
  function init (line 43) | func init() {

FILE: modelzetes/pkg/client/clientset/versioned/typed/modelzetes/v2alpha1/fake/fake_inference.go
  type FakeInferences (line 24) | type FakeInferences struct
    method Get (line 34) | func (c *FakeInferences) Get(ctx context.Context, name string, options...
    method List (line 45) | func (c *FakeInferences) List(ctx context.Context, opts v1.ListOptions...
    method Watch (line 67) | func (c *FakeInferences) Watch(ctx context.Context, opts v1.ListOption...
    method Create (line 74) | func (c *FakeInferences) Create(ctx context.Context, inference *v2alph...
    method Update (line 85) | func (c *FakeInferences) Update(ctx context.Context, inference *v2alph...
    method Delete (line 96) | func (c *FakeInferences) Delete(ctx context.Context, name string, opts...
    method DeleteCollection (line 104) | func (c *FakeInferences) DeleteCollection(ctx context.Context, opts v1...
    method Patch (line 112) | func (c *FakeInferences) Patch(ctx context.Context, name string, pt ty...

FILE: modelzetes/pkg/client/clientset/versioned/typed/modelzetes/v2alpha1/fake/fake_modelzetes_client.go
  type FakeTensorchordV2alpha1 (line 17) | type FakeTensorchordV2alpha1 struct
    method Inferences (line 21) | func (c *FakeTensorchordV2alpha1) Inferences(namespace string) v2alpha...
    method RESTClient (line 27) | func (c *FakeTensorchordV2alpha1) RESTClient() rest.Interface {

FILE: modelzetes/pkg/client/clientset/versioned/typed/modelzetes/v2alpha1/generated_expansion.go
  type InferenceExpansion (line 11) | type InferenceExpansion interface

FILE: modelzetes/pkg/client/clientset/versioned/typed/modelzetes/v2alpha1/inference.go
  type InferencesGetter (line 25) | type InferencesGetter interface
  type InferenceInterface (line 30) | type InferenceInterface interface
  type inferences (line 43) | type inferences struct
    method Get (line 57) | func (c *inferences) Get(ctx context.Context, name string, options v1....
    method List (line 70) | func (c *inferences) List(ctx context.Context, opts v1.ListOptions) (r...
    method Watch (line 87) | func (c *inferences) Watch(ctx context.Context, opts v1.ListOptions) (...
    method Create (line 102) | func (c *inferences) Create(ctx context.Context, inference *v2alpha1.I...
    method Update (line 115) | func (c *inferences) Update(ctx context.Context, inference *v2alpha1.I...
    method Delete (line 129) | func (c *inferences) Delete(ctx context.Context, name string, opts v1....
    method DeleteCollection (line 140) | func (c *inferences) DeleteCollection(ctx context.Context, opts v1.Del...
    method Patch (line 156) | func (c *inferences) Patch(ctx context.Context, name string, pt types....
  function newInferences (line 49) | func newInferences(c *TensorchordV2alpha1Client, namespace string) *infe...

FILE: modelzetes/pkg/client/clientset/versioned/typed/modelzetes/v2alpha1/modelzetes_client.go
  type TensorchordV2alpha1Interface (line 19) | type TensorchordV2alpha1Interface interface
  type TensorchordV2alpha1Client (line 25) | type TensorchordV2alpha1Client struct
    method Inferences (line 29) | func (c *TensorchordV2alpha1Client) Inferences(namespace string) Infer...
    method RESTClient (line 92) | func (c *TensorchordV2alpha1Client) RESTClient() rest.Interface {
  function NewForConfig (line 36) | func NewForConfig(c *rest.Config) (*TensorchordV2alpha1Client, error) {
  function NewForConfigAndClient (line 50) | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*Tensorchord...
  function NewForConfigOrDie (line 64) | func NewForConfigOrDie(c *rest.Config) *TensorchordV2alpha1Client {
  function New (line 73) | func New(c rest.Interface) *TensorchordV2alpha1Client {
  function setConfigDefaults (line 77) | func setConfigDefaults(config *rest.Config) error {

FILE: modelzetes/pkg/client/informers/externalversions/factory.go
  type SharedInformerOption (line 26) | type SharedInformerOption
  type sharedInformerFactory (line 28) | type sharedInformerFactory struct
    method Start (line 105) | func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
    method Shutdown (line 129) | func (f *sharedInformerFactory) Shutdown() {
    method WaitForCacheSync (line 138) | func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{...
    method InformerFor (line 161) | func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFun...
    method Tensorchord (line 239) | func (f *sharedInformerFactory) Tensorchord() modelzetes.Interface {
  function WithCustomResyncConfig (line 48) | func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) Sh...
  function WithTweakListOptions (line 58) | func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListO...
  function WithNamespace (line 66) | func WithNamespace(namespace string) SharedInformerOption {
  function NewSharedInformerFactory (line 74) | func NewSharedInformerFactory(client versioned.Interface, defaultResync ...
  function NewFilteredSharedInformerFactory (line 82) | func NewFilteredSharedInformerFactory(client versioned.Interface, defaul...
  function NewSharedInformerFactoryWithOptions (line 87) | func NewSharedInformerFactoryWithOptions(client versioned.Interface, def...
  type SharedInformerFactory (line 206) | type SharedInformerFactory interface

FILE: modelzetes/pkg/client/informers/externalversions/generic.go
  type GenericInformer (line 21) | type GenericInformer interface
  type genericInformer (line 26) | type genericInformer struct
    method Informer (line 32) | func (f *genericInformer) Informer() cache.SharedIndexInformer {
    method Lister (line 37) | func (f *genericInformer) Lister() cache.GenericLister {
  method ForResource (line 43) | func (f *sharedInformerFactory) ForResource(resource schema.GroupVersion...

FILE: modelzetes/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go
  type NewInformerFunc (line 21) | type NewInformerFunc
  type SharedInformerFactory (line 24) | type SharedInformerFactory interface
  type TweakListOptionsFunc (line 30) | type TweakListOptionsFunc

FILE: modelzetes/pkg/client/informers/externalversions/modelzetes/interface.go
  type Interface (line 17) | type Interface interface
  type group (line 22) | type group struct
    method V2alpha1 (line 34) | func (g *group) V2alpha1() v2alpha1.Interface {
  function New (line 29) | func New(f internalinterfaces.SharedInformerFactory, namespace string, t...

FILE: modelzetes/pkg/client/informers/externalversions/modelzetes/v2alpha1/inference.go
  type InferenceInformer (line 27) | type InferenceInformer interface
  type inferenceInformer (line 32) | type inferenceInformer struct
    method defaultInformer (line 70) | func (f *inferenceInformer) defaultInformer(client versioned.Interface...
    method Informer (line 74) | func (f *inferenceInformer) Informer() cache.SharedIndexInformer {
    method Lister (line 78) | func (f *inferenceInformer) Lister() v2alpha1.InferenceLister {
  function NewInferenceInformer (line 41) | func NewInferenceInformer(client versioned.Interface, namespace string, ...
  function NewFilteredInferenceInformer (line 48) | func NewFilteredInferenceInformer(client versioned.Interface, namespace ...

FILE: modelzetes/pkg/client/informers/externalversions/modelzetes/v2alpha1/interface.go
  type Interface (line 16) | type Interface interface
  type version (line 21) | type version struct
    method Inferences (line 33) | func (v *version) Inferences() InferenceInformer {
  function New (line 28) | func New(f internalinterfaces.SharedInformerFactory, namespace string, t...

FILE: modelzetes/pkg/client/listers/modelzetes/v2alpha1/expansion_generated.go
  type InferenceListerExpansion (line 13) | type InferenceListerExpansion interface
  type InferenceNamespaceListerExpansion (line 17) | type InferenceNamespaceListerExpansion interface

FILE: modelzetes/pkg/client/listers/modelzetes/v2alpha1/inference.go
  type InferenceLister (line 20) | type InferenceLister interface
  type inferenceLister (line 30) | type inferenceLister struct
    method List (line 40) | func (s *inferenceLister) List(selector labels.Selector) (ret []*v2alp...
    method Inferences (line 48) | func (s *inferenceLister) Inferences(namespace string) InferenceNamesp...
  function NewInferenceLister (line 35) | func NewInferenceLister(indexer cache.Indexer) InferenceLister {
  type InferenceNamespaceLister (line 54) | type InferenceNamespaceLister interface
  type inferenceNamespaceLister (line 66) | type inferenceNamespaceLister struct
    method List (line 72) | func (s inferenceNamespaceLister) List(selector labels.Selector) (ret ...
    method Get (line 80) | func (s inferenceNamespaceLister) Get(name string) (*v2alpha1.Inferenc...

FILE: modelzetes/pkg/config/config.go
  type Config (line 9) | type Config struct
    method GetString (line 58) | func (c Config) GetString() (string, error) {
    method Validate (line 63) | func (c Config) Validate() error {
  type InferenceConfig (line 18) | type InferenceConfig struct
  type ProbesConfig (line 23) | type ProbesConfig struct
  type ProbeConfig (line 29) | type ProbeConfig struct
  type HuggingfaceProxyConfig (line 35) | type HuggingfaceProxyConfig struct
  type ControllerConfig (line 39) | type ControllerConfig struct
  type MetricsConfig (line 43) | type MetricsConfig struct
  type KubeConfig (line 46) | type KubeConfig struct
  function New (line 54) | func New() Config {

FILE: modelzetes/pkg/consts/consts.go
  constant ResourceNvidiaGPU (line 4) | ResourceNvidiaGPU = "nvidia.com/gpu"
  constant LabelInferenceName (line 6) | LabelInferenceName      = "inference"
  constant LabelInferenceNamespace (line 7) | LabelInferenceNamespace = "inference-namespace"
  constant LabelBuildName (line 8) | LabelBuildName          = "ai.tensorchord.build"
  constant LabelName (line 9) | LabelName               = "ai.tensorchord.name"
  constant LabelNamespace (line 10) | LabelNamespace          = "modelz.tensorchord.ai/namespace"
  constant LabelServerResource (line 11) | LabelServerResource     = "ai.tensorchord.server-resource"
  constant AnnotationBuilding (line 13) | AnnotationBuilding        = "ai.tensorchord.building"
  constant AnnotationDockerImage (line 14) | AnnotationDockerImage     = "ai.tensorchord.docker.image"
  constant AnnotationControlPlaneKey (line 15) | AnnotationControlPlaneKey = "ai.tensorchord.control-plane"
  constant ModelzAnnotationValue (line 17) | ModelzAnnotationValue = "modelz"
  constant TolerationGPU (line 19) | TolerationGPU              = "ai.tensorchord.gpu"
  constant TolerationNvidiaGPUPresent (line 20) | TolerationNvidiaGPUPresent = "nvidia.com/gpu"
  constant OrchestrationIdentifier (line 23) | OrchestrationIdentifier = "kubernetes"
  constant ProviderName (line 25) | ProviderName = "modelzetes"
  constant DefaultServicePrefix (line 27) | DefaultServicePrefix = "mdz-"
  constant DefaultHTTPProbePath (line 29) | DefaultHTTPProbePath = "/"
  constant MaxReplicas (line 32) | MaxReplicas = 5

FILE: modelzetes/pkg/controller/annotations_test.go
  function Test_makeAnnotations_NoKeys (line 9) | func Test_makeAnnotations_NoKeys(t *testing.T) {
  function Test_makeAnnotations_WithKeyAndValue (line 38) | func Test_makeAnnotations_WithKeyAndValue(t *testing.T) {
  function Test_makeAnnotationsDoesNotModifyOriginalSpec (line 72) | func Test_makeAnnotationsDoesNotModifyOriginalSpec(t *testing.T) {

FILE: modelzetes/pkg/controller/controller.go
  constant controllerAgentName (line 34) | controllerAgentName = "modelz-operator"
  constant functionPort (line 35) | functionPort        = 8080
  constant SuccessSynced (line 37) | SuccessSynced = "Synced"
  constant ErrResourceExists (line 40) | ErrResourceExists = "ErrResourceExists"
  constant MessageResourceExists (line 44) | MessageResourceExists = "Resource %q already exists and is not managed b...
  constant MessageResourceSynced (line 47) | MessageResourceSynced = "Function synced successfully"
  type Controller (line 51) | type Controller struct
    method Run (line 149) | func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error {
    method runWorker (line 176) | func (c *Controller) runWorker() {
    method processNextWorkItem (line 183) | func (c *Controller) processNextWorkItem() bool {
    method syncHandler (line 216) | func (c *Controller) syncHandler(key string) error {
    method enqueueFunction (line 349) | func (c *Controller) enqueueFunction(obj interface{}) {
    method handleObject (line 364) | func (c *Controller) handleObject(obj interface{}) {
    method getSecrets (line 401) | func (c *Controller) getSecrets(namespace string,
  function NewController (line 78) | func NewController(
  function getReplicas (line 419) | func getReplicas(inference *v2alpha1.Inference, deployment *appsv1.Deplo...

FILE: modelzetes/pkg/controller/deployment.go
  constant annotationInferenceSpec (line 23) | annotationInferenceSpec = "ai.tensorchord.inference.spec"
  constant defaultPort (line 24) | defaultPort             = 8080
  function newDeployment (line 32) | func newDeployment(
  function makeTolerationGPU (line 188) | func makeTolerationGPU() []corev1.Toleration {
  function makeCommand (line 204) | func makeCommand(inference *v2alpha1.Inference) []string {
  function makeEnvVars (line 212) | func makeEnvVars(inference *v2alpha1.Inference) []corev1.EnvVar {
  function addEnvVarIfNotExists (line 243) | func addEnvVarIfNotExists(envVars []corev1.EnvVar, name, value string) [...
  function makeLabels (line 256) | func makeLabels(inference *v2alpha1.Inference) map[string]string {
  function makePort (line 271) | func makePort(inference *v2alpha1.Inference) int {
  function makeAnnotations (line 279) | func makeAnnotations(inference *v2alpha1.Inference) map[string]string {
  function makeNodeSelector (line 304) | func makeNodeSelector(constraints []string) map[string]string {
  function deploymentNeedsUpdate (line 321) | func deploymentNeedsUpdate(
  function int32p (line 349) | func int32p(i int32) *int32 {

FILE: modelzetes/pkg/controller/deployment_test.go
  function assertEnv (line 39) | func assertEnv(t *testing.T, expect map[string]string, real []v1.EnvVar) {
  function Test_newDeployment (line 54) | func Test_newDeployment(t *testing.T) {
  function TestNewDeploymentWithStartupDurationLabel (line 94) | func TestNewDeploymentWithStartupDurationLabel(t *testing.T) {
  function Test_newDeployment_PrometheusScrape_NotOverridden (line 156) | func Test_newDeployment_PrometheusScrape_NotOverridden(t *testing.T) {
  function Test_newDeployment_WithZeroResource (line 202) | func Test_newDeployment_WithZeroResource(t *testing.T) {
  function Test_newDeployment_WithNonZeroResource (line 236) | func Test_newDeployment_WithNonZeroResource(t *testing.T) {
  function Test_newDeployment_WithCommandsAndEnvVars (line 270) | func Test_newDeployment_WithCommandsAndEnvVars(t *testing.T) {

FILE: modelzetes/pkg/controller/deployment_update_test.go
  function Test_Deployment_Need_Update (line 13) | func Test_Deployment_Need_Update(t *testing.T) {

FILE: modelzetes/pkg/controller/factory.go
  type FunctionFactory (line 15) | type FunctionFactory struct
    method MakeHuggingfacePullThroughCacheEnvVar (line 61) | func (f *FunctionFactory) MakeHuggingfacePullThroughCacheEnvVar() *cor...
    method MakeProbes (line 72) | func (f *FunctionFactory) MakeProbes(function *v2alpha1.Inference, por...
    method ConfigureReadOnlyRootFilesystem (line 83) | func (f *FunctionFactory) ConfigureReadOnlyRootFilesystem(function *v2...
    method ConfigureContainerUserID (line 87) | func (f *FunctionFactory) ConfigureContainerUserID(deployment *appsv1....
  function NewFunctionFactory (line 19) | func NewFunctionFactory(clientset kubernetes.Interface, config k8s.Deplo...
  function functionToResourceRequirements (line 28) | func functionToResourceRequirements(in *v2alpha1.Inference) types.Resour...

FILE: modelzetes/pkg/controller/framework_test.go
  function Test_newDeployment_FrameworkGradio (line 14) | func Test_newDeployment_FrameworkGradio(t *testing.T) {
  function Test_newDeployment_FrameworkMosec (line 39) | func Test_newDeployment_FrameworkMosec(t *testing.T) {
  function Test_newDeployment_FrameworkStreamlit (line 64) | func Test_newDeployment_FrameworkStreamlit(t *testing.T) {

FILE: modelzetes/pkg/controller/fromconfig.go
  function New (line 19) | func New(c config.Config, stopCh <-chan struct{}) (*Controller, error) {

FILE: modelzetes/pkg/controller/replicas_test.go
  function Test_Replicas (line 14) | func Test_Replicas(t *testing.T) {

FILE: modelzetes/pkg/controller/secrets.go
  constant secretsMountPath (line 12) | secretsMountPath = "/var/openfaas/secrets"
  function UpdateSecrets (line 19) | func UpdateSecrets(function *v2alpha1.Inference, deployment *appsv1.Depl...
  function removeVolume (line 100) | func removeVolume(volumeName string, volumes []corev1.Volume) []corev1.V...
  function removeVolumeMount (line 114) | func removeVolumeMount(volumeName string, mounts []corev1.VolumeMount) [...

FILE: modelzetes/pkg/controller/secrets_test.go
  function Test_UpdateSecrets_DoesNotAddVolumeIfRequestSecretsIsNil (line 12) | func Test_UpdateSecrets_DoesNotAddVolumeIfRequestSecretsIsNil(t *testing...
  function Test_UpdateSecrets_DoesNotAddVolumeIfRequestSecretsIsEmpty (line 44) | func Test_UpdateSecrets_DoesNotAddVolumeIfRequestSecretsIsEmpty(t *testi...
  function Test_UpdateSecrets_RemovesAllCopiesOfExitingSecretsVolumes (line 76) | func Test_UpdateSecrets_RemovesAllCopiesOfExitingSecretsVolumes(t *testi...
  function Test_UpdateSecrets_AddNewSecretVolume (line 128) | func Test_UpdateSecrets_AddNewSecretVolume(t *testing.T) {
  function Test_UpdateSecrets_ReplacesPreviousSecretMountWithNewMount (line 160) | func Test_UpdateSecrets_ReplacesPreviousSecretMountWithNewMount(t *testi...
  function Test_UpdateSecrets_RemovesSecretsVolumeIfRequestSecretsIsEmptyOrNil (line 199) | func Test_UpdateSecrets_RemovesSecretsVolumeIfRequestSecretsIsEmptyOrNil...
  function validateEmptySecretVolumesAndMounts (line 243) | func validateEmptySecretVolumesAndMounts(t *testing.T, deployment *appsv...
  function validateNewSecretVolumesAndMounts (line 257) | func validateNewSecretVolumesAndMounts(t *testing.T, deployment *appsv1....

FILE: modelzetes/pkg/controller/service.go
  function newService (line 16) | func newService(function *v2alpha1.Inference) *corev1.Service {

FILE: modelzetes/pkg/controller/service_test.go
  function Test_newService (line 12) | func Test_newService(t *testing.T) {

FILE: modelzetes/pkg/k8s/config.go
  type ProbeConfig (line 7) | type ProbeConfig struct
  type DeploymentConfig (line 14) | type DeploymentConfig struct

FILE: modelzetes/pkg/k8s/errors.go
  function IsNotFound (line 12) | func IsNotFound(err error) bool {

FILE: modelzetes/pkg/k8s/factory.go
  type FunctionFactory (line 13) | type FunctionFactory struct
  function NewFunctionFactory (line 18) | func NewFunctionFactory(clientset kubernetes.Interface, config Deploymen...

FILE: modelzetes/pkg/k8s/factory_test.go
  function mockFactory (line 8) | func mockFactory() FunctionFactory {

FILE: modelzetes/pkg/k8s/instance.go
  function MakeLabelSelector (line 9) | func MakeLabelSelector(name string) map[string]string {
  function InstanceFromPod (line 15) | func InstanceFromPod(pod v1.Pod) *types.InferenceDeploymentInstance {

FILE: modelzetes/pkg/k8s/instance_test.go
  function Test_InstanceFromPod (line 18) | func Test_InstanceFromPod(t *testing.T) {

FILE: modelzetes/pkg/k8s/log.go
  type LogRequestor (line 17) | type LogRequestor struct
    method Query (line 33) | func (l LogRequestor) Query(ctx context.Context, r types.LogRequest) (...
  function NewLogRequestor (line 23) | func NewLogRequestor(client kubernetes.Interface, functionNamespace stri...

FILE: modelzetes/pkg/k8s/logs.go
  constant podInformerResync (line 27) | podInformerResync = 5 * time.Second
  constant defaultLogSince (line 30) | defaultLogSince = 5 * time.Minute
  constant LogBufferSize (line 33) | LogBufferSize = 500 * 2
  type Log (line 38) | type Log struct
  function GetLogs (line 56) | func GetLogs(ctx context.Context, client kubernetes.Interface, functionN...
  function podLogs (line 92) | func podLogs(ctx context.Context, i v1.PodInterface, pod, container, nam...
  function extractTimestampAndMsg (line 147) | func extractTimestampAndMsg(logText string) (string, time.Time) {
  function parseSince (line 164) | func parseSince(r *time.Time) *int64 {
  function startFunctionPodInformer (line 176) | func startFunctionPodInformer(ctx context.Context, client kubernetes.Int...
  function withLabels (line 225) | func withLabels(selector string) internalinterfaces.TweakListOptionsFunc {
  type podLoggerEventHandler (line 231) | type podLoggerEventHandler struct
    method OnAdd (line 237) | func (h *podLoggerEventHandler) OnAdd(obj interface{}, isInitialList b...
    method OnUpdate (line 243) | func (h *podLoggerEventHandler) OnUpdate(oldObj, newObj interface{}) {
    method OnDelete (line 247) | func (h *podLoggerEventHandler) OnDelete(obj interface{}) {

FILE: modelzetes/pkg/k8s/probes.go
  type FunctionProbes (line 11) | type FunctionProbes struct
  method MakeProbes (line 19) | func (f *FunctionFactory) MakeProbes(port int, httpProbePath string) (*F...

FILE: modelzetes/pkg/k8s/probes_test.go
  function Test_makeProbes_useHTTPProbe (line 10) | func Test_makeProbes_useHTTPProbe(t *testing.T) {
  function Test_makeProbes_useCustomDurationHTTPProbe (line 29) | func Test_makeProbes_useCustomDurationHTTPProbe(t *testing.T) {

FILE: modelzetes/pkg/k8s/proxy.go
  constant watchdogPort (line 19) | watchdogPort = 8080
  function NewFunctionLookup (line 21) | func NewFunctionLookup(ns string, lister corelister.EndpointsLister) *Fu...
  type FunctionLookup (line 30) | type FunctionLookup struct
    method GetLister (line 38) | func (f *FunctionLookup) GetLister(ns string) corelister.EndpointsName...
    method SetLister (line 44) | func (f *FunctionLookup) SetLister(ns string, lister corelister.Endpoi...
    method Resolve (line 58) | func (l *FunctionLookup) Resolve(name string) (url.URL, error) {
    method verifyNamespace (line 108) | func (l *FunctionLookup) verifyNamespace(name string) error {
  function getNamespace (line 50) | func getNamespace(name, defaultNamespace string) string {

FILE: modelzetes/pkg/k8s/proxy_test.go
  type FakeLister (line 14) | type FakeLister struct
    method List (line 17) | func (f FakeLister) List(selector labels.Selector) (ret []*corev1.Endp...
    method Endpoints (line 21) | func (f FakeLister) Endpoints(namespace string) corelister.EndpointsNa...
  type FakeNSLister (line 26) | type FakeNSLister struct
    method List (line 29) | func (f FakeNSLister) List(selector labels.Selector) (ret []*corev1.En...
    method Get (line 33) | func (f FakeNSLister) Get(name string) (*corev1.Endpoints, error) {
  function Test_FunctionLookup (line 50) | func Test_FunctionLookup(t *testing.T) {

FILE: modelzetes/pkg/k8s/secrets.go
  constant secretsMountPath (line 24) | secretsMountPath             = "/var/modelz/secrets"
  constant secretLabel (line 25) | secretLabel                  = "app.kubernetes.io/managed-by"
  constant secretLabelValue (line 26) | secretLabelValue             = "modelz"
  constant secretsProjectVolumeNameTmpl (line 27) | secretsProjectVolumeNameTmpl = "projected-secrets"
  type SecretsClient (line 32) | type SecretsClient interface
  type SecretInterfacer (line 55) | type SecretInterfacer interface
  type secretClient (line 60) | type secretClient struct
    method List (line 71) | func (c secretClient) List(namespace string) (names []string, err erro...
    method Create (line 86) | func (c secretClient) Create(secret types.Secret) error {
    method Replace (line 116) | func (c secretClient) Replace(secret types.Secret) error {
    method Delete (line 140) | func (c secretClient) Delete(namespace string, name string) error {
    method GetSecrets (line 148) | func (c secretClient) GetSecrets(namespace string, secretNames []strin...
    method selector (line 164) | func (c secretClient) selector() metav1.ListOptions {
    method validateSecret (line 170) | func (c secretClient) validateSecret(secret types.Secret) error {
    method getValidSecretData (line 182) | func (c secretClient) getValidSecretData(secret types.Secret) map[stri...
  function NewSecretsClient (line 65) | func NewSecretsClient(kube kubernetes.Interface) SecretsClient {
  method ConfigureSecrets (line 200) | func (f *FunctionFactory) ConfigureSecrets(request v2alpha1.Inference, d...
  function ReadFunctionSecretsSpec (line 279) | func ReadFunctionSecretsSpec(item appsv1.Deployment) []string {

FILE: modelzetes/pkg/k8s/secrets_factory_test.go
  function Test_ReadFunctionSecretsSpec (line 16) | func Test_ReadFunctionSecretsSpec(t *testing.T) {
  function Test_FunctionFactory_ConfigureSecrets (line 105) | func Test_FunctionFactory_ConfigureSecrets(t *testing.T) {
  function validateEmptySecretVolumesAndMounts (line 233) | func validateEmptySecretVolumesAndMounts(t *testing.T, deployment *appsv...
  function validateNewSecretVolumesAndMounts (line 247) | func validateNewSecretVolumesAndMounts(t *testing.T, deployment *appsv1....

FILE: modelzetes/pkg/k8s/securityContext.go
  constant SecurityContextUserID (line 13) | SecurityContextUserID = int64(12000)
  method ConfigureContainerUserID (line 17) | func (f *FunctionFactory) ConfigureContainerUserID(deployment *appsv1.De...
  method ConfigureReadOnlyRootFilesystem (line 40) | func (f *FunctionFactory) ConfigureReadOnlyRootFilesystem(deployment *ap...

FILE: modelzetes/pkg/k8s/securityContext_test.go
  function readOnlyRootDisabled (line 13) | func readOnlyRootDisabled(t *testing.T, deployment *appsv1.Deployment) {
  function Test_configureReadOnlyRootFilesystem_Disabled_To_Disabled (line 30) | func Test_configureReadOnlyRootFilesystem_Disabled_To_Disabled(t *testin...

FILE: modelzetes/pkg/k8s/utils.go
  function removeVolume (line 13) | func removeVolume(volumeName string, volumes []corev1.Volume) []corev1.V...
  function removeVolumeMount (line 31) | func removeVolumeMount(volumeName string, mounts []corev1.VolumeMount) [...

FILE: modelzetes/pkg/pointer/ptr.go
  function Ptr (line 3) | func Ptr[T any](v T) *T {
  function PtrCopy (line 7) | func PtrCopy[T any](v T) *T {

FILE: modelzetes/pkg/signals/signal.go
  function SetupSignalHandler (line 13) | func SetupSignalHandler() (stopCh <-chan struct{}) {

FILE: modelzetes/pkg/version/version.go
  type Version (line 46) | type Version struct
    method String (line 57) | func (v Version) String() string {
  function SetGitTagForE2ETest (line 62) | func SetGitTagForE2ETest(tag string) {
  function GetEnvdVersion (line 67) | func GetEnvdVersion() string {
  function GetVersion (line 96) | func GetVersion() Version {
  function UserAgent (line 115) | func UserAgent() string {

FILE: modelzetes/vendor.go
  function main (line 18) | func main() {}

FILE: setup.py
  class bdist_wheel_universal (line 13) | class bdist_wheel_universal(bdist_wheel):
    method get_tag (line 14) | def get_tag(self):
  function build_if_not_exist (line 19) | def build_if_not_exist():
  class ModelzExtension (line 30) | class ModelzExtension(Extension):
  class ModelzBuildExt (line 34) | class ModelzBuildExt(build_ext):
    method build_extension (line 35) | def build_extension(self, ext: Extension) -> None:
Condensed preview — 413 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,264K chars).
[
  {
    "path": ".all-contributorsrc",
    "chars": 2675,
    "preview": "{\n  \"projectName\": \"openmodelz\",\n  \"projectOwner\": \"tensorchord\",\n  \"repoType\": \"github\",\n  \"repoHost\": \"https://github."
  },
  {
    "path": ".github/workflows/CI.yaml",
    "chars": 3156,
    "preview": "name: CI\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - '.github/workflows/**'\n      - '**.go'\n      - '**/M"
  },
  {
    "path": ".github/workflows/publish.yaml",
    "chars": 2406,
    "preview": "name: release\n\non:\n  release:\n    types: [published]\n  pull_request:\n    paths:\n    - '.github/workflows/release.yml'\n  "
  },
  {
    "path": ".gitignore",
    "chars": 3606,
    "preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packagi"
  },
  {
    "path": ".goreleaser.yaml",
    "chars": 6302,
    "preview": "project_name: openmodelz\nbuilds:\n  - env:\n      - CGO_ENABLED=0\n    goos:\n      - linux\n    goarch:\n      - amd64\n    id"
  },
  {
    "path": "LICENSE",
    "chars": 11358,
    "preview": "\n                                 Apache License\n                           Version 2.0, January 2004\n                  "
  },
  {
    "path": "MANIFEST.in",
    "chars": 293,
    "preview": "prune autoscaler\nprune ingress-operator\nprune modelzetes\nprune .github\ninclude LICENSE\ninclude README.md\ninclude .gorele"
  },
  {
    "path": "README.md",
    "chars": 18114,
    "preview": "<div align=\"center\">\n\n# OpenModelZ\n\n</div>\n\n<p align=center>\n<a href=\"https://discord.gg/KqswhpVgdU\"><img alt=\"discord i"
  },
  {
    "path": "agent/.gitignore",
    "chars": 1003,
    "preview": "# If you prefer the allow list template instead of the deny list, see community template:\n# https://github.com/github/gi"
  },
  {
    "path": "agent/Dockerfile",
    "chars": 225,
    "preview": "FROM ubuntu:22.04\n\nLABEL maintainer=\"modelz-support@tensorchord.ai\"\nRUN apt-get -qq update \\\n    && apt-get -qq install "
  },
  {
    "path": "agent/Makefile",
    "chars": 7104,
    "preview": "# Copyright 2022 TensorChord Inc.\n#\n# The old school Makefile, following are required targets. The Makefile is written\n#"
  },
  {
    "path": "agent/README.md",
    "chars": 518,
    "preview": "<div align=\"center\">\n\n# OpenModelZ Agent\n\n</div>\n\n<p align=center>\n<a href=\"https://discord.gg/KqswhpVgdU\"><img alt=\"dis"
  },
  {
    "path": "agent/api/types/build.go",
    "chars": 2275,
    "preview": "package types\n\ntype Build struct {\n\tSpec   BuildSpec   `json:\"spec\"`\n\tStatus BuildStatus `json:\"status,omitempty\"`\n}\n\nty"
  },
  {
    "path": "agent/api/types/error.go",
    "chars": 78,
    "preview": "package types\n\ntype ErrorResponse struct {\n\tMessage string `json:\"message\"`\n}\n"
  },
  {
    "path": "agent/api/types/event.go",
    "chars": 757,
    "preview": "package types\n\nimport \"time\"\n\nconst (\n\tDeploymentCreateEvent     = \"deployment-create\"\n\tDeploymentUpdateEvent     = \"dep"
  },
  {
    "path": "agent/api/types/inference_deployment.go",
    "chars": 4837,
    "preview": "package types\n\n// InferenceDeployment represents a request to create or update a Model.\ntype InferenceDeployment struct "
  },
  {
    "path": "agent/api/types/inference_deployment_instance.go",
    "chars": 1144,
    "preview": "package types\n\nimport \"time\"\n\ntype InferenceDeploymentInstance struct {\n\tSpec   InferenceDeploymentInstanceSpec   `json:"
  },
  {
    "path": "agent/api/types/inference_status.go",
    "chars": 2027,
    "preview": "package types\n\nimport \"time\"\n\n// InferenceDeploymentStatus exported for system/inferences endpoint\ntype InferenceDeploym"
  },
  {
    "path": "agent/api/types/info.go",
    "chars": 759,
    "preview": "package types\n\n// ProviderInfo provides information about the configured provider\ntype ProviderInfo struct {\n\tName      "
  },
  {
    "path": "agent/api/types/log.go",
    "chars": 1201,
    "preview": "package types\n\nimport \"time\"\n\ntype LogRequest struct {\n\tNamespace string `form:\"namespace\" json:\"namespace,omitempty\"`\n\t"
  },
  {
    "path": "agent/api/types/modelz_cloud.go",
    "chars": 1205,
    "preview": "package types\n\nimport \"time\"\n\nconst (\n\tClusterStatusInit    = \"init\"\n\tClusterStatusActive  = \"active\"\n\tClusterStatusUnkn"
  },
  {
    "path": "agent/api/types/namespace.go",
    "chars": 85,
    "preview": "package types\n\ntype NamespaceRequest struct {\n\tName string `json:\"name,omitempty\"`\n}\n"
  },
  {
    "path": "agent/api/types/queue.go",
    "chars": 769,
    "preview": "package types\n\nimport (\n\t\"net/http\"\n\t\"net/url\"\n)\n\n// Request for asynchronous processing\ntype QueueRequest struct {\n\t// "
  },
  {
    "path": "agent/api/types/requests.go",
    "chars": 579,
    "preview": "// Copyright (c) Alex Ellis 2017. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the projec"
  },
  {
    "path": "agent/api/types/secret.go",
    "chars": 431,
    "preview": "package types\n\n// Secret for underlying orchestrator\ntype Secret struct {\n\t// Name of the secret\n\tName string `json:\"nam"
  },
  {
    "path": "agent/api/types/server.go",
    "chars": 1624,
    "preview": "package types\n\ntype Server struct {\n\tSpec   ServerSpec   `json:\"spec,omitempty\"`\n\tStatus ServerStatus `json:\"status,omit"
  },
  {
    "path": "agent/client/build.go",
    "chars": 1820,
    "preview": "package client\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/url\"\n\n\t\"github.com/sirupsen/logrus\"\n\n\t\"github.com/tens"
  },
  {
    "path": "agent/client/client.go",
    "chars": 6304,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/const.go",
    "chars": 4861,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/errors.go",
    "chars": 2778,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/hijack.go",
    "chars": 2236,
    "preview": "package client // import \"docker.io/go-docker\"\n\nimport (\n\t\"net/url\"\n\n\t\"github.com/gorilla/websocket\"\n\t\"golang.org/x/net/"
  },
  {
    "path": "agent/client/image_cache_create.go",
    "chars": 568,
    "preview": "package client\n\nimport (\n\t\"context\"\n\t\"net/url\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)\n\nfunc (cli *Clien"
  },
  {
    "path": "agent/client/inference_create.go",
    "chars": 872,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/inference_get.go",
    "chars": 1063,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/inference_list.go",
    "chars": 880,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/inference_remove.go",
    "chars": 748,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/inference_scale.go",
    "chars": 636,
    "preview": "package client\n\nimport (\n\t\"context\"\n\t\"net/url\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)\n\n// InferenceScal"
  },
  {
    "path": "agent/client/inference_update.go",
    "chars": 878,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/info.go",
    "chars": 854,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/instance_exec.go",
    "chars": 1798,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/instance_list.go",
    "chars": 1044,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/log.go",
    "chars": 2397,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/modelz_cloud.go",
    "chars": 5956,
    "preview": "package client\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"time\"\n\n\t\"github.com/sirupsen/logrus"
  },
  {
    "path": "agent/client/namespace_create.go",
    "chars": 695,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/namespace_delete.go",
    "chars": 697,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/options.go",
    "chars": 5701,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/request.go",
    "chars": 8352,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/server_label_create.go",
    "chars": 844,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/server_list.go",
    "chars": 750,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/server_node_delete.go",
    "chars": 713,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/transport.go",
    "chars": 567,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/client/utils.go",
    "chars": 946,
    "preview": "package client\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/cockroachdb/errors\"\n\t\"github.com/tensorchord/openmodelz/agent/a"
  },
  {
    "path": "agent/cmd/agent/main.go",
    "chars": 863,
    "preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"github.com/urfave/cli/v2\"\n\n\t\"github.com/tensorchord"
  },
  {
    "path": "agent/errdefs/defs.go",
    "chars": 2140,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/errdefs/doc.go",
    "chars": 854,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/errdefs/helpers.go",
    "chars": 5850,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/errdefs/http_helpers.go",
    "chars": 1609,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/errdefs/is.go",
    "chars": 2796,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/pkg/app/config.go",
    "chars": 2720,
    "preview": "package app\n\nimport (\n\t\"github.com/urfave/cli/v2\"\n\n\t\"github.com/tensorchord/openmodelz/agent/pkg/config\"\n)\n\nfunc configF"
  },
  {
    "path": "agent/pkg/app/root.go",
    "chars": 13091,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "agent/pkg/config/config.go",
    "chars": 5323,
    "preview": "package config\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"time\"\n)\n\ntype Config struct {\n\tServer      ServerConfig      `json"
  },
  {
    "path": "agent/pkg/consts/consts.go",
    "chars": 177,
    "preview": "package consts\n\nimport \"time\"\n\nconst (\n\tDomain        = \"modelz.live\"\n\tDefaultPrefix = \"modelz-\"\n\tAPIKEY_PREFIX = \"mzi-\""
  },
  {
    "path": "agent/pkg/docs/docs.go",
    "chars": 59519,
    "preview": "// Package docs GENERATED BY SWAG; DO NOT EDIT\n// This file was generated by swaggo/swag\npackage docs\n\nimport \"github.co"
  },
  {
    "path": "agent/pkg/event/event.go",
    "chars": 1097,
    "preview": "package event\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"github.com/tensorchord/openmodelz/agent/api/t"
  },
  {
    "path": "agent/pkg/event/fake.go",
    "chars": 188,
    "preview": "package event\n\ntype Fake struct {\n}\n\nfunc NewFake() Interface {\n\treturn &Fake{}\n}\n\nfunc (f *Fake) CreateDeploymentEvent("
  },
  {
    "path": "agent/pkg/event/suite_test.go",
    "chars": 182,
    "preview": "package event\n\nimport (\n\t\"testing\"\n\n\t. \"github.com/onsi/ginkgo/v2\"\n\t. \"github.com/onsi/gomega\"\n)\n\nfunc TestBuilder(t *te"
  },
  {
    "path": "agent/pkg/event/username.go",
    "chars": 358,
    "preview": "package event\n\nimport \"fmt\"\n\nconst (\n\tDefaultPrefix = \"modelz-\"\n)\n\nfunc getUserIDFromNamespace(ns string) (string, error"
  },
  {
    "path": "agent/pkg/event/util.go",
    "chars": 165,
    "preview": "package event\n\nimport (\n\t\"database/sql\"\n)\n\nfunc NullStringBuilder(String string, Valid bool) sql.NullString {\n\treturn sq"
  },
  {
    "path": "agent/pkg/k8s/convert_inference.go",
    "chars": 2858,
    "preview": "package k8s\n\nimport (\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n\t\"github.com/tensorchord/openmodelz/modelzete"
  },
  {
    "path": "agent/pkg/k8s/convert_inference_test.go",
    "chars": 3606,
    "preview": "package k8s\n\nimport (\n\t\"time\"\n\n\t. \"github.com/onsi/ginkgo/v2\"\n\t. \"github.com/onsi/gomega\"\n\t\"github.com/tensorchord/openm"
  },
  {
    "path": "agent/pkg/k8s/convert_job.go",
    "chars": 588,
    "preview": "package k8s\n\nimport (\n\tv1 \"k8s.io/api/batch/v1\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)\n\nfunc AsBuild(jo"
  },
  {
    "path": "agent/pkg/k8s/convert_pod.go",
    "chars": 2344,
    "preview": "package k8s\n\nimport (\n\t\"github.com/tensorchord/openmodelz/modelzetes/pkg/consts\"\n\tv1 \"k8s.io/api/core/v1\"\n\n\t\"github.com/"
  },
  {
    "path": "agent/pkg/k8s/convert_pod_test.go",
    "chars": 4559,
    "preview": "package k8s\n\nimport (\n\t. \"github.com/onsi/ginkgo/v2\"\n\t. \"github.com/onsi/gomega\"\n\t\"github.com/sirupsen/logrus\"\n\t. \"githu"
  },
  {
    "path": "agent/pkg/k8s/generate_image_cache.go",
    "chars": 1405,
    "preview": "package k8s\n\nimport (\n\t\"time\"\n\n\tkubefledged \"github.com/senthilrch/kube-fledged/pkg/apis/kubefledged/v1alpha3\"\n\t\"github."
  },
  {
    "path": "agent/pkg/k8s/generate_job.go",
    "chars": 4884,
    "preview": "package k8s\n\nimport (\n\t\"time\"\n\n\t\"github.com/cockroachdb/errors\"\n\tbatchv1 \"k8s.io/api/batch/v1\"\n\tcorev1 \"k8s.io/api/core/"
  },
  {
    "path": "agent/pkg/k8s/managed_cluster.go",
    "chars": 216,
    "preview": "package k8s\n\nimport (\n\t\"k8s.io/apimachinery/pkg/version\"\n\t\"k8s.io/client-go/kubernetes\"\n)\n\nfunc GetKubernetesVersion(cli"
  },
  {
    "path": "agent/pkg/k8s/resolver.go",
    "chars": 3641,
    "preview": "package k8s\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"math/rand\"\n\t\"net/url\"\n\t\"strconv\"\n\n\t\"github.com/anthhub/forwarder\"\n\t\"github.com"
  },
  {
    "path": "agent/pkg/k8s/suite_test.go",
    "chars": 178,
    "preview": "package k8s\n\nimport (\n\t\"testing\"\n\n\t. \"github.com/onsi/ginkgo/v2\"\n\t. \"github.com/onsi/gomega\"\n)\n\nfunc TestBuilder(t *test"
  },
  {
    "path": "agent/pkg/log/factory.go",
    "chars": 310,
    "preview": "package log\n\nimport (\n\t\"context\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)\n\n// Requester submits queries t"
  },
  {
    "path": "agent/pkg/log/k8s.go",
    "chars": 7640,
    "preview": "package log\n\nimport (\n\t\"bufio\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"github.com/te"
  },
  {
    "path": "agent/pkg/log/loki.go",
    "chars": 3500,
    "preview": "package log\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"github.com/cockroa"
  },
  {
    "path": "agent/pkg/metrics/exporter.go",
    "chars": 4090,
    "preview": "// Copyright (c) Alex Ellis 2017\n// Copyright (c) 2018 OpenFaaS Author(s)\n// Licensed under the MIT license. See LICENSE"
  },
  {
    "path": "agent/pkg/metrics/metrics.go",
    "chars": 4021,
    "preview": "// Copyright (c) Alex Ellis 2017. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the projec"
  },
  {
    "path": "agent/pkg/prom/prometheus_query.go",
    "chars": 3095,
    "preview": "package prom\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strconv\"\n\n\t\"github.com/sirupsen/log"
  },
  {
    "path": "agent/pkg/runtime/build.go",
    "chars": 1980,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\tk8serrors \"k8s.io/apimachinery/pkg/api/errors\"\n\tmetav1 \"k8s.io/apimachiner"
  },
  {
    "path": "agent/pkg/runtime/cluster_info_get.go",
    "chars": 646,
    "preview": "package runtime\n\nimport (\n\t\"strings\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n\t\"github.com/tensorchord/open"
  },
  {
    "path": "agent/pkg/runtime/image_cache.go",
    "chars": 699,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"github.com/tensorchord/openmodelz/agent/api/types\""
  },
  {
    "path": "agent/pkg/runtime/inference_create.go",
    "chars": 6293,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\tv1 \"k8s.io/api/core/v1\"\n\tk8serrors \"k8s.io/apimachinery/pkg/api/errors\"\n\tm"
  },
  {
    "path": "agent/pkg/runtime/inference_delete.go",
    "chars": 2103,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\n\tingressclientset \"github.com/tensorchord/openmodelz/ingress-operator/pkg/client/c"
  },
  {
    "path": "agent/pkg/runtime/inference_exec.go",
    "chars": 5842,
    "preview": "package runtime\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/gorilla/w"
  },
  {
    "path": "agent/pkg/runtime/inference_get.go",
    "chars": 1685,
    "preview": "package runtime\n\nimport (\n\t\"fmt\"\n\n\tk8serrors \"k8s.io/apimachinery/pkg/api/errors\"\n\tv1 \"k8s.io/client-go/listers/apps/v1\""
  },
  {
    "path": "agent/pkg/runtime/inference_instance.go",
    "chars": 1102,
    "preview": "package runtime\n\nimport (\n\tk8serrors \"k8s.io/apimachinery/pkg/api/errors\"\n\t\"k8s.io/apimachinery/pkg/labels\"\n\tv1 \"k8s.io/"
  },
  {
    "path": "agent/pkg/runtime/inference_list.go",
    "chars": 2640,
    "preview": "package runtime\n\nimport (\n\t\"sort\"\n\n\tmv2alpha1 \"github.com/tensorchord/openmodelz/modelzetes/pkg/apis/modelzetes/v2alpha1"
  },
  {
    "path": "agent/pkg/runtime/inference_replicas.go",
    "chars": 2117,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\n\t\"github.com/tensorchord/openmodelz/modelzetes/pkg/consts\"\n\tmetav1 \"k8s.io/apimach"
  },
  {
    "path": "agent/pkg/runtime/inference_update.go",
    "chars": 2820,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\n\t\"github.com/tensorchord/openmodelz/modelzetes/pkg/apis/modelzetes/v2alpha1\"\n\tinfe"
  },
  {
    "path": "agent/pkg/runtime/mock/mock.go",
    "chars": 14236,
    "preview": "// Code generated by MockGen. DO NOT EDIT.\n// Source: pkg/runtime/runtime.go\n\n// Package mock is a generated GoMock pack"
  },
  {
    "path": "agent/pkg/runtime/namespace.go",
    "chars": 1601,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\tv1 \"k8s.io/api/core/v1\"\n\tk8serrors \"k8s.io/apimachinery/pkg/api/errors\"\n\tm"
  },
  {
    "path": "agent/pkg/runtime/node.go",
    "chars": 667,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"github.com/tensorchord/openmodelz/modelzetes/pkg/c"
  },
  {
    "path": "agent/pkg/runtime/runtime.go",
    "chars": 5168,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/sirupsen/logrus\"\n\tapicorev1 \"k8s.io/api/"
  },
  {
    "path": "agent/pkg/runtime/server_delete.go",
    "chars": 482,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\n\t\"github.com/tensorchord/openmodelz/agent/errdefs\"\n\tk8serrors \"k8s.io/apimachinery"
  },
  {
    "path": "agent/pkg/runtime/server_label_create.go",
    "chars": 961,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\t\"path/filepath\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n\t\"github.com"
  },
  {
    "path": "agent/pkg/runtime/server_list.go",
    "chars": 2384,
    "preview": "package runtime\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n\t\"github.com/tenso"
  },
  {
    "path": "agent/pkg/runtime/util_domain.go",
    "chars": 679,
    "preview": "package runtime\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/dchest/uniuri\"\n)\n\nconst (\n\tAnnotationDomain = \"ai.tensorchord.domain\"\n)\n\n"
  },
  {
    "path": "agent/pkg/runtime/util_resource.go",
    "chars": 2156,
    "preview": "package runtime\n\nimport (\n\t\"github.com/tensorchord/openmodelz/modelzetes/pkg/consts\"\n\tcorev1 \"k8s.io/api/core/v1\"\n\t\"k8s."
  },
  {
    "path": "agent/pkg/scaling/function_scaler.go",
    "chars": 5223,
    "preview": "package scaling\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/dgraph-io/ristretto\"\n\t\"github.com/sirupsen/log"
  },
  {
    "path": "agent/pkg/scaling/ranges.go",
    "chars": 1243,
    "preview": "package scaling\n\nimport \"time\"\n\ntype ScaleType string\n\nconst (\n\t// DefaultMinReplicas is the minimal amount of replicas "
  },
  {
    "path": "agent/pkg/scaling/retry.go",
    "chars": 402,
    "preview": "package scaling\n\nimport (\n\t\"log\"\n\t\"time\"\n)\n\ntype routine func(attempt int) error\n\nfunc Retry(r routine, label string, at"
  },
  {
    "path": "agent/pkg/scaling/service_query.go",
    "chars": 787,
    "preview": "// Copyright (c) OpenFaaS Author(s). All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the pro"
  },
  {
    "path": "agent/pkg/scaling/util.go",
    "chars": 712,
    "preview": "package scaling\n\nimport (\n\t\"time\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)\n\nfunc AsServerQueryResponse(in"
  },
  {
    "path": "agent/pkg/server/error.go",
    "chars": 2520,
    "preview": "package server\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/tensorchord/openmodelz/agent/errdefs\"\n)\n\n// Error def"
  },
  {
    "path": "agent/pkg/server/handler_build_create.go",
    "chars": 1303,
    "preview": "package server\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/sirupsen/logrus\"\n\n\t\"github.com/tensorchor"
  },
  {
    "path": "agent/pkg/server/handler_build_get.go",
    "chars": 1019,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t_ \"github.com/tensorchord/openmodelz/agent"
  },
  {
    "path": "agent/pkg/server/handler_build_list.go",
    "chars": 803,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t_ \"github.com/tensorchord/openmodelz/agent"
  },
  {
    "path": "agent/pkg/server/handler_build_logs.go",
    "chars": 800,
    "preview": "package server\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\n\t_ \"github.com/tensorchord/openmodelz/agent/api/types\"\n)\n\n// @Summ"
  },
  {
    "path": "agent/pkg/server/handler_gradio_proxy.go",
    "chars": 2893,
    "preview": "package server\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net\"\n\t\"net/http\"\n\t\"net/http/httputil\"\n\t\"net/url\"\n\t\"path\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"g"
  },
  {
    "path": "agent/pkg/server/handler_healthz.go",
    "chars": 327,
    "preview": "package server\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n)\n\n// @Summary     Healthz\n// @Description Healthz\n// "
  },
  {
    "path": "agent/pkg/server/handler_healthz_test.go",
    "chars": 429,
    "preview": "package server\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\t. \"github.com/onsi/ginkgo/v2\"\n\t. \"github.com/onsi/gomega\"\n)\n\nvar _"
  },
  {
    "path": "agent/pkg/server/handler_image_cache.go",
    "chars": 1118,
    "preview": "package server\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)"
  },
  {
    "path": "agent/pkg/server/handler_inference_create.go",
    "chars": 1650,
    "preview": "package server\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/"
  },
  {
    "path": "agent/pkg/server/handler_inference_create_test.go",
    "chars": 1324,
    "preview": "package server\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/golang/mock/gomock\"\n\t. \"github.com/onsi/ginkgo/v2\"\n\t. "
  },
  {
    "path": "agent/pkg/server/handler_inference_delete.go",
    "chars": 1300,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/tensorchord/openmodelz/agent/a"
  },
  {
    "path": "agent/pkg/server/handler_inference_delete_test.go",
    "chars": 1248,
    "preview": "package server\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/golang/mock/gomock\"\n\t. \"github.com/onsi/ginkgo/v2\"\n\t. "
  },
  {
    "path": "agent/pkg/server/handler_inference_get.go",
    "chars": 1049,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t_ \"github.com/tensorchord/openmodelz/agent"
  },
  {
    "path": "agent/pkg/server/handler_inference_get_test.go",
    "chars": 1733,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/golang/mock/gomock\"\n\t. \"github.com/onsi/gin"
  },
  {
    "path": "agent/pkg/server/handler_inference_instance.go",
    "chars": 1099,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t_ \"github.com/tensorchord/openmodelz/agent"
  },
  {
    "path": "agent/pkg/server/handler_inference_instance_exec.go",
    "chars": 1623,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t_ \"github.com/tensor"
  },
  {
    "path": "agent/pkg/server/handler_inference_list.go",
    "chars": 985,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t_ \"github.com/tensorchord/openmodelz/agent"
  },
  {
    "path": "agent/pkg/server/handler_inference_logs.go",
    "chars": 3152,
    "preview": "package server\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/cockroachdb/errors\"\n\t\"github.com/"
  },
  {
    "path": "agent/pkg/server/handler_inference_proxy.go",
    "chars": 4366,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"net\"\n\t\"net/http\"\n\t\"net/http/httputil\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"githu"
  },
  {
    "path": "agent/pkg/server/handler_inference_scale.go",
    "chars": 1273,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/tensorchord/openmodelz/agent/a"
  },
  {
    "path": "agent/pkg/server/handler_inference_update.go",
    "chars": 1241,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/tensorchord/openmodelz/agent/a"
  },
  {
    "path": "agent/pkg/server/handler_info.go",
    "chars": 861,
    "preview": "package server\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n"
  },
  {
    "path": "agent/pkg/server/handler_mosec_proxy.go",
    "chars": 771,
    "preview": "package server\n\nimport (\n\t\"fmt\"\n\t\"path\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/tensorchord/openmodelz/agent/pkg/const"
  },
  {
    "path": "agent/pkg/server/handler_namespace_create.go",
    "chars": 826,
    "preview": "package server\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)"
  },
  {
    "path": "agent/pkg/server/handler_namespace_delete.go",
    "chars": 828,
    "preview": "package server\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)"
  },
  {
    "path": "agent/pkg/server/handler_namespace_delete_test.go",
    "chars": 1265,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/golang/mock/gomock\"\n\t. \"github.com/onsi/gin"
  },
  {
    "path": "agent/pkg/server/handler_namespace_list.go",
    "chars": 516,
    "preview": "package server\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n)\n\n// @Summary     List the namespaces.\n// @Descriptio"
  },
  {
    "path": "agent/pkg/server/handler_other_proxy.go",
    "chars": 1661,
    "preview": "package server\n\nimport (\n\t\"fmt\"\n\t\"net\"\n\t\"net/http\"\n\t\"net/http/httputil\"\n\t\"net/url\"\n\t\"path\"\n\t\"time\"\n\n\t\"github.com/gin-gon"
  },
  {
    "path": "agent/pkg/server/handler_root.go",
    "chars": 309,
    "preview": "package server\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/tensorchord/openmodelz/agent/pkg/server/static\"\n)\n\nfun"
  },
  {
    "path": "agent/pkg/server/handler_server_delete.go",
    "chars": 699,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n)\n\n// @Summary     Delete a node from the cl"
  },
  {
    "path": "agent/pkg/server/handler_server_label_create.go",
    "chars": 1023,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/tensorchord/openmodelz/agent/ap"
  },
  {
    "path": "agent/pkg/server/handler_server_list.go",
    "chars": 584,
    "preview": "package server\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)"
  },
  {
    "path": "agent/pkg/server/handler_streamlit_proxy.go",
    "chars": 2819,
    "preview": "package server\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net\"\n\t\"net/http\"\n\t\"net/http/httputil\"\n\t\"net/url\"\n\t\"path\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"g"
  },
  {
    "path": "agent/pkg/server/middleware_callid.go",
    "chars": 539,
    "preview": "package server\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/google/uuid\"\n)\n\nfunc (s Server) middle"
  },
  {
    "path": "agent/pkg/server/proxy_auth.go",
    "chars": 3065,
    "preview": "package server\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/sirupsen/logrus\"\n\t\"githu"
  },
  {
    "path": "agent/pkg/server/server_factory.go",
    "chars": 3366,
    "preview": "package server\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/dgraph-io/ristretto\"\n\t\"github.com/gin-contrib/cors\"\n\t\"github.com/gin-"
  },
  {
    "path": "agent/pkg/server/server_handlerfunc.go",
    "chars": 822,
    "preview": "package server\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/sirupsen/logrus\"\n)\n\ntype Handle"
  },
  {
    "path": "agent/pkg/server/server_init_kubernetes.go",
    "chars": 6742,
    "preview": "package server\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/prometheus/client_golang/prometheus\"\n\t\"github.com/sirup"
  },
  {
    "path": "agent/pkg/server/server_init_logs.go",
    "chars": 322,
    "preview": "package server\n\nimport (\n\t\"github.com/tensorchord/openmodelz/agent/pkg/log\"\n)\n\nfunc (s *Server) initLogs() {\n\tif len(s.c"
  },
  {
    "path": "agent/pkg/server/server_init_metrics.go",
    "chars": 408,
    "preview": "package server\n\nimport (\n\t\"context\"\n\n\t\"github.com/tensorchord/openmodelz/agent/pkg/metrics\"\n)\n\nfunc (s *Server) initMetr"
  },
  {
    "path": "agent/pkg/server/server_init_modelz_cloud.go",
    "chars": 2117,
    "preview": "package server\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/sirupsen/logrus\"\n\t\"github.com/tensorch"
  },
  {
    "path": "agent/pkg/server/server_init_route.go",
    "chars": 3793,
    "preview": "package server\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\tswaggerfiles \"github.com/swaggo/files\"\n\tginSwagger \"github.com/swa"
  },
  {
    "path": "agent/pkg/server/server_run.go",
    "chars": 4227,
    "preview": "package server\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/signal\"\n\t\"syscall\"\n\t\"time\"\n\n\t\"github.com/sir"
  },
  {
    "path": "agent/pkg/server/server_websocket.go",
    "chars": 1711,
    "preview": "package server\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"time\"\n\n\t\"github.com/rancher/remotedialer\"\n\t\"github.com/siru"
  },
  {
    "path": "agent/pkg/server/static/index.html",
    "chars": 7695,
    "preview": "<html lang=\"en\">\n\n<head>\n    <meta http-equiv=\"refresh\" content=\"10\">\n    <meta charset=\"utf-8\">\n    <meta name=\"viewpor"
  },
  {
    "path": "agent/pkg/server/static/landing.go",
    "chars": 542,
    "preview": "package static\n\nimport (\n\t\"bytes\"\n\t_ \"embed\"\n\t\"html/template\"\n\n\t\"github.com/tensorchord/openmodelz/agent/pkg/version\"\n)\n"
  },
  {
    "path": "agent/pkg/server/static/page_loading.go",
    "chars": 5495,
    "preview": "package static\n\nimport (\n\t\"bytes\"\n\t\"html/template\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)\n\nconst htmlDe"
  },
  {
    "path": "agent/pkg/server/suite_test.go",
    "chars": 1577,
    "preview": "package server\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"io\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"net/url\"\n\t\"testing\"\n\n\t\"githu"
  },
  {
    "path": "agent/pkg/server/user.go",
    "chars": 543,
    "preview": "package server\n\nimport (\n\t\"context\"\n\n\t\"github.com/sirupsen/logrus\"\n)\n\nfunc (s *Server) getUIDFromDeploymentID(ctx contex"
  },
  {
    "path": "agent/pkg/server/validator/validator.go",
    "chars": 4035,
    "preview": "package validator\n\nimport (\n\t\"fmt\"\n\t\"regexp\"\n\n\t\"k8s.io/apimachinery/pkg/util/rand\"\n\n\t\"github.com/tensorchord/openmodelz/"
  },
  {
    "path": "agent/pkg/version/version.go",
    "chars": 3506,
    "preview": "/*\n   Copyright The TensorChord Inc.\n   Copyright The BuildKit Authors.\n   Copyright The containerd Authors.\n\n   License"
  },
  {
    "path": "agent/sqlc.yaml",
    "chars": 331,
    "preview": "version: \"2\"\nsql:\n  - engine: \"postgresql\"\n    queries: \"sql/query/\"\n    schema: \"./sql/schema.sql\"\n    gen:\n      go:\n "
  },
  {
    "path": "autoscaler/.gitignore",
    "chars": 1003,
    "preview": "# If you prefer the allow list template instead of the deny list, see community template:\n# https://github.com/github/gi"
  },
  {
    "path": "autoscaler/Dockerfile",
    "chars": 140,
    "preview": "FROM ubuntu:22.04\n\nLABEL maintainer=\"modelz-support@tensorchord.ai\"\n\nCOPY autoscaler /usr/bin/autoscaler\nENTRYPOINT [\"/u"
  },
  {
    "path": "autoscaler/Makefile",
    "chars": 7091,
    "preview": "# Copyright 2022 TensorChord Inc.\n#\n# The old school Makefile, following are required targets. The Makefile is written\n#"
  },
  {
    "path": "autoscaler/cmd/autoscaler/main.go",
    "chars": 568,
    "preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"github.com/urfave/cli/v2\"\n\n\t\"github.com/tensorchord"
  },
  {
    "path": "autoscaler/pkg/autoscaler/factory.go",
    "chars": 989,
    "preview": "package autoscaler\n\nimport (\n\t\"net/http\"\n\t\"net/url\"\n\t\"time\"\n\n\t\"github.com/cockroachdb/errors\"\n\t\"github.com/sirupsen/logr"
  },
  {
    "path": "autoscaler/pkg/autoscaler/inferencecache.go",
    "chars": 748,
    "preview": "package autoscaler\n\nimport (\n\t\"time\"\n\n\t\"github.com/tensorchord/openmodelz/agent/api/types\"\n)\n\ntype Inference struct {\n\tD"
  },
  {
    "path": "autoscaler/pkg/autoscaler/loadcache.go",
    "chars": 534,
    "preview": "package autoscaler\n\nimport \"time\"\n\n// LoadCache is a cache for load metrics.\ntype LoadCache struct {\n\tload map[string]Lo"
  },
  {
    "path": "autoscaler/pkg/autoscaler/scaler.go",
    "chars": 13421,
    "preview": "package autoscaler\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"math\"\n\t\"net/url\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/sirupsen/l"
  },
  {
    "path": "autoscaler/pkg/autoscalerapp/root.go",
    "chars": 3214,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "autoscaler/pkg/prom/prom.go",
    "chars": 4124,
    "preview": "package prom\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/prometheus/clie"
  },
  {
    "path": "autoscaler/pkg/prom/types.go",
    "chars": 1936,
    "preview": "package prom\n\nimport (\n\t\"fmt\"\n\t\"sort\"\n)\n\ntype VectorQueryResponse struct {\n\tData struct {\n\t\tResult []struct {\n\t\t\tMetric "
  },
  {
    "path": "autoscaler/pkg/server/status.go",
    "chars": 1243,
    "preview": "// This Source Code Form is subject to the terms of the Mozilla Public\n// License, v. 2.0. If a copy of the MPL was not "
  },
  {
    "path": "autoscaler/pkg/version/version.go",
    "chars": 3506,
    "preview": "/*\n   Copyright The TensorChord Inc.\n   Copyright The BuildKit Authors.\n   Copyright The containerd Authors.\n\n   License"
  },
  {
    "path": "go.mod",
    "chars": 7429,
    "preview": "module github.com/tensorchord/openmodelz\n\ngo 1.20\n\nreplace (\n\tgithub.com/anthhub/forwarder => github.com/tensorchord/for"
  },
  {
    "path": "go.sum",
    "chars": 119955,
    "preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1"
  },
  {
    "path": "ingress-operator/.DEREK.yml",
    "chars": 76,
    "preview": "redirect: https://raw.githubusercontent.com/openfaas/faas/master/.DEREK.yml\n"
  },
  {
    "path": "ingress-operator/.dockerignore",
    "chars": 51,
    "preview": ".git\n.github\n.vscode\n.tools\nartifacts\nexamples\nhack"
  },
  {
    "path": "ingress-operator/.gitignore",
    "chars": 348,
    "preview": "faas-o6s\n\n# Binaries for programs and plugins\n*.exe\n*.dll\n*.so\n*.dylib\n\n# Test binary, build with `go test -c`\n*.test\n\n#"
  },
  {
    "path": "ingress-operator/.tools/README.md",
    "chars": 715,
    "preview": "# Tools folder\n\nThe tools folder allows us a space to define and pin external dependencies. If they are go based tools w"
  },
  {
    "path": "ingress-operator/.tools/code-generator.mod",
    "chars": 143,
    "preview": "module _ // Fake module so that we can install code-generator separate from the project\n\ngo 1.16\n\nrequire (\n    k8s.io/c"
  },
  {
    "path": "ingress-operator/.tools/code-generator.sum",
    "chars": 18656,
    "preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ngithub.com/BurntSushi/toml v0.3.1/go."
  },
  {
    "path": "ingress-operator/.vscode/settings.json",
    "chars": 468,
    "preview": "{\n    \"go.inferGopath\": false,\n    \"cSpell.words\": [\n        \"Infof\",\n        \"appsv\",\n        \"corev\",\n        \"faas\",\n"
  },
  {
    "path": "ingress-operator/Dockerfile",
    "chars": 158,
    "preview": "FROM ubuntu:22.04\n\nLABEL maintainer=\"modelz-support@tensorchord.ai\"\n\nCOPY ingress-operator /usr/bin/ingress-operator\nENT"
  },
  {
    "path": "ingress-operator/LICENSE",
    "chars": 1116,
    "preview": "MIT License\n\nCopyright (c) 2023 TensorChord Inc.\nCopyright (c) 2017-2019 OpenFaaS Author(s)\n\nPermission is hereby grante"
  },
  {
    "path": "ingress-operator/Makefile",
    "chars": 6805,
    "preview": "# Copyright 2022 TensorChord Inc.\n#\n# The old school Makefile, following are required targets. The Makefile is written\n#"
  },
  {
    "path": "ingress-operator/artifacts/.gitignore",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "ingress-operator/artifacts/crds/tensorchord.ai_inferenceingresses.yaml",
    "chars": 3400,
    "preview": "apiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  annotations:\n    controller-gen.kubebuild"
  },
  {
    "path": "ingress-operator/artifacts/operator-amd64.yaml",
    "chars": 712,
    "preview": "---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: ingress-operator\n  namespace: openfaas\nspec:\n  replicas: 1\n  "
  },
  {
    "path": "ingress-operator/artifacts/operator-rbac.yaml",
    "chars": 1072,
    "preview": "---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: ingress-operator\n  namespace: openfaas\n---\napiVersion: rbac.au"
  },
  {
    "path": "ingress-operator/cmd/ingress-operator/main.go",
    "chars": 681,
    "preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\tcli \"github.com/urfave/cli/v2\"\n\tklog \"k8s.io/klog\"\n\n\t// required to authenticate a"
  },
  {
    "path": "ingress-operator/hack/boilerplate.go.txt",
    "chars": 138,
    "preview": "/*\nCopyright 2023 TensorChord Inc.\n\nLicensed under the MIT license. See LICENSE file in the project root for full licens"
  },
  {
    "path": "ingress-operator/hack/custom-boilerplate.go.txt",
    "chars": 140,
    "preview": "/*\nCopyright 2023 OpenFaaS Author(s)\n\nLicensed under the MIT license. See LICENSE file in the project root for full lice"
  },
  {
    "path": "ingress-operator/hack/print-codegen-version.sh",
    "chars": 279,
    "preview": "#!/bin/bash\n\n# This scripts exists primarily so that it can be used in the Makefile.\n# It is needed because the `($shell"
  },
  {
    "path": "ingress-operator/hack/update-codegen.sh",
    "chars": 1381,
    "preview": "#!/usr/bin/env bash\n\n# copied from: https://github.com/weaveworks/flagger/tree/master/hack\n\nset -o errexit\nset -o nounse"
  },
  {
    "path": "ingress-operator/hack/update-crds.sh",
    "chars": 334,
    "preview": "#!/bin/bash\n\nexport controllergen=\"$GOPATH/bin/controller-gen\"\nexport PKG=sigs.k8s.io/controller-tools/cmd/controller-ge"
  },
  {
    "path": "ingress-operator/hack/verify-codegen.sh",
    "chars": 697,
    "preview": "#!/usr/bin/env bash\n\nset -o errexit\nset -o nounset\nset -o pipefail\n\nSCRIPT_ROOT=$(git rev-parse --show-toplevel)\n\nDIFFRO"
  },
  {
    "path": "ingress-operator/pkg/apis/modelzetes/register.go",
    "chars": 60,
    "preview": "package modelzetes\n\nconst (\n\tGroupName = \"tensorchord.ai\"\n)\n"
  },
  {
    "path": "ingress-operator/pkg/apis/modelzetes/v1/doc.go",
    "chars": 132,
    "preview": "// +k8s:deepcopy-gen=package,register\n\n// Package v1 is the OpenFaaS v1 version of the API.\n// +groupName=tensorchord.ai"
  }
]

// ... and 213 more files (download for full content)

About this extraction

This page contains the full source code of the tensorchord/openmodelz GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 413 files (1.1 MB), approximately 354.2k tokens, and a symbol index with 1456 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!