Skip to content

Create separate store for configuration and labeler - #9171

Merged
knative-prow-robot merged 2 commits into
knative:masterfrom
SwEngin:seperate_cfgmaps_8871
Sep 8, 2020
Merged

knative-prow-robot merged 2 commits into
knative:masterfrom
SwEngin:seperate_cfgmaps_8871

Conversation

@SwEngin

@SwEngin SwEngin commented Aug 25, 2020

Copy link
Copy Markdown

Issue #8871

@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 25, 2020
@knative-prow-robot

Copy link
Copy Markdown
Contributor

Welcome @SwEngin! It looks like this is your first PR to knative/serving 🎉

@knative-prow-robot

Copy link
Copy Markdown
Contributor

Hi @SwEngin. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 25, 2020
@googlebot

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no Indicates the PR's author has not signed the CLA. label Aug 25, 2020
@knative-prow-robot knative-prow-robot added the area/API API objects and controllers label Aug 25, 2020
@nak3

nak3 commented Aug 25, 2020

Copy link
Copy Markdown
Contributor

Hi @SwEngin
Could you please comment @googlebot I fixed it.? (like this #8285 (comment)). Then I guess CLA check will pass.

@mattmoor

Copy link
Copy Markdown
Contributor

I pulled the branch and the git history shows mona AT swengin.com as the author of these commits. Is that the email used to sign the CLA?

cc @thisisnotapril

@SwEngin

SwEngin commented Aug 25, 2020 via email

Copy link
Copy Markdown
Author

@vagababov

Copy link
Copy Markdown
Contributor

OK, I verified internally that CLA is signed.

@vagababov

Copy link
Copy Markdown
Contributor

@SwEngin can you add a message saying

@googlebot I fixed it.

ensure the period is there :)

@vagababov

Copy link
Copy Markdown
Contributor

There are 2 emails on CLA, so should be good, I think :)

@SwEngin
SwEngin force-pushed the seperate_cfgmaps_8871 branch from b314c2b to 72ba93e Compare August 25, 2020 16:26
@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes Indicates the PR's author has signed the CLA. and removed cla: no Indicates the PR's author has not signed the CLA. labels Aug 25, 2020

@vagababov vagababov left a comment

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.

/assign @whaught
You should not need new CM parsers though. Just the store.

@SwEngin

SwEngin commented Aug 25, 2020

Copy link
Copy Markdown
Author

@vagababov ok will fix that

@whaught whaught left a comment

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.

I don't think we need to duplicate features.go and defaults.go, just the store

@SwEngin
SwEngin force-pushed the seperate_cfgmaps_8871 branch from 72ba93e to 42fa8c4 Compare August 26, 2020 06:26
@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 26, 2020
@julz

julz commented Aug 26, 2020

Copy link
Copy Markdown
Contributor

/ok-to-test

@knative-prow-robot knative-prow-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 26, 2020
}

