-
Notifications
You must be signed in to change notification settings - Fork 702
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
Conversation
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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