Fix godep-* hack scripts for 1.7

* Added a godep-update-k8s script for upgrading.
$ KUBE_VERSION ./hack/godeps/godep-update-k8s.sh

* Added client-go version ldflags to localkube and minikube.  The
version package is now split in both kubernetes and client-go, so we
need to supply both ldflags.

* Change cross builds to use BUILD_IN_DOCKER

* Add a patch for kube-proxy
The setup of kube-proxy recently changed, making the registering of the
component config a fatal error instead of a warning.  This patch
reverts it to be a warning, which is a no-op for us anyways since we
don't supply a config file.
pull/1693/head
Matt Rickard 2017-06-28 11:18:58 -07:00
parent 88137a54a5
commit 9433a90888
7 changed files with 76 additions and 23 deletions

View File

@ -22,7 +22,7 @@ import sys
from datetime import datetime
K8S_PACKAGE = 'k8s.io/kubernetes/'
X_ARG_BASE = '-X k8s.io/minikube/vendor/k8s.io/kubernetes/pkg/version.'
X_ARGS = ['-X k8s.io/minikube/vendor/k8s.io/kubernetes/pkg/version.', '-X k8s.io/minikube/vendor/k8s.io/client-go/pkg/version.']
def get_rev():
return 'gitCommit=%s' % get_from_godep('Rev')
@ -52,7 +52,11 @@ def main():
if len(sys.argv) > 1 and sys.argv[1] == "--k8s-version-only":
return get_from_godep('Comment')
args = [get_rev(), get_version(), get_tree_state(), get_build_date()]
return ' '.join([X_ARG_BASE + arg for arg in args])
ret = ''
for xarg in X_ARGS:
for arg in args:
ret += xarg + arg + " "
return ret
if __name__ == '__main__':
sys.exit(main())

View File

@ -32,12 +32,8 @@ if [ ! -d "${KUBE_ROOT}" ]; then
popd >/dev/null
fi
pushd ${KUBE_ROOT} >/dev/null
git checkout ${KUBE_VERSION}
./hack/godep-restore.sh
popd >/dev/null
godep::restore_kubernetes
godep::sync_staging
pushd ${MINIKUBE_ROOT} >/dev/null
godep restore ./...
popd >/dev/null

View File

@ -28,8 +28,13 @@ godep::sync_staging
rm -rf ${MINIKUBE_ROOT}/vendor ${MINIKUBE_ROOT}/Godeps
godep save ./...
cp ${KUBE_ROOT}/pkg/generated/openapi/zz_generated.openapi.go ${MINIKUBE_ROOT}/vendor/k8s.io/kubernetes/pkg/generated/openapi
godep::remove_staging_from_json
git checkout -- ${MINIKUBE_ROOT}/vendor/golang.org/x/sys/windows
git apply ${MINIKUBE_ROOT}/hack/tpr-patch.diff
pushd ${MINIKUBE_ROOT} >/dev/null
git apply ${MINIKUBE_ROOT}/hack/tpr-patch.diff
git apply ${MINIKUBE_ROOT}/hack/kube-proxy-patch.diff
popd >/dev/null

25
hack/godeps/godep-update-k8s.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# 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.
K8S_ORG_ROOT=${GOPATH}/src/k8s.io
MINIKUBE_ROOT=${K8S_ORG_ROOT}/minikube
KUBE_ROOT=${K8S_ORG_ROOT}/kubernetes
KUBE_VERSION=${KUBE_VERSION:=$(python ${MINIKUBE_ROOT}/hack/get_k8s_version.py --k8s-version-only 2>&1)}
source ${MINIKUBE_ROOT}/hack/godeps/utils.sh
godep::restore_kubernetes
${MINIKUBE_ROOT}/hack/godeps/godep-save.sh

View File

@ -18,26 +18,20 @@ package main
import (
"encoding/json"
"io/ioutil"
"log"
"os"
"path"
"strings"
flag "github.com/spf13/pflag"
)
var (
godepsFile = flag.String("godeps-file", "", "absolute path to Godeps.json")
godepsFile = flag.String("godeps-file", "", "absolute path to Godeps.json")
kubernetesPath = flag.String("kubernetes-dir", "", "absolute path to the kubernetes folder")
)
var ignoredPrefixes = []string{
"k8s.io/client-go",
"k8s.io/apimachinery",
"k8s.io/apiserver",
"k8s.io/kube-aggregator",
"k8s.io/kube-apiextensions-server",
"k8s.io/metrics",
}
type Dependency struct {
ImportPath string
Comment string `json:",omitempty"`
@ -55,7 +49,7 @@ type Godeps struct {
func main() {
flag.Parse()
var g Godeps
if len(*godepsFile) == 0 {
if godepsFile == nil || kubernetesPath == nil {
log.Fatalf("absolute path to Godeps.json is required")
}
f, err := os.OpenFile(*godepsFile, os.O_RDWR, 0666)
@ -68,11 +62,18 @@ func main() {
log.Fatalf("Unable to parse %q: %v", *godepsFile, err)
}
k8sStagingDir := path.Join(*kubernetesPath, "staging", "src", "k8s.io")
stagedRepos, err := ioutil.ReadDir(k8sStagingDir)
if err != nil {
log.Fatalf("Couldn't read kubernetes staging repo: %v", err)
}
i := 0
for _, dep := range g.Deps {
ignored := false
for _, ignoredPrefix := range ignoredPrefixes {
if strings.HasPrefix(dep.ImportPath, ignoredPrefix) {
for _, stagedRepo := range stagedRepos {
importPrefix := path.Join("k8s.io", stagedRepo.Name())
if strings.HasPrefix(dep.ImportPath, importPrefix) {
ignored = true
}
}

View File

@ -52,6 +52,15 @@ for repo in $(ls ${KUBE_ROOT}/staging/src/k8s.io); do
done
}
godep::remove_staging_from_json() {
go run ${MINIKUBE_ROOT}/hack/godeps/godeps-json-updater.go --godeps-file ${MINIKUBE_ROOT}/Godeps/Godeps.json
godep::restore_kubernetes() {
pushd ${KUBE_ROOT} >/dev/null
git checkout ${KUBE_VERSION}
./hack/godep-restore.sh
bazel build //pkg/generated/openapi:zz_generated.openapi
popd >/dev/null
godep::sync_staging
}
godep::remove_staging_from_json() {
go run ${MINIKUBE_ROOT}/hack/godeps/godeps-json-updater.go --godeps-file ${MINIKUBE_ROOT}/Godeps/Godeps.json --kubernetes-dir ${KUBE_ROOT}
}

View File

@ -0,0 +1,13 @@
diff --git a/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server.go b/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server.go
index 8d1ae7774..8745a176f 100644
--- a/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server.go
+++ b/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server.go
@@ -422,7 +422,7 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
if c, err := configz.New("componentconfig"); err == nil {
c.Set(config)
} else {
- return nil, fmt.Errorf("unable to register configz: %s", err)
+ glog.Errorf("unable to register configz: %s", err)
}
protocol := utiliptables.ProtocolIpv4