diff --git a/parts/kubernetesmastervars.t b/parts/kubernetesmastervars.t index 4d91f93b8..b4e1a4a94 100644 --- a/parts/kubernetesmastervars.t +++ b/parts/kubernetesmastervars.t @@ -147,6 +147,7 @@ "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]", "vnetSubnetID": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[concat(variables('orchestratorName'), '-vnet-', variables('nameSuffix'))]", + "virtualNetworkResourceGroupName": "''", {{end}} "vnetCidr": "[parameters('vnetCidr')]", "kubeDNSServiceIP": "[parameters('kubeDNSServiceIP')]", diff --git a/pkg/api/agentPoolOnlyApi/v20170831/types.go b/pkg/api/agentPoolOnlyApi/v20170831/types.go index fc01bee45..1eee232fd 100644 --- a/pkg/api/agentPoolOnlyApi/v20170831/types.go +++ b/pkg/api/agentPoolOnlyApi/v20170831/types.go @@ -100,16 +100,24 @@ const ( // - OS type of the VMs in the pool // - list of applicable upgrades type PoolUpgradeProfile struct { - KubernetesVersion string `json:"kubernetesVersion"` - Name string `json:"name,omitempty"` - OSType string `json:"osType,omitempty"` - Upgrades []*string `json:"upgrades,omitempty"` + KubernetesVersion string `json:"kubernetesVersion"` + Name string `json:"name,omitempty"` + OSType string `json:"osType,omitempty"` + Upgrades []string `json:"upgrades,omitempty"` +} + +// UpgradeProfileProperties contains properties of UpgradeProfile +type UpgradeProfileProperties struct { + ControlPlaneProfile *PoolUpgradeProfile `json:"controlPlaneProfile"` + AgentPoolProfiles []*PoolUpgradeProfile `json:"agentPoolProfiles"` } // UpgradeProfile contains controlPlane and agent pools upgrade profiles type UpgradeProfile struct { - ControlPlaneProfile *PoolUpgradeProfile `json:"controlPlaneProfile"` - AgentPoolProfiles []*PoolUpgradeProfile `json:"agentPoolProfiles"` + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + Properties UpgradeProfileProperties `json:"properties"` } // AgentPoolProfile represents configuration of VMs running agent diff --git a/pkg/api/apiloader.go b/pkg/api/apiloader.go index d502d8bdd..4529f4e1d 100644 --- a/pkg/api/apiloader.go +++ b/pkg/api/apiloader.go @@ -160,7 +160,6 @@ func (a *Apiloader) LoadContainerServiceForAgentPoolOnlyCluster(contents []byte, if e := json.Unmarshal(contents, &managedCluster); e != nil { return nil, e } - setManagedClusterDefaultsv20170831(managedCluster) if e := managedCluster.Properties.Validate(); validate && e != nil { return nil, e } @@ -170,7 +169,6 @@ func (a *Apiloader) LoadContainerServiceForAgentPoolOnlyCluster(contents []byte, if e := json.Unmarshal(contents, &managedCluster); e != nil { return nil, e } - setManagedClusterDefaultsvlabs(managedCluster) if e := managedCluster.Properties.Validate(); validate && e != nil { return nil, e } @@ -293,13 +291,3 @@ func setContainerServiceDefaultsv20170131(c *v20170131.ContainerService) { } } } - -// Sets default HostedMaster property values for any appropriate zero values -func setManagedClusterDefaultsv20170831(hm *v20170831.ManagedCluster) { - hm.Properties.KubernetesVersion = "" -} - -// Sets default HostedMaster property values for any appropriate zero values -func setManagedClusterDefaultsvlabs(hm *apvlabs.ManagedCluster) { - hm.Properties.KubernetesVersion = "" -} diff --git a/pkg/api/convertertoapi_test.go b/pkg/api/convertertoapi_test.go index 088385034..9d14a685a 100644 --- a/pkg/api/convertertoapi_test.go +++ b/pkg/api/convertertoapi_test.go @@ -2,6 +2,9 @@ package api import ( "testing" + + "github.com/Azure/acs-engine/pkg/api/v20170701" + "github.com/Azure/acs-engine/pkg/api/vlabs" ) func TestAddDCOSPublicAgentPool(t *testing.T) { @@ -71,3 +74,56 @@ func getProperties(profiles []*AgentPoolProfile, master *MasterProfile) *Propert MasterProfile: master, } } + +func TestOrchestratorVersion(t *testing.T) { + // test v20170701 + v20170701cs := &v20170701.ContainerService{ + Properties: &v20170701.Properties{ + OrchestratorProfile: &v20170701.OrchestratorProfile{ + OrchestratorType: v20170701.Kubernetes, + }, + }, + } + cs := ConvertV20170701ContainerService(v20170701cs) + if cs.Properties.OrchestratorProfile.OrchestratorVersion != KubernetesDefaultVersion { + t.Fatalf("incorrect OrchestratorVersion '%s'", cs.Properties.OrchestratorProfile.OrchestratorVersion) + } + + v20170701cs = &v20170701.ContainerService{ + Properties: &v20170701.Properties{ + OrchestratorProfile: &v20170701.OrchestratorProfile{ + OrchestratorType: v20170701.Kubernetes, + OrchestratorVersion: KubernetesVersion1Dot6Dot11, + }, + }, + } + cs = ConvertV20170701ContainerService(v20170701cs) + if cs.Properties.OrchestratorProfile.OrchestratorVersion != KubernetesVersion1Dot6Dot11 { + t.Fatalf("incorrect OrchestratorVersion '%s'", cs.Properties.OrchestratorProfile.OrchestratorVersion) + } + // test vlabs + vlabscs := &vlabs.ContainerService{ + Properties: &vlabs.Properties{ + OrchestratorProfile: &vlabs.OrchestratorProfile{ + OrchestratorType: vlabs.Kubernetes, + }, + }, + } + cs = ConvertVLabsContainerService(vlabscs) + if cs.Properties.OrchestratorProfile.OrchestratorVersion != KubernetesDefaultVersion { + t.Fatalf("incorrect OrchestratorVersion '%s'", cs.Properties.OrchestratorProfile.OrchestratorVersion) + } + + vlabscs = &vlabs.ContainerService{ + Properties: &vlabs.Properties{ + OrchestratorProfile: &vlabs.OrchestratorProfile{ + OrchestratorType: vlabs.Kubernetes, + OrchestratorVersion: KubernetesVersion1Dot6Dot11, + }, + }, + } + cs = ConvertVLabsContainerService(vlabscs) + if cs.Properties.OrchestratorProfile.OrchestratorVersion != KubernetesVersion1Dot6Dot11 { + t.Fatalf("incorrect OrchestratorVersion '%s'", cs.Properties.OrchestratorProfile.OrchestratorVersion) + } +} diff --git a/pkg/api/orchestrators.go b/pkg/api/orchestrators.go index 935e54d4b..9511768ec 100644 --- a/pkg/api/orchestrators.go +++ b/pkg/api/orchestrators.go @@ -64,9 +64,8 @@ func GetOrchestratorVersionProfileListV20170930(orchestrator, version string) (* return nil, err } orchList := &v20170930.OrchestratorVersionProfileList{} - orchList.Orchestrators = []*v20170930.OrchestratorVersionProfile{} for _, orch := range apiOrchs { - orchList.Orchestrators = append(orchList.Orchestrators, ConvertOrchestratorVersionProfileToV20170930(orch)) + orchList.Properties.Orchestrators = append(orchList.Properties.Orchestrators, ConvertOrchestratorVersionProfileToV20170930(orch)) } return orchList, nil } diff --git a/pkg/api/orchestrators_test.go b/pkg/api/orchestrators_test.go index 95e0aa119..b46371e23 100644 --- a/pkg/api/orchestrators_test.go +++ b/pkg/api/orchestrators_test.go @@ -89,4 +89,9 @@ func TestOrchestratorUpgradeInfo(t *testing.T) { orch, e = GetOrchestratorVersionProfile(csOrch) Expect(e).To(BeNil()) Expect(len(orch.Upgrades)).To(Equal(0)) + + // v20170930 + list, e := GetOrchestratorVersionProfileListV20170930("", "") + Expect(e).To(BeNil()) + Expect(len(list.Properties.Orchestrators)).NotTo(Equal(0)) } diff --git a/pkg/api/v20170701/types.go b/pkg/api/v20170701/types.go index 2747ba7fd..a6ef5c2d3 100644 --- a/pkg/api/v20170701/types.go +++ b/pkg/api/v20170701/types.go @@ -196,12 +196,20 @@ type PoolUpgradeProfile struct { Upgrades []*OrchestratorProfile `json:"upgrades,omitempty"` } -// UpgradeProfile contains master and agent pools upgrade profiles -type UpgradeProfile struct { +// UpgradeProfileProperties contains properties of UpgradeProfile +type UpgradeProfileProperties struct { MasterPoolProfile *PoolUpgradeProfile `json:"masterPoolProfile"` AgentPoolProfiles []*PoolUpgradeProfile `json:"agentPoolProfiles"` } +// UpgradeProfile contains master and agent pools upgrade profiles +type UpgradeProfile struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + Properties UpgradeProfileProperties `json:"properties"` +} + // UnmarshalJSON unmarshal json using the default behavior // And do fields manipulation, such as populating default value func (a *AgentPoolProfile) UnmarshalJSON(b []byte) error { diff --git a/pkg/api/v20170930/types.go b/pkg/api/v20170930/types.go index 48680b7c6..ade4b3576 100644 --- a/pkg/api/v20170930/types.go +++ b/pkg/api/v20170930/types.go @@ -22,7 +22,15 @@ type OrchestratorVersionProfile struct { Upgrades []*OrchestratorProfile `json:"upgrades,omitempty"` } -// OrchestratorVersionProfileList contains list of version profiles for supported orchestrators -type OrchestratorVersionProfileList struct { +// OrchestratorVersionProfileListProperties contains properties of OrchestratorVersionProfileList +type OrchestratorVersionProfileListProperties struct { Orchestrators []*OrchestratorVersionProfile `json:"orchestrators"` } + +// OrchestratorVersionProfileList contains list of version profiles for supported orchestrators +type OrchestratorVersionProfileList struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + Properties OrchestratorVersionProfileListProperties `json:"properties"` +}