@@ -20,11 +20,15 @@ import (
2020 apps "k8s.io/api/apps/v1"
2121 corev1 "k8s.io/api/core/v1"
2222
23+ identity_api "yunion.io/x/onecloud/pkg/apis/identity"
24+ "yunion.io/x/onecloud/pkg/cloudcommon/options"
25+
2326 "yunion.io/x/onecloud-operator/pkg/apis/constants"
2427 "yunion.io/x/onecloud-operator/pkg/apis/onecloud/v1alpha1"
2528 "yunion.io/x/onecloud-operator/pkg/controller"
2629 "yunion.io/x/onecloud-operator/pkg/manager"
2730 "yunion.io/x/onecloud-operator/pkg/service-init/component"
31+ "yunion.io/x/onecloud-operator/pkg/util/option"
2832)
2933
3034const (
@@ -34,9 +38,15 @@ const (
3438 yunion . {
3539 sql_connection mysql+pymysql://{{.DBUser}}:{{.DBPassword}}@{{.DBHost}}:{{.DBPort}}/{{.DBName}}?charset=utf8
3640 dns_domain {{.DNSDomain}}
41+ auth_url {{.AuthURL}}
42+ admin_user {{.AdminUser}}
43+ admin_domain {{.AdminDomain}}
44+ admin_password {{.AdminPassword}}
45+ admin_project {{.AdminProject}}
46+ admin_project_domain {{.AdminProjectDomain}}
3747 region {{.Region}}
38- k8s_skip
39- fallthrough .
48+ {{if .InCloudOnly}}in_cloud_only
49+ {{end}} fallthrough .
4050 }
4151
4252 {{- range .Proxies }}
@@ -53,15 +63,20 @@ const (
5363)
5464
5565type RegionDNSConfig struct {
66+ options.CommonOptions
67+
5668 DBUser string
5769 DBPassword string
5870 DBHost string
5971 DBPort int32
6072 DBName string
61- DNSDomain string
62- Region string
73+
74+ DNSDomain string
75+ // Region string
6376
6477 Proxies []RegionDNSProxy
78+
79+ InCloudOnly bool
6580}
6681
6782type RegionDNSProxy struct {
@@ -130,16 +145,28 @@ func (m *regionDNSManager) getConfigMap(oc *v1alpha1.OnecloudCluster, cfg *v1alp
130145 DBHost : db .Host ,
131146 DBPort : db .Port ,
132147 DBName : regionDB .Database ,
133- DNSDomain : regionSpec .DNSDomain ,
134- Region : oc .GetRegion (),
135- Proxies : proxies ,
148+
149+ DNSDomain : regionSpec .DNSDomain ,
150+
151+ Proxies : proxies ,
152+
153+ InCloudOnly : spec .InCloudOnly ,
154+ }
155+ config .Region = oc .GetRegion ()
156+ option .SetServiceCommonOptions (& config .CommonOptions , oc , cfg .RegionServer .ServiceDBCommonOptions .ServiceCommonOptions )
157+ if len (config .AdminProjectDomain ) == 0 {
158+ config .AdminProjectDomain = identity_api .DEFAULT_DOMAIN_NAME
159+ }
160+ if len (config .AdminDomain ) == 0 {
161+ config .AdminDomain = identity_api .DEFAULT_DOMAIN_NAME
136162 }
137163 content , err := config .GetContent ()
138164 if err != nil {
139165 return nil , false , err
140166 }
141167 oc .Spec .RegionDNS = spec
142- return m .newConfigMap (cType , "" , oc , content ), false , nil
168+ // always update configmaps
169+ return m .newConfigMap (cType , "" , oc , content ), true , nil
143170}
144171
145172func (m * regionDNSManager ) getService (oc * v1alpha1.OnecloudCluster , cfg * v1alpha1.OnecloudClusterConfig , zone string ) []* corev1.Service {
0 commit comments