This repository has been archived by the owner on Jul 12, 2018. It is now read-only.
/
clock_global.go
137 lines (124 loc) · 3.68 KB
/
clock_global.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package cloudfoundry
import (
"gopkg.in/yaml.v2"
"github.com/enaml-ops/enaml"
"github.com/enaml-ops/omg-product-bundle/products/oss_cf/enaml-gen/cloud_controller_clock"
"github.com/enaml-ops/omg-product-bundle/products/oss_cf/enaml-gen/cloud_controller_ng"
"github.com/enaml-ops/omg-product-bundle/products/oss_cf/plugin/config"
)
type clockGlobal struct {
Metron *Metron
Config *config.Config
}
func NewClockGlobalPartition(config *config.Config) InstanceGroupCreator {
cg := &clockGlobal{
Config: config,
Metron: NewMetron(config),
}
return cg
}
func (c *clockGlobal) ToInstanceGroup() *enaml.InstanceGroup {
ig := &enaml.InstanceGroup{
Name: "clock_global-partition",
Instances: 1,
VMType: c.Config.ClockGlobalVMType,
AZs: c.Config.AZs,
Stemcell: c.Config.StemcellName,
Networks: []enaml.Network{
{Name: c.Config.NetworkName},
},
Update: enaml.Update{
MaxInFlight: 1,
},
}
metronJob := c.Metron.CreateJob()
ccw := newCloudControllerNgJob(NewCloudControllerPartition(c.Config).(*CloudControllerPartition))
props := ccw.Properties.(*cloud_controller_ng.CloudControllerNgJob)
ig.AddJob(c.newCloudControllerClockJob(props))
ig.AddJob(&metronJob)
return ig
}
func (c *clockGlobal) newCloudControllerClockJob(ccng *cloud_controller_ng.CloudControllerNgJob) *enaml.InstanceJob {
props := &cloud_controller_clock.CloudControllerClockJob{
Domain: c.Config.SystemDomain,
SystemDomain: c.Config.SystemDomain,
SystemDomainOrganization: "system",
AppDomains: c.Config.AppDomains,
Cc: &cloud_controller_clock.Cc{},
Ccdb: &cloud_controller_clock.Ccdb{
Address: c.Config.MySQLProxyHost(),
Port: 3306,
DbScheme: "mysql",
Roles: []map[string]interface{}{
{
"name": c.Config.CCDBUsername,
"password": c.Config.CCDBPassword,
"tag": "admin",
},
},
Databases: []map[string]interface{}{
map[string]interface{}{
"citext": true,
"name": "ccdb",
"tag": "cc",
},
},
},
Uaa: &cloud_controller_clock.Uaa{
Url: prefixSystemDomain(c.Config.SystemDomain, "uaa"),
Jwt: &cloud_controller_clock.Jwt{
VerificationKey: c.Config.JWTVerificationKey,
},
Clients: &cloud_controller_clock.Clients{
CcServiceDashboards: &cloud_controller_clock.CcServiceDashboards{
Secret: c.Config.CCServiceDashboardsClientSecret,
},
},
},
LoggerEndpoint: &cloud_controller_clock.LoggerEndpoint{
Port: 443,
},
Ssl: &cloud_controller_clock.Ssl{
SkipCertVerify: c.Config.SkipSSLCertVerify,
},
Nats: &cloud_controller_clock.Nats{
User: c.Config.NATSUser,
Password: c.Config.NATSPassword,
Port: c.Config.NATSPort,
Machines: c.Config.NATSMachines,
},
}
job := &enaml.InstanceJob{
Name: "cloud_controller_clock",
Release: CFReleaseName,
Properties: props,
}
ccYaml, _ := yaml.Marshal(ccng.Cc)
yaml.Unmarshal(ccYaml, props.Cc)
props.Cc.QuotaDefinitions = map[string]interface{}{
"default": map[string]interface{}{
"memory_limit": 10240,
"total_services": 100,
"non_basic_services_allowed": true,
"total_routes": 1000,
"trial_db_allowed": true,
},
"runaway": map[string]interface{}{
"memory_limit": 102400,
"total_services": -1,
"non_basic_services_allowed": true,
"total_routes": 1000,
},
}
props.Cc.SecurityGroupDefinitions = []map[string]interface{}{
map[string]interface{}{"name": "all_open",
"rules": []map[string]interface{}{
map[string]interface{}{
"protocol": "all",
"destination": "0.0.0.0-255.255.255.255",
},
},
},
}
return job
}