forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
converterfromosaapi.go
68 lines (61 loc) · 2.03 KB
/
converterfromosaapi.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
package api
import (
"github.com/Azure/acs-engine/pkg/api/osa/vlabs"
)
// ConvertVLabsOpenShiftClusterToContainerService converts from a
// vlabs.OpenShiftCluster to a ContainerService.
func ConvertVLabsOpenShiftClusterToContainerService(oc *vlabs.OpenShiftCluster) *ContainerService {
cs := &ContainerService{
ID: oc.ID,
Location: oc.Location,
Name: oc.Name,
Tags: oc.Tags,
Type: oc.Type,
}
if oc.Plan != nil {
cs.Plan = &ResourcePurchasePlan{
Name: oc.Plan.Name,
Product: oc.Plan.Product,
PromotionCode: oc.Plan.PromotionCode,
Publisher: oc.Plan.Publisher,
}
}
if oc.Properties != nil {
cs.Properties = &Properties{
ProvisioningState: ProvisioningState(oc.Properties.ProvisioningState),
OrchestratorProfile: &OrchestratorProfile{
OrchestratorVersion: oc.Properties.OpenShiftVersion,
OpenShiftConfig: &OpenShiftConfig{
PublicHostname: oc.Properties.PublicHostname,
},
},
MasterProfile: &MasterProfile{
FQDN: oc.Properties.FQDN,
},
ServicePrincipalProfile: &ServicePrincipalProfile{
ClientID: oc.Properties.ServicePrincipalProfile.ClientID,
Secret: oc.Properties.ServicePrincipalProfile.Secret,
},
}
cs.Properties.OrchestratorProfile.OpenShiftConfig.RouterProfiles = make([]OpenShiftRouterProfile, len(oc.Properties.RouterProfiles))
for i, rp := range oc.Properties.RouterProfiles {
cs.Properties.OrchestratorProfile.OpenShiftConfig.RouterProfiles[i] = OpenShiftRouterProfile{
Name: rp.Name,
PublicSubdomain: rp.PublicSubdomain,
FQDN: rp.FQDN,
}
}
cs.Properties.AgentPoolProfiles = make([]*AgentPoolProfile, len(oc.Properties.AgentPoolProfiles))
for i, app := range oc.Properties.AgentPoolProfiles {
cs.Properties.AgentPoolProfiles[i] = &AgentPoolProfile{
Name: app.Name,
Count: app.Count,
VMSize: app.VMSize,
OSType: OSType(app.OSType),
VnetSubnetID: app.VnetSubnetID,
Role: AgentPoolProfileRole(app.Role),
}
}
}
return cs
}