Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Add resolved offerings to the AppInstance status #2377

Merged
merged 2 commits into from
Dec 19, 2023

Conversation

g-linville
Copy link
Contributor

@g-linville g-linville commented Dec 14, 2023

This is the second try at resolved offerings. This time I am just adding it as an additional controller route on AppInstances, leaving Defaults alone and making nothing depend on the new resolved offerings. I have tested this and verified that the bug that caused child acorns to be deleted is not present with these changes.

The unit tests for resolved offerings are copied from the defaults package and modified a little bit.

Checklist

  • The title of this PR would make a good line in Acorn's Release Note's Changelog
  • The title of this PR ends with a link to the main issue being address in parentheses, like: This is a title (#1216). Here's an example
  • All relevant issues are referenced in the PR description. NOTE: don't use GitHub keywords that auto-close issues
  • Commits follow contributing guidance
  • Automated tests added to cover the changes. If tests couldn't be added, an explanation is provided in the Verification and Testing section
  • Changes to user-facing functionality, API, CLI, and upgrade impacts are clearly called out in PR description
  • PR has at least two approvals before merging (or a reasonable exception, like it's just a docs change)

@g-linville g-linville changed the title Reapply "Resolved offerings (#2369)" (#2376) Resolved offerings second attempt Dec 14, 2023
@g-linville g-linville changed the title Resolved offerings second attempt Add resolved offerings to the AppInstance status Dec 14, 2023
Signed-off-by: Grant Linville <[email protected]>
@g-linville g-linville force-pushed the resolved-offerings-second-try branch from f375bd5 to acd4a24 Compare December 14, 2023 07:41
@g-linville g-linville marked this pull request as ready for review December 14, 2023 22:45
Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

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

Looking good. Found a few small things.

@@ -597,12 +597,34 @@ func containerAnnotation(container v1.Container) string {
return string(json)
}

func resolvedOfferingsAnnotation(appInstance *v1.AppInstance, container v1.Container) (string, error) {
if resolved, exists := appInstance.Status.ResolvedOfferings.Containers[container.Name]; exists {
data, err := convert.EncodeToMap(resolved)
Copy link
Member

Choose a reason for hiding this comment

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

why convert it to a map first?

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 was following the example of the containerAnnotation func right above it.

Copy link
Contributor

Choose a reason for hiding this comment

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

The comment above says it is converting to map first to sort the keys, but I thought json.Marshal does that automatically.

pkg/controller/appdefinition/deploy.go Show resolved Hide resolved
pkg/controller/resolvedofferings/region.go Show resolved Hide resolved
pkg/controller/resolvedofferings/region.go Outdated Show resolved Hide resolved
pkg/controller/resolvedofferings/resolvedofferings.go Outdated Show resolved Hide resolved
pkg/controller/resolvedofferings/resolvedofferings.go Outdated Show resolved Hide resolved
Signed-off-by: Grant Linville <[email protected]>
@g-linville g-linville requested a review from njhale December 19, 2023 14:33
@@ -597,12 +597,34 @@ func containerAnnotation(container v1.Container) string {
return string(json)
}

func resolvedOfferingsAnnotation(appInstance *v1.AppInstance, container v1.Container) (string, error) {
if resolved, exists := appInstance.Status.ResolvedOfferings.Containers[container.Name]; exists {
data, err := convert.EncodeToMap(resolved)
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment above says it is converting to map first to sort the keys, but I thought json.Marshal does that automatically.

pkg/controller/appdefinition/deploy.go Show resolved Hide resolved
@g-linville g-linville merged commit 17a4108 into acorn-io:main Dec 19, 2023
5 checks passed
@g-linville g-linville deleted the resolved-offerings-second-try branch December 19, 2023 17:41
dciangot added a commit to dciangot/runtime that referenced this pull request Dec 20, 2023
resolve offerings introduced in acorn-io#2377
dciangot added a commit to dciangot/runtime that referenced this pull request Dec 20, 2023
resolve offerings introduced in acorn-io#2377

Signed-off-by: dciangot <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants