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,14 +537,10 @@ func RunCreateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Cr
|
|||
}
|
||||
|
||||
if featureflag.Azure.Enabled() {
|
||||
if c.AzureSubscriptionID == "" {
|
||||
if id, ok := os.LookupEnv("AZURE_SUBSCRIPTION_ID"); ok {
|
||||
c.AzureSubscriptionID = id
|
||||
} else {
|
||||
if c.CloudProvider == "azure" && c.AzureSubscriptionID == "" {
|
||||
return fmt.Errorf("--azure-subscription-id is required")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clusterResult, err := cloudup.NewCluster(&c.NewClusterOptions, clientset)
|
||||
if err != nil {
|
||||
|
|
|
@ -319,6 +319,9 @@ func defaultClusterName(cloudProvider string) (string, error) {
|
|||
switch cloudProvider {
|
||||
case "aws":
|
||||
suffix = dnsDomain
|
||||
case "azure":
|
||||
// Azure uses --dns=none and the domain is not needed
|
||||
suffix = ""
|
||||
default:
|
||||
suffix = "k8s.local"
|
||||
}
|
||||
|
@ -337,7 +340,12 @@ func defaultClusterName(cloudProvider string) (string, error) {
|
|||
if len(jobName) > gcpLimit && cloudProvider == "gce" {
|
||||
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
|
||||
|
|
|
@ -91,7 +91,7 @@ func (a azureVerifier) VerifyToken(ctx context.Context, rawRequest *http.Request
|
|||
}
|
||||
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 {
|
||||
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 {
|
||||
ipConfigProperties.PublicIPAddressConfiguration = &compute.VirtualMachineScaleSetPublicIPAddressConfiguration{
|
||||
Name: to.Ptr(name + "-publicipconfig"),
|
||||
Name: to.Ptr(name),
|
||||
Properties: &compute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{
|
||||
PublicIPAddressVersion: to.Ptr(compute.IPVersionIPv4),
|
||||
},
|
||||
|
@ -328,13 +328,13 @@ func (s *VMScaleSet) RenderAzure(t *azure.AzureAPITarget, a, e, changes *VMScale
|
|||
}
|
||||
|
||||
networkConfig := &compute.VirtualMachineScaleSetNetworkConfiguration{
|
||||
Name: to.Ptr(name + "-netconfig"),
|
||||
Name: to.Ptr(name),
|
||||
Properties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{
|
||||
Primary: to.Ptr(true),
|
||||
EnableIPForwarding: to.Ptr(true),
|
||||
IPConfigurations: []*compute.VirtualMachineScaleSetIPConfiguration{
|
||||
{
|
||||
Name: to.Ptr(name + "-ipconfig"),
|
||||
Name: to.Ptr(name),
|
||||
Properties: ipConfigProperties,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -212,7 +212,7 @@ func TestVMScaleSetFind(t *testing.T) {
|
|||
PrivateIPAddressVersion: to.Ptr(compute.IPVersionIPv4),
|
||||
}
|
||||
ipConfigProperties.PublicIPAddressConfiguration = &compute.VirtualMachineScaleSetPublicIPAddressConfiguration{
|
||||
Name: to.Ptr("vmss-publicipconfig"),
|
||||
Name: to.Ptr("vmss"),
|
||||
Properties: &compute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{
|
||||
PublicIPAddressVersion: to.Ptr(compute.IPVersionIPv4),
|
||||
},
|
||||
|
@ -223,13 +223,13 @@ func TestVMScaleSetFind(t *testing.T) {
|
|||
},
|
||||
}
|
||||
networkConfig := &compute.VirtualMachineScaleSetNetworkConfiguration{
|
||||
Name: to.Ptr("vmss-netconfig"),
|
||||
Name: to.Ptr("vmss"),
|
||||
Properties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{
|
||||
Primary: to.Ptr(true),
|
||||
EnableIPForwarding: to.Ptr(true),
|
||||
IPConfigurations: []*compute.VirtualMachineScaleSetIPConfiguration{
|
||||
{
|
||||
Name: to.Ptr("vmss-ipconfig"),
|
||||
Name: to.Ptr("vmss"),
|
||||
Properties: ipConfigProperties,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -19,6 +19,7 @@ package cloudup
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
@ -179,6 +180,7 @@ func (o *NewClusterOptions) InitDefaults() {
|
|||
|
||||
// Azure-specific
|
||||
o.AzureAdminUser = "kops"
|
||||
o.AzureSubscriptionID = os.Getenv("AZURE_SUBSCRIPTION_ID")
|
||||
}
|
||||
|
||||
type NewClusterResult struct {
|
||||
|
|
Loading…
Reference in New Issue