Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions cmd/kops/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,8 @@ 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 {
return fmt.Errorf("--azure-subscription-id is required")
}
if c.CloudProvider == "azure" && c.AzureSubscriptionID == "" {
return fmt.Errorf("--azure-subscription-id is required")
}
}

Expand Down
10 changes: 9 additions & 1 deletion tests/e2e/kubetest2-kops/deployer/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion upup/pkg/fi/cloudup/azure/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/azuretasks/vmscaleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand All @@ -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,
},
},
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/azuretasks/vmscaleset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand All @@ -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,
},
},
Expand Down
2 changes: 2 additions & 0 deletions upup/pkg/fi/cloudup/new_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package cloudup
import (
"context"
"fmt"
"os"
"strconv"
"strings"

Expand Down Expand Up @@ -179,6 +180,7 @@ func (o *NewClusterOptions) InitDefaults() {

// Azure-specific
o.AzureAdminUser = "kops"
o.AzureSubscriptionID = os.Getenv("AZURE_SUBSCRIPTION_ID")
}

type NewClusterResult struct {
Expand Down
Loading