Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
fix hyperkube to run from goland. (#1984)
Browse files Browse the repository at this point in the history
* fix hyperkube to run from goland.

* Explain the magic, comment.
  • Loading branch information
n3wscott authored and Jay Boyd committed Apr 25, 2018
1 parent 5a51a20 commit 06ffe53
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cmd/service-catalog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package main
import (
"os"

"github.com/kubernetes-incubator/service-catalog/cmd/service-catalog/server"
"github.com/kubernetes-incubator/service-catalog/pkg/hyperkube"
)

Expand All @@ -31,8 +32,8 @@ func main() {
Long: "This is an all-in-one binary that can run any of the various Kubernetes service-catalog servers.",
}

hk.AddServer(NewAPIServer())
hk.AddServer(NewControllerManager())
hk.AddServer(server.NewAPIServer())
hk.AddServer(server.NewControllerManager())

hk.RunToExit(os.Args)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package main
package server

import (
"github.com/kubernetes-incubator/service-catalog/cmd/apiserver/app/server"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package main
package server

import (
"github.com/kubernetes-incubator/service-catalog/cmd/controller-manager/app"
Expand Down
4 changes: 4 additions & 0 deletions pkg/hyperkube/hyperkube.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func (hk *HyperKube) Printf(format string, i ...interface{}) {
func (hk *HyperKube) Run(args []string, stopCh <-chan struct{}) error {
// If we are called directly, parse all flags up to the first real
// argument. That should be the server to run.
RunAgain:
command := args[0]
serverName := path.Base(command)
args = args[1:]
Expand Down Expand Up @@ -164,6 +165,9 @@ func (hk *HyperKube) Run(args []string, stopCh <-chan struct{}) error {

s, err := hk.FindServer(serverName)
if err != nil {
if len(args) > 0 {
goto RunAgain // the first args was popped off at start of Run, try again with new args
}
hk.Printf("Error: %v\n\n", err)
hk.Usage()
return err
Expand Down

0 comments on commit 06ffe53

Please sign in to comment.