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
IR-16: Implementing Leader Election #575
IR-16: Implementing Leader Election #575
Conversation
We will migrate this operator to leverage this package.
/test e2e-aws-image-registry cp: cannot create regular file '/var/run/secrets/ci.openshift.io/cluster-profile/day-2-manifests-insights-live.yaml': Read-only file system |
/test e2e-aws cp: cannot create regular file '/var/run/secrets/ci.openshift.io/cluster-profile/day-2-manifests-insights-live.yaml': Read-only file system |
/test e2e-aws |
1 similar comment
/test e2e-aws |
/retest |
/retest Error: Unable to find matching route for Route Table (rtb-0beb26e67e23ea820) and destination CIDR block (0.0.0.0/0). |
/retest |
/assign @dmage |
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.
few nits, otherwise looks good
klog.Warningf("Unable to watch %s: %v", path, err) | ||
continue | ||
} | ||
fileContents[path] = fcontent |
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.
You don't need to provide this map unless you want to avoid race conditions. But to avoid race conditions, the file consumer should provide the value that was read from the file.
If the consumer cannot provide it, these is no reason to read it manually.
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.
This was rather confusing but yeah, seems like if we don't pass it it calculates on its own. Patching it.
).WithLeaderElection( | ||
configv1.LeaderElection{ | ||
LeaseDuration: metav1.Duration{ | ||
Duration: 15 * time.Second, |
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.
Can we use default values?
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.
seems like we can, patching it.
func(ctx context.Context, cctx *controllercmd.ControllerContext) error { | ||
printVersion() | ||
rand.Seed(time.Now().UnixNano()) | ||
go metrics.RunServer(metricsPort) |
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.
You can keep shopCh and pass ctx.Done()
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.
That was my initial approach but I decided to get rid of it, it is not necessary.
Migrated to controllercmd so we can: 1. Have leader election 2. Have file watcher feature embed into the operator
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dmage, ricardomaraschini 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 |
Using controllercmd package to implement: