Skip to content

Control the policy controller monitoring resources from chart, enhanc… - #1687

Open
senanz wants to merge 30 commits into
sigstore:mainfrom
senanz:issues_1388
Open

Control the policy controller monitoring resources from chart, enhanc…#1687
senanz wants to merge 30 commits into
sigstore:mainfrom
senanz:issues_1388

Conversation

@senanz

@senanz senanz commented Nov 3, 2024

Copy link
Copy Markdown

…ment for the current implmentation to hadd all the resources by default, The new change add avail to pass resourcesNames through the chart with list of resources comma sperataed for which resources to be monitored by the policy controller, the default is all resources if the flag wasn't presented in the chart

This PR resolves #1388

Signed-off-by: Senan Zedan (EXT-Nokia) senan.zedan.ext@nokia.com

Summary

The new change add avail to pass resourcesNames through the chart with list of resources comma sperataed for which resources to be monitored by the policy controller, the default is all resources if the flag wasn't presented in the chart

codysoyland and others added 3 commits November 3, 2024 15:06
Signed-off-by: Cody Soyland <codysoyland@github.com>
Signed-off-by: Senan Zedan (EXT-Nokia) <senan.zedan.ext@nokia.com>
…store#1683)

Bumps [google-github-actions/auth](https://github.com/google-github-actions/auth) from 2.1.6 to 2.1.7.
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](google-github-actions/auth@8254fb7...6fc4af4)

---
updated-dependencies:
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Senan Zedan (EXT-Nokia) <senan.zedan.ext@nokia.com>
…ment for the current implmentation to hadd all the resources by default, The new change add avail to pass resourcesNames through the chart with list of resources comma sperataed for which resources to be monitored by the policy controller, the default is all resources if the flag wasn't presented in the chart

Signed-off-by: Senan Zedan (EXT-Nokia) <senan.zedan.ext@nokia.com>
@senanz

senanz commented Nov 11, 2024

Copy link
Copy Markdown
Author

@vaikas - Could you please look into this?

@vaikas

vaikas commented Nov 11, 2024

Copy link
Copy Markdown
Collaborator

Could you add some tests, maybe here: https://github.com/sigstore/policy-controller/tree/main/test

@senanz

senanz commented Nov 12, 2024

Copy link
Copy Markdown
Author

@vaikas - per your request, test added.

@vaikas

vaikas commented Nov 12, 2024

Copy link
Copy Markdown
Collaborator

@vaikas - per your request, test added.

That does not really test any of this new code. You'd have to add a test that launches policy controller with these new flags, here's one example where we change the policy-controller behaviour by the flags:

# Install policy-controller that does not have TUF embedded or installed.

So, create a new kustomize file that launches policy controller with say --resource-name=pods, and customize it like here:

kustomize build test/kustomize-no-tuf | kubectl apply -f -

And then after the policy-controller has been started with the flags under test, you'd run your new test:

./test/e2e_test_cluster_image_policy_with_tsa.sh

It should at the bare minimum have a negative test and a positive test. So, if you're using resource-name pods, then launching a deployment with a failing config should succeed if you instead launch a pod.

@vaikas vaikas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking great! There's just some nits for naming, namespaces. One change that should be made it so make sure the tag->digest resolution does not actually happen. The webhook configuration is a good check, but it's easy enough to also make sure the actual resource (deployment) does not get modified.

Comment thread .github/workflows/kind-cluster-custom-resources.yaml Outdated
Comment thread .github/workflows/kind-cluster-custom-resources.yaml
Comment thread .github/workflows/kind-cluster-custom-resources.yaml Outdated
Comment thread .github/workflows/kind-cluster-custom-resources.yaml
Comment thread test/e2e_test_policy_custom_resource.sh
Comment thread test/testdata/policy-controller/e2e/test-deployment-with-custom-resource.yaml Outdated
Comment thread test/testdata/policy-controller/e2e/test-deployment-with-custom-resource.yaml Outdated
@codecov

codecov Bot commented Dec 9, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.66%. Comparing base (50ef092) to head (8723902).
⚠️ Report is 444 commits behind head on main.

Files with missing lines Patch % Lines
cmd/webhook/main.go 0.00% 26 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1687       +/-   ##
===========================================
- Coverage   52.92%   42.66%   -10.27%     
===========================================
  Files          44      121       +77     
  Lines        3979     9010     +5031     
===========================================
+ Hits         2106     3844     +1738     
- Misses       1651     4811     +3160     
- Partials      222      355      +133     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vaikas

vaikas commented Dec 9, 2024

Copy link
Copy Markdown
Collaborator

Looks like some of the changes I requested, and you marked as fixed have not made it in to this PR 🤔 ?

Also, looks like bunch of sed commands are failing, for example:
https://github.com/sigstore/policy-controller/actions/runs/12234409121/job/34140387122?pr=1687#step:14:132

@senanz

senanz commented Dec 9, 2024 via email

Copy link
Copy Markdown
Author

@senanz

senanz commented Dec 12, 2024

Copy link
Copy Markdown
Author

apolofize for the delay, updated.

@senanz
senanz requested a review from vaikas December 12, 2024 12:58
Comment thread cmd/webhook/main.go Outdated
Comment thread cmd/webhook/main.go Outdated
Comment thread .github/workflows/kind-cluster-custom-resources.yaml
@senanz
senanz requested a review from vaikas December 22, 2024 21:14
senanz and others added 12 commits December 23, 2024 13:23
…ment for the current implmentation to hadd all the resources by default, The new change add avail to pass resourcesNames through the chart with list of resources comma sperataed for which resources to be monitored by the policy controller, the default is all resources if the flag wasn't presented in the chart

Signed-off-by: Senan Zedan (EXT-Nokia) <senan.zedan.ext@nokia.com>
…ller into issues_1388

# Conflicts:
#	cmd/webhook/main.go
- name: Run Custom resources Tests
timeout-minutes: 5
run: |
chmod +x ./test/e2e_test_policy_custom_resource.sh

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FYI, you should be able to make this change in git so that you don't have to do this here.

@0xiso

0xiso commented Mar 10, 2025

Copy link
Copy Markdown
Contributor

@senanz Thank you for creating a great PR. I'm looking forward to this PR being merged and released soon. Do you have any plans to update this PR? If for any reason it is difficult to update the PR, I'm considering offering my assistance.

@senanz

senanz commented Mar 10, 2025

Copy link
Copy Markdown
Author

hi @0xiso , Will back to work on that early next week, will ping you on slack and for sure we can collaborate.

@0xiso

0xiso commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

Hi @senanz, I apologize for asking multiple times, but are there any updates? Please let me know if there's anything I can do to help merge this PR; I'd be happy to.

@Cajga

Cajga commented Sep 4, 2025

Copy link
Copy Markdown

Hi @senanz , sorry for bothering but do you still plan to give this a go?

@@ -0,0 +1,149 @@
# Copyright 2022 The Sigstore Authors.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

2025

@@ -0,0 +1,114 @@
#!/usr/bin/env bash
#
# Copyright 2024 The Sigstore Authors.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify only pods

6 participants