-
Notifications
You must be signed in to change notification settings - Fork 744
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
Update enimetadata for interfaces with no ip info #3041
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,24 @@ func (imds TypedIMDS) GetMACs(ctx context.Context) ([]string, error) { | |
return list, err | ||
} | ||
|
||
// GetMACImdsFields returns the imds fields present for a MAC | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't we use
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will be preferable to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @orsenthil Can you add more details on using GetMACs.. So efa-only will not have any IP fields associated with them. So checking local-ipv4s field. Want to understand how we can use GetMACs here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Pavani-Panakanti - you are right. I thought, we were using the |
||
func (imds TypedIMDS) GetMACImdsFields(ctx context.Context, mac string) ([]string, error) { | ||
key := fmt.Sprintf("network/interfaces/macs/%s", mac) | ||
list, err := imds.getList(ctx, key) | ||
if err != nil { | ||
if imdsErr, ok := err.(*imdsRequestError); ok { | ||
log.Warnf("%v", err) | ||
return nil, imdsErr.err | ||
} | ||
return nil, err | ||
} | ||
// Remove trailing / | ||
for i, item := range list { | ||
list[i] = strings.TrimSuffix(item, "/") | ||
} | ||
return list, err | ||
} | ||
|
||
// GetInterfaceID returns the ID of the network interface. | ||
func (imds TypedIMDS) GetInterfaceID(ctx context.Context, mac string) (string, error) { | ||
key := fmt.Sprintf("network/interfaces/macs/%s/interface-id", mac) | ||
|
@@ -166,12 +184,6 @@ func (imds TypedIMDS) getInt(ctx context.Context, key string) (int, error) { | |
return dataInt, err | ||
} | ||
|
||
// GetNetworkCard returns the unique network card number associated with an interface. | ||
func (imds TypedIMDS) GetNetworkCard(ctx context.Context, mac string) (int, error) { | ||
key := fmt.Sprintf("network/interfaces/macs/%s/network-card", mac) | ||
return imds.getInt(ctx, key) | ||
} | ||
|
||
// GetDeviceNumber returns the unique device number associated with an interface. The primary interface is 0. | ||
func (imds TypedIMDS) GetDeviceNumber(ctx context.Context, mac string) (int, error) { | ||
key := fmt.Sprintf("network/interfaces/macs/%s/device-number", mac) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is if the ENI is truly missing
local-ipv4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. If these kind of 'structural' definitions is supported by any documentation or spec, that will be best to rely upon.