forked from Azure/acs-engine
/
mocks.go
89 lines (76 loc) · 3.87 KB
/
mocks.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
package api
import (
"github.com/Azure/acs-engine/pkg/helpers"
"github.com/satori/go.uuid"
)
// CreateMockContainerService returns a mock container service for testing purposes
func CreateMockContainerService(containerServiceName, orchestratorVersion string, masterCount, agentCount int, certs bool) *ContainerService {
cs := ContainerService{}
cs.ID = uuid.NewV4().String()
cs.Location = "eastus"
cs.Name = containerServiceName
cs.Properties = &Properties{}
cs.Properties.MasterProfile = &MasterProfile{}
cs.Properties.MasterProfile.Count = masterCount
cs.Properties.MasterProfile.DNSPrefix = "testmaster"
cs.Properties.MasterProfile.VMSize = "Standard_D2_v2"
cs.Properties.AgentPoolProfiles = []*AgentPoolProfile{}
agentPool := &AgentPoolProfile{}
agentPool.Count = agentCount
agentPool.Name = "agentpool1"
agentPool.VMSize = "Standard_D2_v2"
agentPool.OSType = "Linux"
agentPool.AvailabilityProfile = "AvailabilitySet"
agentPool.StorageProfile = "StorageAccount"
cs.Properties.AgentPoolProfiles = append(cs.Properties.AgentPoolProfiles, agentPool)
cs.Properties.LinuxProfile = &LinuxProfile{
AdminUsername: "azureuser",
SSH: struct {
PublicKeys []PublicKey `json:"publicKeys"`
}{},
}
cs.Properties.LinuxProfile.AdminUsername = "azureuser"
cs.Properties.LinuxProfile.SSH.PublicKeys = append(
cs.Properties.LinuxProfile.SSH.PublicKeys, PublicKey{KeyData: "test"})
cs.Properties.ServicePrincipalProfile = &ServicePrincipalProfile{}
cs.Properties.ServicePrincipalProfile.ClientID = "DEC923E3-1EF1-4745-9516-37906D56DEC4"
cs.Properties.ServicePrincipalProfile.Secret = "DEC923E3-1EF1-4745-9516-37906D56DEC4"
cs.Properties.OrchestratorProfile = &OrchestratorProfile{}
cs.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
cs.Properties.OrchestratorProfile.OrchestratorVersion = orchestratorVersion
cs.Properties.OrchestratorProfile.KubernetesConfig = &KubernetesConfig{
EnableSecureKubelet: helpers.PointerToBool(DefaultSecureKubeletEnabled),
EnableRbac: helpers.PointerToBool(DefaultRBACEnabled),
EtcdDiskSizeGB: DefaultEtcdDiskSize,
ServiceCIDR: DefaultKubernetesServiceCIDR,
DockerBridgeSubnet: DefaultDockerBridgeSubnet,
DNSServiceIP: DefaultKubernetesDNSServiceIP,
GCLowThreshold: DefaultKubernetesGCLowThreshold,
GCHighThreshold: DefaultKubernetesGCHighThreshold,
MaxPods: DefaultKubernetesMaxPodsVNETIntegrated,
ClusterSubnet: DefaultKubernetesSubnet,
ContainerRuntime: DefaultContainerRuntime,
NetworkPlugin: DefaultNetworkPlugin,
NetworkPolicy: DefaultNetworkPolicy,
EtcdVersion: DefaultEtcdVersion,
KubeletConfig: make(map[string]string),
}
cs.Properties.CertificateProfile = &CertificateProfile{}
if certs {
cs.Properties.CertificateProfile.CaCertificate = "cacert"
cs.Properties.CertificateProfile.CaPrivateKey = "cakey"
cs.Properties.CertificateProfile.KubeConfigCertificate = "kubeconfigcert"
cs.Properties.CertificateProfile.KubeConfigPrivateKey = "kubeconfigkey"
cs.Properties.CertificateProfile.APIServerCertificate = "apiservercert"
cs.Properties.CertificateProfile.APIServerPrivateKey = "apiserverkey"
cs.Properties.CertificateProfile.ClientCertificate = "clientcert"
cs.Properties.CertificateProfile.ClientPrivateKey = "clientkey"
cs.Properties.CertificateProfile.EtcdServerCertificate = "etcdservercert"
cs.Properties.CertificateProfile.EtcdServerPrivateKey = "etcdserverkey"
cs.Properties.CertificateProfile.EtcdClientCertificate = "etcdclientcert"
cs.Properties.CertificateProfile.EtcdClientPrivateKey = "etcdclientkey"
cs.Properties.CertificateProfile.EtcdPeerCertificates = []string{"etcdpeercert1", "etcdpeercert2", "etcdpeercert3", "etcdpeercert4", "etcdpeercert5"}
cs.Properties.CertificateProfile.EtcdPeerPrivateKeys = []string{"etcdpeerkey1", "etcdpeerkey2", "etcdpeerkey3", "etcdpeerkey4", "etcdpeerkey5"}
}
return &cs
}