Skip to content

Apply Subscription.Spec.Config.Annotations to Deployments, Pods, ApiServices #3169

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

Merged

Conversation

cognifloyd
Copy link
Contributor

@cognifloyd cognifloyd commented Feb 3, 2024

Description of the change:

Use Subscription.Spec.Config.Annotations to apply admin-supplied annotations to an Operator's:

  • Deployments
  • Pods (via Deployment Spec)
  • ApiServices

Motivation for the change:

I need a way to annotate operator deployments to satisfy an admissions hook in my on-prem vanilla (not OCP) k8s clusters (The admissions hook requires annotations that say which team is responsible for that deployment).

After discussing in #olm-dev, it looks like Subscription is the best user (cluster admin) facing API to extend for this purpose, as other resources, like CSV, should generally be opaque to the cluster admin.

So, I added Annotations to SubscriptionConfig in: operator-framework/api#312
That was released in v0.22.0.

Architectural changes:

N/A

Testing remarks:

No testing yet. I need feedback on this before I do anything else.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Bug fixes are accompanied by regression test(s)
  • e2e tests and flake fixes are accompanied evidence of flake testing, e.g. executing the test 100(0) times
  • tech debt/todo is accompanied by issue link(s) in comments in the surrounding code
  • Tests are comprehensible, e.g. Ginkgo DSL is being used appropriately
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive
  • Tests marked as [FLAKE] are truly flaky and have an issue
  • Code is properly formatted

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 3, 2024
Copy link

openshift-ci bot commented Feb 3, 2024

Hi @cognifloyd. Thanks for your PR.

I'm waiting for a operator-framework 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.

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.

Copy link

openshift-ci bot commented Feb 3, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: cognifloyd
Once this PR has been reviewed and has the lgtm label, please assign joelanford for approval. For more information see the Kubernetes Code Review Process.

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

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

@grokspawn
Copy link
Contributor

/ok-to-test

@openshift-ci openshift-ci bot 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 Feb 7, 2024
@cognifloyd cognifloyd force-pushed the deployment_annotations branch from 1f0596e to 140f8d9 Compare February 14, 2024 22:12
Signed-off-by: Jacob Floyd <cognifloyd@gmail.com>
Signed-off-by: Jacob Floyd <cognifloyd@gmail.com>
Signed-off-by: Jacob Floyd <cognifloyd@gmail.com>
@cognifloyd cognifloyd force-pushed the deployment_annotations branch from 140f8d9 to 76bf38b Compare February 14, 2024 22:15
@cognifloyd cognifloyd marked this pull request as ready for review February 14, 2024 22:18
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 14, 2024
Copy link
Contributor

@stevekuznetsov stevekuznetsov left a comment

Choose a reason for hiding this comment

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

Do you own the definition of your validating admission webhook? It strikes me as easier to ensure that Subscriptions have the ownership annotations you need and exclude Deployments that have OLM management labels.

Copy link
Contributor

@stevekuznetsov stevekuznetsov left a comment

Choose a reason for hiding this comment

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

These changes look good, perhaps @joelanford can do a review here for direction.

Signed-off-by: Jacob Floyd <cognifloyd@gmail.com>
@cognifloyd cognifloyd force-pushed the deployment_annotations branch from 8c6c0b4 to f6e6199 Compare February 16, 2024 17:25
@cognifloyd
Copy link
Contributor Author

I just force pushed to signoff my commit and satisfy the DCO check.

@cognifloyd
Copy link
Contributor Author

cognifloyd commented Feb 16, 2024

Do you own the definition of your validating admission webhook? It strikes me as easier to ensure that Subscriptions have the ownership annotations you need and exclude Deployments that have OLM management labels.

Yes and no. Yes, my team manages the admissions webhook, but the policy on inspecting Deployments was defined by an audit team. So, just modifying that admissions webhook won't satisfy the auditor's policy which ties my hands.

Copy link
Member

@kevinrizza kevinrizza 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

if err != nil {
return err
} else if ownerSubscription == nil {
// This is not an error. For example, the PackageServer CSV in OLM is created without a Subscription.
Copy link
Member

Choose a reason for hiding this comment

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

👍

@kevinrizza kevinrizza added this pull request to the merge queue Feb 16, 2024
Merged via the queue into operator-framework:master with commit 40ba65c Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants