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

Update ObservabilityPolicy API to have minimum one target ref #2753

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

salonichf5
Copy link
Contributor

@salonichf5 salonichf5 commented Nov 7, 2024

Proposed changes

Write a clear and concise description that helps reviewers understand the purpose and impact of your changes. Use the
following format:

Problem: User wants ObservabilityPolicy CRD should require a minimum of 1 TargetRef.

Solution: Add validation to have minimum one target ref for each ObservabilityPolicy. This compatible change requires version update from v1alpha1 --> v1alpha2 . Add deprecated tag to v1alpha1 version of ObservabilityPolicy API.

Testing:

Tested manually using the example. Installed observabilityPolicy with on branch main and then installing the new generated CRDs of the updated ObservabilityPolicy API.

ObservabilityPolicy API gets updated to newer version when installing the new CRDs

k describe observabilitypolicies.gateway.nginx.org coffee
Name:         coffee
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  gateway.nginx.org/v1alpha2
Kind:         ObservabilityPolicy
Metadata:
  Creation Timestamp:  2024-11-07T06:20:58Z
  Generation:          1
  Resource Version:    10314
  UID:                 22295862-a3eb-4763-9cea-942c89b850d8
Spec:
  Target Refs:
    Group:  gateway.networking.k8s.io
    Kind:   HTTPRoute
    Name:   coffee
  Tracing:
    Ratio:  75
    Span Attributes:
      Key:     coffee-key
      Value:   coffee-value
    Strategy:  ratio
Status:
  Ancestors:
    Ancestor Ref:
      Group:      gateway.networking.k8s.io
      Kind:       HTTPRoute
      Name:       coffee
      Namespace:  default
    Conditions:
      Last Transition Time:  2024-11-07T06:20:58Z
      Message:               Policy is accepted
      Observed Generation:   1
      Reason:                Accepted
      Status:                True
      Type:                  Accepted
    Controller Name:         gateway.nginx.org/nginx-gateway-controller
Events:                      <none>

Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.

Closes #2524

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

ObservabilityPolicy API new version released[v1alpha2]. Version `v1aplha1` will be deprecated after release of version 2.3.

@salonichf5 salonichf5 requested review from a team as code owners November 7, 2024 07:11
@github-actions github-actions bot added bug Something isn't working documentation Improvements or additions to documentation labels Nov 7, 2024
Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.40%. Comparing base (fb9cad3) to head (3a03912).
Report is 15 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2753   +/-   ##
=======================================
  Coverage   89.40%   89.40%           
=======================================
  Files         110      110           
  Lines       10913    10913           
  Branches       50       50           
=======================================
  Hits         9757     9757           
  Misses       1098     1098           
  Partials       58       58           

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

@salonichf5
Copy link
Contributor Author

Should we mention in the release-note about the deprecation of v1alpha2 .

Currently, the user can use both versions of ObservabilityPolicy but the stored version is v1alpha2 . How do we deprecate it after 3 weeks?

Copy link
Contributor

@ADubhlaoich ADubhlaoich left a comment

Choose a reason for hiding this comment

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

Doc update LGTM!

@sjberman
Copy link
Contributor

If you install an old version of the policy, can you still view it properly when running kubectl get or describe? And everything still works as expected? Same with the new version?

Also, please update all ObservabilityPolicy examples to use the new version.

We should mention this in the release notes. After three releases we'll remove the v1alpha1 version, so let's create an issue targeted for the 2.3 milestone for this.

@salonichf5
Copy link
Contributor Author

salonichf5 commented Nov 11, 2024

Created a new issue to remove version v1alpha1

@github-actions github-actions bot added the tests Pull requests that update tests label Nov 14, 2024
@salonichf5
Copy link
Contributor Author

If you install an old version of the policy, can you still view it properly when running kubectl get or describe? And everything still works as expected? Same with the new version?

Also, please update all ObservabilityPolicy examples to use the new version.

We should mention this in the release notes. After three releases we'll remove the v1alpha1 version, so let's create an issue targeted for the 2.3 milestone for this.

Yes, when I create a policy with CRDs on main, the policy is set to v1alpha1 version. When I apply the newly defined CRDs on my branch, the policy gets updated to v1alpha2

We can still create a policy with version v1alpha1 but it automatically gets upgraded to v1alpha2 since that is the stored version.

@sjberman
Copy link
Contributor

Let's update the release note to include what the actual change is (relating to the targetRef minimum)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation release-notes tests Pull requests that update tests
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

Add validation to ObservabilityPolicy to require TargetRefs
3 participants