Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

chore: per-agent pool k8s versions and provisioning state #423

Merged
merged 2 commits into from Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/api/types.go
Expand Up @@ -486,6 +486,7 @@ type AgentPoolProfile struct {
DNSPrefix string `json:"dnsPrefix,omitempty"`
OSType OSType `json:"osType,omitempty"`
Ports []int `json:"ports,omitempty"`
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
CecileRobertMichon marked this conversation as resolved.
Show resolved Hide resolved
AvailabilityProfile string `json:"availabilityProfile"`
ScaleSetPriority string `json:"scaleSetPriority,omitempty"`
ScaleSetEvictionPolicy string `json:"scaleSetEvictionPolicy,omitempty"`
Expand All @@ -503,6 +504,7 @@ type AgentPoolProfile struct {
PreprovisionExtension *Extension `json:"preProvisionExtension"`
Extensions []Extension `json:"extensions"`
KubernetesConfig *KubernetesConfig `json:"kubernetesConfig,omitempty"`
OrchestratorVersion string `json:"orchestratorVersion"`
ImageRef *ImageReference `json:"imageReference,omitempty"`
MaxCount *int `json:"maxCount,omitempty"`
MinCount *int `json:"minCount,omitempty"`
Expand Down
36 changes: 36 additions & 0 deletions pkg/api/types_test.go
Expand Up @@ -504,6 +504,42 @@ func TestAvailabilityProfile(t *testing.T) {
}
}

func TestPerAgentPoolVersionAndState(t *testing.T) {
cases := []struct {
ap AgentPoolProfile
expectedVersion string
expectedState ProvisioningState
}{
{
ap: AgentPoolProfile{
Name: "agentpool1",
OrchestratorVersion: "1.12.0",
ProvisioningState: Creating,
},
expectedVersion: "1.12.0",
expectedState: Creating,
},
{
ap: AgentPoolProfile{
Name: "agentpool2",
OrchestratorVersion: "",
ProvisioningState: "",
},
expectedVersion: "",
expectedState: "",
},
}

for _, c := range cases {
if c.ap.OrchestratorVersion != c.expectedVersion {
t.Fatalf("Orchestrator profile mismatch. Expected: %s. Got: %s.", c.expectedVersion, c.ap.OrchestratorVersion)
}
if c.ap.ProvisioningState != c.expectedState {
t.Fatalf("Provisioning state mismatch. Expected: %s. Got: %s.", c.expectedState, c.ap.ProvisioningState)
}
}
}

func TestIsCustomVNET(t *testing.T) {
cases := []struct {
p Properties
Expand Down
13 changes: 13 additions & 0 deletions pkg/armhelpers/compute.go
Expand Up @@ -60,6 +60,19 @@ func (az *AzureClient) DeleteVirtualMachineScaleSetVM(ctx context.Context, resou
return err
}

// DeleteVirtualMachineScaleSet deletes an entire VM Scale Set.
func (az *AzureClient) DeleteVirtualMachineScaleSet(ctx context.Context, resourceGroup, vmssName string) error {
future, err := az.virtualMachineScaleSetsClient.Delete(ctx, resourceGroup, vmssName)
if err != nil {
return err
}
if err = future.WaitForCompletionRef(ctx, az.virtualMachineScaleSetsClient.Client); err != nil {
return err
}
_, err = future.Result(az.virtualMachineScaleSetsClient)
return err
}

// SetVirtualMachineScaleSetCapacity sets the VMSS capacity
func (az *AzureClient) SetVirtualMachineScaleSetCapacity(ctx context.Context, resourceGroup, virtualMachineScaleSet string, sku compute.Sku, location string) error {
future, err := az.virtualMachineScaleSetsClient.CreateOrUpdate(
Expand Down