Skip to content

Conversation

@chetanmeh
Copy link
Member

Enables support for feature flags which for now is used to enable or disable support for provide-api-key (#4284)

Description

With #4284 support was added for provide-api-key annotation. In some cases we may want to enable this feature later. This PR introduces a feature flag support which allow disabling such feature based on config. To disable this feature use config like below

whisk {
    feature-flags {
        require-api-key-annotation = false
    }
}

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

*/
protected[core] def amendAnnotations(annotations: Parameters, exec: Exec, create: Boolean = true): Parameters = {
val newAnnotations = if (create) {
val newAnnotations = if (create && FeatureFlags.requireApiKeyAnnotation) {
Copy link
Member

Choose a reason for hiding this comment

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

i suspect that if this is set to false, some tests will fail.

did you consider also updating this for completeness although there may be another place or two that don't use this method that could be affected.

https://github.com/apache/incubator-openwhisk/blob/fb0bab64de6634725b409a63ffbb90fee295e8c1/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ControllerTestCommon.scala#L88-L95

Copy link
Member Author

Choose a reason for hiding this comment

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

For now I do not think that we should make test case complex with feature flag support. So test should work assuming all new features enabled (unless using some SPI mechanism). For main code we just validate manually that if feature is disabled then we get back the earlier behavior.

@rabbah rabbah merged commit bb4e4df into apache:master Mar 14, 2019
@chetanmeh chetanmeh deleted the feature-flag branch March 14, 2019 04:51
@falkzoll
Copy link
Contributor

This looks great :-). Exactly what I was thinking about. Many thanks for providing this implementation. For me this is a good example and I will take some time and look at the code to understand how it has been implemented. 👍

BillZong pushed a commit to BillZong/openwhisk that referenced this pull request Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants