-
Notifications
You must be signed in to change notification settings - Fork 94
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
WIP: kor backend - http server #354
base: kor-api
Are you sure you want to change the base?
Conversation
…lidation has been added, token validation moved to a separate file
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.
API's look good overall, there are some conventions from kor cli that should be implemented here
} | ||
|
||
// Validate list namespaces | ||
func validateListNamespaces(next http.Handler) http.Handler { |
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.
nit: move this to namespaces.go
api := router.PathPrefix("/api/v1").Subrouter() | ||
|
||
router.HandleFunc("/healthcheck", healthCheckHandler).Methods("GET") | ||
api.Handle("/configmaps", authMiddleware(validateListNamespaces(http.HandlerFunc(getUnusedConfigmaps)))).Methods("GET") |
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.
Since this will grow, maybe this should be in a create routes function
RUN go build -o /go-service | ||
|
||
# Use a smaller base image for the final container | ||
FROM alpine:latest |
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.
use FROM scratch it will make the image significantly smaller
@@ -0,0 +1,33 @@ | |||
# Use an official Golang image as the build environment | |||
FROM golang:1.22.2-alpine AS builder |
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.
Take a look at the kor dockerfile https://github.com/yonahd/kor/blob/main/Dockerfile
making it easier to integrate into web services, dashboards, and automation pipelines. | ||
|
||
## Swagger | ||
```swag init``` |
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.
Is the swagger initialized by default in the docker?
package main | ||
|
||
import ( | ||
"crypto/tls" |
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.
Please sort the imports as we do in kor
What this PR does / why we need it?
Defines KOR HTTP server that uses the Gorilla Mux router, JWT authentication, and Swagger documentation
Functionality:
PR Checklist
GitHub Issue
Notes for your reviewers