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

Bug 2100033: Fetch VM IP from DHCP server to set NodeInternalIP #22

Merged
merged 1 commit into from Jun 24, 2022

Conversation

Karthik-K-N
Copy link
Member

@Karthik-K-N Karthik-K-N commented Jun 23, 2022

Main intention of this PR is to set the NodeInternalIP for machine so that the cluster auto approver will approve the server csr requests

  1. With DHCP server in place , The IP of the machine needs to fetched from dhcp server lease using the VM mac address
  2. Also a cache implementation is added to avoid frequent calls to DHCP server
  • Add unit test cases

@openshift-ci openshift-ci bot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jun 23, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 23, 2022

@Karthik-K-N: This pull request references Bugzilla bug 2100033, which is invalid:

  • expected the bug to target the "4.11.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 2100033: Fetch VM IP from DHCP server to set NodeInternalIP

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot requested a review from mkumatag June 23, 2022 08:10
@Karthik-K-N
Copy link
Member Author

@mkumatag @dharaneeshvrd @Prajyot-Parab Please review.

@mkumatag
Copy link
Member

mkumatag commented Jun 23, 2022

@Karthik-K-N there is an already cache library written here in the https://github.com/kubernetes/client-go/blob/master/tools/cache/expiration_cache.go package which supports the TTL as well, wondering if we can use that here directly.

This one in particular https://github.com/kubernetes/client-go/blob/8dfe88aeffaac2cd6aba895db8fccfb51baf770d/tools/cache/expiration_cache.go#L203

@Karthik-K-N
Copy link
Member Author

@Karthik-K-N there is an already cache library written here in the https://github.com/kubernetes/client-go/blob/master/tools/cache/expiration_cache.go package which supports the TTL as well, wondering if we can use that here directly.

This one in particular https://github.com/kubernetes/client-go/blob/8dfe88aeffaac2cd6aba895db8fccfb51baf770d/tools/cache/expiration_cache.go#L203

Sure, Will check that out

@openshift-ci openshift-ci bot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jun 23, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 23, 2022

@Karthik-K-N: This pull request references Bugzilla bug 2100033, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.11.0) matches configured target release for branch (4.11.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

No GitHub users were found matching the public email listed for the QA contact in Bugzilla (pdsilva@redhat.com), skipping review request.

In response to this:

Bug 2100033: Fetch VM IP from DHCP server to set NodeInternalIP

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Karthik-K-N
Copy link
Member Author

Updated with changes to use cache functions from client-go. This PR is ready for PR

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add some unit tests around this as well?

pkg/actuators/machine/instances.go Outdated Show resolved Hide resolved
@@ -20,6 +21,8 @@ const (
requeueAfterSeconds = 20
requeueAfterFatalSeconds = 180
masterLabel = "node-role.kubernetes.io/master"
// CacheTTL is duration of time to store the vm ip in cache
CacheTTL = time.Duration(15) * time.Minute
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this 15mins? we need to understand what's the lease period for the dhcp IP address and set the tll accordingly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this can be moved to that new file caching.go

pkg/actuators/machine/reconciler.go Outdated Show resolved Hide resolved
pkg/actuators/machine/reconciler.go Outdated Show resolved Hide resolved
pkg/actuators/machine/reconciler.go Outdated Show resolved Hide resolved
klog.Infof("found DHCP server with ID %s for network ID %s", *server.Network.ID, *networkID)
dhcpServerDetails, err = r.powerVSClient.GetDHCPServerByID(*server.ID)
if err != nil || dhcpServerDetails == nil {
errStr := fmt.Errorf("failed to get DHCP server details for with DHCP server ID: %s error: %v ", *server.Network.ID, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is chance of NPE exception when err == nil and dhcpServerDetails == nil

pkg/actuators/machine/reconciler.go Show resolved Hide resolved
pkg/actuators/machine/reconciler.go Show resolved Hide resolved
pkg/actuators/machine/reconciler.go Show resolved Hide resolved
pkg/actuators/machine/reconciler.go Outdated Show resolved Hide resolved
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 24, 2022

@Karthik-K-N: This pull request references Bugzilla bug 2100033, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.11.0) matches configured target release for branch (4.11.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

No GitHub users were found matching the public email listed for the QA contact in Bugzilla (pdsilva@redhat.com), skipping review request.

In response to this:

Bug 2100033: Fetch VM IP from DHCP server to set NodeInternalIP

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor nit, otherwise lgtm

pkg/actuators/machine/caching.go Outdated Show resolved Hide resolved
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 24, 2022

@Karthik-K-N: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 24, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 24, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Karthik-K-N, mkumatag

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 24, 2022
@openshift-ci openshift-ci bot merged commit f52a8d4 into openshift:main Jun 24, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 24, 2022

@Karthik-K-N: All pull requests linked via external trackers have merged:

Bugzilla bug 2100033 has been moved to the MODIFIED state.

In response to this:

Bug 2100033: Fetch VM IP from DHCP server to set NodeInternalIP

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants