Skip to content

Commit 97b021f

Browse files
committed
introduce reclaim policy for ephemerally created virtualIP
1 parent 6be4b62 commit 97b021f

File tree

14 files changed

+345
-32
lines changed

14 files changed

+345
-32
lines changed

api/networking/v1alpha1/virtualip_types.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ const (
2828
VirtualIPTypePublic VirtualIPType = "Public"
2929
)
3030

31+
// ReclaimPolicyType is the ironcore ReclaimPolicy of a VirtualIP.
32+
type ReclaimPolicyType string
33+
34+
const (
35+
// ReclaimPolicyTypeRetain is used for any VirtualIP that is retained when the claim of VirtualIP is released.
36+
ReclaimPolicyTypeRetain ReclaimPolicyType = "Retain"
37+
// ReclaimPolicyTypeDelete is used for any VirtualIP that is deleted when the claim of VirtualIP is released.
38+
ReclaimPolicyTypeDelete ReclaimPolicyType = "Delete"
39+
)
40+
3141
// VirtualIPStatus defines the observed state of VirtualIP
3242
type VirtualIPStatus struct {
3343
// IP is the allocated IP, if any.
@@ -55,8 +65,15 @@ type VirtualIPList struct {
5565
Items []VirtualIP `json:"items"`
5666
}
5767

68+
type EphemeralVirtualIPSpec struct {
69+
// VirtualIPSpec defines the desired state of VirtualIP
70+
VirtualIPSpec `json:",inline"`
71+
// ReclaimPolicy is the ReclaimPolicyType of virtualIP
72+
ReclaimPolicy ReclaimPolicyType `json:"reclaimPolicy,omitempty"`
73+
}
74+
5875
// VirtualIPTemplateSpec is the specification of a VirtualIP template.
5976
type VirtualIPTemplateSpec struct {
6077
metav1.ObjectMeta `json:"metadata,omitempty"`
61-
Spec VirtualIPSpec `json:"spec,omitempty"`
78+
Spec EphemeralVirtualIPSpec `json:"spec,omitempty"`
6279
}

api/networking/v1alpha1/zz_generated.deepcopy.go

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

client-go/applyconfigurations/internal/internal.go

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

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

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

client-go/applyconfigurations/networking/v1alpha1/virtualiptemplatespec.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/applyconfigurations/utils.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.

client-go/openapi/zz_generated.openapi.go

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

internal/apis/networking/v1alpha1/zz_generated.conversion.go

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

internal/apis/networking/validation/virtualiptemplate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func ValidateVirtualIPTemplateSpec(spec *networking.VirtualIPTemplateSpec, fldPa
3333
var allErrs field.ErrorList
3434

3535
allErrs = append(allErrs, validateVirtualIPTemplateSpecMetadata(&spec.ObjectMeta, fldPath.Child("metadata"))...)
36-
allErrs = append(allErrs, validateVirtualIPSpec(&spec.Spec, fldPath.Child("spec"))...)
36+
allErrs = append(allErrs, validateVirtualIPSpec(&spec.Spec.VirtualIPSpec, fldPath.Child("spec"))...)
3737

3838
return allErrs
3939
}

internal/apis/networking/virtualip_types.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ const (
2828
VirtualIPTypePublic VirtualIPType = "Public"
2929
)
3030

31+
// ReclaimPolicyType is the ironcore ReclaimPolicy of a VirtualIP.
32+
type ReclaimPolicyType string
33+
34+
const (
35+
// ReclaimPolicyTypeRetain is used for any VirtualIP that is retained when the claim of VirtualIP is released.
36+
ReclaimPolicyTypeRetain ReclaimPolicyType = "Retain"
37+
// ReclaimPolicyTypeDelete is used for any VirtualIP that is deleted when the claim of VirtualIP is released.
38+
ReclaimPolicyTypeDelete ReclaimPolicyType = "Delete"
39+
)
40+
3141
// VirtualIPStatus defines the observed state of VirtualIP
3242
type VirtualIPStatus struct {
3343
// IP is the allocated IP, if any.
@@ -55,8 +65,15 @@ type VirtualIPList struct {
5565
Items []VirtualIP
5666
}
5767

68+
type EphemeralVirtualIPSpec struct {
69+
// VirtualIPSpec defines the desired state of VirtualIP
70+
VirtualIPSpec
71+
// ReclaimPolicy is the ReclaimPolicyType of virtualIP
72+
ReclaimPolicy ReclaimPolicyType `json:"reclaimPolicy,omitempty"`
73+
}
74+
5875
// VirtualIPTemplateSpec is the specification of a VirtualIP template.
5976
type VirtualIPTemplateSpec struct {
6077
metav1.ObjectMeta
61-
Spec VirtualIPSpec
78+
Spec EphemeralVirtualIPSpec
6279
}

0 commit comments

Comments
 (0)