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

Merge cm updates #436

Merged
merged 2 commits into from
Feb 16, 2022
Merged

Merge cm updates #436

merged 2 commits into from
Feb 16, 2022

Conversation

100mik
Copy link
Contributor

@100mik 100mik commented Feb 16, 2022

Reduce the number of calls being made to update app config map

@100mik
Copy link
Contributor Author

100mik commented Feb 16, 2022

Started sorting GVs before storing them as well to make them deterministic
cc: @cppforlife

@@ -92,7 +76,17 @@ func (a *RecordedApp) usedGKs() (*[]schema.GroupKind, error) {

func (a *RecordedApp) UsedGKs() (*[]schema.GroupKind, error) { return a.usedGKs() }

func (a *RecordedApp) UpdateUsedGKs(gks []schema.GroupKind) error {
func (a *RecordedApp) UpdateUsedGVsAndGKs(gvs []schema.GroupVersion, gks []schema.GroupKind) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: As this function has grown in size, we can call two private functions 1. func (a *RecordedApp) updateUsedGVs(gvs []schema.GroupVersion) error and other func (a *RecordedApp) updateUsedGKs(gks []schema.GroupKind) error and then call

a.update(func(meta *Meta) {
		meta.UsedGVs = uniqGVs
		meta.UsedGKs = &uniqGKs
})```

instead of writing everything inside it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say it is pretty straight forward (with the exact same operations being performed on 2 lists of things)
I did consider it initially but chose not to do that as it would be something like uniqGKs() and uniqGVs() since the functions would just deduplicate the list and the actual update happens in the function itself.

I decided to stick with this because it is more logically straightforward. Leaving this open for discussion.

Copy link
Contributor

Choose a reason for hiding this comment

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

im ok with current way.

pkg/kapp/app/interfaces.go Show resolved Hide resolved
@cppforlife cppforlife merged commit af35dd5 into carvel-dev:develop Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants