-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Katib v1alpha3 api implementation (#739)
* v1alpha3 api implementation * fix jsonnet params * Adding v1alpha3 examples * Adding UI to builds
- Loading branch information
1 parent
7d8743c
commit daacf9f
Showing
293 changed files
with
39,872 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Build the manager binary | ||
FROM golang:alpine AS build-env | ||
|
||
# Copy in the go src | ||
ADD . /go/src/github.com/kubeflow/katib | ||
|
||
WORKDIR /go/src/github.com/kubeflow/katib/cmd/katib-controller | ||
# Build | ||
RUN if [ "$(uname -m)" = "ppc64le" ]; then \ | ||
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -a -o katib-controller ./v1alpha3; \ | ||
else \ | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o katib-controller ./v1alpha3; \ | ||
fi | ||
# Copy the controller-manager into a thin image | ||
FROM alpine:3.7 | ||
WORKDIR /app | ||
COPY --from=build-env /go/src/github.com/kubeflow/katib/cmd/katib-controller/katib-controller . | ||
ENTRYPOINT ["./katib-controller"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
Copyright 2018 The Kubeflow Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
/* | ||
Katib-controller is a controller (operator) for Experiments and Trials | ||
*/ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"os" | ||
|
||
"github.com/spf13/viper" | ||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp" | ||
"sigs.k8s.io/controller-runtime/pkg/client/config" | ||
"sigs.k8s.io/controller-runtime/pkg/manager" | ||
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" | ||
"sigs.k8s.io/controller-runtime/pkg/runtime/signals" | ||
|
||
apis "github.com/kubeflow/katib/pkg/apis/controller" | ||
controller "github.com/kubeflow/katib/pkg/controller.v1alpha3" | ||
"github.com/kubeflow/katib/pkg/controller.v1alpha3/consts" | ||
webhook "github.com/kubeflow/katib/pkg/webhook/v1alpha3" | ||
) | ||
|
||
func main() { | ||
logf.SetLogger(logf.ZapLogger(false)) | ||
log := logf.Log.WithName("entrypoint") | ||
|
||
var experimentSuggestionName string | ||
var metricsAddr string | ||
|
||
flag.StringVar(&experimentSuggestionName, "experiment-suggestion-name", | ||
"default", "The implementation of suggestion interface in experiment controller (default|fake)") | ||
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.") | ||
|
||
flag.Parse() | ||
|
||
viper.Set(consts.ConfigExperimentSuggestionName, experimentSuggestionName) | ||
log.Info("Config:", | ||
consts.ConfigExperimentSuggestionName, | ||
viper.GetString(consts.ConfigExperimentSuggestionName)) | ||
|
||
// Get a config to talk to the apiserver | ||
cfg, err := config.GetConfig() | ||
if err != nil { | ||
log.Error(err, "Fail to get the config") | ||
os.Exit(1) | ||
} | ||
|
||
// Create a new katib controller to provide shared dependencies and start components | ||
mgr, err := manager.New(cfg, manager.Options{ | ||
MetricsBindAddress: metricsAddr, | ||
}) | ||
if err != nil { | ||
log.Error(err, "unable add APIs to scheme") | ||
os.Exit(1) | ||
} | ||
|
||
log.Info("Registering Components.") | ||
|
||
// Setup Scheme for all resources | ||
if err := apis.AddToScheme(mgr.GetScheme()); err != nil { | ||
log.Error(err, "Fail to create the manager") | ||
os.Exit(1) | ||
} | ||
|
||
// Setup all Controllers | ||
log.Info("Setting up controller") | ||
if err := controller.AddToManager(mgr); err != nil { | ||
log.Error(err, "unable to register controllers to the manager") | ||
os.Exit(1) | ||
} | ||
|
||
log.Info("Setting up webhooks") | ||
if err := webhook.AddToManager(mgr); err != nil { | ||
log.Error(err, "unable to register webhooks to the manager") | ||
os.Exit(1) | ||
} | ||
|
||
// Start the Cmd | ||
log.Info("Starting the Cmd.") | ||
if err := mgr.Start(signals.SetupSignalHandler()); err != nil { | ||
log.Error(err, "unable to run the manager") | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM golang:alpine AS build-env | ||
# The GOPATH in the image is /go. | ||
ADD . /go/src/github.com/kubeflow/katib | ||
WORKDIR /go/src/github.com/kubeflow/katib/cmd/manager-rest | ||
RUN if [ "$(uname -m)" = "ppc64le" ]; then \ | ||
apk --update add gcc musl-dev && \ | ||
go build -o katib-manager-rest ./v1alpha3; \ | ||
else \ | ||
go build -o katib-manager-rest ./v1alpha3; \ | ||
fi | ||
|
||
FROM alpine:3.7 | ||
WORKDIR /app | ||
COPY --from=build-env /go/src/github.com/kubeflow/katib/cmd/manager-rest/katib-manager-rest /app/ | ||
ENTRYPOINT ["./katib-manager-rest"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"net/http" | ||
|
||
"github.com/grpc-ecosystem/grpc-gateway/runtime" | ||
"golang.org/x/net/context" | ||
"google.golang.org/grpc" | ||
"k8s.io/klog" | ||
|
||
gw "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" | ||
) | ||
|
||
var ( | ||
katibManagerEndpoint = flag.String("echo_endpoint", "katib-manager:6789", "katib-manager endpoint") | ||
) | ||
|
||
func run() error { | ||
ctx := context.Background() | ||
ctx, cancel := context.WithCancel(ctx) | ||
defer cancel() | ||
|
||
mux := runtime.NewServeMux() | ||
opts := []grpc.DialOption{grpc.WithInsecure()} | ||
// register handlers for the HTTP endpoints | ||
err := gw.RegisterManagerHandlerFromEndpoint(ctx, mux, *katibManagerEndpoint, opts) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// proxy server listens on port 80 | ||
return http.ListenAndServe(":80", mux) | ||
} | ||
|
||
func main() { | ||
flag.Parse() | ||
defer klog.Flush() | ||
|
||
if err := run(); err != nil { | ||
klog.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM golang:alpine AS build-env | ||
# The GOPATH in the image is /go. | ||
ADD . /go/src/github.com/kubeflow/katib | ||
WORKDIR /go/src/github.com/kubeflow/katib/cmd/manager | ||
RUN if [ "$(uname -m)" = "ppc64le" ]; then \ | ||
apk --update add git gcc musl-dev && \ | ||
go build -o katib-manager ./v1alpha3 && \ | ||
go get github.com/grpc-ecosystem/grpc-health-probe && \ | ||
mv $GOPATH/bin/grpc-health-probe /bin/grpc_health_probe && \ | ||
chmod +x /bin/grpc_health_probe; \ | ||
else \ | ||
go build -o katib-manager ./v1alpha3 && \ | ||
GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \ | ||
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ | ||
chmod +x /bin/grpc_health_probe; \ | ||
fi | ||
|
||
FROM alpine:3.7 | ||
WORKDIR /app | ||
COPY --from=build-env /bin/grpc_health_probe /bin/ | ||
COPY --from=build-env /go/src/github.com/kubeflow/katib/cmd/manager/katib-manager /app/ | ||
ENTRYPOINT ["./katib-manager"] | ||
CMD ["-w", "kubernetes"] |
Oops, something went wrong.