Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 9 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ require (
k8s.io/apimachinery v0.26.2
k8s.io/client-go v0.26.2
k8s.io/klog v0.3.3
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
yunion.io/x/jsonutils v1.0.1-0.20260917025845-3108cd9a32ea
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
yunion.io/x/onecloud v0.0.0-20260714035258-73d7cbbb1f53
yunion.io/x/pkg v1.10.4-0.20260422030155-01b100134978
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
yunion.io/x/onecloud v0.0.0-20260922165722-171561b0780b
yunion.io/x/pkg v1.10.4-0.20260918012554-27cd9d2e093b
yunion.io/x/structarg v0.0.0-20260917033311-96c7653334ac
)

require (
Expand All @@ -48,18 +48,19 @@ require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/go-yaml/yaml v2.1.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-plus/errors v1.0.0 // indirect
github.com/golang-plus/uuid v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
Expand Down Expand Up @@ -141,10 +142,10 @@ require (
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260713095312-995dd1831cd6 // indirect
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260916101519-866f1e3144cf // indirect
yunion.io/x/executor v0.0.0-20260312022053-f538abd2b005 // indirect
yunion.io/x/s3cli v0.0.0-20241221171442-1c11599d28e1 // indirect
yunion.io/x/sqlchemy v1.1.3-0.20251231025938-b0a38f6e9fab // indirect
yunion.io/x/sqlchemy v1.1.3-0.20260917035232-d682485b3a12 // indirect
)

replace (
Expand Down
206 changes: 188 additions & 18 deletions go.sum

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions pkg/apis/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ const (
MonitorLoki = "monitor-loki"
MonitorPrometheus = "prometheus-monitor-monitor-stack-prometheus"

MonitorBucketThanos = "thanos"
MonitorBucketLoki = "loki"
MonitorBucketAiProxy = "aiproxy-log"
MonitorBucketAiProxyRetentionDays = 90
MonitorBucketThanos = "thanos"
MonitorBucketLoki = "loki"
MonitorBucketAiProxy = "aiproxy-log"
MonitorBucketAiProxyRetentionDays = 90
)

const (
Expand Down Expand Up @@ -411,9 +411,11 @@ const (
ServiceTypeScheduledtask = "scheduledtask"
ScheduledtaskPort = 30978

ServiceNameAPIMap = "apimap"
ServiceTypeAPIMap = "apimap"
APIMapPort = 31999
ServiceNameApiMap = "apimap"
ServiceTypeApiMap = "apimap"
ApiMapAdminUser = "apimapadmin"
ApiMapAdminProject = SysAdminProject
ApiMapPort = 31999

ServiceNameReport = "report"
ServiceTypeReport = "report"
Expand Down
7 changes: 3 additions & 4 deletions pkg/apis/onecloud/v1alpha1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func SetDefaults_OnecloudClusterSpec(obj *OnecloudClusterSpec, isEE bool, isEEOr
SuggestionComponentType: nHP(&obj.Suggestion.DeploymentSpec, useHyperImage),
ScheduledtaskComponentType: nHP(&obj.Scheduledtask.DeploymentSpec, useHyperImage),
ReportComponentType: nHP(&obj.Report.DeploymentSpec, useHyperImage),
APIMapComponentType: nHP(&obj.APIMap.DeploymentSpec, useHyperImage),
ApiMapComponentType: nHP(&obj.ApiMap.DeploymentSpec, useHyperImage),
BastionHostComponentType: nHP(&obj.BastionHost.DeploymentSpec, useHyperImage),
ExtdbComponentType: nHP(&obj.Extdb.DeploymentSpec, useHyperImage),
BillingComponentType: nHP(&obj.Billing.DeploymentSpec, useHyperImage),
Expand All @@ -224,8 +224,6 @@ func SetDefaults_OnecloudClusterSpec(obj *OnecloudClusterSpec, isEE bool, isEEOr
spec.Supported, isEE,
))
}
// disable the apimap service defaultly
obj.APIMap.Disable = true

// CE or EE parts
for cType, spec := range map[ComponentType]*hyperImagePair{
Expand Down Expand Up @@ -493,7 +491,7 @@ func setDefaults_Components_ServicePort(obj *OnecloudClusterSpec) {
newSP(&obj.VictoriaMetrics.Service, constants.VictoriaMetricsPort),
newSP(&obj.Monitor.Service, constants.MonitorPort),
newSP(&obj.Scheduledtask.Service, constants.ScheduledtaskPort),
newSP(&obj.APIMap.Service, constants.APIMapPort),
newSP(&obj.ApiMap.Service, constants.ApiMapPort),
newSP(&obj.Report.Service, constants.ReportPort),
newSP(&obj.APIGateway.APIService, constants.APIGatewayPort),
newSP(&obj.APIGateway.WSService, constants.APIWebsocketPort),
Expand Down Expand Up @@ -808,6 +806,7 @@ func SetDefaults_OnecloudClusterConfig(obj *OnecloudClusterConfig) {
&obj.S3gateway: {constants.S3gatewayAdminUser, constants.S3gatewayPort},
&obj.EsxiAgent.ServiceCommonOptions: {constants.EsxiAgentAdminUser, constants.EsxiAgentPort},
&obj.VpcAgent.ServiceCommonOptions: {constants.VpcAgentAdminUser, constants.VpcAgentPort},
&obj.ApiMap.ServiceCommonOptions: {constants.ApiMapAdminUser, constants.ApiMapPort},
&obj.ServiceOperator: {constants.ServiceOperatorAdminUser, constants.ServiceOperatorPort},
&obj.Lbagent.ServiceCommonOptions: {constants.LbagentAdminUser, constants.LbagentPort},
&obj.McpServer.ServiceCommonOptions: {constants.McpServerAdminUser, constants.McpServerPort},
Expand Down
13 changes: 10 additions & 3 deletions pkg/apis/onecloud/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const (

ScheduledtaskComponentType ComponentType = "scheduledtask"

APIMapComponentType ComponentType = "apimap"
ApiMapComponentType ComponentType = "apimap"

MonitorStackComponentType ComponentType = "monitor-stack"

Expand Down Expand Up @@ -348,7 +348,8 @@ type OnecloudClusterSpec struct {
MonitorStack MonitorStackSpec `json:"monitorStack"`

Scheduledtask DeploymentServicePortSpec `json:"scheduledtask"`
APIMap DeploymentServicePortSpec `json:"apiMap"`

ApiMap DeploymentServicePortSpec `json:"apimap"`

Report DeploymentServicePortSpec `json:"report"`
EChartsSSR EChartsSSRSpec `json:"echartsSSR"`
Expand Down Expand Up @@ -415,7 +416,7 @@ type OnecloudClusterStatus struct {
Cloudmon DeploymentStatus `json:"cloudmon,omitempty"`
MonitorStack MonitorStackStatus `json:"monitorStack,omitempty"`
Scheduledtask DeploymentStatus `json:"scheduledtask,omitempty"`
APIMap DeploymentStatus `json:"apiMap,omitempty"`
APIMap DeploymentStatus `json:"apimap,omitempty"`
Report DeploymentStatus `json:"report,omitempty"`
ECharts DeploymentStatus `json:"echarts,omitempty"`
BastionHost DeploymentStatus `json:"bastionHost,omitempty"`
Expand Down Expand Up @@ -646,6 +647,7 @@ type WebconsoleSpec struct {

type DeploymentServicePortSpec struct {
DeploymentSpec

Service ServiceSpec `json:"service"`
DbEngine TDBEngineType `json:"db_engine"`
}
Expand Down Expand Up @@ -1230,6 +1232,10 @@ type VpcAgentConfig struct {
ServiceCommonOptions
}

type APIMapConfig struct {
ServiceCommonOptions
}

type ItsmConfig struct {
ServiceDBCommonOptions
SecondDatabase string `json:"secondDatabase"`
Expand Down Expand Up @@ -1290,4 +1296,5 @@ type OnecloudClusterConfig struct {
LLM ServiceDBCommonOptions `json:"llm"`
McpServer ServiceDBCommonOptions `json:"mcpServer"`
AiProxy ServiceDBCommonOptions `json:"aiproxy"`
ApiMap APIMapConfig `json:"apimap"`
}
30 changes: 29 additions & 1 deletion pkg/apis/onecloud/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 34 additions & 15 deletions pkg/manager/component/apimap.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@
package component

import (
"path"

apps "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"

"yunion.io/x/pkg/errors"

"yunion.io/x/onecloud/pkg/apimap/options"
"yunion.io/x/onecloud/pkg/mcclient"

"yunion.io/x/onecloud-operator/pkg/apis/constants"
"yunion.io/x/onecloud-operator/pkg/apis/onecloud/v1alpha1"
"yunion.io/x/onecloud-operator/pkg/controller"
"yunion.io/x/onecloud-operator/pkg/manager"
"yunion.io/x/onecloud-operator/pkg/service-init/component"
"yunion.io/x/onecloud-operator/pkg/util/onecloud"
"yunion.io/x/onecloud-operator/pkg/util/option"
)

type apiMapManager struct {
Expand All @@ -42,42 +43,60 @@ func (m *apiMapManager) getProductVersions() []v1alpha1.ProductVersion {
return []v1alpha1.ProductVersion{
v1alpha1.ProductVersionFullStack,
v1alpha1.ProductVersionEdge,
v1alpha1.ProductVersionLightEdge,
v1alpha1.ProductVersionAI,
}
}

func (m *apiMapManager) GetComponentType() v1alpha1.ComponentType {
return v1alpha1.APIMapComponentType
return v1alpha1.ApiMapComponentType
}

func (m *apiMapManager) IsDisabled(oc *v1alpha1.OnecloudCluster) bool {
return oc.Spec.APIMap.Disable || !isInProductVersion(m, oc)
return oc.Spec.ApiMap.Disable || !isInProductVersion(m, oc)
}

func (m *apiMapManager) GetServiceName() string {
return constants.ServiceNameAPIMap
return constants.ServiceNameApiMap
}

func (m *apiMapManager) Sync(oc *v1alpha1.OnecloudCluster) error {
return syncComponent(m, oc, "")
}

func (m *apiMapManager) getPhaseControl(man controller.ComponentManager, zone string) controller.PhaseControl {
return component.NewAPIMap().GetPhaseControl(man)
func (m *apiMapManager) getCloudUser(cfg *v1alpha1.OnecloudClusterConfig) *v1alpha1.CloudUser {
return &cfg.ApiMap.CloudUser
}

func (m *apiMapManager) getConfigMap(oc *v1alpha1.OnecloudCluster, cfg *v1alpha1.OnecloudClusterConfig, zone string) (*corev1.ConfigMap, bool, error) {
opt, err := component.NewAPIMap().GetConfig(oc, cfg)
if err != nil {
return nil, false, errors.Wrap(err, "apimap: SetOptionsDefault")
opts := options.GetOptions()
if err := option.SetOptionsDefault(opts, constants.ServiceTypeApiMap); err != nil {
return nil, false, err
}
return m.newServiceConfigMap(v1alpha1.APIMapComponentType, "", oc, opt), false, nil
config := cfg.ApiMap
option.SetOptionsServiceTLS(&opts.BaseOptions, false)
option.SetServiceCommonOptions(&opts.CommonOptions, oc, config.ServiceCommonOptions, cfg.CommonConfig)
opts.SslCertfile = path.Join(constants.CertDir, constants.ServiceCertName)
opts.SslKeyfile = path.Join(constants.CertDir, constants.ServiceKeyName)
opts.Port = constants.ApiMapPort
return m.newServiceConfigMap(v1alpha1.ApiMapComponentType, "", oc, opts), false, nil
// return m.shouldSyncConfigmap(oc, v1alpha1.ApiMapComponentType, opts, nil)
}

func (m *apiMapManager) getPhaseControl(man controller.ComponentManager, zone string) controller.PhaseControl {
return controller.NewRegisterEndpointComponent(man,
v1alpha1.ApiMapComponentType,
constants.ServiceNameApiMap,
constants.ServiceTypeApiMap,
man.GetCluster().Spec.ApiMap.Service.NodePort, "")
}

func (m *apiMapManager) getService(oc *v1alpha1.OnecloudCluster, cfg *v1alpha1.OnecloudClusterConfig, zone string) []*corev1.Service {
return m.newSinglePortService(v1alpha1.APIMapComponentType, oc, oc.Spec.APIMap.Service.InternalOnly, int32(oc.Spec.APIMap.Service.NodePort), constants.APIMapPort, oc.Spec.APIMap.SlaveReplicas > 0)
return m.newSinglePortService(v1alpha1.ApiMapComponentType, oc, oc.Spec.ApiMap.Service.InternalOnly, int32(oc.Spec.ApiMap.Service.NodePort), constants.ApiMapPort, oc.Spec.ApiMap.SlaveReplicas > 0)
}

func (m *apiMapManager) getDeployment(oc *v1alpha1.OnecloudCluster, cfg *v1alpha1.OnecloudClusterConfig, zone string) (*apps.Deployment, error) {
return m.newCloudServiceSinglePortDeployment(v1alpha1.APIMapComponentType, "", oc, &oc.Spec.APIMap.DeploymentSpec, constants.APIMapPort, false, false)
return m.newCloudServiceSinglePortDeployment(v1alpha1.ApiMapComponentType, "", oc, &oc.Spec.ApiMap.DeploymentSpec, constants.ApiMapPort, false, false)
}

func (m *apiMapManager) getDeploymentStatus(oc *v1alpha1.OnecloudCluster, zone string) *v1alpha1.DeploymentStatus {
Expand All @@ -97,7 +116,7 @@ func (m *apiMapManager) getMcclientSyncFunc(oc *v1alpha1.OnecloudCluster) func(*
if m.IsDisabled(oc) {
return onecloud.EnsureDisableService(s, m.GetServiceName())
} else {
return onecloud.EnsureEnableService(s, m.GetServiceName(), m.supportsReadOnlyService() && oc.Spec.APIMap.SlaveReplicas > 0)
return onecloud.EnsureEnableService(s, m.GetServiceName(), m.supportsReadOnlyService() && oc.Spec.ApiMap.SlaveReplicas > 0)
}
}
}
2 changes: 1 addition & 1 deletion pkg/manager/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ func (m *ComponentManager) shouldSyncConfigmap(
if oldCfgMap != nil {
optStr, ok := oldCfgMap.Data["config"]
if ok {
if cond(optStr) {
if cond != nil && cond(optStr) {
return cfgMap, true, nil
}
}
Expand Down
9 changes: 3 additions & 6 deletions pkg/manager/component/vpcagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ package component
import (
"fmt"
"path"
"strings"

apps "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"

"yunion.io/x/log"

"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/vpcagent/options"

Expand Down Expand Up @@ -90,8 +87,8 @@ func (m *vpcAgentManager) getConfigMap(oc *v1alpha1.OnecloudCluster, cfg *v1alph
opts.SslCertfile = path.Join(constants.CertDir, constants.ServiceCertName)
opts.SslKeyfile = path.Join(constants.CertDir, constants.ServiceKeyName)
opts.Port = constants.VpcAgentPort
// return m.newServiceConfigMap(v1alpha1.VpcAgentComponentType, "", oc, opts), false, nil
return m.shouldSyncConfigmap(oc, v1alpha1.VpcAgentComponentType, opts, func(oldOpt string) bool {
return m.newServiceConfigMap(v1alpha1.VpcAgentComponentType, "", oc, opts), false, nil
/*return m.shouldSyncConfigmap(oc, v1alpha1.VpcAgentComponentType, opts, func(oldOpt string) bool {
for _, k := range []string{
"fetch_data_from_compute_service: false",
} {
Expand All @@ -102,7 +99,7 @@ func (m *vpcAgentManager) getConfigMap(oc *v1alpha1.OnecloudCluster, cfg *v1alph
}
}
return false
})
})*/
}

func (m *vpcAgentManager) getPhaseControl(man controller.ComponentManager, zone string) controller.PhaseControl {
Expand Down
Loading
Loading