mirror of https://github.com/kubernetes/kops.git
Merge pull request #17517 from hakman/azure-test
azure: Fix periodic tests
This commit is contained in:
commit
5f564fe1ab
|
@ -537,12 +537,8 @@ func RunCreateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Cr
|
||||||
}
|
}
|
||||||
|
|
||||||
if featureflag.Azure.Enabled() {
|
if featureflag.Azure.Enabled() {
|
||||||
if c.AzureSubscriptionID == "" {
|
if c.CloudProvider == "azure" && c.AzureSubscriptionID == "" {
|
||||||
if id, ok := os.LookupEnv("AZURE_SUBSCRIPTION_ID"); ok {
|
return fmt.Errorf("--azure-subscription-id is required")
|
||||||
c.AzureSubscriptionID = id
|
|
||||||
} else {
|
|
||||||
return fmt.Errorf("--azure-subscription-id is required")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,6 +319,9 @@ func defaultClusterName(cloudProvider string) (string, error) {
|
||||||
switch cloudProvider {
|
switch cloudProvider {
|
||||||
case "aws":
|
case "aws":
|
||||||
suffix = dnsDomain
|
suffix = dnsDomain
|
||||||
|
case "azure":
|
||||||
|
// Azure uses --dns=none and the domain is not needed
|
||||||
|
suffix = ""
|
||||||
default:
|
default:
|
||||||
suffix = "k8s.local"
|
suffix = "k8s.local"
|
||||||
}
|
}
|
||||||
|
@ -337,7 +340,12 @@ func defaultClusterName(cloudProvider string) (string, error) {
|
||||||
if len(jobName) > gcpLimit && cloudProvider == "gce" {
|
if len(jobName) > gcpLimit && cloudProvider == "gce" {
|
||||||
jobName = jobName[:gcpLimit]
|
jobName = jobName[:gcpLimit]
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%v.%v", jobName, suffix), nil
|
|
||||||
|
if suffix != "" {
|
||||||
|
jobName = jobType + "." + suffix
|
||||||
|
}
|
||||||
|
|
||||||
|
return jobName, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// stateStore returns the kops state store to use
|
// stateStore returns the kops state store to use
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (a azureVerifier) VerifyToken(ctx context.Context, rawRequest *http.Request
|
||||||
}
|
}
|
||||||
nodeName := strings.ToLower(*vm.Properties.OSProfile.ComputerName)
|
nodeName := strings.ToLower(*vm.Properties.OSProfile.ComputerName)
|
||||||
|
|
||||||
ni, err := a.client.nisClient.GetVirtualMachineScaleSetNetworkInterface(ctx, a.client.resourceGroup, vmssName, vmssIndex, vmssName+"-netconfig", nil)
|
ni, err := a.client.nisClient.GetVirtualMachineScaleSetNetworkInterface(ctx, a.client.resourceGroup, vmssName, vmssIndex, vmssName, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("getting info for VMSS network interface %q #%s: %w", vmssName, vmssIndex, err)
|
return nil, fmt.Errorf("getting info for VMSS network interface %q #%s: %w", vmssName, vmssIndex, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ func (s *VMScaleSet) RenderAzure(t *azure.AzureAPITarget, a, e, changes *VMScale
|
||||||
}
|
}
|
||||||
if *e.RequirePublicIP {
|
if *e.RequirePublicIP {
|
||||||
ipConfigProperties.PublicIPAddressConfiguration = &compute.VirtualMachineScaleSetPublicIPAddressConfiguration{
|
ipConfigProperties.PublicIPAddressConfiguration = &compute.VirtualMachineScaleSetPublicIPAddressConfiguration{
|
||||||
Name: to.Ptr(name + "-publicipconfig"),
|
Name: to.Ptr(name),
|
||||||
Properties: &compute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{
|
Properties: &compute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{
|
||||||
PublicIPAddressVersion: to.Ptr(compute.IPVersionIPv4),
|
PublicIPAddressVersion: to.Ptr(compute.IPVersionIPv4),
|
||||||
},
|
},
|
||||||
|
@ -328,13 +328,13 @@ func (s *VMScaleSet) RenderAzure(t *azure.AzureAPITarget, a, e, changes *VMScale
|
||||||
}
|
}
|
||||||
|
|
||||||
networkConfig := &compute.VirtualMachineScaleSetNetworkConfiguration{
|
networkConfig := &compute.VirtualMachineScaleSetNetworkConfiguration{
|
||||||
Name: to.Ptr(name + "-netconfig"),
|
Name: to.Ptr(name),
|
||||||
Properties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{
|
Properties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{
|
||||||
Primary: to.Ptr(true),
|
Primary: to.Ptr(true),
|
||||||
EnableIPForwarding: to.Ptr(true),
|
EnableIPForwarding: to.Ptr(true),
|
||||||
IPConfigurations: []*compute.VirtualMachineScaleSetIPConfiguration{
|
IPConfigurations: []*compute.VirtualMachineScaleSetIPConfiguration{
|
||||||
{
|
{
|
||||||
Name: to.Ptr(name + "-ipconfig"),
|
Name: to.Ptr(name),
|
||||||
Properties: ipConfigProperties,
|
Properties: ipConfigProperties,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -212,7 +212,7 @@ func TestVMScaleSetFind(t *testing.T) {
|
||||||
PrivateIPAddressVersion: to.Ptr(compute.IPVersionIPv4),
|
PrivateIPAddressVersion: to.Ptr(compute.IPVersionIPv4),
|
||||||
}
|
}
|
||||||
ipConfigProperties.PublicIPAddressConfiguration = &compute.VirtualMachineScaleSetPublicIPAddressConfiguration{
|
ipConfigProperties.PublicIPAddressConfiguration = &compute.VirtualMachineScaleSetPublicIPAddressConfiguration{
|
||||||
Name: to.Ptr("vmss-publicipconfig"),
|
Name: to.Ptr("vmss"),
|
||||||
Properties: &compute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{
|
Properties: &compute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{
|
||||||
PublicIPAddressVersion: to.Ptr(compute.IPVersionIPv4),
|
PublicIPAddressVersion: to.Ptr(compute.IPVersionIPv4),
|
||||||
},
|
},
|
||||||
|
@ -223,13 +223,13 @@ func TestVMScaleSetFind(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
networkConfig := &compute.VirtualMachineScaleSetNetworkConfiguration{
|
networkConfig := &compute.VirtualMachineScaleSetNetworkConfiguration{
|
||||||
Name: to.Ptr("vmss-netconfig"),
|
Name: to.Ptr("vmss"),
|
||||||
Properties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{
|
Properties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{
|
||||||
Primary: to.Ptr(true),
|
Primary: to.Ptr(true),
|
||||||
EnableIPForwarding: to.Ptr(true),
|
EnableIPForwarding: to.Ptr(true),
|
||||||
IPConfigurations: []*compute.VirtualMachineScaleSetIPConfiguration{
|
IPConfigurations: []*compute.VirtualMachineScaleSetIPConfiguration{
|
||||||
{
|
{
|
||||||
Name: to.Ptr("vmss-ipconfig"),
|
Name: to.Ptr("vmss"),
|
||||||
Properties: ipConfigProperties,
|
Properties: ipConfigProperties,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,6 +19,7 @@ package cloudup
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -179,6 +180,7 @@ func (o *NewClusterOptions) InitDefaults() {
|
||||||
|
|
||||||
// Azure-specific
|
// Azure-specific
|
||||||
o.AzureAdminUser = "kops"
|
o.AzureAdminUser = "kops"
|
||||||
|
o.AzureSubscriptionID = os.Getenv("AZURE_SUBSCRIPTION_ID")
|
||||||
}
|
}
|
||||||
|
|
||||||
type NewClusterResult struct {
|
type NewClusterResult struct {
|
||||||
|
|
Loading…
Reference in New Issue