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.

@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 89.51049% with 15 lines in your changes missing coverage. Please review.

Project coverage is 70.88%. Comparing base (6c7a5dd) to head (7683267).

Files with missing lines Patch % Lines
...kg/controllers/subnetport/subnetport_controller.go 89.28% 11 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #856      +/-   ##
==========================================
+ Coverage   70.61%   70.88%   +0.27%     
==========================================
  Files          95       95              
  Lines       15094    15205     +111     
==========================================
+ Hits        10658    10778     +120     
+ Misses       3710     3703       -7     
+ Partials      726      724       -2     
Flag Coverage Δ
unit-tests 70.88% <89.51%> (+0.27%) ⬆️
Files with missing lines Coverage Δ
pkg/nsx/services/subnetport/builder.go 80.00% <100.00%> (+0.49%) ⬆️
...kg/controllers/subnetport/subnetport_controller.go 77.11% <89.28%> (+6.99%) ⬆️

@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: ""

@gran-vmv gran-vmv force-pushed the eab-cond branch 3 times, most recently from 03ea1ca to 3a767e1 Compare November 8, 2024 03:17
Add conditions to CR. Follow SubnetPort conditions.
Handle SubnetPort deleted when AddressBinding exists.

Signed-off-by: Ran Gu <ran.gu@broadcom.com>
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