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

Make build operator leader durations configurable #433

Merged
merged 4 commits into from
Oct 10, 2020
Merged

Make build operator leader durations configurable #433

merged 4 commits into from
Oct 10, 2020

Conversation

HeavyWombat
Copy link
Contributor

@HeavyWombat HeavyWombat commented Oct 7, 2020

In case the build operator needs to be started with very specific leader
lease duration configuration, there is currently no way to configure it.

Introduce new section in build configuration that contains some of the
manager options to be configurable and passed through to the manager.

Pass new section values as-is into the manager options for the build
operator setup. Any nil value will result in the default value.

Add four new environment variables to override these settings:

  • BUILD_OPERATOR_LEADER_ELECTION_NAMESPACE
  • BUILD_OPERATOR_LEASE_DURATION
  • BUILD_OPERATOR_RENEW_DEADLINE
  • BUILD_OPERATOR_RETRY_PERIOD

Please note: All duration based environment variables use the time duration
parse function, so they expect an input like 42s.

This should fix #414.

Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

Nice work. Requesting two additions:

  • a unit test where BUILD_OPERATOR_LEADER_ELECTION_NAMESPACE is set
  • documentation for the environment variables, maybe just add a new file within the docs folder about the manager configuration; we will need to link this from somewhere then separately (the metrics.md is currently also not referenced from anywhere which we will also need to fix)

@zhangtbj
Copy link
Contributor

zhangtbj commented Oct 9, 2020

A comment:

In case the build operator needs to be started with very specific leader
lease duration configuration, there is currently no way to configure it.

Introduce new section in build configuration that contains some of the
manager options to be configurable and passed through to the manager.

Pass new section values as-is into the manager options for the build
operator setup. Any `nil` value will result in the default value.

Add four new environment variables to override these settings:
- `BUILD_OPERATOR_LEADER_ELECTION_NAMESPACE`
- `BUILD_OPERATOR_LEASE_DURATION`
- `BUILD_OPERATOR_RENEW_DEADLINE`
- `BUILD_OPERATOR_RETRY_PERIOD`

Hint: All duration based environment variables use the time duration
parse function, so they expect an input like `42s`.
In order to make it more readable and distinguishable, rename `c` to
a name that is more descriptive: `buildCfg`.
The current namespace of the build-operator lock configmap is hard-coded
to be `default` at the moment. With the new override possibilities, it
can be set to a more suitable location.

Use downward API to set `BUILD_OPERATOR_LEADER_ELECTION_NAMESPACE`
environment variable in the deployment YAML for the build-operator to be
the same namespace as the operator pod is located in.
Add new configuration documentation to explain the possible overrides of
the build-operator using environment variables.
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 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-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 9, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SaschaSchwarze0

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 9, 2020
@openshift-merge-robot openshift-merge-robot merged commit 79806d8 into shipwright-io:master Oct 10, 2020
@HeavyWombat HeavyWombat deleted the add/operator-config-overrides branch October 12, 2020 08:44
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow the RenewDeadline and LeaderElectionNamespace to be configurable
5 participants