mirror of
https://github.com/hanzoai/ai.git
synced 2026-11-20 14:13:23 +00:00
github.com/hanzoai/ai/object is the record layer. Seven of its files were not records: they built client-go clients, ran an informer cache, polled the metrics API, rendered manifests through kustomize and applied them. Importing an Application row therefore linked a Kubernetes control plane. They move to github.com/hanzoai/ai/cluster, which owns everything the product does against a cluster: render, apply, observe. object keeps the values — ApplicationView and its nested types are plain data with no k8s types in them, so Application.Details keeps its exact static type and the /v1/get-application wire shape is unchanged. The Status constants become their own string literals rather than aliases of core/v1 pod phases. Two braids come apart with the move: UpdateApplication recomputed the manifest from the template on every write, so a status or URL update re-ran kustomize. It now writes the record; cluster.Manifest renders, and the four callers that want a fresh manifest render first. DeleteApplication raced a fire-and-forget undeploy goroutine against its own row delete. The controllers now tear down first, best-effort, then drop the row — an org with no Kubernetes provider still deletes its applications. RegisterServedModel, which writes the Provider and ModelRoute for a served fine-tune, is a record write and stays in object; it was the one place reaching adapter.db from the moved files. No route, opcode, swagger path or admin page changes. Names lose the stutter the package qualifier now carries: GetK8sStatus is cluster.Status, AddDetails is cluster.Describe, DeployApplicationSync is cluster.DeploySync, GetFinetuneTrainJobStatus is cluster.TrainJobStatus. object drops 538 packages, 1799 to 1261: all 412 k8s.io, all 84 sigs.k8s.io, and with kustomize gone the `plugin` package, which forces --export-dynamic on every binary that links it. Co-authored-by: Hanzo Dev <[email protected]>
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
// Copyright 2023-2025 Hanzo AI Inc. All Rights Reserved.
|
|
// Portions Copyright 2025 The OpenAgent Authors. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package controllers
|
|
|
|
import (
|
|
"github.com/hanzoai/ai/cluster"
|
|
)
|
|
|
|
// GetK8sStatus
|
|
// @Title GetK8sStatus
|
|
// @Tag Deployment API
|
|
// @Description get kubernetes cluster status
|
|
// @Success 200 {object} object.K8sStatus The Response object
|
|
// @router /get-k8s-status [get]
|
|
func (c *ApiController) GetK8sStatus() {
|
|
if !c.RequireSuperAdmin() {
|
|
return
|
|
}
|
|
status, err := cluster.Status(c.GetAcceptLanguage())
|
|
if err != nil {
|
|
c.ResponseError(err.Error())
|
|
return
|
|
}
|
|
|
|
c.ResponseOk(status)
|
|
}
|