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

support HTTP headers in service API calls #11041

Merged
merged 6 commits into from
Sep 9, 2024

Conversation

JimBugwadia
Copy link
Member

@JimBugwadia JimBugwadia commented Sep 9, 2024

Explanation

Support HTTP headers in Service API calls

Related issue

Fixes #6833

Milestone of this PR

1.13

Documentation (required for features)

My PR contains new or altered behavior to Kyverno.

What type of PR is this

/kind feature

Proposed Changes

Support HTTP headers in Service API calls:

      context:
        - name: result
          apiCall:
            method: POST
            data:
              - key: foo
                value: bar
              - key: namespace
                value: "{{ `{{ request.namespace }}` }}"
            service:
              url: http://my-service.svc.cluster.local/validation
              headers:
                - key: "UserAgent"
                  value: "Kyverno Policy XYZ"
                - key: "Authorization"
                  value: "Bearer {{ MY_SECRET }}"

Proof Manifests

See unit tests.

Checklist

  • I have read the contributing guidelines.
  • I have read the PR documentation guide and followed the process including adding proof manifests to this PR.
  • This is a bug fix and I have added unit tests that prove my fix is effective.
  • This is a feature and I have added CLI tests that are applicable.
  • My PR needs to be cherry picked to a specific release branch which is .
  • My PR contains new or altered behavior to Kyverno and
    • CLI support should be added and my PR doesn't contain that functionality.

Further Comments

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 9, 2024
@JimBugwadia JimBugwadia added this to the Kyverno Release 1.13.0 milestone Sep 9, 2024
@JimBugwadia JimBugwadia marked this pull request as draft September 9, 2024 06:31
@JimBugwadia JimBugwadia requested review from vishal-chdhry and removed request for MarcelMue, realshuting, eddycharly and MariamFahmy98 September 9, 2024 06:41
Signed-off-by: Jim Bugwadia <[email protected]>
@JimBugwadia JimBugwadia marked this pull request as ready for review September 9, 2024 06:52
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Sep 9, 2024
Signed-off-by: Jim Bugwadia <[email protected]>
@JimBugwadia
Copy link
Member Author

Added changes from: #11042

@JimBugwadia JimBugwadia mentioned this pull request Sep 9, 2024
8 tasks
Signed-off-by: Jim Bugwadia <[email protected]>
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 26.92308% with 38 lines in your changes missing coverage. Please review.

Project coverage is 12.21%. Comparing base (be0ad07) to head (5a378d8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/kyverno/v1/zz_generated.deepcopy.go 0.00% 14 Missing ⚠️
...lient/applyconfigurations/kyverno/v1/httpheader.go 0.00% 8 Missing ⚠️
pkg/engine/apicall/executor.go 63.63% 4 Missing and 4 partials ⚠️
...ient/applyconfigurations/kyverno/v1/servicecall.go 0.00% 6 Missing ⚠️
pkg/client/applyconfigurations/utils.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11041      +/-   ##
==========================================
- Coverage   12.22%   12.21%   -0.01%     
==========================================
  Files         945      946       +1     
  Lines       87258    87295      +37     
==========================================
+ Hits        10663    10667       +4     
- Misses      75282    75313      +31     
- Partials     1313     1315       +2     

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

@eddycharly
Copy link
Member

/cherry-pick release-1.13

@eddycharly eddycharly enabled auto-merge (squash) September 9, 2024 18:03
@eddycharly eddycharly merged commit ce5cd47 into kyverno:main Sep 9, 2024
536 of 539 checks passed
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Sep 9, 2024
* support HTTP headers in service API calls

Signed-off-by: Jim Bugwadia <[email protected]>

* generate CRDs

Signed-off-by: Jim Bugwadia <[email protected]>

* fix chunked tests

Signed-off-by: Jim Bugwadia <[email protected]>

* fix POST call

Signed-off-by: Jim Bugwadia <[email protected]>

---------

Signed-off-by: Jim Bugwadia <[email protected]>
Co-authored-by: Charles-Edouard Brétéché <[email protected]>
@eddycharly eddycharly added the cherry-pick-completed The PR was cherry-picked (or merged) to required release branches label Sep 9, 2024
eddycharly added a commit that referenced this pull request Sep 9, 2024
* support HTTP headers in service API calls



* generate CRDs



* fix chunked tests



* fix POST call



---------

Signed-off-by: Jim Bugwadia <[email protected]>
Co-authored-by: Jim Bugwadia <[email protected]>
Co-authored-by: Charles-Edouard Brétéché <[email protected]>
@realshuting
Copy link
Member

This needs to be documented.

pipo02mix pushed a commit to giantswarm/kyverno-upstream that referenced this pull request Feb 10, 2025
* support HTTP headers in service API calls

Signed-off-by: Jim Bugwadia <[email protected]>

* generate CRDs

Signed-off-by: Jim Bugwadia <[email protected]>

* fix chunked tests

Signed-off-by: Jim Bugwadia <[email protected]>

* fix POST call

Signed-off-by: Jim Bugwadia <[email protected]>

---------

Signed-off-by: Jim Bugwadia <[email protected]>
Co-authored-by: Charles-Edouard Brétéché <[email protected]>
Signed-off-by: pipo02mix <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-completed The PR was cherry-picked (or merged) to required release branches cherry-pick-required milestone 1.13.0 size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feature] Service calls to support custom headers
5 participants