Skip to content

Commit 29e2e54

Browse files
authored
Merge pull request #18197 from hakman/azure-ccm
azure: Deploy cloud-controller-manager for node lifecycle and LB support
2 parents b2f9e82 + 1226217 commit 29e2e54

29 files changed

+971
-275
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,6 @@ _output
9292
# Used by E2E testing
9393
_artifacts
9494
_rundir
95+
96+
# kustomize helm chart cache
97+
charts/

k8s/crds/kops.k8s.io_clusters.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,10 @@ spec:
666666
description: Allow the cluster to run without the cluster-id on
667667
cloud instances
668668
type: boolean
669+
azureNodeManagerImage:
670+
description: AzureNodeManagerImage is the OCI image of the Azure
671+
cloud node manager.
672+
type: string
669673
cidrAllocatorType:
670674
description: CIDRAllocatorType specifies the type of CIDR allocator
671675
to use.

nodeup/pkg/model/cloudconfig.go

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,22 @@ const (
3737
)
3838

3939
// azureCloudConfig is the configuration passed to Cloud Provider Azure.
40-
// The specification is described in https://kubernetes-sigs.github.io/cloud-provider-azure/install/configs/.
40+
// The specification is described in https://cloud-provider-azure.sigs.k8s.io/install/configs/.
41+
// Field order follows the upstream documentation: auth configs first, then cluster config.
4142
type azureCloudConfig struct {
42-
// SubscriptionID is the ID of the Azure Subscription that the cluster is deployed in.
43-
SubscriptionID string `json:"subscriptionId,omitempty"`
44-
// TenantID is the ID of the tenant that the cluster is deployed in.
45-
TenantID string `json:"tenantId"`
46-
// CloudConfigType is the cloud configure type for Azure cloud provider. Supported values are file, secret and merge.
47-
CloudConfigType string `json:"cloudConfigType,omitempty"`
48-
// VMType is the type of azure nodes.
49-
VMType string `json:"vmType,omitempty" yaml:"vmType,omitempty"`
50-
// ResourceGroup is the name of the resource group that the cluster is deployed in.
51-
ResourceGroup string `json:"resourceGroup,omitempty"`
52-
// Location is the location of the resource group that the cluster is deployed in.
53-
Location string `json:"location,omitempty"`
54-
// RouteTableName is the name of the route table attached to the subnet that the cluster is deployed in.
55-
RouteTableName string `json:"routeTableName,omitempty"`
56-
// VnetName is the name of the virtual network that the cluster is deployed in.
57-
VnetName string `json:"vnetName"`
58-
59-
// UseInstanceMetadata specifies where instance metadata service is used where possible.
60-
UseInstanceMetadata bool `json:"useInstanceMetadata,omitempty"`
61-
// UseManagedIdentityExtension specifies where managed service
62-
// identity is used for the virtual machine to access Azure
63-
// ARM APIs.
64-
UseManagedIdentityExtension bool `json:"useManagedIdentityExtension,omitempty"`
65-
// DisableAvailabilitySetNodes disables VMAS nodes support.
66-
DisableAvailabilitySetNodes bool `json:"disableAvailabilitySetNodes,omitempty"`
43+
// Auth configs
44+
TenantID string `json:"tenantId,omitempty"`
45+
SubscriptionID string `json:"subscriptionId,omitempty"`
46+
UseManagedIdentityExtension bool `json:"useManagedIdentityExtension,omitempty"`
47+
48+
// Cluster config
49+
ResourceGroup string `json:"resourceGroup,omitempty"`
50+
Location string `json:"location,omitempty"`
51+
VnetName string `json:"vnetName,omitempty"`
52+
SubnetName string `json:"subnetName,omitempty"`
53+
SecurityGroupName string `json:"securityGroupName,omitempty"`
54+
UseInstanceMetadata bool `json:"useInstanceMetadata,omitempty"`
55+
DisableAvailabilitySetNodes bool `json:"disableAvailabilitySetNodes,omitempty"`
6756
}
6857

6958
// CloudConfigBuilder creates the cloud configuration file
@@ -130,17 +119,17 @@ func (b *CloudConfigBuilder) build(c *fi.NodeupModelBuilderContext, inTree bool)
130119
}
131120

132121
c := &azureCloudConfig{
133-
CloudConfigType: "file",
134-
SubscriptionID: b.NodeupConfig.AzureSubscriptionID,
122+
// Auth
135123
TenantID: b.NodeupConfig.AzureTenantID,
136-
Location: b.NodeupConfig.AzureLocation,
137-
VMType: "vmss",
124+
SubscriptionID: b.NodeupConfig.AzureSubscriptionID,
125+
UseManagedIdentityExtension: true,
126+
// Cluster
138127
ResourceGroup: b.NodeupConfig.AzureResourceGroup,
139-
RouteTableName: b.NodeupConfig.AzureRouteTableName,
128+
Location: b.NodeupConfig.AzureLocation,
140129
VnetName: vnetName,
130+
SubnetName: b.NodeupConfig.AzureSubnetName,
131+
SecurityGroupName: b.NodeupConfig.AzureSecurityGroupName,
141132
UseInstanceMetadata: true,
142-
UseManagedIdentityExtension: true,
143-
// Disable availability set nodes as we currently use VMSS.
144133
DisableAvailabilitySetNodes: true,
145134
}
146135
data, err := json.Marshal(c)

