Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make publicips reconcile/delete async #1745

Closed
Closed
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1dd9f21
wip: make publicips reconcile async
karuppiah7890 Sep 30, 2021
e397f7b
wip: implement create or update async and implement public ip spec pa…
karuppiah7890 Oct 1, 2021
b82eb8f
move public ip spec to publicips package
karuppiah7890 Oct 1, 2021
aaae998
wip: add tests and implementation for Parameters method and add some …
karuppiah7890 Oct 2, 2021
08a914d
rename publicip_spec_test.go to spec_test.go
karuppiah7890 Oct 2, 2021
36d966b
wip: add todo about zones
karuppiah7890 Oct 2, 2021
d42eb7d
add todo for parallelizing tests in publicips spec test
karuppiah7890 Oct 2, 2021
a609795
add location, cluster name and additional tags field to public ip spe…
karuppiah7890 Oct 2, 2021
3fe5d0b
use the location, cluster name and additional tags from ip spec to co…
karuppiah7890 Oct 2, 2021
a6824a3
add zones field to public ip spec and use zones field to construct th…
karuppiah7890 Oct 2, 2021
396b443
remove todo for CreateOrUpdateAsync test
karuppiah7890 Oct 2, 2021
a5c7b31
add test for machine scope AdditionalTags method
karuppiah7890 Oct 2, 2021
85683ac
implement publicips client IsDone method
karuppiah7890 Oct 2, 2021
72d68f0
add test for cluster scope PublicIPSpecs method and fix an issue and …
karuppiah7890 Oct 2, 2021
4034ccc
add test for cluster scope FailureDomains method and remove some TODOs
karuppiah7890 Oct 2, 2021
339b8c5
add timeout to publicip service Reconcile method
karuppiah7890 Oct 2, 2021
8c26b22
add timeout to publicip service Delete method
karuppiah7890 Oct 2, 2021
e7ec334
wip: make public ips delete async
karuppiah7890 Oct 2, 2021
b1da4f0
add some todos
karuppiah7890 Oct 2, 2021
946c81b
update a todo
karuppiah7890 Oct 3, 2021
a49109e
add continue after error in getting ip management state to avoid logg…
karuppiah7890 Oct 3, 2021
aff734a
remove finished TODOs
karuppiah7890 Oct 3, 2021
ac72d84
update TODOs
karuppiah7890 Oct 3, 2021
f69ed77
implement the DeleteAsync method of the public ips client
karuppiah7890 Oct 3, 2021
c12e916
delete the unused Delete method of the public ips client
karuppiah7890 Oct 3, 2021
f81d496
use pointer receiver for public ip spec methods
karuppiah7890 Oct 3, 2021
87876ee
rename ip to ipSpec in publicips reconcile method
karuppiah7890 Oct 3, 2021
59ae8e8
change the signature of PublicIPSpecs method to return []azure.Resour…
karuppiah7890 Oct 3, 2021
abdd6d2
fix publicips_test.go tests
karuppiah7890 Oct 3, 2021
815ddce
fix public ip specs tests for cluster scope and machine scope PublicI…
karuppiah7890 Oct 3, 2021
ca50e87
fix lint issues
karuppiah7890 Oct 4, 2021
a807225
update publicips client mock
karuppiah7890 Oct 4, 2021
8d1aa48
add todo regarding api call to check if public ip is managed or not
karuppiah7890 Oct 5, 2021
b9c51d4
make the tests parallel
karuppiah7890 Oct 15, 2021
5ef7626
remove todo comment from isIPManaged method
karuppiah7890 Nov 30, 2021
57da368
fix compilation errors
karuppiah7890 Nov 30, 2021
42f4a81
fix test failures
karuppiah7890 Nov 30, 2021
7dc3fda
add extra tests for error precedence in public ip deletion method
karuppiah7890 Nov 30, 2021
74cbb90
go format azure/scope/cluster.go and azure/scope/machine.go files
karuppiah7890 Nov 30, 2021
2c6fa2d
fix order of import in publicips_mock.go
karuppiah7890 Nov 30, 2021
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
Prev Previous commit
Next Next commit
add zones field to public ip spec and use zones field to construct th…
…e azure public ip address in Parameters method

