feat: complete E2E deployment flow with storage layered config and values template versioning
- Instance deployment: charts browser, deploy modal, instances list - Values Template version management (create/history/rollback) - Storage layered config (cluster > workspace > shared priority) - Cluster credential decryptIfNeeded for mixed encrypted/plaintext kubeconfig - YAML syntax validation (client-side + server-side warning) - Frontend: charts, instances, storage, templates, admin pages - Backend: storage service, instance service, cluster service, helm client - Multi-Tenant Kubeconfig.md: added by user
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// InstanceStatus 实例状态
|
||||
@ -103,9 +106,31 @@ func (i *Instance) SetValues(values map[string]interface{}) {
|
||||
i.UpdatedAt = time.Now()
|
||||
}
|
||||
|
||||
// SetValuesYAML 设置 YAML 格式的 Values
|
||||
func (i *Instance) SetValuesYAML(yaml string) {
|
||||
i.ValuesYAML = yaml
|
||||
// SetValuesYAML 设置 YAML 格式的 Values 并解析到 Values map
|
||||
func (i *Instance) SetValuesYAML(yamlStr string) {
|
||||
i.ValuesYAML = yamlStr
|
||||
if yamlStr == "" {
|
||||
return
|
||||
}
|
||||
// 解析 YAML 到 map,确保 Helm 客户端能正确使用
|
||||
var parsed map[string]interface{}
|
||||
if err := yaml.Unmarshal([]byte(yamlStr), &parsed); err != nil {
|
||||
log.Printf("[SetValuesYAML] WARNING: failed to parse YAML for instance %s: %s, yaml=%q", i.Name, err, yamlStr)
|
||||
return
|
||||
}
|
||||
if parsed == nil {
|
||||
return
|
||||
}
|
||||
// Merge into existing Values (user-provided takes precedence)
|
||||
if i.Values == nil {
|
||||
i.Values = make(map[string]interface{})
|
||||
}
|
||||
for k, v := range parsed {
|
||||
// Only set if not already present (Values map takes precedence over YAML fallback)
|
||||
if _, exists := i.Values[k]; !exists {
|
||||
i.Values[k] = v
|
||||
}
|
||||
}
|
||||
i.UpdatedAt = time.Now()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user