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

refactor: change generic secret label #3331

Merged
merged 6 commits into from
Jan 22, 2025

Conversation

krancour
Copy link
Member

@jessesuen @gdsoumya this PR changes the label used to indicate a Secret is a generic one as discussed offline.

New Secrets get created with the new label.

To not break backwards compatibility with v1.2.0, updates will swap the legacy label for the new one and list operations will list all Secrets labeled with one or both.

There is a small breaking change, which will be documented in the release notes:

Expressions now have access only to appropriately labeled Secrets. That should have been included in #2975, but was accidentally overlooked.

Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Copy link

netlify bot commented Jan 21, 2025

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit 511864c
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-io/deploys/6791611c3998c50008ed7eef
😎 Deploy Preview https://deploy-preview-3331.docs.kargo.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.

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 83.87097% with 10 lines in your changes missing coverage. Please review.

Project coverage is 52.53%. Comparing base (24f71a5) to head (511864c).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
internal/api/delete_project_secret_v1alpha1.go 25.00% 2 Missing and 1 partial ⚠️
internal/api/list_project_secrets_v1alpha1.go 86.36% 2 Missing and 1 partial ⚠️
internal/directives/simple_engine_promote.go 89.28% 2 Missing and 1 partial ⚠️
internal/api/update_project_secret_v1alpha1.go 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3331      +/-   ##
==========================================
+ Coverage   52.05%   52.53%   +0.48%     
==========================================
  Files         295      291       -4     
  Lines       26695    26586     -109     
==========================================
+ Hits        13895    13968      +73     
+ Misses      12041    11855     -186     
- Partials      759      763       +4     

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

@hiddeco hiddeco changed the title refactore: change generic secret label refactor: change generic secret label Jan 21, 2025
@krancour krancour force-pushed the krancour/change-generic-secret-label branch from 27c0c77 to c02a5f8 Compare January 22, 2025 01:36
…in v1.4.0

Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
@krancour krancour force-pushed the krancour/change-generic-secret-label branch from c02a5f8 to 77cab9e Compare January 22, 2025 01:37
@jessesuen
Copy link
Member

As part of this, let's also get rid of kargo.akuity.io/analysis-run-template label, which was never used/documented/etc...

@krancour
Copy link
Member Author

As part of this, let's also get rid of kargo.akuity.io/analysis-run-template label, which was never used/documented/etc...

@jessesuen there are spots in the code where we list only Secrets or ConfigMaps that have that label. When building an AnalysisRun we also refuse references to any ConfigMap or Secret not labeled in that way.

Can you clarify for me how you want those behaviors to change? Are we simply eliminating those constraints? Or, more likely, are we eliminating that constraint for ConfigMaps and for Secrets, we will require the new generic cred label instead?

@jessesuen
Copy link
Member

there are spots in the code where we list only Secrets or ConfigMaps that have that label

It must not be enforced with the Job metric. In other words, I can currently create a job that references a secret to be used as an env var, and it currently works. So the label is not really fulfilling it's purpose, if that was the intent.

@krancour
Copy link
Member Author

When building an AnalysisRun we also refuse references to any ConfigMap or Secret not labeled in that way.

It must not be enforced with the Job metric. In other words, I can currently create a job that references a secret to be used as an env var, and it currently works. So the label is not really fulfilling it's purpose, if that was the intent.

My apologies. I was a bit hasty in my analysis of where this was used and I mis-identified a chunk of code that referenced that label.

This is used exclusively by API endpoints that don't appear ever to have been used.

So that label can go away easily.

…mplate label

Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
@krancour krancour added this pull request to the merge queue Jan 22, 2025
Merged via the queue into akuity:main with commit 95ae6a6 Jan 22, 2025
17 checks passed
@krancour krancour deleted the krancour/change-generic-secret-label branch January 22, 2025 22:04
github-actions bot pushed a commit that referenced this pull request Jan 23, 2025
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
(cherry picked from commit 95ae6a6)
@akuitybot
Copy link

Successfully created backport PR for release-1.2:

fykaa pushed a commit to fykaa/kargo that referenced this pull request Feb 6, 2025
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
aidan-canva pushed a commit to aidan-canva/kargo that referenced this pull request Feb 12, 2025
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Aidan Rowe <aidan@canva.com>
aidan-canva pushed a commit to aidan-canva/kargo that referenced this pull request Feb 12, 2025
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Aidan Rowe <aidan@canva.com>
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.

4 participants