This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 558
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
CecileRobertMichon
committed
Jul 3, 2018
1 parent
298bd61
commit 2b3a0a1
Showing
2 changed files
with
90 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package acsengine | ||
|
||
import ( | ||
"github.com/Azure/acs-engine/pkg/api" | ||
"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) *api.ContainerService { | ||
cs := api.ContainerService{} | ||
cs.ID = uuid.NewV4().String() | ||
cs.Location = "eastus" | ||
cs.Name = containerServiceName | ||
|
||
cs.Properties = &api.Properties{} | ||
|
||
cs.Properties.MasterProfile = &api.MasterProfile{} | ||
cs.Properties.MasterProfile.Count = masterCount | ||
cs.Properties.MasterProfile.DNSPrefix = "testmaster" | ||
cs.Properties.MasterProfile.VMSize = "Standard_D2_v2" | ||
|
||
cs.Properties.AgentPoolProfiles = []*api.AgentPoolProfile{} | ||
agentPool := &api.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 = &api.LinuxProfile{ | ||
AdminUsername: "azureuser", | ||
SSH: struct { | ||
PublicKeys []api.PublicKey `json:"publicKeys"` | ||
}{}, | ||
} | ||
|
||
cs.Properties.LinuxProfile.AdminUsername = "azureuser" | ||
cs.Properties.LinuxProfile.SSH.PublicKeys = append( | ||
cs.Properties.LinuxProfile.SSH.PublicKeys, api.PublicKey{KeyData: "test"}) | ||
|
||
cs.Properties.ServicePrincipalProfile = &api.ServicePrincipalProfile{} | ||
cs.Properties.ServicePrincipalProfile.ClientID = "DEC923E3-1EF1-4745-9516-37906D56DEC4" | ||
cs.Properties.ServicePrincipalProfile.Secret = "DEC923E3-1EF1-4745-9516-37906D56DEC4" | ||
|
||
cs.Properties.OrchestratorProfile = &api.OrchestratorProfile{} | ||
cs.Properties.OrchestratorProfile.OrchestratorType = api.Kubernetes | ||
cs.Properties.OrchestratorProfile.OrchestratorVersion = orchestratorVersion | ||
cs.Properties.OrchestratorProfile.KubernetesConfig = &api.KubernetesConfig{ | ||
EnableSecureKubelet: helpers.PointerToBool(api.DefaultSecureKubeletEnabled), | ||
EnableRbac: helpers.PointerToBool(api.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 = &api.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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters