Skip to content

Commit

Permalink
TerminusManifest to OlaresManifest
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleLollipop committed Nov 12, 2024
1 parent 7164eea commit 006fb4f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion internal/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const (
DataPath = "./data"
ChartsLocalDir = "./data/charts"
ChartsLocalTempDir = "./data/chartsTmp"
AppCfgFileName = "TerminusManifest.yaml"
AppCfgFileName = "OlaresManifest.yaml"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions internal/models/app_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ type AppMetaData struct {
}

type AppConfiguration struct {
ConfigVersion string `yaml:"terminusManifest.version" json:"terminusManifest.version"`
ConfigType string `yaml:"terminusManifest.type" json:"terminusManifest.type"`
ConfigVersion string `yaml:"olaresManifest.version" json:"olaresManifest.version"`
ConfigType string `yaml:"olaresManifest.type" json:"olaresManifest.type"`
Metadata AppMetaData `yaml:"metadata" json:"metadata"`
Entrances []EntranceFromCfg `yaml:"entrances" json:"entrances" bson:"entrance"`
Spec AppSpec `yaml:"spec" json:"spec"`
Expand Down
6 changes: 3 additions & 3 deletions internal/validate/appcfg_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func init() {
}

type AppConfiguration struct {
ConfigVersion string `yaml:"terminusManifest.version" json:"terminusManifest.version" vd:"len($)>0;msg:sprintf('invalid parameter: %v;terminusManifest.version must satisfy the expr: len($)>0',$)"`
ConfigVersion string `yaml:"olaresManifest.version" json:"olaresManifest.version" vd:"len($)>0;msg:sprintf('invalid parameter: %v;olaresManifest.version must satisfy the expr: len($)>0',$)"`
Metadata AppMetaData `yaml:"metadata" json:"metadata"`
Entrances []Entrance `yaml:"entrances" json:"entrances" vd:"len($)>0 && len($)<=10;msg:sprintf('invalid parameter: %v;entrances must satisfy the expr: len($)>0 && len($)<=10',$)"`
Spec AppSpec `yaml:"spec,omitempty" json:"spec,omitempty"`
Expand Down Expand Up @@ -207,7 +207,7 @@ func getAppConfigFromCfgFile(chartPath string) (*AppConfiguration, error) {
if !strings.HasSuffix(chartPath, "/") {
chartPath += "/"
}
f, err := os.Open(chartPath + "TerminusManifest.yaml")
f, err := os.Open(chartPath + "OlaresManifest.yaml")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -339,7 +339,7 @@ func CheckAppData(cfg *AppConfiguration, chartPath string) error {
scanner := bufio.NewScanner(f)
for scanner.Scan() {
if p.MatchString(scanner.Text()) {
rerr = fmt.Errorf("found .Values.userspace.appCache in %s, but not set permission.appCache in TerminusManifest.yaml", filepath.Base(path))
rerr = fmt.Errorf("found .Values.userspace.appCache in %s, but not set permission.appCache in OlaresManifest.yaml", filepath.Base(path))
}
}
}
Expand Down
36 changes: 18 additions & 18 deletions internal/validate/appcfg_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/assert"
)

const metaAndEntrance = `terminusManifest.version: v1
const metaAndEntrance = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand All @@ -27,13 +27,13 @@ entrances:
title: nginx
`
const metaAndEntranceWithoutMeta = `terminusManifest.version: v1
const metaAndEntranceWithoutMeta = `olaresManifest.version: v1
entrances:
- name: nginx-service
port: 80
title: nginx
`
const metaAndEntranceWithoutEntrance = `terminusManifest.version: v1
const metaAndEntranceWithoutEntrance = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand All @@ -45,7 +45,7 @@ metadata:
- utils
`

const appSpec = `terminusManifest.version: v1
const appSpec = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand All @@ -68,7 +68,7 @@ spec:
limitedCpu: 500m
`

const appCfgWithPermission = `terminusManifest.version: v1
const appCfgWithPermission = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -98,7 +98,7 @@ Permission:
ops:
- get
`
const appCfgWithPermissionWithEmptyOps = `terminusManifest.version: v1
const appCfgWithPermissionWithEmptyOps = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -126,7 +126,7 @@ Permission:
dataType: sys
version: v1
`
const appCfgWithMiddleware = `terminusManifest.version: v1
const appCfgWithMiddleware = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -169,7 +169,7 @@ middleware:
- name: index0
`

const appCfgWithMiddlewareWithMultiRedisDb = `terminusManifest.version: v1
const appCfgWithMiddlewareWithMultiRedisDb = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -213,7 +213,7 @@ middleware:
- name: index0
`

const appCfgWithOptionsWithPolicy = `terminusManifest.version: v1
const appCfgWithOptionsWithPolicy = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -241,7 +241,7 @@ options:
oneTime: false
validDuration: "3600s"
`
const appCfgWithOptionsWithPolicyDuration1 = `terminusManifest.version: v1
const appCfgWithOptionsWithPolicyDuration1 = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -269,7 +269,7 @@ options:
oneTime: false
validDuration: "1h1h"
`
const appCfgWithOptionsWithPolicyDuration2 = `terminusManifest.version: v1
const appCfgWithOptionsWithPolicyDuration2 = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -298,7 +298,7 @@ options:
validDuration: "-1h5ms5us8ns"
`

const appCfgWithOptionsWithPolicyDuration3 = `terminusManifest.version: v1
const appCfgWithOptionsWithPolicyDuration3 = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -327,7 +327,7 @@ options:
validDuration: "100"
`

const appCfgWithOptionsWithAnalytics = `terminusManifest.version: v1
const appCfgWithOptionsWithAnalytics = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand All @@ -353,7 +353,7 @@ options:
enabled: true
`

const appCfgWithOptionsWithDependencies = `terminusManifest.version: v1
const appCfgWithOptionsWithDependencies = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -384,7 +384,7 @@ options:
type: application
`

const appCfgWithOptionsWithDependenciesErrorType = `terminusManifest.version: v1
const appCfgWithOptionsWithDependenciesErrorType = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -415,7 +415,7 @@ options:
type: applications
`

const appCfgWithAll = `terminusManifest.version: v1
const appCfgWithAll = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -481,7 +481,7 @@ options:
type: application
`

const appCfgWith11Entrances = `terminusManifest.version: v1
const appCfgWith11Entrances = `olaresManifest.version: v1
metadata:
name: nginx
description: "n8n is an extendable workflow automation tool."
Expand Down Expand Up @@ -635,7 +635,7 @@ func TestChartAppCfg(t *testing.T) {
err = vd.Validate(cfg, true)
err = checkAppCfg(cfg, "./testdata/nextcloud2")
if err != nil {
t.Error("TerminusManifest.yaml validate failed", err)
t.Error("olaresManifest.yaml validate failed", err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/validate/resource_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ func checkResourceLimit(resources kube.ResourceList, cfg *AppConfiguration) erro
}
}
if limitCPU > appLimitedCPU {
errs = append(errs, fmt.Errorf("sum of all containers resources limits cpu should less than TerminusManifest.yaml spec.limitedCpu"))
errs = append(errs, fmt.Errorf("sum of all containers resources limits cpu should less than OlaresManifest.yaml spec.limitedCpu"))
}
if limitMemory > appLimitedMemory {
errs = append(errs, fmt.Errorf("sum of all containers resources limits memory should less than TerminusManifest.yaml spec.limitedMemory"))
errs = append(errs, fmt.Errorf("sum of all containers resources limits memory should less than OlaresManifest.yaml spec.limitedMemory"))
}
return AggregateErr(errs)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/apiserver/service/v1/handler_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ func validChart(chartDir string, info *models.ApplicationInfo) (err error) {
switch info.CfgType {
case constants.AppType:
case constants.RecommendType, constants.AgentType, constants.ModelType, constants.MiddlewareType: //todo
glog.Infof("terminusManifest.type:%s do not check chart", info.CfgType)
glog.Infof("olaresManifest.type:%s do not check chart", info.CfgType)
return
default:
err = fmt.Errorf("terminusManifest.type %s must in %v", info.CfgType, constants.ValidTypes)
err = fmt.Errorf("olaresManifest.type %s must in %v", info.CfgType, constants.ValidTypes)
return
}

Expand Down

0 comments on commit 006fb4f

Please sign in to comment.