* updated upgrade API
* fixed parts/kubernetesmastervars.t
This commit is contained in:
dmitsh 2017-10-10 20:22:51 -07:00 коммит произвёл GitHub
Родитель 57ff0e2132
Коммит 2b9d9eda56
8 изменённых файлов: 97 добавлений и 24 удалений

Просмотреть файл

@ -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')]",

Просмотреть файл

@ -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

Просмотреть файл

@ -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 = ""
}

Просмотреть файл

@ -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)
}
}

Просмотреть файл

@ -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
}

Просмотреть файл

@ -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))
}

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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"`
}