in pkg/api/mocks.go [14:104]
func CreateMockContainerService(containerServiceName, orchestratorVersion string, masterCount, agentCount int, certs bool) *ContainerService {
cs := ContainerService{}
cs.ID = uuid.Must(uuid.NewRandom()).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
if orchestratorVersion == "" {
cs.Properties.OrchestratorProfile.OrchestratorVersion = common.RationalizeReleaseAndVersion(Kubernetes, "", "", false, false, false)
} else {
cs.Properties.OrchestratorProfile.OrchestratorVersion = orchestratorVersion
}
cs.Properties.OrchestratorProfile.KubernetesConfig = &KubernetesConfig{
EnableSecureKubelet: to.BoolPtr(DefaultSecureKubeletEnabled),
EnableRbac: to.BoolPtr(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,
MobyVersion: DefaultMobyVersion,
ContainerdVersion: DefaultContainerdVersion,
LoadBalancerSku: BasicLoadBalancerSku,
KubeletConfig: make(map[string]string),
ControllerManagerConfig: make(map[string]string),
KubernetesImageBaseType: common.KubernetesImageBaseTypeGCR,
MicrosoftAptRepositoryURL: DefaultMicrosoftAptRepositoryURL,
}
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
}