Signed-off-by: Karuppiah Natarajan <karuppiahn@vmware.com>
karuppiah7890 committed Dec 3, 2021
commit a6824a30d80e2b1df7b944c299de97fc91948f74
5 changes: 5 additions & 0 deletions azure/scope/cluster.go
Original file line number Diff line number Diff line change
@@ -142,6 +142,7 @@ func (s *ClusterScope) PublicIPSpecs() []publicips.PublicIPSpec {
Location: s.Location(),
ClusterName: s.ClusterName(),
AdditionalTags: s.AdditionalTags(),
Zones: s.FailureDomains(),
}}
}
publicIPSpecs = append(publicIPSpecs, controlPlaneOutboundIPSpecs...)
@@ -163,6 +164,7 @@ func (s *ClusterScope) PublicIPSpecs() []publicips.PublicIPSpec {
Location: s.Location(),
ClusterName: s.ClusterName(),
AdditionalTags: s.AdditionalTags(),
Zones: s.FailureDomains(),
})
}
publicIPSpecs = append(publicIPSpecs, nodeNatGatewayIPSpecs...)
@@ -177,6 +179,7 @@ func (s *ClusterScope) PublicIPSpecs() []publicips.PublicIPSpec {
Location: s.Location(),
ClusterName: s.ClusterName(),
AdditionalTags: s.AdditionalTags(),
Zones: s.FailureDomains(),
}
publicIPSpecs = append(publicIPSpecs, azureBastionPublicIP)
}
@@ -755,6 +758,7 @@ func (s *ClusterScope) getOutboundLBPublicIPSpecs(outboundLB *infrav1.LoadBalanc
Location: s.Location(),
ClusterName: s.ClusterName(),
AdditionalTags: s.AdditionalTags(),
Zones: s.FailureDomains(),
})
} else {
for i := 0; i < int(*loadBalancerNodeOutboundIPs); i++ {
@@ -764,6 +768,7 @@ func (s *ClusterScope) getOutboundLBPublicIPSpecs(outboundLB *infrav1.LoadBalanc
Location: s.Location(),
ClusterName: s.ClusterName(),
AdditionalTags: s.AdditionalTags(),
Zones: s.FailureDomains(),
})
}
}
1 change: 1 addition & 0 deletions azure/scope/machine.go
Original file line number Diff line number Diff line change
@@ -191,6 +191,7 @@ func (m *MachineScope) PublicIPSpecs() []publicips.PublicIPSpec {
Location: m.Location(),
ClusterName: m.ClusterName(),
AdditionalTags: m.AdditionalTags(),
Zones: m.FailureDomains(),
})
}
return spec
14 changes: 14 additions & 0 deletions azure/scope/machine_test.go
Original file line number Diff line number Diff line change
@@ -271,6 +271,19 @@ func TestMachineScope_PublicIPSpecs(t *testing.T) {
"b": "b1",
},
},
Status: infrav1.AzureClusterStatus{
FailureDomains: clusterv1.FailureDomains{
"1": clusterv1.FailureDomainSpec{
ControlPlane: true,
},
"2": clusterv1.FailureDomainSpec{
ControlPlane: true,
},
"3": clusterv1.FailureDomainSpec{
ControlPlane: true,
},
},
},
},
},
AzureMachine: &infrav1.AzureMachine{
@@ -298,6 +311,7 @@ func TestMachineScope_PublicIPSpecs(t *testing.T) {
"c": "c1",
"kubernetes.io_cluster_cluster-name": "owned",
},
Zones: []string{"1", "2", "3"},
},
},
},
2 changes: 2 additions & 0 deletions azure/services/publicips/publicips_test.go
Original file line number Diff line number Diff line change
@@ -55,6 +55,7 @@ var (
Location: "location",
ClusterName: "cluster-name",
AdditionalTags: infrav1.Tags{"foo": "bar"},
Zones: []string{"1", "2", "3"},
}
ipSpec2 = publicips.PublicIPSpec{
Name: "my-publicip-ipv6",
@@ -64,6 +65,7 @@ var (
Location: "location",
ClusterName: "cluster-name",
AdditionalTags: infrav1.Tags{"foo": "bar"},
Zones: []string{"1", "2", "3"},
}
fakePublicIPSpecs = []publicips.PublicIPSpec{
ipSpec1,
4 changes: 2 additions & 2 deletions azure/services/publicips/spec.go
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ type PublicIPSpec struct {
Location string
ClusterName string
AdditionalTags infrav1.Tags
Zones []string
}

// ResourceName returns the name of the public IP.
@@ -88,7 +89,6 @@ func (s PublicIPSpec) Parameters(existing interface{}) (interface{}, error) {
PublicIPAllocationMethod: network.IPAllocationMethodStatic,
DNSSettings: dnsSettings,
},
// TODO(karuppiah7890): Add Zones
// Zones: s.Zones()
Zones: to.StringSlicePtr(s.Zones),
}, nil
}
9 changes: 6 additions & 3 deletions azure/services/publicips/spec_test.go
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ func TestParameters(t *testing.T) {
AdditionalTags: infrav1.Tags{
"foo": "bar",
},
Zones: []string{"1", "2", "3"},
},
expectedPublicIPAddress: network.PublicIPAddress{
Name: to.StringPtr("my-publicip"),
@@ -61,7 +62,7 @@ func TestParameters(t *testing.T) {
Fqdn: to.StringPtr("fakedns.mydomain.io"),
},
},
// Zones: to.StringSlicePtr([]string{"1,2,3"}),
Zones: to.StringSlicePtr([]string{"1", "2", "3"}),
},
},
{
@@ -74,6 +75,7 @@ func TestParameters(t *testing.T) {
AdditionalTags: infrav1.Tags{
"foo": "bar",
},
Zones: []string{"1", "2", "3"},
},
expectedPublicIPAddress: network.PublicIPAddress{
Name: to.StringPtr("my-publicip-2"),
@@ -88,7 +90,7 @@ func TestParameters(t *testing.T) {
PublicIPAddressVersion: network.IPVersionIPv4,
PublicIPAllocationMethod: network.IPAllocationMethodStatic,
},
// Zones: to.StringSlicePtr([]string{"1,2,3"}),
Zones: to.StringSlicePtr([]string{"1", "2", "3"}),
},
},
{
@@ -103,6 +105,7 @@ func TestParameters(t *testing.T) {
AdditionalTags: infrav1.Tags{
"foo": "bar",
},
Zones: []string{"1", "2", "3"},
},
expectedPublicIPAddress: network.PublicIPAddress{
Name: to.StringPtr("my-publicip-ipv6"),
@@ -121,7 +124,7 @@ func TestParameters(t *testing.T) {
Fqdn: to.StringPtr("fakename.mydomain.io"),
},
},
// Zones: to.StringSlicePtr([]string{"1,2,3"}),
Zones: to.StringSlicePtr([]string{"1", "2", "3"}),
},
},
}