nodeup/pkg/model/cloudconfig_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func TestBuildAzure(t *testing.T) {
3535
subscriptionID = "subID"
3636
tenantID = "tenantID"
3737
resourceGroupName = "test-resource-group"
38-
routeTableName = "test-route-table"
3938
vnetName = "test-vnet"
4039
)
4140
cluster := &kops.Cluster{
@@ -48,7 +47,6 @@ func TestBuildAzure(t *testing.T) {
4847
SubscriptionID: subscriptionID,
4948
TenantID: tenantID,
5049
ResourceGroupName: resourceGroupName,
51-
RouteTableName: routeTableName,
5250
},
5351
},
5452
Networking: kops.NetworkingSpec{
@@ -101,14 +99,13 @@ func TestBuildAzure(t *testing.T) {
10199
t.Fatalf("unexpected error from json.Unmarshal(%q): %v", string(data), err)
102100
}
103101
expected := azureCloudConfig{
104-
CloudConfigType: "file",
105102
SubscriptionID: subscriptionID,
106103
TenantID: tenantID,
107104
Location: "eastus",
108-
VMType: "vmss",
109105
ResourceGroup: resourceGroupName,
110-
RouteTableName: routeTableName,
111106
VnetName: vnetName,
107+
SubnetName: "test-subnet",
108+
SecurityGroupName: vnetName,
112109
UseInstanceMetadata: true,
113110
UseManagedIdentityExtension: true,
114111
DisableAvailabilitySetNodes: true,

pkg/apis/kops/cluster.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,15 @@ func (c *Cluster) AzureRouteTableName() string {
922922
return c.Name
923923
}
924924

925+
// AzureNetworkSecurityGroupName returns the name of the network security group for the cluster.
926+
// The NSG shares its name with the virtual network.
927+
func (c *Cluster) AzureNetworkSecurityGroupName() string {
928+
if c.Spec.Networking.NetworkID != "" {
929+
return c.Spec.Networking.NetworkID
930+
}
931+
return c.Name
932+
}
933+
925934
func (c *Cluster) PublishesDNSRecords() bool {
926935
if c.UsesNoneDNS() || dns.IsGossipClusterName(c.Name) {
927936
return false

pkg/apis/kops/componentconfig.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,8 @@ type CloudControllerManagerConfig struct {
779779
NodeStatusUpdateFrequency *metav1.Duration `json:"nodeStatusUpdateFrequency,omitempty" flag:"node-status-update-frequency"`
780780
// ConcurrentNodeSyncs is the number of workers concurrently synchronizing nodes. (default: 1)
781781
ConcurrentNodeSyncs *int32 `json:"concurrentNodeSyncs,omitempty" flag:"concurrent-node-syncs"`
782+
// AzureNodeManagerImage is the OCI image of the Azure cloud node manager.
783+
AzureNodeManagerImage string `json:"azureNodeManagerImage,omitempty"`
782784
}
783785

784786
// KubeSchedulerConfig is the configuration for the kube-scheduler

pkg/apis/kops/v1alpha2/componentconfig.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,8 @@ type CloudControllerManagerConfig struct {
785785
NodeStatusUpdateFrequency *metav1.Duration `json:"nodeStatusUpdateFrequency,omitempty" flag:"node-status-update-frequency"`
786786
// ConcurrentNodeSyncs is the number of workers concurrently synchronizing nodes. (default: 1)
787787
ConcurrentNodeSyncs *int32 `json:"concurrentNodeSyncs,omitempty" flag:"concurrent-node-syncs"`
788+
// AzureNodeManagerImage is the OCI image of the Azure cloud node manager.
789+
AzureNodeManagerImage string `json:"azureNodeManagerImage,omitempty"`
788790
}
789791

790792
// KubeSchedulerConfig is the configuration for the kube-scheduler

pkg/apis/kops/v1alpha2/zz_generated.conversion.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/kops/v1alpha3/componentconfig.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,8 @@ type CloudControllerManagerConfig struct {
776776
NodeStatusUpdateFrequency *metav1.Duration `json:"nodeStatusUpdateFrequency,omitempty" flag:"node-status-update-frequency"`
777777
// ConcurrentNodeSyncs is the number of workers concurrently synchronizing nodes. (default: 1)
778778
ConcurrentNodeSyncs *int32 `json:"concurrentNodeSyncs,omitempty" flag:"concurrent-node-syncs"`
779+
// AzureNodeManagerImage is the OCI image of the Azure cloud node manager.
780+
AzureNodeManagerImage string `json:"azureNodeManagerImage,omitempty"`
779781
}
780782

781783
// KubeSchedulerConfig is the configuration for the kube-scheduler

pkg/apis/kops/v1alpha3/zz_generated.conversion.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)