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

feat(api): add GetAnalysisRun endpoint #1682

Merged
merged 4 commits into from
Mar 26, 2024

Conversation

hiddeco
Copy link
Contributor

@hiddeco hiddeco commented Mar 26, 2024

This adds an endpoint to the API to get an AnalysisRun, to allow the UI to display the full YAML, besides offering a list based on the verification history information from a Stage.

The client used to get the AnalysisRun is set up in the same way as for the controller, and isolated from the "Kargo client" used for other resource kinds.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Copy link

netlify bot commented Mar 26, 2024

Deploy Preview for docs-kargo-akuity-io canceled.

Name Link
🔨 Latest commit 8c055fa
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-akuity-io/deploys/6602fdffee45a000083e50de

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 23.27586% with 89 lines in your changes are missing coverage. Please review.

Project coverage is 43.93%. Comparing base (46c2da5) to head (8c055fa).
Report is 2 commits behind head on main.

Files Patch % Lines
cmd/controlplane/api.go 0.00% 88 Missing ⚠️
internal/cli/cmd/server/server.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1682      +/-   ##
==========================================
- Coverage   44.10%   43.93%   -0.17%     
==========================================
  Files         202      203       +1     
  Lines       13043    13061      +18     
==========================================
- Hits         5753     5739      -14     
- Misses       7045     7075      +30     
- Partials      245      247       +2     

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

@hiddeco hiddeco force-pushed the api-get-analysisrun branch 2 times, most recently from 89d5330 to c483514 Compare March 26, 2024 14:18
@hiddeco hiddeco marked this pull request as ready for review March 26, 2024 14:23
@hiddeco hiddeco requested a review from a team as a code owner March 26, 2024 14:23
@hiddeco hiddeco force-pushed the api-get-analysisrun branch 2 times, most recently from 9542f39 to 42eb718 Compare March 26, 2024 14:39
@@ -60,4 +60,10 @@ data:
ARGOCD_URLS: {{ range $key, $val := .Values.api.argocd.urls }}{{ $key }}={{ $val }},{{- end }}
{{- end }}
ROLLOUTS_INTEGRATION_ENABLED: {{ quote .Values.api.rollouts.integrationEnabled }}
{{- if .Values.controller.rollouts.integrationEnabled }}
Copy link
Member

Choose a reason for hiding this comment

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

It bugs me that we're using a .Values.controller... setting for an API server concern...

I suspect we may eventually remove support for two separate clients for Kargo control plane and Rollouts control plane, so I wouldn't waste time fixing this. Just calling out that I recognize the peculiarity of this and think we can let it slide for now.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I take that back. It's easy enough to fix this. Sorry for the flip-flopping.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that's an actual copy/paste mistake from my side. The thing that's harder to change though is the .controller.rollouts.analysisRunsNamespace value.

Copy link
Member

Choose a reason for hiding this comment

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

Also, we'll still need this flag even if we remove support for the second client, so ya... any initial thought I had that this was temporary was completely off.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a scenario in which API and controller are configured differently? If not, we could move .rollouts up under .Values itself, with fallback to the previous fields where applicable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed the remaining .controller reference by amending c885b16

Copy link
Member

Choose a reason for hiding this comment

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

Is there a scenario in which API and controller are configured differently?

In a single Helm release... no.

API server is only ever installed on the control plane. Controllers can be more distributed, but any API server and controller that are co-located would probably agree on what integrations are enabled.

I agree we could move it up, although it is a breaking change... 🤔

hiddeco added 3 commits March 26, 2024 17:39
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
@hiddeco hiddeco force-pushed the api-get-analysisrun branch from 42eb718 to 8c055fa Compare March 26, 2024 16:55
@akuity akuity locked and limited conversation to collaborators Mar 26, 2024
@akuity akuity unlocked this conversation Mar 26, 2024
@@ -136,12 +144,14 @@ func NewServer(
cfg config.ServerConfig,
kubeClient kubernetes.Client,
internalClient client.Client,
rolloutsEnabled bool,
Copy link
Member

Choose a reason for hiding this comment

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

I suspect longer term we will find more things we need to pass in and might opt for some kind of config object here, but I think this is suitable for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, or ServerConfig being utilized better. As I am not sure what to think of passing config and options.

Copy link
Member

Choose a reason for hiding this comment

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

🤦‍♂️ I overlooked the ServerConfig that was already there... I might prefer if this bool were a field in there instead of loose.

Copy link
Member

Choose a reason for hiding this comment

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

Ah... you merged, but this was non-blocking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do a quick follow up tomorrow as I initially didn't want to touch it due to it dealing with loading user defined settings.

But I think a way I do feel comfortable with is to overwrite / downgrade these settings if they are not feasible (due to e.g. the CRDs not being present).

Copy link
Member

Choose a reason for hiding this comment

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

It's probably possible though for the CRDs to be present on the cluster and the integration is still not desired.

@krancour krancour added this to the v0.5.0 milestone Mar 26, 2024
@hiddeco hiddeco added this pull request to the merge queue Mar 26, 2024
Merged via the queue into akuity:main with commit 11a956e Mar 26, 2024
15 of 17 checks passed
@hiddeco hiddeco deleted the api-get-analysisrun branch March 26, 2024 19:44
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.

3 participants