Skip to content

Commit

Permalink
feat: add shipwright build runs to k8s-watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius committed Jan 8, 2025
1 parent dbdf462 commit 035e52b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions k8s-watcher/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ func NewConfigFromEnvOrDie(prefix string) Config {
config.AmaltheaSessionPlural = "amaltheasessions"
}

if ibGroup, ok := os.LookupEnv(fmt.Sprintf("%sSHIPWRIGHT_BUILDRUN_GROUP", prefix)); ok {
config.ShipwrightBuildRunGroup = ibGroup
} else {
config.ShipwrightBuildRunGroup = "shipwright.io"
}

if ibVersion, ok := os.LookupEnv(fmt.Sprintf("%sSHIPWRIGHT_BUILDRUN_VERSION", prefix)); ok {
config.ShipwrightBuildRunVersion = ibVersion
} else {
config.ShipwrightBuildRunVersion = "v1beta1"
}

if ibPlural, ok := os.LookupEnv(fmt.Sprintf("%sSHIPWRIGHT_BUILDRUN_PLURAL", prefix)); ok {
config.ShipwrightBuildRunPlural = ibPlural
} else {
config.ShipwrightBuildRunPlural = "buildruns"
}
if port, ok := os.LookupEnv(fmt.Sprintf("%sPORT", prefix)); ok {
portInt, err := strconv.Atoi(port)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions k8s-watcher/server_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func (s *Server) registerRoutes() {
s.router.HandlerFunc("GET", "/users/:userID/sessions", s.asUserID)
s.router.HandlerFunc("GET", "/users/:userID/sessions/:serverID", s.asUserIDServerID)
// Used for the shipwright operator in charge of image build custom resources
s.router.HandlerFunc("GET", "/builds", s.ibGetAll)
s.router.HandlerFunc("GET", "/builds/:buildID", s.ibGetOne)
s.router.HandlerFunc("GET", "/buildruns", s.ibGetAll)
s.router.HandlerFunc("GET", "/buildruns/:buildID", s.ibGetOne)
}

func (s *Server) jsGetAll(w http.ResponseWriter, req *http.Request) {
Expand Down

0 comments on commit 035e52b

Please sign in to comment.