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

chore: audit controller and management controller permissions #2230

Merged
merged 9 commits into from
Jul 2, 2024

Conversation

krancour
Copy link
Member

@krancour krancour commented Jul 2, 2024

No description provided.

Copy link

netlify bot commented Jul 2, 2024

Deploy Preview for docs-kargo-akuity-io ready!

Name Link
🔨 Latest commit 415edab
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-akuity-io/deploys/668420ea7cd3550008d63a8d
😎 Deploy Preview https://deploy-preview-2230.kargo.akuity.io
📱 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.

@@ -50,7 +50,6 @@ rules:
- list
- patch
- promote
- update
Copy link
Member Author

Choose a reason for hiding this comment

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

The only update to Stages involves removing a finalizer and that can quite easily be done with a patch.

@@ -40,7 +40,6 @@ rules:
- get
- list
- watch
- patch
Copy link
Member Author

Choose a reason for hiding this comment

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

The controller doesn't need to patch Freight or Promotions at all.

@@ -57,7 +57,6 @@ rules:
verbs:
- get
- list
- patch
Copy link
Member Author

Choose a reason for hiding this comment

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

The controller does not need to patch Warehouses at all.

@@ -67,7 +67,6 @@ rules:
- warehouses/finalizers
- warehouses/status
verbs:
- update
Copy link
Member Author

Choose a reason for hiding this comment

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

The controller only ever patches status subresources.

@@ -114,7 +114,6 @@ rules:
- create
- get
- list
- patch
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 don't believe there is actually any need to patch AnalysisRuns. Everything works correctly e2e without this.

@hiddeco maybe you can give me a sanity check on this one, however.

Copy link
Member Author

Choose a reason for hiding this comment

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

nm. I just noticed the DM you sent me about this hours ago.

It's for aborting a verification's underlying AnalysisRun.

I'll fix this in the morning.

Comment on lines +101 to +108
- apiGroups:
- argoproj.io
resources:
- analysistemplates
verbs:
- get
- list
- watch
Copy link
Member Author

Choose a reason for hiding this comment

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

These permissions are better off down here where they will not be granted in the event that Rollouts integration is completely disabled.

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 78.46154% with 14 lines in your changes missing coverage. Please review.

Project coverage is 46.36%. Comparing base (1f23cfd) to head (415edab).

Files Patch % Lines
api/v1alpha1/helpers.go 79.54% 5 Missing and 4 partials ⚠️
internal/controller/stages/stages.go 0.00% 3 Missing ⚠️
...nternal/controller/management/projects/projects.go 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2230      +/-   ##
==========================================
+ Coverage   46.30%   46.36%   +0.05%     
==========================================
  Files         242      242              
  Lines       16777    16810      +33     
==========================================
+ Hits         7769     7794      +25     
- Misses       8636     8640       +4     
- Partials      372      376       +4     

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

@@ -16,7 +16,6 @@ rules:
- get
- list
- patch
- update
Copy link
Member Author

@krancour krancour Jul 2, 2024

Choose a reason for hiding this comment

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

This was only ever used for updating owners and finalizers, but those are easy enough to do with patches.

@@ -46,5 +46,4 @@ rules:
- projects/status
verbs:
- patch
- update
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 permission was already unused.

Comment on lines 36 to 42
func ClearAnnotations(ctx context.Context, c client.Client, obj client.Object, keys ...string) error {
kvs := make(map[string]*string, len(keys))
for _, k := range keys {
kvs[k] = nil
}
return patchAnnotations(ctx, c, obj, kvs)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Seems we stopped clearing refresh annotation quite some time ago and that was the only thing we were ever using this for.

@krancour krancour force-pushed the krancour/permissions-audit branch from e1e6aca to e310cbc Compare July 2, 2024 02:17
@krancour krancour force-pushed the krancour/permissions-audit branch from e310cbc to 415edab Compare July 2, 2024 15:46
@krancour krancour enabled auto-merge July 2, 2024 15:47
@krancour krancour added this pull request to the merge queue Jul 2, 2024
Merged via the queue into akuity:main with commit 132b288 Jul 2, 2024
17 checks passed
@krancour krancour deleted the krancour/permissions-audit branch July 2, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants