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

[AddressBinding] Enhance error handling #856

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gran-vmv
Copy link
Contributor

@gran-vmv gran-vmv commented Nov 1, 2024

Add conditions to CR. Follow SubnetPort conditions.
Handle SubnetPort deleted when AddressBinding exists.

Known issue: SubnetPort delete event cannot trigger deleteSuccess function call, thus the related AddressBinding will be processed by GC.

TODO: Improve UT.

Add conditions to CR. Follow SubnetPort conditions.
Handle SubnetPort deleted when AddressBinding exists.

Signed-off-by: Ran Gu <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 18.85246% with 99 lines in your changes missing coverage. Please review.

Project coverage is 64.61%. Comparing base (535a902) to head (9b0f083).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...kg/controllers/subnetport/subnetport_controller.go 19.32% 93 Missing and 3 partials ⚠️
pkg/nsx/services/subnetport/builder.go 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #856      +/-   ##
==========================================
+ Coverage   63.80%   64.61%   +0.80%     
==========================================
  Files          96       95       -1     
  Lines       15153    15203      +50     
==========================================
+ Hits         9668     9823     +155     
+ Misses       4794     4684     -110     
- Partials      691      696       +5     
Flag Coverage Δ
unit-tests 64.61% <18.85%> (+0.80%) ⬆️
Files with missing lines Coverage Δ
pkg/nsx/services/subnetport/builder.go 77.60% <0.00%> (-1.91%) ⬇️
...kg/controllers/subnetport/subnetport_controller.go 60.45% <19.32%> (-9.67%) ⬇️

... and 9 files with indirect coverage changes

@gran-vmv
Copy link
Contributor Author

gran-vmv commented Nov 5, 2024

Verified:

root@42256e78b24d8b424207f711d199ffce [ ~ ]# kubectl get addressbinding -A -oyaml
apiVersion: v1
items:
- apiVersion: crd.nsx.vmware.com/v1alpha1
  kind: AddressBinding
  metadata:
    creationTimestamp: "2024-11-05T03:33:50Z"
    generation: 1
    name: gran1
    namespace: kube-system
    resourceVersion: "3744197"
    uid: d443d68f-748c-44a7-a3e9-65cd94a493da
  spec:
    interfaceName: inf1
    vmName: vm1
  status:
    conditions:
    - lastTransitionTime: "2024-11-05T03:33:51Z"
      message: AddressBinding has been successfully created/updated
      reason: AddressBindingReady
      status: "True"
      type: Ready
    ipAddress: 192.168.0.7
kind: List
metadata:
  resourceVersion: ""

root@42256e78b24d8b424207f711d199ffce [ ~ ]# kubectl get addressbinding -A -oyaml
apiVersion: v1
items:
- apiVersion: crd.nsx.vmware.com/v1alpha1
  kind: AddressBinding
  metadata:
    creationTimestamp: "2024-11-05T03:33:50Z"
    generation: 1
    name: gran1
    namespace: kube-system
    resourceVersion: "3745448"
    uid: d443d68f-748c-44a7-a3e9-65cd94a493da
  spec:
    interfaceName: inf1
    vmName: vm1
  status:
    conditions:
    - lastTransitionTime: "2024-11-05T03:33:51Z"
      message: 'error occurred while processing the AddressBinding CR. Error: VM or
        interface not found'
      reason: AddressBindingNotReady
      status: "False"
      type: Ready
    ipAddress: ""
kind: List
metadata:
  resourceVersion: ""

root@42256e78b24d8b424207f711d199ffce [ ~ ]# kubectl get addressbinding -A -oyaml
apiVersion: v1
items:
- apiVersion: crd.nsx.vmware.com/v1alpha1
  kind: AddressBinding
  metadata:
    creationTimestamp: "2024-11-05T03:39:09Z"
    generation: 1
    name: gran1
    namespace: kube-system
    resourceVersion: "3747700"
    uid: 60f115fa-e0d3-464b-9a11-b047e1d2a731
  spec:
    vmName: vm1
  status:
    conditions:
    - lastTransitionTime: "2024-11-05T03:39:09Z"
      message: 'error occurred while processing the AddressBinding CR. Error: multiple
        interfaces found'
      reason: AddressBindingNotReady
      status: "False"
      type: Ready
    ipAddress: ""
kind: List
metadata:
  resourceVersion: ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants