Skip to content

Commit b8de157

Browse files
committed
Cleanup
1 parent 00d3b62 commit b8de157

File tree

8 files changed

+20
-35
lines changed

8 files changed

+20
-35
lines changed

pkg/featureflag/featureflag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ var (
7474
// ClusterAddons activates experimental cluster-addons support
7575
ClusterAddons = new("ClusterAddons", Bool(false))
7676
// Azure toggles the Azure support.
77-
Azure = new("Azure", Bool(true))
77+
Azure = new("Azure", Bool(false))
7878
// APIServerNodes enables ability to provision nodes that only run the kube-apiserver.
7979
APIServerNodes = new("APIServerNodes", Bool(false))
8080
// UseAddonOperators activates experimental addon operator support

tests/e2e/kubetest2-kops/azure/zones.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222

2323
var allZones = []string{
2424
"uksouth-1",
25+
"uksouth-2",
26+
"uksouth-3",
2527
}
2628

2729
// RandomZones returns a random set of availability zones within a region

tests/e2e/kubetest2-kops/deployer/common.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func (d *deployer) env() []string {
233233
vars = append(vars, fmt.Sprintf("KUBE_SSH_KEY_PATH=%v", d.SSHPrivateKeyPath))
234234
} else if d.CloudProvider == "azure" {
235235
// Pass through some env vars if set
236-
for _, k := range []string{"AZURE_TENANT_ID", "AZURE_SUBSCRIPTION_ID", "AZURE_CLIENT_ID", "AZURE_FEDERATED_TOKEN_FILE"} {
236+
for _, k := range []string{"AZURE_TENANT_ID", "AZURE_SUBSCRIPTION_ID", "AZURE_CLIENT_ID", "AZURE_FEDERATED_TOKEN_FILE", "AZURE_STORAGE_ACCOUNT"} {
237237
v := os.Getenv(k)
238238
if v != "" {
239239
vars = append(vars, k+"="+v)
@@ -359,6 +359,7 @@ func (d *deployer) stateStore() string {
359359
d.createBucket = true
360360
ss = "s3://" + bucketName
361361
case "azure":
362+
// TODO: Use dynamic container name
362363
ss = "azureblob://cluster-state"
363364
case "gce":
364365
d.createBucket = true

tests/e2e/kubetest2-kops/deployer/deployer.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ type deployer struct {
6262
// ControlPlaneCount specifies the number of VMs in the control-plane.
6363
ControlPlaneCount int `flag:"control-plane-count" desc:"Number of control-plane instances"`
6464

65-
AzureSubscriptionID string `flag:"azure-subscription-id" desc:"DELETEME"`
66-
6765
ControlPlaneIGOverrides []string `flag:"control-plane-instance-group-overrides" desc:"overrides for the control plane instance groups"`
6866
NodeIGOverrides []string `flag:"node-instance-group-overrides" desc:"overrides for the node instance groups"`
6967

tests/e2e/kubetest2-kops/deployer/up.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"k8s.io/kops/tests/e2e/kubetest2-kops/do"
3737
"k8s.io/kops/tests/e2e/kubetest2-kops/gce"
3838
"k8s.io/kops/tests/e2e/pkg/kops"
39+
"k8s.io/kops/tests/e2e/pkg/util"
3940
"k8s.io/kops/tests/e2e/pkg/version"
4041
"sigs.k8s.io/kubetest2/pkg/exec"
4142
)
@@ -79,13 +80,12 @@ func (d *deployer) Up() error {
7980

8081
adminAccess := d.AdminAccess
8182
if adminAccess == "" {
82-
adminAccess = "0.0.0.0/0"
83-
//publicIP, err := util.ExternalIPRange()
84-
//if err != nil {
85-
// return err
86-
//}
87-
//
88-
//adminAccess = publicIP
83+
publicIP, err := util.ExternalIPRange()
84+
if err != nil {
85+
return err
86+
}
87+
88+
adminAccess = publicIP
8989
}
9090

9191
zones, err := d.zones()
@@ -193,7 +193,9 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e
193193
args = appendIfUnset(args, "--master-size", "c5.large")
194194
}
195195
case "azure":
196+
// TODO: Check why Azure requires --network-cidr
196197
args = appendIfUnset(args, "--network-cidr", "10.0.0.0/16")
198+
args = appendIfUnset(args, "--cloud-labels", "DO-NOT-DELETE=kOps")
197199
args = appendIfUnset(args, "--control-plane-size", "Standard_D4s_v3")
198200
args = appendIfUnset(args, "--node-size", "Standard_D4s_v3")
199201
args = appendIfUnset(args, "--azure-admin-user", "ubuntu")

tests/e2e/pkg/tester/tester.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ func (t *Tester) addRegionFlag() error {
253253
case "aws":
254254
zone := cluster.Spec.Subnets[0].Zone
255255
region = zone[:len(zone)-1]
256+
case "azure":
257+
region = cluster.Spec.Subnets[0].Region
256258
case "gce":
257259
region = cluster.Spec.Subnets[0].Region
258260
default:

upup/pkg/fi/cloudup/utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ func BuildCloud(cluster *kops.Cluster) (fi.Cloud, error) {
156156
return nil, fmt.Errorf("on Azure, subnets must include Regions")
157157
}
158158

159-
cloudTags := map[string]string{
160-
azure.TagClusterName: cluster.ObjectMeta.Name,
161-
"DO-NOT-DELETE": "contact kOps",
159+
cloudTags := map[string]string{azure.TagClusterName: cluster.ObjectMeta.Name}
160+
for k, v := range cluster.Spec.CloudLabels {
161+
cloudTags[k] = v
162162
}
163163

164164
subscriptionID := cluster.Spec.CloudProvider.Azure.SubscriptionID

util/pkg/vfs/azureclient.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,41 +19,21 @@ package vfs
1919
import (
2020
"context"
2121
"fmt"
22-
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
2322
"os"
2423

2524
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
2625
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
27-
"k8s.io/klog/v2"
2826
)
2927

3028
func newAzureClient(ctx context.Context) (*azblob.Client, error) {
31-
klog.Infof("New Azure Blob client")
3229
accountName := os.Getenv("AZURE_STORAGE_ACCOUNT")
3330
if accountName == "" {
3431
return nil, fmt.Errorf("AZURE_STORAGE_ACCOUNT must be set")
3532
}
3633

3734
url := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)
3835

39-
klog.Infof("AZURE_TENANT_ID: %s", os.Getenv("AZURE_TENANT_ID"))
40-
klog.Infof("AZURE_SUBSCRIPTION_ID: %s", os.Getenv("AZURE_SUBSCRIPTION_ID"))
41-
klog.Infof("AZURE_CLIENT_ID: %s", os.Getenv("AZURE_CLIENT_ID"))
42-
klog.Infof("AZURE_FEDERATED_TOKEN_FILE: %s", os.Getenv("AZURE_FEDERATED_TOKEN_FILE"))
43-
44-
var credential azcore.TokenCredential
45-
var err error
46-
if token, found := os.LookupEnv("AZURE_FEDERATED_TOKEN_FILE"); found {
47-
klog.Infof("New WI Credential")
48-
clientID := os.Getenv("AZURE_CLIENT_ID")
49-
credential, err = azidentity.NewWorkloadIdentityCredential(&azidentity.WorkloadIdentityCredentialOptions{
50-
ClientID: clientID,
51-
TokenFilePath: token,
52-
})
53-
} else {
54-
klog.Infof("New Default Credential")
55-
credential, err = azidentity.NewDefaultAzureCredential(nil)
56-
}
36+
credential, err := azidentity.NewDefaultAzureCredential(nil)
5737
if err != nil {
5838
return nil, err
5939
}

0 commit comments

Comments
 (0)