if cfg.Defaults == nil {
cfg.Defaults, _ = cfgmap.NewDefaultsConfigFromMap(map[string]string{})

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.

I think nil map here and below should work just fine.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

actually not because the responsive revision depends on 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.

Sure. I don't see how that relates to my comment though? :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

defaults can be nil but features cannot as it gets referenced in responsive revision (we use the same store there)

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.

You're reading the comment incorrectly. I am not saying that Defaults CM or Features CM can be nil, I mean the map you're passing to the call. You create unnecessary objects.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done!

@@ -0,0 +1,122 @@
# Copyright 2020 The Knative Authors

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.

This should a link to the ./config/core/configmaps/defaults.yaml rather than just a file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

so ConfigMapFromTestFile is not implemented to follow symlinks should I add that?

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.

All our other store/cm tests load symlinks without much trouble. It'll work here as well, I think?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

@@ -0,0 +1,94 @@
# Copyright 2020 The Knative Authors

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.

Ditto.

Comment thread pkg/reconciler/labeler/config/store.go Outdated
@@ -0,0 +1,108 @@
/*

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.

Should this re-use the one from above?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

you mean should reuse the configuration store?

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.

yeah is there a reason to have individual ones here?
It is fine, but I want it to be an informed decision.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

updated labeler to use configuration store, but I have my doubts regarding separation of concerns (coming from a java background) I know they will point to the same configmaps at the end, but

@SwEngin
SwEngin force-pushed the seperate_cfgmaps_8871 branch 2 times, most recently from 0c3878c to 7ea2f61 Compare August 27, 2020 12:19
Comment on lines +49 to +51
if diff := cmp.Diff(expected, config.Defaults, ignoreStuff...); diff != "" {
t.Errorf("Unexpected defaults config (-want, +got):\n%v", diff)
}

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.

I really prefer cmp.Equal in the if call and only call cmp.Diff in case it fails.
Same below.

t.Run("defaults", func(t *testing.T) {
expected, _ := cfgmap.NewDefaultsConfigFromConfigMap(defaultsConfig)
if diff := cmp.Diff(expected, config.Defaults, ignoreStuff...); diff != "" {
t.Errorf("Unexpected defaults config (-want, +got):\n%v", diff)

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.

Suggested change
t.Errorf("Unexpected defaults config (-want, +got):\n%v", diff)
t.Errorf("Unexpected defaults config (-want, +got):\n%s", diff)

t.Run("features", func(t *testing.T) {
expected, _ := cfgmap.NewFeaturesConfigFromConfigMap(featuresConfig)
if diff := cmp.Diff(expected, config.Features, ignoreStuff...); diff != "" {
t.Errorf("Unexpected features config (-want, +got):\n%v", diff)

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.

Suggested change
t.Errorf("Unexpected features config (-want, +got):\n%v", diff)
t.Errorf("Unexpected features config (-want, +got):\n%s", diff)

@SwEngin
SwEngin force-pushed the seperate_cfgmaps_8871 branch from 7ea2f61 to 7f7afc6 Compare August 28, 2020 15:06
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 28, 2020

@vagababov vagababov left a comment

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.

Nits mostly.
Thanks for the change.

t.Run("defaults", func(t *testing.T) {
expected, _ := cfgmap.NewDefaultsConfigFromConfigMap(defaultsConfig)
if got, want := config.Defaults, expected; !cmp.Equal(got, want, ignoreStuff...) {
t.Errorf("Unexpected defaults config = %v, want: %v, diff (-want, +got):\n %s", got, want, cmp.Diff(want, got, ignoreStuff...))

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.

Suggested change
t.Errorf("Unexpected defaults config = %v, want: %v, diff (-want, +got):\n %s", got, want, cmp.Diff(want, got, ignoreStuff...))
t.Errorf("Unexpected defaults config = %v, want: %v, diff (-want, +got):\n%s", got, want, cmp.Diff(want, got, ignoreStuff...))

We add \n for proper alignment in the output, hence we don't want the space.

t.Run("features", func(t *testing.T) {
expected, _ := cfgmap.NewFeaturesConfigFromConfigMap(featuresConfig)
if got, want := config.Features, expected; !cmp.Equal(got, want, ignoreStuff...) {
t.Errorf("Unexpected features config = %v, want: %v, diff (-want, +got):\n %s", got, want, cmp.Diff(want, got, ignoreStuff...))

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.

Suggested change
t.Errorf("Unexpected features config = %v, want: %v, diff (-want, +got):\n %s", got, want, cmp.Diff(want, got, ignoreStuff...))
t.Errorf("Unexpected features config = %v, want: %v, diff (-want, +got):\n%s", got, want, cmp.Diff(want, got, ignoreStuff...))

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.

This still here. And below.

@SwEngin
SwEngin force-pushed the seperate_cfgmaps_8871 branch from 7f7afc6 to e0fc19d Compare August 28, 2020 18:15

@vagababov vagababov left a comment

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.

/approve

If you fix the test nits, this should be good.

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 28, 2020
@SwEngin

SwEngin commented Aug 28, 2020

Copy link
Copy Markdown
Author

@vagababov will do thanks for your patience

@SwEngin
SwEngin force-pushed the seperate_cfgmaps_8871 branch 2 times, most recently from 74e2962 to c649bbc Compare September 8, 2020 06:03
@SwEngin
SwEngin force-pushed the seperate_cfgmaps_8871 branch from c649bbc to 9a9dd77 Compare September 8, 2020 06:03
@knative-metrics-robot

Copy link
Copy Markdown

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

File Old Coverage New Coverage Delta
pkg/reconciler/configuration/config/store.go Do not exist 100.0%

@vagababov vagababov left a comment

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.

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 8, 2020
@knative-prow-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SwEngin, vagababov

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:

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

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/API API objects and controllers cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants