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

Upgrade to k8s-v1.7 #1693

Merged
merged 13 commits into from
Jul 14, 2017
Merged
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
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3,790 changes: 2,194 additions & 1,596 deletions Godeps/Godeps.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BUILDROOT_BRANCH ?= 2017.02
REGISTRY?=gcr.io/k8s-minikube

MINIKUBE_BUILD_IMAGE ?= karalabe/xgo-1.8.3
LOCALKUBE_BUILD_IMAGE ?= gcr.io/google_containers/kube-cross:v1.7.1-0
LOCALKUBE_BUILD_IMAGE ?= gcr.io/google_containers/kube-cross:v1.8.3-1
ISO_BUILD_IMAGE ?= $(REGISTRY)/buildroot-image

ISO_VERSION ?= v0.22.0
Expand Down
2 changes: 1 addition & 1 deletion cmd/localkube/cmd/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func AddFlags(s *localkube.LocalkubeServer) {
flag.StringVar(&s.APIServerName, "apiserver-name", s.APIServerName, "The apiserver name which is used in the generated certificate for localkube/kubernetes. This can be used if you want to make the API server available from outside the machine")

flag.BoolVar(&s.ShouldGenerateCerts, "generate-certs", s.ShouldGenerateCerts, "If localkube should generate it's own certificates")
flag.BoolVar(&s.ShowVersion, "version", s.ShowVersion, "If localkube should just print the version and exit.")
flag.BoolVar(&s.ShowVersion, "show-version", s.ShowVersion, "If localkube should just print the version and exit.")
flag.BoolVar(&s.ShowHostIP, "host-ip", s.ShowHostIP, "If localkube should just print the host IP and exit.")
flag.Var(&s.RuntimeConfig, "runtime-config", "A set of key=value pairs that describe runtime configuration that may be passed to apiserver. apis/<groupVersion> key can be used to turn on/off specific api versions. apis/<groupVersion>/<resource> can be used to turn on/off specific resources. api/all and api/legacy are special keys to control all and legacy api versions respectively.")
flag.IPVar(&s.NodeIP, "node-ip", s.NodeIP, "IP address of the node. If set, kubelet will use this IP address for the node.")
Expand Down
6 changes: 0 additions & 6 deletions cmd/localkube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"os"
"os/signal"

"github.com/coreos/pkg/capnslog"
"github.com/golang/glog"
"k8s.io/apiserver/pkg/util/feature"

Expand All @@ -47,11 +46,6 @@ func StartLocalkube() {
os.Exit(0)
}

// Get the etcd logger for the api repo
apiRepoLogger := capnslog.MustRepoLogger("github.com/coreos/etcd/etcdserver/api")
// Set the logging level to NOTICE as there is an INFO lvl log statement that runs every few seconds -> log spam
apiRepoLogger.SetRepoLogLevel(capnslog.NOTICE)

// TODO: Require root

SetupServer(Server)
Expand Down
2 changes: 1 addition & 1 deletion deploy/addons/addon-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
hostNetwork: true
containers:
- name: kube-addon-manager
image: gcr.io/google-containers/kube-addon-manager:v6.4-beta.1
image: gcr.io/google-containers/kube-addon-manager:v6.4-beta.2
imagePullPolicy: IfNotPresent
resources:
requests:
Expand Down
6 changes: 3 additions & 3 deletions deploy/addons/kube-dns/kube-dns-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
optional: true
containers:
- name: kubedns
image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.2
image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.4
resources:
# TODO: Set memory limits when we've profiled the container for large
# clusters, then set request = limit to keep this container in
Expand Down Expand Up @@ -95,7 +95,7 @@ spec:
- name: kube-dns-config
mountPath: /kube-dns-config
- name: dnsmasq
image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.2
image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.4
livenessProbe:
httpGet:
path: /healthcheck/dnsmasq
Expand Down Expand Up @@ -133,7 +133,7 @@ spec:
- name: kube-dns-config
mountPath: /etc/k8s/dns/dnsmasq-nanny
- name: sidecar
image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.2
image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.4
livenessProbe:
httpGet:
path: /metrics
Expand Down
8 changes: 6 additions & 2 deletions hack/get_k8s_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
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')
Expand Down Expand Up @@ -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())
6 changes: 1 addition & 5 deletions hack/godeps/godep-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion hack/godeps/godep-save.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 25 additions & 0 deletions hack/godeps/godep-update-k8s.sh
Original file line number Diff line number Diff line change
@@ -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
27 changes: 14 additions & 13 deletions hack/godeps/godeps-json-updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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)
Expand All @@ -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
}
}
Expand Down
11 changes: 10 additions & 1 deletion hack/godeps/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ for repo in $(ls ${KUBE_ROOT}/staging/src/k8s.io); do
done
}

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
go run ${MINIKUBE_ROOT}/hack/godeps/godeps-json-updater.go --godeps-file ${MINIKUBE_ROOT}/Godeps/Godeps.json --kubernetes-dir ${KUBE_ROOT}
}
13 changes: 13 additions & 0 deletions hack/kube-proxy-patch.diff
Original file line number Diff line number Diff line change
@@ -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
16 changes: 11 additions & 5 deletions pkg/localkube/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func (lk LocalkubeServer) NewAPIServer() Server {
func StartAPIServer(lk LocalkubeServer) func() error {
config := options.NewServerRunOptions()

config.SecureServing.ServingOptions.BindAddress = lk.APIServerAddress
config.SecureServing.ServingOptions.BindPort = lk.APIServerPort
config.SecureServing.BindAddress = lk.APIServerAddress
config.SecureServing.BindPort = lk.APIServerPort

config.InsecureServing.BindAddress = lk.APIServerInsecureAddress
config.InsecureServing.BindPort = lk.APIServerInsecurePort
Expand All @@ -46,8 +46,13 @@ func StartAPIServer(lk LocalkubeServer) func() error {

config.SecureServing.ServerCert.CertKey.CertFile = lk.GetPublicKeyCertPath()
config.SecureServing.ServerCert.CertKey.KeyFile = lk.GetPrivateKeyCertPath()
config.GenericServerRunOptions.AdmissionControl = "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota"

config.Admission.PluginNames = []string{
"NamespaceLifecycle",
"LimitRanger",
"ServiceAccount",
"DefaultStorageClass",
"ResourceQuota",
}
// use localkube etcd

config.Etcd.StorageConfig.ServerList = KubeEtcdClientURLs
Expand All @@ -73,7 +78,8 @@ func StartAPIServer(lk LocalkubeServer) func() error {
lk.SetExtraConfigForComponent("apiserver", &config)

return func() error {
return apiserver.Run(config)
stop := make(chan struct{})
return apiserver.Run(config, stop)
}
}

Expand Down
25 changes: 13 additions & 12 deletions pkg/localkube/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package localkube
import (
kubeproxy "k8s.io/kubernetes/cmd/kube-proxy/app"

"k8s.io/kubernetes/cmd/kube-proxy/app/options"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/apis/componentconfig"
"k8s.io/kubernetes/pkg/kubelet/qos"
)
Expand All @@ -34,22 +34,23 @@ func (lk LocalkubeServer) NewProxyServer() Server {
}

func StartProxyServer(lk LocalkubeServer) func() error {
config := options.NewProxyConfig()

// master details
config.Master = lk.GetAPIServerInsecureURL()

config.Mode = componentconfig.ProxyModeIPTables

// defaults
config.OOMScoreAdj = &OOMScoreAdj
config.IPTablesMasqueradeBit = &MasqueradeBit
config := &componentconfig.KubeProxyConfiguration{
OOMScoreAdj: &OOMScoreAdj,
IPTables: componentconfig.KubeProxyIPTablesConfiguration{
MasqueradeBit: &MasqueradeBit,
},
BindAddress: lk.APIServerInsecureAddress.String(),
Mode: componentconfig.ProxyModeIPTables,
FeatureGates: lk.FeatureGates,
// Disable the healthz check
HealthzBindAddress: "0",
}

lk.SetExtraConfigForComponent("proxy", &config)

return func() error {
// Creating this config requires the API Server to be up, so do it in the start function itself.
server, err := kubeproxy.NewProxyServerDefault(config)
server, err := kubeproxy.NewProxyServer(config, false, runtime.NewScheme(), lk.GetAPIServerInsecureURL())
if err != nil {
panic(err)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/minikube/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func TestGetServiceListFromServicesByLabel(t *testing.T) {
}

func TestPrintURLsForService(t *testing.T) {
defaultTemplate := template.Must(template.New("svc-template").Parse("{{.IP}}:{{.Port}}"))
defaultTemplate := template.Must(template.New("svc-template").Parse("http://{{.IP}}:{{.Port}}"))
client := &MockCoreClient{
servicesMap: serviceNamespaces,
}
Expand Down Expand Up @@ -260,15 +260,15 @@ func TestPrintURLsForService(t *testing.T) {
test := test
t.Run(test.description, func(t *testing.T) {
t.Parallel()
urls, err := printURLsForService(client, "http://127.0.0.1", test.serviceName, test.namespace, test.tmpl)
urls, err := printURLsForService(client, "127.0.0.1", test.serviceName, test.namespace, test.tmpl)
if err != nil && !test.err {
t.Errorf("Error: %s", err)
}
if err == nil && test.err {
t.Errorf("Expected error but got none")
}
if !reflect.DeepEqual(urls, test.expectedOutput) {
t.Errorf("\nExpected %v \nActual: %v \n\n", urls, test.expectedOutput)
t.Errorf("\nExpected %v \nActual: %v \n\n", test.expectedOutput, urls)
}
})
}
Expand Down Expand Up @@ -350,7 +350,7 @@ func TestGetServiceURLsForService(t *testing.T) {
},
},
}
defaultTemplate := template.Must(template.New("svc-template").Parse("{{.IP}}:{{.Port}}"))
defaultTemplate := template.Must(template.New("svc-template").Parse("http://{{.IP}}:{{.Port}}"))

var tests = []struct {
description string
Expand Down
1 change: 0 additions & 1 deletion pkg/util/kubeconfig/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ func configEquals(a, b *api.Config) bool {

if aCluster.LocationOfOrigin != bCluster.LocationOfOrigin ||
aCluster.Server != bCluster.Server ||
aCluster.APIVersion != bCluster.APIVersion ||
aCluster.InsecureSkipTLSVerify != bCluster.InsecureSkipTLSVerify ||
aCluster.CertificateAuthority != bCluster.CertificateAuthority ||
len(aCluster.CertificateAuthorityData) != len(bCluster.CertificateAuthorityData) ||
Expand Down

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

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

Loading