Skip to content

Commit 75cef8a

Browse files
committed
introduce reclaim policy for ephemerally created virtualIP
1 parent 97b021f commit 75cef8a

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

client-go/applyconfigurations/networking/v1alpha1/ephemeralvirtualipspec.go

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

client-go/openapi/zz_generated.openapi.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/controllers/networking/networkinterface_ephemeralvirtualip_controller.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ func (r *NetworkInterfaceEphemeralVirtualIPReconciler) handleCreateVirtualIP(
135135
return nil
136136
}
137137
if !apierrors.IsAlreadyExists(err) {
138-
fmt.Println(virtualIP.Name)
139138
return err
140139
}
141140

@@ -170,7 +169,6 @@ func (r *NetworkInterfaceEphemeralVirtualIPReconciler) reconcile(ctx context.Con
170169
errs []error
171170
)
172171
for _, virtualIP := range virtualIPList.Items {
173-
fmt.Println(">>>>>>>>>>>>>>>>>> ", virtualIP)
174172
virtualIPName := virtualIP.Name
175173
ephemVip, shouldManage := ephemNicByName[virtualIPName]
176174
delete(ephemNicByName, virtualIPName)

internal/controllers/networking/networkinterface_ephemeralvirtualip_controller_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ var _ = Describe("NetworkInterfaceEphemeralVirtualIP", func() {
7070
},
7171
}),
7272
))
73-
By("Verifying OwnerRef is set for ephemeral volume")
74-
// Eventually(Object(vip)).Should(HaveField("ObjectMeta.OwnerReferences", Not(BeNil())))
73+
By("Verifying OwnerRef is set for ephemeral virtualIP")
7574
Eventually(Object(vip)).Should(HaveField("ObjectMeta.OwnerReferences", ConsistOf(MatchFields(IgnoreExtras, Fields{
7675
"APIVersion": Equal(networkingv1alpha1.SchemeGroupVersion.String()),
7776
"Kind": Equal("NetworkInterface"),
@@ -119,14 +118,14 @@ var _ = Describe("NetworkInterfaceEphemeralVirtualIP", func() {
119118
},
120119
}
121120
Eventually(Get(vip)).Should(Succeed())
122-
By("Verifying OwnerRef is not set for ephemeral volume when reclaim policy is retain")
121+
By("Verifying OwnerRef is not set for ephemeral virtualIP when reclaim policy is retain")
123122
Eventually(Object(vip)).Should(HaveField("ObjectMeta.OwnerReferences", BeEmpty()))
124123

125124
By("Updating reclaim policy to delete")
126125
baseNic := nic.DeepCopy()
127126
nic.Spec.VirtualIP.Ephemeral.VirtualIPTemplate.Spec.ReclaimPolicy = networkingv1alpha1.ReclaimPolicyTypeDelete
128127
Expect(k8sClient.Patch(ctx, nic, client.MergeFrom(baseNic))).To(Succeed())
129-
By("Verifying OwnerRef is updated for ephemeral volume")
128+
By("Verifying OwnerRef is updated for ephemeral virtualIP")
130129
Eventually(Object(vip)).Should(HaveField("ObjectMeta.OwnerReferences", ConsistOf(MatchFields(IgnoreExtras, Fields{
131130
"APIVersion": Equal(networkingv1alpha1.SchemeGroupVersion.String()),
132131
"Kind": Equal("NetworkInterface"),

0 commit comments

Comments
 (0)