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

Add GetAppRepository to kubeops backend #4027

Merged
merged 2 commits into from
Jan 5, 2022

Conversation

absoludity
Copy link
Contributor

@absoludity absoludity commented Jan 5, 2022

Description of the change

This PR primarily adds an endpoint to the current kubeops backend handler to get an app repository, importantly, that includes the related auth header/ca.crt secret in the response. The dashboard currently relies on fetching app repo secrets directly from the k8s API server, which we want to remove. This is an initial work-around to avoid requiring a generic get secret endpoint (see #3922 for discussion of options).

While there, I've fixed the returnK8sError helper which was logging incorrect and hence confusing information.

Benefits

It'll enable the followup PR which updates the dashboard to no longer fetch secrets via the k8s API.

Possible drawbacks

Applicable issues

Additional information

Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Copy link
Contributor

@antgamdia antgamdia left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@@ -60,13 +61,13 @@ func JSONError(w http.ResponseWriter, err interface{}, code int) {
json.NewEncoder(w).Encode(err)
}

func returnK8sError(err error, w http.ResponseWriter) {
func returnK8sError(err error, action string, resource string, w http.ResponseWriter) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Great, more meaningful error messages

}
}
}

// GetAppRepository gets an App Repository with a related secret if present.
func GetAppRepository(kubeHandler kube.AuthHandler) func(w http.ResponseWriter, req *http.Request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this function will get eventually moved to the new repositories API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, indeed, but that needs to be properly designed for a more generic approach etc.

@absoludity absoludity merged commit 31348f5 into master Jan 5, 2022
@absoludity absoludity deleted the 3922-app-repo-secrets-workaround branch January 5, 2022 23:08
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.

None yet

2 participants