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

🐛 fix: put annotations in deployment's pod template #1432

Conversation

joelanford
Copy link
Member

Description

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@joelanford joelanford requested a review from a team as a code owner November 6, 2024 21:37
Copy link

netlify bot commented Nov 6, 2024

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 3064fae
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/672ccba5bbfdd9000843e56b
😎 Deploy Preview https://deploy-preview-1432--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -462,11 +476,11 @@ func convertToUnstructured(obj interface{}) unstructured.Unstructured {
return unstructured.Unstructured{Object: unstructuredObj}
}

func containsObject(obj unstructured.Unstructured, result []client.Object) client.Object {
func findObjectByName(name string, result []client.Object) client.Object {
Copy link
Contributor

@camilamacedo86 camilamacedo86 Nov 6, 2024

Choose a reason for hiding this comment

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

make sense the change to allow we mock the data like above for testDeployment 👍

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.78%. Comparing base (cfd4bec) to head (3064fae).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1432      +/-   ##
==========================================
+ Coverage   73.45%   73.78%   +0.32%     
==========================================
  Files          42       42              
  Lines        3063     3063              
==========================================
+ Hits         2250     2260      +10     
+ Misses        640      632       -8     
+ Partials      173      171       -2     
Flag Coverage Δ
e2e 55.40% <100.00%> (+0.06%) ⬆️
unit 55.27% <100.00%> (+2.67%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

camilamacedo86

This comment was marked as outdated.

By("verifying olm.targetNamespaces annotation in the deployment's pod template")
dep := findObjectByName("testDeployment", plainBundle.Objects)
Expect(dep).NotTo(BeNil())
Expect(dep.(*appsv1.Deployment).Spec.Template.Annotations).To(HaveKeyWithValue("olm.targetNamespaces", strings.Join(watchNamespaces, ",")))
Copy link
Contributor

Choose a reason for hiding this comment

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

We are checking here the change 👍

ObjectMeta: metav1.ObjectMeta{
Name: "testCSV",
Annotations: map[string]string{
"olm.properties": fmt.Sprintf("[{\"type\": %s, \"value\": \"%s\"}]", property.TypeConstraint, "value"),
},
},
Spec: v1alpha1.ClusterServiceVersionSpec{
InstallModes: []v1alpha1.InstallMode{{Type: v1alpha1.InstallModeTypeMultiNamespace, Supported: true}},
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand that it was removed because, after the conversion, we expect InstallStrategy, correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the piece of the CSV that I want to configure in each of the test scenarios, so I removed it here and then each test scenario does a deep copy before setting InstallModes for that scenario.

Namespace: installNamespace,
Name: depSpec.Name,
Labels: depSpec.Label,
Annotations: annotations,
Copy link
Contributor

@camilamacedo86 camilamacedo86 Nov 6, 2024

Choose a reason for hiding this comment

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

@joelanford, I have a quick question: should we not keep the annotations in both places, given that we’re merging other annotations with annotations := util.MergeMaps(in.CSV.Annotations, depSpec.Spec.Template.Annotations)?

Could we not have more annotations ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm just trying to match OLMv0's behavior (which I may still not have exactly right, btw. It's complicated). We are also dealing with the etcd size limit, so I don't want to duplicate stuff more than necessary. There is a Subscription.spec.config.annotations in OLMv0 that I think propagates to the deployment's annotations. So once we have the parameterized value stuff design/implemented/supported, users will be able to provide custom annotations.

Copy link
Contributor

@camilamacedo86 camilamacedo86 Nov 7, 2024

Choose a reason for hiding this comment

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

dealing with the etcd size limit
Bit by bit, memories are resurfacing... I remember this

Make sense 👍

@camilamacedo86
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2024
perdasilva
perdasilva previously approved these changes Nov 7, 2024
Copy link
Contributor

@perdasilva perdasilva left a comment

Choose a reason for hiding this comment

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

lgtm - just left a small suggestion. If you don't think it's necessary, I think it's ok to merge.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2024
@joelanford joelanford enabled auto-merge November 7, 2024 14:13
@joelanford joelanford force-pushed the fix-targetnamespace-annotation branch from d7b1425 to 3064fae Compare November 7, 2024 14:16
Copy link
Contributor

@tmshort tmshort left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2024
Copy link
Contributor

@perdasilva perdasilva left a comment

Choose a reason for hiding this comment

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

lgtm =D

@joelanford joelanford added this pull request to the merge queue Nov 7, 2024
Merged via the queue into operator-framework:main with commit bb80643 Nov 7, 2024
18 checks passed
@joelanford joelanford deleted the fix-targetnamespace-annotation branch November 8, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants