Skip to content

Experimental features configuration and validation#5214

Merged
knative-prow-robot merged 7 commits into
knative:mainfrom
slinkydeveloper:experimental_flags
May 26, 2021
Merged

Experimental features configuration and validation#5214
knative-prow-robot merged 7 commits into
knative:mainfrom
slinkydeveloper:experimental_flags

Conversation

@slinkydeveloper
Copy link
Copy Markdown
Contributor

@slinkydeveloper slinkydeveloper commented Apr 8, 2021

Signed-off-by: Francesco Guardiani francescoguard@gmail.com

Details: https://docs.google.com/document/d/1AoH0FyLeuHIg5snrlCKzELQv-NEA6bbjTU2Qv3zlW5k/edit?usp=sharing

Proposed Changes

  • 🎁 Store to read the experimental features flags from a specific config map
  • 🎁 Validator for APIs when using experimental features
  • 🎁 Scaffolded the directory to add experimental features e2e/conformance tests

Release Note


Docs

@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 8, 2021
@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 8, 2021
@knative-prow-robot
Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 8, 2021
@slinkydeveloper slinkydeveloper marked this pull request as ready for review April 8, 2021 13:20
@matzew
Copy link
Copy Markdown
Member

matzew commented Apr 8, 2021

How do I register "experimental features"?

@slinkydeveloper
Copy link
Copy Markdown
Contributor Author

How do I register "experimental features"?

There is no need to "register" an experimental feature:

  • By default, all features are disabled.
  • If the CM contains my-feature: "true", then the feature is enabled.

@matzew
Copy link
Copy Markdown
Member

matzew commented Apr 8, 2021

If the CM contains my-feature: "true", then the feature is enabled.

not fully getting how the my-feature is than really defined, as like more concrete: timeout-enabeld?

how would that apply to a timeout field?

@slinkydeveloper
Copy link
Copy Markdown
Contributor Author

@matzew the field still has to be in the api data structure, but it will be rejected by the webhook if the feature is not enabled. I'll explain it in the doc I'm writing 😄

@@ -0,0 +1 @@
core/configmaps/experimental-features.yaml No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we call this just features.yaml, to be consistent with Knative Serving? A feature can be Alpha, ie experimental. A feature can also be stable and still be disabled if a vendor doesn't want it for X reason.

Copy link
Copy Markdown
Contributor Author

@slinkydeveloper slinkydeveloper Apr 9, 2021

Choose a reason for hiding this comment

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

I added a comment in the doc about that. I don't like mixing up the concepts, I would prefer that if a feature still needs a flag to enable/disable, it even after GA, that flag should live somewhere else, wherever it makes more sense to do so. e.g. a feature related to broker config should live in the broker config map.

This approach of keeping it separate from experimental features also fits in the various scoping of configurations we already implement for every component. I don't want experimental features to end up re-doing that.

apiVersion: v1
kind: ConfigMap
metadata:
name: config-experimental-features
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here

Comment thread pkg/apis/experimental/api_validation.go

if (fieldVal.Kind() == reflect.Ptr || fieldVal.Kind() == reflect.Slice || fieldVal.Kind() == reflect.Map) && !fieldVal.IsNil() {
errs = errs.Also(&apis.FieldError{
Message: fmt.Sprintf("Disallowed field because the experimental feature '%s' is disabled", featureName),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove experimental

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2021

Codecov Report

Merging #5214 (f093286) into main (0653ac4) will increase coverage by 0.08%.
The diff coverage is 90.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5214      +/-   ##
==========================================
+ Coverage   82.68%   82.77%   +0.08%     
==========================================
  Files         194      197       +3     
  Lines        6006     6071      +65     
==========================================
+ Hits         4966     5025      +59     
- Misses        717      721       +4     
- Partials      323      325       +2     
Impacted Files Coverage Δ
pkg/apis/experimental/features.go 84.61% <84.61%> (ø)
pkg/apis/experimental/store.go 91.30% <91.30%> (ø)
pkg/apis/experimental/api_validation.go 93.10% <93.10%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0653ac4...f093286. Read the comment docs.

@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 8, 2021
@slinkydeveloper slinkydeveloper changed the title [WIP] Experimental features configuration and validation Experimental features configuration and validation Apr 22, 2021
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 22, 2021
@knative-prow-robot knative-prow-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. area/test-and-release Test infrastructure, tests or release labels May 19, 2021
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
…conformance tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 19, 2021
@slinkydeveloper
Copy link
Copy Markdown
Contributor Author

I've added a directory (and modified the GH action) where we can place the experimental features e2e/conformance tests. These are not going to cause any troubles to existing e2e/conformance tests.

Fix e2e tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on the affected files.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/experimental/api_validation.go Do not exist 95.5%
pkg/apis/experimental/features.go Do not exist 92.3%
pkg/apis/experimental/store.go Do not exist 93.8%

@vaikas
Copy link
Copy Markdown
Contributor

vaikas commented May 24, 2021

/lgtm
Thanks for driving this through. Will be great to keep on experimenting and improving and learning!
I'll wait on actual approval, since you said you'd do that tmw.

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 24, 2021
Copy link
Copy Markdown
Member

@matzew matzew left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matzew, slinkydeveloper

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [matzew,slinkydeveloper]

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2021
@knative-prow-robot knative-prow-robot merged commit 295134c into knative:main May 26, 2021
@slinkydeveloper slinkydeveloper deleted the experimental_flags branch May 26, 2021 12:31
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. area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants