-
Notifications
You must be signed in to change notification settings - Fork 204
Add leader elections flags/values to the deployment manifests #455
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
Conversation
templates/cmd/controller/main.go.tpl
Outdated
LeaderElection: ackCfg.EnableLeaderElection, | ||
LeaderElectionID: awsServiceAPIGroup, | ||
Namespace: ackCfg.WatchNamespace, | ||
LeaderElectionNamespace: ackSystemNamespace, |
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 was thinking about adding a --leader-election-namespace
flag to allow users to set their own.. thoughts?
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'm not the sure what the use case for this flag is, or what it actually does under the covers. operator-sdk
only scaffolds with the below options:
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: leaderElectionID,
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.
LeaderElectionNamespace
is the namespace where the Lease
object is created
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.
Without namespace, i'm running into unable to create controller manager {"aws.service": "lambda", "error": "unable to find leader election namespace: not running in-cluster, please specify LeaderElectionNamespace"}
- does operator-sdk use leases as well? or maybe configmaps (that's what controller-runtime used before leases introduction)?
Example logs of a controller acquiring leader lease:
Example logs of a controller waiting for leader lease to be freed:
|
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 feel like this change should be duplicated to the kuztomize templates as well.
6449e45
to
5d66bae
Compare
/retest |
1 similar comment
/retest |
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.
A few changes to this are needed. Also, we still need the leader-elect
RBAC files and changes that I sent as a patch, otherwise this will not work.
Issue #, if available: N/A Description of changes: Fixing deployment `args` to have boolean values on a single line. This is needed since the presence of the flag itself is a `truthy` statement, and the next line for the `env` is ignored. See [this](#455 (comment)) comment on `leader-elect` PR for more info. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
b5a9929
to
fb8f197
Compare
/test ecr-controller-test |
- "" | ||
resources: | ||
- configmaps | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- update | ||
- patch | ||
- delete |
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 have confirmed that ACK does not need the configmap
. This is sort of an either/or thing, where configmap
or leases
can be used, and the operator developer can choose which to use. For legacy
purposes and for operators that might have been developed before leases
were created, this is kept in the scaffolding.
Since ACK isn't exposing this flag which allows the choice, we are safe to remove the confimap
section from the RBAC.
@a-hilaly I hope all the above makes sense, let me know if there are questions...After this is removed I think we are good to go.
/retest |
/hold need to pin runtime |
@a-hilaly Why did you revert the RBAC changes? |
@acornett21 Looks like it's gonna be a bigger change than we expected.. since the feature is disabled by default, it's safe to go with this now and we will address the RBAC matters in a seperate PR |
/test dynamodb-controller-test |
@a-hilaly Can you elaborate on this? If someone goes to enable this, the controller will fail to function and throw errors without RBAC changes present. |
Yes that's correct. We wanted to make the release quickly today without RBAC support for few reasons:
I still would like to come up with a plan to add those RBACs in a seperate PR, i want to open one as soon as this one is merged. |
/test s3-controller-test |
66bb8f8
to
79b3864
Compare
@acornett21 good points, and thank you for bringing this! I just added few configurations for kustomize and helm chart templates. |
ACK controllers use k8s-sigs/controller-runtime behind the scenes, which support leader election. This feature is not properly working due to a missing configuration `LeaderElectionNamespace` which is used by the manager to create `k8s.io/coordination` Lease objects. This patch sets the default `LeaderElectionNamespace` to `ack-system` and adds the capability of enabling leader election using helm values. Co-authored-by: Adam Cornett <[email protected]>
b1fad3c
to
d61015a
Compare
/retest |
eca490f
to
1601f66
Compare
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.
/lgtm
1601f66
to
2b46d30
Compare
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.
/lgtm
/retest |
/lgtm cancel |
/hold |
/unhold |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: acornett21, RedbackThomson 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 |
…1884) Issue #, if available: - Relates: aws-controllers-k8s/code-generator#455 Description of changes: Adding these env's to the configmap so when leader election code is merged, installs on OpenShift can still function properly. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
…ntrollers-k8s#457) Issue #, if available: N/A Description of changes: Fixing deployment `args` to have boolean values on a single line. This is needed since the presence of the flag itself is a `truthy` statement, and the next line for the `env` is ignored. See [this](aws-controllers-k8s#455 (comment)) comment on `leader-elect` PR for more info. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue: aws-controllers-k8s/community#1753 (comment)
ACK controllers use k8s-sigs/controller-runtime behind the scenes, which
support leader election. This feature is not properly working due to a
missing configuration
LeaderElectionNamespace
which is used by themanager to create
k8s.io/coordination
Lease objects.This patch sets the default
LeaderElectionNamespace
toack-system
and adds the capability of enabling leader election using helm values.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Co-authored-by: Adam Cornett [email protected]