Skip to content
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

Cherry pick commits from upstream #31

Open
wants to merge 16 commits into
base: v1.0-aliyun-branch
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
language: go

go:
- "1.9"
- "1.10"
- "1.12"

go_import_path: github.com/kubeflow/tf-operator

install:
# get coveralls.io support
- go get github.com/mattn/goveralls
- go get -u github.com/alecthomas/gometalinter
- gometalinter --install
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.18.0
- go install ./vendor/k8s.io/code-generator/cmd/openapi-gen

script:
- go build -o tf-operator.v1beta2 github.com/kubeflow/tf-operator/cmd/tf-operator.v1beta2
- hack/verify-codegen.sh
- go build -o tf-operator.v1 github.com/kubeflow/tf-operator/cmd/tf-operator.v1
- go build -o backend github.com/kubeflow/tf-operator/dashboard/backend
- gometalinter --config=linter_config.json --vendor ./...
- golangci-lint run ./...
# We customize the build step because by default
# Travis runs go test -v ./... which will include the vendor
# directory.
# With go 1.9 vendor will be automatically excluded.
# For now though we just run all tests in pkg.
# And we can not use ** because goveralls uses filepath.Match
# to match ignore files and it does not support it.
- goveralls -service=travis-ci -v -package ./pkg/... -ignore "pkg/client/*/*.go,pkg/client/*/*/*.go,pkg/client/*/*/*/*.go,pkg/client/*/*/*/*/*.go,pkg/client/*/*/*/*/*/*.go,pkg/client/*/*/*/*/*/*/*.go,pkg/util/testutil/*.go,pkg/apis/tensorflow/*/zz_generated.*.go,pkg/apis/tensorflow/*/*_generated.go,pkg/apis/common/*/zz_generated.*.go,pkg/apis/common/*/*_generated.go"
- goveralls -service=travis-ci -v -package ./pkg/... -ignore "pkg/client/*/*.go,pkg/client/*/*/*.go,pkg/client/*/*/*/*.go,pkg/client/*/*/*/*/*.go,pkg/client/*/*/*/*/*/*.go,pkg/client/*/*/*/*/*/*/*.go,pkg/util/*.go,pkg/util/*/*.go,pkg/apis/tensorflow/*/zz_generated.*.go,pkg/apis/tensorflow/*/*_generated.go,pkg/apis/common/*/zz_generated.*.go,pkg/apis/common/*/*_generated.go"

notifications:
webhooks: https://www.travisbuddy.com/
Expand Down
67 changes: 45 additions & 22 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 6 additions & 10 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ required = [

[[constraint]]
name = "k8s.io/client-go"
version = "kubernetes-1.11.2"
version = "kubernetes-1.12.3"

[[constraint]]
# kube-openapi does not have any version.
Expand All @@ -40,23 +40,19 @@ required = [

[[constraint]]
name = "k8s.io/kubernetes"
version = "v1.11.2"
version = "v1.12.3"

[[constraint]]
name = "k8s.io/api"
version = "kubernetes-1.11.2"
version = "kubernetes-1.12.3"

[[constraint]]
name = "k8s.io/apimachinery"
version = "kubernetes-1.11.2"

[[constraint]]
name = "k8s.io/apiextensions-apiserver"
version = "kubernetes-1.11.2"
version = "kubernetes-1.12.3"

[[constraint]]
name = "k8s.io/code-generator"
version = "kubernetes-1.11.2"
version = "kubernetes-1.12.3"

[[constraint]]
name = "github.com/prometheus/client_golang"
Expand Down Expand Up @@ -85,7 +81,7 @@ required = [

[[override]]
name = "k8s.io/apiserver"
version = "kubernetes-1.11.2"
version = "kubernetes-1.12.3"

[prune]
go-tests = true
Expand Down
19 changes: 4 additions & 15 deletions build/images/tf_operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
FROM registry.access.redhat.com/ubi8/ubi:latest

ARG GOLANG_VERSION=1.8.3
ENV GOROOT=/usr/local/go PATH=$PATH:/usr/local/go/bin

RUN if [ "$(uname -m)" = "ppc64le" ]; then \
curl -fksSL https://dl.google.com/go/go$GOLANG_VERSION.linux-ppc64le.tar.gz | tar -xz -C /usr/local/; \
else \
curl -fksSL https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz | tar -xz -C /usr/local/; \
fi

# TODO(jlewi): We should probably change the directory to /opt/kubeflow.
RUN mkdir -p /opt/tensorflow_k8s/dashboard/
RUN mkdir -p /opt/kubeflow/samples
RUN mkdir -p /opt/tensorflow_k8s/dashboard/ \
&& mkdir -p /opt/kubeflow/samples

COPY tf_smoke.py /opt/kubeflow/samples/
RUN chmod a+x /opt/kubeflow/samples/*
COPY tf-operator.v1beta2 /opt/kubeflow
COPY tf-operator.v1 /opt/kubeflow
COPY backend /opt/tensorflow_k8s/dashboard/
COPY build /opt/tensorflow_k8s/dashboard/frontend/build

RUN chmod a+x /opt/kubeflow/tf-operator.v1beta2
RUN chmod a+x /opt/kubeflow/tf-operator.v1
RUN chmod a+x /opt/tensorflow_k8s/dashboard/backend
RUN chmod a+x /opt/kubeflow/tf-operator.v1 \
&& chmod a+x /opt/tensorflow_k8s/dashboard/backend

ENTRYPOINT ["/opt/kubeflow/tf-operator.v1"]
2 changes: 2 additions & 0 deletions cmd/tf-operator.v1/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ func NewServerOption() *ServerOption {

// AddFlags adds flags for a specific CMServer to the specified FlagSet.
func (s *ServerOption) AddFlags(fs *flag.FlagSet) {
fs.StringVar(&s.Kubeconfig, "kubeconfig", "", "The path of kubeconfig file")

fs.StringVar(&s.MasterURL, "master", "",
`The url of the Kubernetes API server,
will overrides any value in kubeconfig, only required if out-of-cluster.`)
Expand Down
7 changes: 4 additions & 3 deletions cmd/tf-operator.v1/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package app

import (
"context"
"fmt"
"os"
"time"
Expand Down Expand Up @@ -129,7 +130,7 @@ func Run(opt *options.ServerOption) error {
go unstructuredInformer.Informer().Run(stopCh)

// Set leader election start function.
run := func(<-chan struct{}) {
run := func(context.Context) {
isLeader.Set(1)
if err := tc.Run(opt.Threadiness, stopCh); err != nil {
log.Errorf("Failed to run the controller: %v", err)
Expand All @@ -145,7 +146,7 @@ func Run(opt *options.ServerOption) error {

// Prepare event clients.
eventBroadcaster := record.NewBroadcaster()
if err = v1.AddToScheme(scheme.Scheme); err != nil {
if err = corev1.AddToScheme(scheme.Scheme); err != nil {
return fmt.Errorf("CoreV1 Add Scheme failed: %v", err)
}
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "tf-operator"})
Expand All @@ -163,7 +164,7 @@ func Run(opt *options.ServerOption) error {
}

// Start leader election.
election.RunOrDie(election.LeaderElectionConfig{
election.RunOrDie(context.TODO(), election.LeaderElectionConfig{
Lock: rl,
LeaseDuration: leaseDuration,
RenewDeadline: renewDuration,
Expand Down
Loading