Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog - klog as explicit InitFlags() so we add them as necessary - we update the other repositories that we vendor that made a similar change from glog to klog * github.com/kubernetes/repo-infra * k8s.io/gengo/ * k8s.io/kube-openapi/ * github.com/google/cadvisor - Entirely remove all references to glog - Fix some tests by explicit InitFlags in their init() methods Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
This commit is contained in:
parent
97baad34a7
commit
954996e231
@ -22,7 +22,7 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,11 +24,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
restclient "k8s.io/client-go/rest"
|
restclient "k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
clientapi "k8s.io/client-go/tools/clientcmd/api"
|
clientapi "k8s.io/client-go/tools/clientcmd/api"
|
||||||
|
"k8s.io/klog"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
api "k8s.io/kubernetes/pkg/apis/core"
|
||||||
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
|
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
|
||||||
)
|
)
|
||||||
@ -61,22 +61,22 @@ func flattenSubsets(subsets []api.EndpointSubset) []string {
|
|||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
glog.Info("Kubernetes Elasticsearch logging discovery")
|
klog.Info("Kubernetes Elasticsearch logging discovery")
|
||||||
|
|
||||||
cc, err := buildConfigFromEnvs(os.Getenv("APISERVER_HOST"), os.Getenv("KUBE_CONFIG_FILE"))
|
cc, err := buildConfigFromEnvs(os.Getenv("APISERVER_HOST"), os.Getenv("KUBE_CONFIG_FILE"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Failed to make client: %v", err)
|
klog.Fatalf("Failed to make client: %v", err)
|
||||||
}
|
}
|
||||||
client, err := clientset.NewForConfig(cc)
|
client, err := clientset.NewForConfig(cc)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Failed to make client: %v", err)
|
klog.Fatalf("Failed to make client: %v", err)
|
||||||
}
|
}
|
||||||
namespace := metav1.NamespaceSystem
|
namespace := metav1.NamespaceSystem
|
||||||
envNamespace := os.Getenv("NAMESPACE")
|
envNamespace := os.Getenv("NAMESPACE")
|
||||||
if envNamespace != "" {
|
if envNamespace != "" {
|
||||||
if _, err := client.Core().Namespaces().Get(envNamespace, metav1.GetOptions{}); err != nil {
|
if _, err := client.Core().Namespaces().Get(envNamespace, metav1.GetOptions{}); err != nil {
|
||||||
glog.Fatalf("%s namespace doesn't exist: %v", envNamespace, err)
|
klog.Fatalf("%s namespace doesn't exist: %v", envNamespace, err)
|
||||||
}
|
}
|
||||||
namespace = envNamespace
|
namespace = envNamespace
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ func main() {
|
|||||||
// If we did not find an elasticsearch logging service then log a warning
|
// If we did not find an elasticsearch logging service then log a warning
|
||||||
// and return without adding any unicast hosts.
|
// and return without adding any unicast hosts.
|
||||||
if elasticsearch == nil {
|
if elasticsearch == nil {
|
||||||
glog.Warningf("Failed to find the elasticsearch-logging service: %v", err)
|
klog.Warningf("Failed to find the elasticsearch-logging service: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,17 +112,17 @@ func main() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
addrs = flattenSubsets(endpoints.Subsets)
|
addrs = flattenSubsets(endpoints.Subsets)
|
||||||
glog.Infof("Found %s", addrs)
|
klog.Infof("Found %s", addrs)
|
||||||
if len(addrs) > 0 && len(addrs) >= count {
|
if len(addrs) > 0 && len(addrs) >= count {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If there was an error finding endpoints then log a warning and quit.
|
// If there was an error finding endpoints then log a warning and quit.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Error finding endpoints: %v", err)
|
klog.Warningf("Error finding endpoints: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("Endpoints = %s", addrs)
|
klog.Infof("Endpoints = %s", addrs)
|
||||||
fmt.Printf("discovery.zen.ping.unicast.hosts: [%s]\n", strings.Join(addrs, ", "))
|
fmt.Printf("discovery.zen.ping.unicast.hosts: [%s]\n", strings.Join(addrs, ", "))
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,12 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/cluster/images/etcd-version-monitor",
|
importpath = "k8s.io/kubernetes/cluster/images/etcd-version-monitor",
|
||||||
deps = [
|
deps = [
|
||||||
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus/promhttp:go_default_library",
|
"//vendor/github.com/prometheus/client_golang/prometheus/promhttp:go_default_library",
|
||||||
"//vendor/github.com/prometheus/client_model/go:go_default_library",
|
"//vendor/github.com/prometheus/client_model/go:go_default_library",
|
||||||
"//vendor/github.com/prometheus/common/expfmt:go_default_library",
|
"//vendor/github.com/prometheus/common/expfmt:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -25,12 +25,12 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
dto "github.com/prometheus/client_model/go"
|
dto "github.com/prometheus/client_model/go"
|
||||||
"github.com/prometheus/common/expfmt"
|
"github.com/prometheus/common/expfmt"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Initialize the prometheus instrumentation and client related flags.
|
// Initialize the prometheus instrumentation and client related flags.
|
||||||
@ -245,7 +245,7 @@ func getVersionPeriodically(stopCh <-chan struct{}) {
|
|||||||
lastSeenBinaryVersion := ""
|
lastSeenBinaryVersion := ""
|
||||||
for {
|
for {
|
||||||
if err := getVersion(&lastSeenBinaryVersion); err != nil {
|
if err := getVersion(&lastSeenBinaryVersion); err != nil {
|
||||||
glog.Errorf("Failed to fetch etcd version: %v", err)
|
klog.Errorf("Failed to fetch etcd version: %v", err)
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case <-stopCh:
|
case <-stopCh:
|
||||||
@ -399,7 +399,7 @@ func main() {
|
|||||||
go getVersionPeriodically(stopCh)
|
go getVersionPeriodically(stopCh)
|
||||||
|
|
||||||
// Serve our metrics on listenAddress/metricsPath.
|
// Serve our metrics on listenAddress/metricsPath.
|
||||||
glog.Infof("Listening on: %v", listenAddress)
|
klog.Infof("Listening on: %v", listenAddress)
|
||||||
http.Handle(metricsPath, promhttp.HandlerFor(gatherer, promhttp.HandlerOpts{}))
|
http.Handle(metricsPath, promhttp.HandlerFor(gatherer, promhttp.HandlerOpts{}))
|
||||||
glog.Errorf("Stopped listening/serving metrics: %v", http.ListenAndServe(listenAddress, nil))
|
klog.Errorf("Stopped listening/serving metrics: %v", http.ListenAndServe(listenAddress, nil))
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ go_library(
|
|||||||
"//vendor/github.com/coreos/etcd/wal:go_default_library",
|
"//vendor/github.com/coreos/etcd/wal:go_default_library",
|
||||||
"//vendor/github.com/coreos/etcd/wal/walpb:go_default_library",
|
"//vendor/github.com/coreos/etcd/wal/walpb:go_default_library",
|
||||||
"//vendor/github.com/coreos/go-semver/semver:go_default_library",
|
"//vendor/github.com/coreos/go-semver/semver:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DataDirectory provides utilities for initializing and backing up an
|
// DataDirectory provides utilities for initializing and backing up an
|
||||||
@ -45,7 +45,7 @@ func OpenOrCreateDataDirectory(path string) (*DataDirectory, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !exists {
|
if !exists {
|
||||||
glog.Infof("data directory '%s' does not exist, creating it", path)
|
klog.Infof("data directory '%s' does not exist, creating it", path)
|
||||||
err := os.MkdirAll(path, 0777)
|
err := os.MkdirAll(path, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create data directory %s: %v", path, err)
|
return nil, fmt.Errorf("failed to create data directory %s: %v", path, err)
|
||||||
@ -67,7 +67,7 @@ func (d *DataDirectory) Initialize(target *EtcdVersionPair) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if isEmpty {
|
if isEmpty {
|
||||||
glog.Infof("data directory '%s' is empty, writing target version '%s' to version.txt", d.path, target)
|
klog.Infof("data directory '%s' is empty, writing target version '%s' to version.txt", d.path, target)
|
||||||
err = d.versionFile.Write(target)
|
err = d.versionFile.Write(target)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to write version.txt to '%s': %v", d.path, err)
|
return fmt.Errorf("failed to write version.txt to '%s': %v", d.path, err)
|
||||||
|
@ -21,8 +21,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -85,7 +85,7 @@ func runMigrate() {
|
|||||||
if opts.name == "" {
|
if opts.name == "" {
|
||||||
hostname, err := os.Hostname()
|
hostname, err := os.Hostname()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Error while getting hostname to supply default --name: %v", err)
|
klog.Errorf("Error while getting hostname to supply default --name: %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
opts.name = fmt.Sprintf("etcd-%s", hostname)
|
opts.name = fmt.Sprintf("etcd-%s", hostname)
|
||||||
@ -98,29 +98,29 @@ func runMigrate() {
|
|||||||
opts.initialCluster = fmt.Sprintf("%s=http://localhost:2380", opts.name)
|
opts.initialCluster = fmt.Sprintf("%s=http://localhost:2380", opts.name)
|
||||||
}
|
}
|
||||||
if opts.targetStorage == "" {
|
if opts.targetStorage == "" {
|
||||||
glog.Errorf("--target-storage is required")
|
klog.Errorf("--target-storage is required")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if opts.targetVersion == "" {
|
if opts.targetVersion == "" {
|
||||||
glog.Errorf("--target-version is required")
|
klog.Errorf("--target-version is required")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if opts.dataDir == "" {
|
if opts.dataDir == "" {
|
||||||
glog.Errorf("--data-dir is required")
|
klog.Errorf("--data-dir is required")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if opts.bundledVersionString == "" {
|
if opts.bundledVersionString == "" {
|
||||||
glog.Errorf("--bundled-versions is required")
|
klog.Errorf("--bundled-versions is required")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
bundledVersions, err := ParseSupportedVersions(opts.bundledVersionString)
|
bundledVersions, err := ParseSupportedVersions(opts.bundledVersionString)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to parse --supported-versions: %v", err)
|
klog.Errorf("Failed to parse --supported-versions: %v", err)
|
||||||
}
|
}
|
||||||
err = validateBundledVersions(bundledVersions, opts.binDir)
|
err = validateBundledVersions(bundledVersions, opts.binDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to validate that 'etcd-<version>' and 'etcdctl-<version>' binaries exist in --bin-dir '%s' for all --bundled-verions '%s': %v",
|
klog.Errorf("Failed to validate that 'etcd-<version>' and 'etcdctl-<version>' binaries exist in --bin-dir '%s' for all --bundled-verions '%s': %v",
|
||||||
opts.binDir, opts.bundledVersionString, err)
|
opts.binDir, opts.bundledVersionString, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ func migrate(name string, port uint64, peerListenUrls string, peerAdvertiseUrls
|
|||||||
|
|
||||||
dataDir, err := OpenOrCreateDataDirectory(dataDirPath)
|
dataDir, err := OpenOrCreateDataDirectory(dataDirPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Error opening or creating data directory %s: %v", dataDirPath, err)
|
klog.Errorf("Error opening or creating data directory %s: %v", dataDirPath, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ func migrate(name string, port uint64, peerListenUrls string, peerAdvertiseUrls
|
|||||||
}
|
}
|
||||||
client, err := NewEtcdMigrateClient(cfg)
|
client, err := NewEtcdMigrateClient(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Migration failed: %v", err)
|
klog.Errorf("Migration failed: %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
defer client.Close()
|
defer client.Close()
|
||||||
@ -167,7 +167,7 @@ func migrate(name string, port uint64, peerListenUrls string, peerAdvertiseUrls
|
|||||||
|
|
||||||
err = migrator.MigrateIfNeeded(target)
|
err = migrator.MigrateIfNeeded(target)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Migration failed: %v", err)
|
klog.Errorf("Migration failed: %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
|
|
||||||
clientv2 "github.com/coreos/etcd/client"
|
clientv2 "github.com/coreos/etcd/client"
|
||||||
"github.com/coreos/etcd/clientv3"
|
"github.com/coreos/etcd/clientv3"
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CombinedEtcdClient provides an implementation of EtcdMigrateClient using a combination of the etcd v2 client, v3 client
|
// CombinedEtcdClient provides an implementation of EtcdMigrateClient using a combination of the etcd v2 client, v3 client
|
||||||
@ -202,13 +202,13 @@ func (e *CombinedEtcdClient) AttachLease(leaseDuration time.Duration) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error while creating lease: %v", err)
|
return fmt.Errorf("Error while creating lease: %v", err)
|
||||||
}
|
}
|
||||||
glog.Infof("Lease with TTL: %v created", lease.TTL)
|
klog.Infof("Lease with TTL: %v created", lease.TTL)
|
||||||
|
|
||||||
glog.Infof("Attaching lease to %d entries", len(objectsResp.Kvs))
|
klog.Infof("Attaching lease to %d entries", len(objectsResp.Kvs))
|
||||||
for _, kv := range objectsResp.Kvs {
|
for _, kv := range objectsResp.Kvs {
|
||||||
putResp, err := v3client.KV.Put(ctx, string(kv.Key), string(kv.Value), clientv3.WithLease(lease.ID), clientv3.WithPrevKV())
|
putResp, err := v3client.KV.Put(ctx, string(kv.Key), string(kv.Value), clientv3.WithLease(lease.ID), clientv3.WithPrevKV())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Error while attaching lease to: %s", string(kv.Key))
|
klog.Errorf("Error while attaching lease to: %s", string(kv.Key))
|
||||||
}
|
}
|
||||||
if bytes.Compare(putResp.PrevKv.Value, kv.Value) != 0 {
|
if bytes.Compare(putResp.PrevKv.Value, kv.Value) != 0 {
|
||||||
return fmt.Errorf("concurrent access to key detected when setting lease on %s, expected previous value of %s but got %s",
|
return fmt.Errorf("concurrent access to key detected when setting lease on %s, expected previous value of %s but got %s",
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EtcdMigrateServer manages starting and stopping a versioned etcd server binary.
|
// EtcdMigrateServer manages starting and stopping a versioned etcd server binary.
|
||||||
@ -75,10 +75,10 @@ func (r *EtcdMigrateServer) Start(version *EtcdVersion) error {
|
|||||||
case <-interval.C:
|
case <-interval.C:
|
||||||
err := r.client.SetEtcdVersionKeyValue(version)
|
err := r.client.SetEtcdVersionKeyValue(version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Infof("Still waiting for etcd to start, current error: %v", err)
|
klog.Infof("Still waiting for etcd to start, current error: %v", err)
|
||||||
// keep waiting
|
// keep waiting
|
||||||
} else {
|
} else {
|
||||||
glog.Infof("Etcd on port %d is up.", r.cfg.port)
|
klog.Infof("Etcd on port %d is up.", r.cfg.port)
|
||||||
r.cmd = etcdCmd
|
r.cmd = etcdCmd
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ func (r *EtcdMigrateServer) Stop() error {
|
|||||||
case <-stopped:
|
case <-stopped:
|
||||||
return
|
return
|
||||||
case <-timedout:
|
case <-timedout:
|
||||||
glog.Infof("etcd server has not terminated gracefully after %s, killing it.", gracefulWait)
|
klog.Infof("etcd server has not terminated gracefully after %s, killing it.", gracefulWait)
|
||||||
r.cmd.Process.Kill()
|
r.cmd.Process.Kill()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -122,11 +122,11 @@ func (r *EtcdMigrateServer) Stop() error {
|
|||||||
err = r.cmd.Wait()
|
err = r.cmd.Wait()
|
||||||
stopped <- true
|
stopped <- true
|
||||||
if exiterr, ok := err.(*exec.ExitError); ok {
|
if exiterr, ok := err.(*exec.ExitError); ok {
|
||||||
glog.Infof("etcd server stopped (signal: %s)", exiterr.Error())
|
klog.Infof("etcd server stopped (signal: %s)", exiterr.Error())
|
||||||
// stopped
|
// stopped
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return fmt.Errorf("error waiting for etcd to stop: %v", err)
|
return fmt.Errorf("error waiting for etcd to stop: %v", err)
|
||||||
}
|
}
|
||||||
glog.Infof("Stopped etcd server %s", r.cfg.name)
|
klog.Infof("Stopped etcd server %s", r.cfg.name)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/blang/semver"
|
"github.com/blang/semver"
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EtcdMigrateCfg provides all configuration required to perform etcd data upgrade/downgrade migrations.
|
// EtcdMigrateCfg provides all configuration required to perform etcd data upgrade/downgrade migrations.
|
||||||
@ -63,7 +63,7 @@ type Migrator struct {
|
|||||||
|
|
||||||
// MigrateIfNeeded upgrades or downgrades the etcd data directory to the given target version.
|
// MigrateIfNeeded upgrades or downgrades the etcd data directory to the given target version.
|
||||||
func (m *Migrator) MigrateIfNeeded(target *EtcdVersionPair) error {
|
func (m *Migrator) MigrateIfNeeded(target *EtcdVersionPair) error {
|
||||||
glog.Infof("Starting migration to %s", target)
|
klog.Infof("Starting migration to %s", target)
|
||||||
err := m.dataDirectory.Initialize(target)
|
err := m.dataDirectory.Initialize(target)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to initialize data directory %s: %v", m.dataDirectory.path, err)
|
return fmt.Errorf("failed to initialize data directory %s: %v", m.dataDirectory.path, err)
|
||||||
@ -84,28 +84,28 @@ func (m *Migrator) MigrateIfNeeded(target *EtcdVersionPair) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
glog.Infof("Converging current version '%s' to target version '%s'", current, target)
|
klog.Infof("Converging current version '%s' to target version '%s'", current, target)
|
||||||
currentNextMinorVersion := &EtcdVersion{Version: semver.Version{Major: current.version.Major, Minor: current.version.Minor + 1}}
|
currentNextMinorVersion := &EtcdVersion{Version: semver.Version{Major: current.version.Major, Minor: current.version.Minor + 1}}
|
||||||
switch {
|
switch {
|
||||||
case current.version.MajorMinorEquals(target.version) || currentNextMinorVersion.MajorMinorEquals(target.version):
|
case current.version.MajorMinorEquals(target.version) || currentNextMinorVersion.MajorMinorEquals(target.version):
|
||||||
glog.Infof("current version '%s' equals or is one minor version previous of target version '%s' - migration complete", current, target)
|
klog.Infof("current version '%s' equals or is one minor version previous of target version '%s' - migration complete", current, target)
|
||||||
err = m.dataDirectory.versionFile.Write(target)
|
err = m.dataDirectory.versionFile.Write(target)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to write version.txt to '%s': %v", m.dataDirectory.path, err)
|
return fmt.Errorf("failed to write version.txt to '%s': %v", m.dataDirectory.path, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
case current.storageVersion == storageEtcd2 && target.storageVersion == storageEtcd3:
|
case current.storageVersion == storageEtcd2 && target.storageVersion == storageEtcd3:
|
||||||
glog.Infof("upgrading from etcd2 storage to etcd3 storage")
|
klog.Infof("upgrading from etcd2 storage to etcd3 storage")
|
||||||
current, err = m.etcd2ToEtcd3Upgrade(current, target)
|
current, err = m.etcd2ToEtcd3Upgrade(current, target)
|
||||||
case current.version.Major == 3 && target.version.Major == 2:
|
case current.version.Major == 3 && target.version.Major == 2:
|
||||||
glog.Infof("downgrading from etcd 3.x to 2.x")
|
klog.Infof("downgrading from etcd 3.x to 2.x")
|
||||||
current, err = m.rollbackToEtcd2(current, target)
|
current, err = m.rollbackToEtcd2(current, target)
|
||||||
case current.version.Major == target.version.Major && current.version.Minor < target.version.Minor:
|
case current.version.Major == target.version.Major && current.version.Minor < target.version.Minor:
|
||||||
stepVersion := m.cfg.supportedVersions.NextVersionPair(current)
|
stepVersion := m.cfg.supportedVersions.NextVersionPair(current)
|
||||||
glog.Infof("upgrading etcd from %s to %s", current, stepVersion)
|
klog.Infof("upgrading etcd from %s to %s", current, stepVersion)
|
||||||
current, err = m.minorVersionUpgrade(current, stepVersion)
|
current, err = m.minorVersionUpgrade(current, stepVersion)
|
||||||
case current.version.Major == 3 && target.version.Major == 3 && current.version.Minor > target.version.Minor:
|
case current.version.Major == 3 && target.version.Major == 3 && current.version.Minor > target.version.Minor:
|
||||||
glog.Infof("rolling etcd back from %s to %s", current, target)
|
klog.Infof("rolling etcd back from %s to %s", current, target)
|
||||||
current, err = m.rollbackEtcd3MinorVersion(current, target)
|
current, err = m.rollbackEtcd3MinorVersion(current, target)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -116,13 +116,13 @@ func (m *Migrator) MigrateIfNeeded(target *EtcdVersionPair) error {
|
|||||||
|
|
||||||
func (m *Migrator) backupEtcd2(current *EtcdVersion) error {
|
func (m *Migrator) backupEtcd2(current *EtcdVersion) error {
|
||||||
backupDir := fmt.Sprintf("%s/%s", m.dataDirectory, "migration-backup")
|
backupDir := fmt.Sprintf("%s/%s", m.dataDirectory, "migration-backup")
|
||||||
glog.Infof("Backup etcd before starting migration")
|
klog.Infof("Backup etcd before starting migration")
|
||||||
err := os.Mkdir(backupDir, 0666)
|
err := os.Mkdir(backupDir, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create backup directory before starting migration: %v", err)
|
return fmt.Errorf("failed to create backup directory before starting migration: %v", err)
|
||||||
}
|
}
|
||||||
m.client.Backup(current, backupDir)
|
m.client.Backup(current, backupDir)
|
||||||
glog.Infof("Backup done in %s", backupDir)
|
klog.Infof("Backup done in %s", backupDir)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ func (m *Migrator) rollbackEtcd3MinorVersion(current *EtcdVersionPair, target *E
|
|||||||
return nil, fmt.Errorf("rollback from %s to %s not supported, only rollbacks to the previous minor version are supported", current.version, target.version)
|
return nil, fmt.Errorf("rollback from %s to %s not supported, only rollbacks to the previous minor version are supported", current.version, target.version)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("Performing etcd %s -> %s rollback", current.version, target.version)
|
klog.Infof("Performing etcd %s -> %s rollback", current.version, target.version)
|
||||||
err := m.dataDirectory.Backup()
|
err := m.dataDirectory.Backup()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -145,14 +145,14 @@ func (m *Migrator) rollbackEtcd3MinorVersion(current *EtcdVersionPair, target *E
|
|||||||
|
|
||||||
// Start current version of etcd.
|
// Start current version of etcd.
|
||||||
runner := m.newServer()
|
runner := m.newServer()
|
||||||
glog.Infof("Starting etcd version %s to capture rollback snapshot.", current.version)
|
klog.Infof("Starting etcd version %s to capture rollback snapshot.", current.version)
|
||||||
err = runner.Start(current.version)
|
err = runner.Start(current.version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Unable to automatically downgrade etcd: starting etcd version %s to capture rollback snapshot failed: %v", current.version, err)
|
klog.Fatalf("Unable to automatically downgrade etcd: starting etcd version %s to capture rollback snapshot failed: %v", current.version, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("Snapshotting etcd %s to %s", current.version, snapshotFilename)
|
klog.Infof("Snapshotting etcd %s to %s", current.version, snapshotFilename)
|
||||||
err = m.client.Snapshot(current.version, snapshotFilename)
|
err = m.client.Snapshot(current.version, snapshotFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -163,7 +163,7 @@ func (m *Migrator) rollbackEtcd3MinorVersion(current *EtcdVersionPair, target *E
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("Backing up data before rolling back")
|
klog.Infof("Backing up data before rolling back")
|
||||||
backupDir := fmt.Sprintf("%s.bak", m.dataDirectory)
|
backupDir := fmt.Sprintf("%s.bak", m.dataDirectory)
|
||||||
err = os.RemoveAll(backupDir)
|
err = os.RemoveAll(backupDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -178,7 +178,7 @@ func (m *Migrator) rollbackEtcd3MinorVersion(current *EtcdVersionPair, target *E
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("Restoring etcd %s from %s", target.version, snapshotFilename)
|
klog.Infof("Restoring etcd %s from %s", target.version, snapshotFilename)
|
||||||
err = m.client.Restore(target.version, snapshotFilename)
|
err = m.client.Restore(target.version, snapshotFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -195,7 +195,7 @@ func (m *Migrator) rollbackToEtcd2(current *EtcdVersionPair, target *EtcdVersion
|
|||||||
if !(current.version.Major == 3 && current.version.Minor == 0 && target.version.Major == 2 && target.version.Minor == 2) {
|
if !(current.version.Major == 3 && current.version.Minor == 0 && target.version.Major == 2 && target.version.Minor == 2) {
|
||||||
return nil, fmt.Errorf("etcd3 -> etcd2 downgrade is supported only between 3.0.x and 2.2.x, got current %s target %s", current, target)
|
return nil, fmt.Errorf("etcd3 -> etcd2 downgrade is supported only between 3.0.x and 2.2.x, got current %s target %s", current, target)
|
||||||
}
|
}
|
||||||
glog.Infof("Backup and remove all existing v2 data")
|
klog.Infof("Backup and remove all existing v2 data")
|
||||||
err := m.dataDirectory.Backup()
|
err := m.dataDirectory.Backup()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -214,12 +214,12 @@ func (m *Migrator) etcd2ToEtcd3Upgrade(current *EtcdVersionPair, target *EtcdVer
|
|||||||
}
|
}
|
||||||
runner := m.newServer()
|
runner := m.newServer()
|
||||||
|
|
||||||
glog.Infof("Performing etcd2 -> etcd3 migration")
|
klog.Infof("Performing etcd2 -> etcd3 migration")
|
||||||
err := m.client.Migrate(target.version)
|
err := m.client.Migrate(target.version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
glog.Infof("Attaching leases to TTL entries")
|
klog.Infof("Attaching leases to TTL entries")
|
||||||
|
|
||||||
// Now attach lease to all keys.
|
// Now attach lease to all keys.
|
||||||
// To do it, we temporarily start etcd on a random port (so that
|
// To do it, we temporarily start etcd on a random port (so that
|
||||||
|
@ -42,7 +42,7 @@ import (
|
|||||||
"github.com/coreos/etcd/wal"
|
"github.com/coreos/etcd/wal"
|
||||||
"github.com/coreos/etcd/wal/walpb"
|
"github.com/coreos/etcd/wal/walpb"
|
||||||
"github.com/coreos/go-semver/semver"
|
"github.com/coreos/go-semver/semver"
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
const rollbackVersion = "2.2.0"
|
const rollbackVersion = "2.2.0"
|
||||||
@ -50,7 +50,7 @@ const rollbackVersion = "2.2.0"
|
|||||||
// RollbackV3ToV2 rolls back an etcd 3.0.x data directory to the 2.x.x version specified by rollbackVersion.
|
// RollbackV3ToV2 rolls back an etcd 3.0.x data directory to the 2.x.x version specified by rollbackVersion.
|
||||||
func RollbackV3ToV2(migrateDatadir string, ttl time.Duration) error {
|
func RollbackV3ToV2(migrateDatadir string, ttl time.Duration) error {
|
||||||
dbpath := path.Join(migrateDatadir, "member", "snap", "db")
|
dbpath := path.Join(migrateDatadir, "member", "snap", "db")
|
||||||
glog.Infof("Rolling db file %s back to etcd 2.x", dbpath)
|
klog.Infof("Rolling db file %s back to etcd 2.x", dbpath)
|
||||||
|
|
||||||
// etcd3 store backend. We will use it to parse v3 data files and extract information.
|
// etcd3 store backend. We will use it to parse v3 data files and extract information.
|
||||||
be := backend.NewDefaultBackend(dbpath)
|
be := backend.NewDefaultBackend(dbpath)
|
||||||
@ -139,7 +139,7 @@ func RollbackV3ToV2(migrateDatadir string, ttl time.Duration) error {
|
|||||||
v = rollbackVersion
|
v = rollbackVersion
|
||||||
}
|
}
|
||||||
if _, err := st.Set(n.Key, n.Dir, v, store.TTLOptionSet{}); err != nil {
|
if _, err := st.Set(n.Key, n.Dir, v, store.TTLOptionSet{}); err != nil {
|
||||||
glog.Error(err)
|
klog.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// update nodes
|
// update nodes
|
||||||
@ -147,7 +147,7 @@ func RollbackV3ToV2(migrateDatadir string, ttl time.Duration) error {
|
|||||||
if len(fields) == 4 && fields[2] == "members" {
|
if len(fields) == 4 && fields[2] == "members" {
|
||||||
nodeID, err := strconv.ParseUint(fields[3], 16, 64)
|
nodeID, err := strconv.ParseUint(fields[3], 16, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("failed to parse member ID (%s): %v", fields[3], err)
|
klog.Fatalf("failed to parse member ID (%s): %v", fields[3], err)
|
||||||
}
|
}
|
||||||
nodes = append(nodes, nodeID)
|
nodes = append(nodes, nodeID)
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ func RollbackV3ToV2(migrateDatadir string, ttl time.Duration) error {
|
|||||||
if err := snapshotter.SaveSnap(raftSnap); err != nil {
|
if err := snapshotter.SaveSnap(raftSnap); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
glog.Infof("Finished successfully")
|
klog.Infof("Finished successfully")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ func traverseAndDeleteEmptyDir(st store.Store, dir string) error {
|
|||||||
}
|
}
|
||||||
for _, node := range e.Node.Nodes {
|
for _, node := range e.Node.Nodes {
|
||||||
if !node.Dir {
|
if !node.Dir {
|
||||||
glog.V(2).Infof("key: %s", node.Key[len(etcdserver.StoreKeysPrefix):])
|
klog.V(2).Infof("key: %s", node.Key[len(etcdserver.StoreKeysPrefix):])
|
||||||
} else {
|
} else {
|
||||||
err := traverseAndDeleteEmptyDir(st, node.Key)
|
err := traverseAndDeleteEmptyDir(st, node.Key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -344,6 +344,6 @@ func applyRequest(r *pb.Request, applyV2 etcdserver.ApplierV2) {
|
|||||||
case "POST", "QGET", "SYNC":
|
case "POST", "QGET", "SYNC":
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
glog.Fatal("unknown command")
|
klog.Fatal("unknown command")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/tools/leaderelection:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/leaderelection:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/leaderelection/resourcelock:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/leaderelection/resourcelock:go_default_library",
|
||||||
"//staging/src/k8s.io/cloud-provider:go_default_library",
|
"//staging/src/k8s.io/cloud-provider:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/uuid"
|
"k8s.io/apimachinery/pkg/util/uuid"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
@ -58,7 +58,7 @@ const (
|
|||||||
func NewCloudControllerManagerCommand() *cobra.Command {
|
func NewCloudControllerManagerCommand() *cobra.Command {
|
||||||
s, err := options.NewCloudControllerManagerOptions()
|
s, err := options.NewCloudControllerManagerOptions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("unable to initialize command options: %v", err)
|
klog.Fatalf("unable to initialize command options: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
@ -106,21 +106,21 @@ the cloud specific control loops shipped with Kubernetes.`,
|
|||||||
// Run runs the ExternalCMServer. This should never exit.
|
// Run runs the ExternalCMServer. This should never exit.
|
||||||
func Run(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}) error {
|
func Run(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}) error {
|
||||||
// To help debugging, immediately log version
|
// To help debugging, immediately log version
|
||||||
glog.Infof("Version: %+v", version.Get())
|
klog.Infof("Version: %+v", version.Get())
|
||||||
|
|
||||||
cloud, err := cloudprovider.InitCloudProvider(c.ComponentConfig.KubeCloudShared.CloudProvider.Name, c.ComponentConfig.KubeCloudShared.CloudProvider.CloudConfigFile)
|
cloud, err := cloudprovider.InitCloudProvider(c.ComponentConfig.KubeCloudShared.CloudProvider.Name, c.ComponentConfig.KubeCloudShared.CloudProvider.CloudConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Cloud provider could not be initialized: %v", err)
|
klog.Fatalf("Cloud provider could not be initialized: %v", err)
|
||||||
}
|
}
|
||||||
if cloud == nil {
|
if cloud == nil {
|
||||||
glog.Fatalf("cloud provider is nil")
|
klog.Fatalf("cloud provider is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
if cloud.HasClusterID() == false {
|
if cloud.HasClusterID() == false {
|
||||||
if c.ComponentConfig.KubeCloudShared.AllowUntaggedCloud == true {
|
if c.ComponentConfig.KubeCloudShared.AllowUntaggedCloud == true {
|
||||||
glog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues")
|
klog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues")
|
||||||
} else {
|
} else {
|
||||||
glog.Fatalf("no ClusterID found. A ClusterID is required for the cloud provider to function properly. This check can be bypassed by setting the allow-untagged-cloud option")
|
klog.Fatalf("no ClusterID found. A ClusterID is required for the cloud provider to function properly. This check can be bypassed by setting the allow-untagged-cloud option")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}) error
|
|||||||
if cz, err := configz.New(ConfigzName); err == nil {
|
if cz, err := configz.New(ConfigzName); err == nil {
|
||||||
cz.Set(c.ComponentConfig)
|
cz.Set(c.ComponentConfig)
|
||||||
} else {
|
} else {
|
||||||
glog.Errorf("unable to register configz: %c", err)
|
klog.Errorf("unable to register configz: %c", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the controller manager HTTP server
|
// Start the controller manager HTTP server
|
||||||
@ -150,7 +150,7 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}) error
|
|||||||
|
|
||||||
run := func(ctx context.Context) {
|
run := func(ctx context.Context) {
|
||||||
if err := startControllers(c, ctx.Done(), cloud); err != nil {
|
if err := startControllers(c, ctx.Done(), cloud); err != nil {
|
||||||
glog.Fatalf("error running controllers: %v", err)
|
klog.Fatalf("error running controllers: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}) error
|
|||||||
EventRecorder: c.EventRecorder,
|
EventRecorder: c.EventRecorder,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("error creating lock: %v", err)
|
klog.Fatalf("error creating lock: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and become the leader and start cloud controller manager loops
|
// Try and become the leader and start cloud controller manager loops
|
||||||
@ -189,7 +189,7 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}) error
|
|||||||
Callbacks: leaderelection.LeaderCallbacks{
|
Callbacks: leaderelection.LeaderCallbacks{
|
||||||
OnStartedLeading: run,
|
OnStartedLeading: run,
|
||||||
OnStoppedLeading: func() {
|
OnStoppedLeading: func() {
|
||||||
glog.Fatalf("leaderelection lost")
|
klog.Fatalf("leaderelection lost")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -230,7 +230,7 @@ func startControllers(c *cloudcontrollerconfig.CompletedConfig, stop <-chan stru
|
|||||||
c.ComponentConfig.KubeCloudShared.ClusterName,
|
c.ComponentConfig.KubeCloudShared.ClusterName,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to start service controller: %v", err)
|
klog.Errorf("Failed to start service controller: %v", err)
|
||||||
} else {
|
} else {
|
||||||
go serviceController.Run(stop, int(c.ComponentConfig.ServiceController.ConcurrentServiceSyncs))
|
go serviceController.Run(stop, int(c.ComponentConfig.ServiceController.ConcurrentServiceSyncs))
|
||||||
time.Sleep(wait.Jitter(c.ComponentConfig.Generic.ControllerStartInterval.Duration, ControllerStartJitter))
|
time.Sleep(wait.Jitter(c.ComponentConfig.Generic.ControllerStartInterval.Duration, ControllerStartJitter))
|
||||||
@ -239,13 +239,13 @@ func startControllers(c *cloudcontrollerconfig.CompletedConfig, stop <-chan stru
|
|||||||
// If CIDRs should be allocated for pods and set on the CloudProvider, then start the route controller
|
// If CIDRs should be allocated for pods and set on the CloudProvider, then start the route controller
|
||||||
if c.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs && c.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes {
|
if c.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs && c.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes {
|
||||||
if routes, ok := cloud.Routes(); !ok {
|
if routes, ok := cloud.Routes(); !ok {
|
||||||
glog.Warning("configure-cloud-routes is set, but cloud provider does not support routes. Will not configure cloud provider routes.")
|
klog.Warning("configure-cloud-routes is set, but cloud provider does not support routes. Will not configure cloud provider routes.")
|
||||||
} else {
|
} else {
|
||||||
var clusterCIDR *net.IPNet
|
var clusterCIDR *net.IPNet
|
||||||
if len(strings.TrimSpace(c.ComponentConfig.KubeCloudShared.ClusterCIDR)) != 0 {
|
if len(strings.TrimSpace(c.ComponentConfig.KubeCloudShared.ClusterCIDR)) != 0 {
|
||||||
_, clusterCIDR, err = net.ParseCIDR(c.ComponentConfig.KubeCloudShared.ClusterCIDR)
|
_, clusterCIDR, err = net.ParseCIDR(c.ComponentConfig.KubeCloudShared.ClusterCIDR)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", c.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
klog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", c.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,14 +254,14 @@ func startControllers(c *cloudcontrollerconfig.CompletedConfig, stop <-chan stru
|
|||||||
time.Sleep(wait.Jitter(c.ComponentConfig.Generic.ControllerStartInterval.Duration, ControllerStartJitter))
|
time.Sleep(wait.Jitter(c.ComponentConfig.Generic.ControllerStartInterval.Duration, ControllerStartJitter))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glog.Infof("Will not configure cloud provider routes for allocate-node-cidrs: %v, configure-cloud-routes: %v.", c.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs, c.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes)
|
klog.Infof("Will not configure cloud provider routes for allocate-node-cidrs: %v, configure-cloud-routes: %v.", c.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs, c.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If apiserver is not running we should wait for some time and fail only then. This is particularly
|
// If apiserver is not running we should wait for some time and fail only then. This is particularly
|
||||||
// important when we start apiserver and controller manager at the same time.
|
// important when we start apiserver and controller manager at the same time.
|
||||||
err = genericcontrollermanager.WaitForAPIServer(c.VersionedClient, 10*time.Second)
|
err = genericcontrollermanager.WaitForAPIServer(c.VersionedClient, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Failed to wait for apiserver being healthy: %v", err)
|
klog.Fatalf("Failed to wait for apiserver being healthy: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.SharedInformers.Start(stop)
|
c.SharedInformers.Start(stop)
|
||||||
|
@ -32,7 +32,7 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -265,7 +265,7 @@ func (o *CloudControllerManagerOptions) Config() (*cloudcontrollerconfig.Config,
|
|||||||
|
|
||||||
func createRecorder(kubeClient clientset.Interface, userAgent string) record.EventRecorder {
|
func createRecorder(kubeClient clientset.Interface, userAgent string) record.EventRecorder {
|
||||||
eventBroadcaster := record.NewBroadcaster()
|
eventBroadcaster := record.NewBroadcaster()
|
||||||
eventBroadcaster.StartLogging(glog.Infof)
|
eventBroadcaster.StartLogging(klog.Infof)
|
||||||
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
|
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
|
||||||
// TODO: remove dependence on the legacyscheme
|
// TODO: remove dependence on the legacyscheme
|
||||||
return eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: userAgent})
|
return eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: userAgent})
|
||||||
|
@ -21,8 +21,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apiserver/pkg/server/mux:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/server/mux:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/server/routes:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/server/routes:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WaitForAPIServer waits for the API Server's /healthz endpoint to report "ok" with timeout.
|
// WaitForAPIServer waits for the API Server's /healthz endpoint to report "ok" with timeout.
|
||||||
@ -40,7 +40,7 @@ func WaitForAPIServer(client clientset.Interface, timeout time.Duration) error {
|
|||||||
if healthStatus != http.StatusOK {
|
if healthStatus != http.StatusOK {
|
||||||
content, _ := result.Raw()
|
content, _ := result.Raw()
|
||||||
lastErr = fmt.Errorf("APIServer isn't healthy: %v", string(content))
|
lastErr = fmt.Errorf("APIServer isn't healthy: %v", string(content))
|
||||||
glog.Warningf("APIServer isn't healthy yet: %v. Waiting a little while.", string(content))
|
klog.Warningf("APIServer isn't healthy yet: %v. Waiting a little while.", string(content))
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/cmd/genswaggertypedocs",
|
importpath = "k8s.io/kubernetes/cmd/genswaggertypedocs",
|
||||||
deps = [
|
deps = [
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ import (
|
|||||||
|
|
||||||
kruntime "k8s.io/apimachinery/pkg/runtime"
|
kruntime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -37,7 +37,7 @@ func main() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *typeSrc == "" {
|
if *typeSrc == "" {
|
||||||
glog.Fatalf("Please define -s flag as it is the source file")
|
klog.Fatalf("Please define -s flag as it is the source file")
|
||||||
}
|
}
|
||||||
|
|
||||||
var funcOut io.Writer
|
var funcOut io.Writer
|
||||||
@ -46,7 +46,7 @@ func main() {
|
|||||||
} else {
|
} else {
|
||||||
file, err := os.Create(*functionDest)
|
file, err := os.Create(*functionDest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Couldn't open %v: %v", *functionDest, err)
|
klog.Fatalf("Couldn't open %v: %v", *functionDest, err)
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
funcOut = file
|
funcOut = file
|
||||||
|
@ -73,8 +73,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/kube-aggregator/pkg/client/informers/internalversion/apiregistration/internalversion:go_default_library",
|
"//staging/src/k8s.io/kube-aggregator/pkg/client/informers/internalversion/apiregistration/internalversion:go_default_library",
|
||||||
"//staging/src/k8s.io/kube-aggregator/pkg/controllers/autoregister:go_default_library",
|
"//staging/src/k8s.io/kube-aggregator/pkg/controllers/autoregister:go_default_library",
|
||||||
"//vendor/github.com/go-openapi/spec:go_default_library",
|
"//vendor/github.com/go-openapi/spec:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",
|
"//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
apiextensionsinformers "k8s.io/apiextensions-apiserver/pkg/client/informers/internalversion"
|
apiextensionsinformers "k8s.io/apiextensions-apiserver/pkg/client/informers/internalversion"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -167,7 +167,7 @@ func makeAPIService(gv schema.GroupVersion) *apiregistration.APIService {
|
|||||||
if !ok {
|
if !ok {
|
||||||
// if we aren't found, then we shouldn't register ourselves because it could result in a CRD group version
|
// if we aren't found, then we shouldn't register ourselves because it could result in a CRD group version
|
||||||
// being permanently stuck in the APIServices list.
|
// being permanently stuck in the APIServices list.
|
||||||
glog.Infof("Skipping APIService creation for %v", gv)
|
klog.Infof("Skipping APIService creation for %v", gv)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return &apiregistration.APIService{
|
return &apiregistration.APIService{
|
||||||
|
@ -32,8 +32,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-openapi/spec"
|
"github.com/go-openapi/spec"
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
extensionsapiserver "k8s.io/apiextensions-apiserver/pkg/apiserver"
|
extensionsapiserver "k8s.io/apiextensions-apiserver/pkg/apiserver"
|
||||||
"k8s.io/apimachinery/pkg/apis/meta/v1"
|
"k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -142,7 +142,7 @@ cluster's shared state through which all other components interact.`,
|
|||||||
// Run runs the specified APIServer. This should never exit.
|
// Run runs the specified APIServer. This should never exit.
|
||||||
func Run(completeOptions completedServerRunOptions, stopCh <-chan struct{}) error {
|
func Run(completeOptions completedServerRunOptions, stopCh <-chan struct{}) error {
|
||||||
// To help debugging, immediately log version
|
// To help debugging, immediately log version
|
||||||
glog.Infof("Version: %+v", version.Get())
|
klog.Infof("Version: %+v", version.Get())
|
||||||
|
|
||||||
server, err := CreateServerChain(completeOptions, stopCh)
|
server, err := CreateServerChain(completeOptions, stopCh)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -585,7 +585,7 @@ func Complete(s *options.ServerRunOptions) (completedServerRunOptions, error) {
|
|||||||
return options, fmt.Errorf("error finding host name: %v", err)
|
return options, fmt.Errorf("error finding host name: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.Infof("external host was not specified, using %v", s.GenericServerRunOptions.ExternalHost)
|
klog.Infof("external host was not specified, using %v", s.GenericServerRunOptions.ExternalHost)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Authentication.ApplyAuthorization(s.Authorization)
|
s.Authentication.ApplyAuthorization(s.Authorization)
|
||||||
@ -601,13 +601,13 @@ func Complete(s *options.ServerRunOptions) (completedServerRunOptions, error) {
|
|||||||
if kubeauthenticator.IsValidServiceAccountKeyFile(s.SecureServing.ServerCert.CertKey.KeyFile) {
|
if kubeauthenticator.IsValidServiceAccountKeyFile(s.SecureServing.ServerCert.CertKey.KeyFile) {
|
||||||
s.Authentication.ServiceAccounts.KeyFiles = []string{s.SecureServing.ServerCert.CertKey.KeyFile}
|
s.Authentication.ServiceAccounts.KeyFiles = []string{s.SecureServing.ServerCert.CertKey.KeyFile}
|
||||||
} else {
|
} else {
|
||||||
glog.Warning("No TLS key provided, service account token authentication disabled")
|
klog.Warning("No TLS key provided, service account token authentication disabled")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Etcd.EnableWatchCache {
|
if s.Etcd.EnableWatchCache {
|
||||||
glog.V(2).Infof("Initializing cache sizes based on %dMB limit", s.GenericServerRunOptions.TargetRAMMB)
|
klog.V(2).Infof("Initializing cache sizes based on %dMB limit", s.GenericServerRunOptions.TargetRAMMB)
|
||||||
sizes := cachesize.NewHeuristicWatchCacheSizes(s.GenericServerRunOptions.TargetRAMMB)
|
sizes := cachesize.NewHeuristicWatchCacheSizes(s.GenericServerRunOptions.TargetRAMMB)
|
||||||
if userSpecified, err := serveroptions.ParseWatchCacheSizes(s.Etcd.WatchCacheSizes); err == nil {
|
if userSpecified, err := serveroptions.ParseWatchCacheSizes(s.Etcd.WatchCacheSizes); err == nil {
|
||||||
for resource, size := range userSpecified {
|
for resource, size := range userSpecified {
|
||||||
|
@ -132,8 +132,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1:go_default_library",
|
"//staging/src/k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/metrics/pkg/client/custom_metrics:go_default_library",
|
"//staging/src/k8s.io/metrics/pkg/client/custom_metrics:go_default_library",
|
||||||
"//staging/src/k8s.io/metrics/pkg/client/external_metrics:go_default_library",
|
"//staging/src/k8s.io/metrics/pkg/client/external_metrics:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ func startCSRSigningController(ctx ControllerContext) (http.Handler, bool, error
|
|||||||
|
|
||||||
switch {
|
switch {
|
||||||
case (keyFileExists && keyUsesDefault) || (certFileExists && certUsesDefault):
|
case (keyFileExists && keyUsesDefault) || (certFileExists && certUsesDefault):
|
||||||
glog.Warningf("You might be using flag defaulting for --cluster-signing-cert-file and" +
|
klog.Warningf("You might be using flag defaulting for --cluster-signing-cert-file and" +
|
||||||
" --cluster-signing-key-file. These defaults are deprecated and will be removed" +
|
" --cluster-signing-key-file. These defaults are deprecated and will be removed" +
|
||||||
" in a subsequent release. Please pass these options explicitly.")
|
" in a subsequent release. Please pass these options explicitly.")
|
||||||
case (!keyFileExists && keyUsesDefault) && (!certFileExists && certUsesDefault):
|
case (!keyFileExists && keyUsesDefault) && (!certFileExists && certUsesDefault):
|
||||||
|
@ -19,7 +19,7 @@ package app
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/client-go/informers"
|
"k8s.io/client-go/informers"
|
||||||
cloudprovider "k8s.io/cloud-provider"
|
cloudprovider "k8s.io/cloud-provider"
|
||||||
@ -50,7 +50,7 @@ func createCloudProvider(cloudProvider string, externalCloudVolumePlugin string,
|
|||||||
|
|
||||||
if cloud != nil && cloud.HasClusterID() == false {
|
if cloud != nil && cloud.HasClusterID() == false {
|
||||||
if allowUntaggedCloud == true {
|
if allowUntaggedCloud == true {
|
||||||
glog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues")
|
klog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues")
|
||||||
} else {
|
} else {
|
||||||
return nil, loopMode, fmt.Errorf("no ClusterID Found. A ClusterID is required for the cloud provider to function properly. This check can be bypassed by setting the allow-untagged-cloud option")
|
return nil, loopMode, fmt.Errorf("no ClusterID Found. A ClusterID is required for the cloud provider to function properly. This check can be bypassed by setting the allow-untagged-cloud option")
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
@ -79,7 +79,7 @@ const (
|
|||||||
func NewControllerManagerCommand() *cobra.Command {
|
func NewControllerManagerCommand() *cobra.Command {
|
||||||
s, err := options.NewKubeControllerManagerOptions()
|
s, err := options.NewKubeControllerManagerOptions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("unable to initialize command options: %v", err)
|
klog.Fatalf("unable to initialize command options: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
@ -142,12 +142,12 @@ func ResyncPeriod(c *config.CompletedConfig) func() time.Duration {
|
|||||||
// Run runs the KubeControllerManagerOptions. This should never exit.
|
// Run runs the KubeControllerManagerOptions. This should never exit.
|
||||||
func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
|
func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
|
||||||
// To help debugging, immediately log version
|
// To help debugging, immediately log version
|
||||||
glog.Infof("Version: %+v", version.Get())
|
klog.Infof("Version: %+v", version.Get())
|
||||||
|
|
||||||
if cfgz, err := configz.New(ConfigzName); err == nil {
|
if cfgz, err := configz.New(ConfigzName); err == nil {
|
||||||
cfgz.Set(c.ComponentConfig)
|
cfgz.Set(c.ComponentConfig)
|
||||||
} else {
|
} else {
|
||||||
glog.Errorf("unable to register configz: %c", err)
|
klog.Errorf("unable to register configz: %c", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the controller manager HTTP server
|
// Start the controller manager HTTP server
|
||||||
@ -178,7 +178,7 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
|
|||||||
if len(c.ComponentConfig.SAController.ServiceAccountKeyFile) == 0 {
|
if len(c.ComponentConfig.SAController.ServiceAccountKeyFile) == 0 {
|
||||||
// It'c possible another controller process is creating the tokens for us.
|
// It'c possible another controller process is creating the tokens for us.
|
||||||
// If one isn't, we'll timeout and exit when our client builder is unable to create the tokens.
|
// If one isn't, we'll timeout and exit when our client builder is unable to create the tokens.
|
||||||
glog.Warningf("--use-service-account-credentials was specified without providing a --service-account-private-key-file")
|
klog.Warningf("--use-service-account-credentials was specified without providing a --service-account-private-key-file")
|
||||||
}
|
}
|
||||||
clientBuilder = controller.SAControllerClientBuilder{
|
clientBuilder = controller.SAControllerClientBuilder{
|
||||||
ClientConfig: restclient.AnonymousClientConfig(c.Kubeconfig),
|
ClientConfig: restclient.AnonymousClientConfig(c.Kubeconfig),
|
||||||
@ -191,12 +191,12 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
|
|||||||
}
|
}
|
||||||
controllerContext, err := CreateControllerContext(c, rootClientBuilder, clientBuilder, ctx.Done())
|
controllerContext, err := CreateControllerContext(c, rootClientBuilder, clientBuilder, ctx.Done())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("error building controller context: %v", err)
|
klog.Fatalf("error building controller context: %v", err)
|
||||||
}
|
}
|
||||||
saTokenControllerInitFunc := serviceAccountTokenControllerStarter{rootClientBuilder: rootClientBuilder}.startServiceAccountTokenController
|
saTokenControllerInitFunc := serviceAccountTokenControllerStarter{rootClientBuilder: rootClientBuilder}.startServiceAccountTokenController
|
||||||
|
|
||||||
if err := StartControllers(controllerContext, saTokenControllerInitFunc, NewControllerInitializers(controllerContext.LoopMode), unsecuredMux); err != nil {
|
if err := StartControllers(controllerContext, saTokenControllerInitFunc, NewControllerInitializers(controllerContext.LoopMode), unsecuredMux); err != nil {
|
||||||
glog.Fatalf("error starting controllers: %v", err)
|
klog.Fatalf("error starting controllers: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
controllerContext.InformerFactory.Start(controllerContext.Stop)
|
controllerContext.InformerFactory.Start(controllerContext.Stop)
|
||||||
@ -226,7 +226,7 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
|
|||||||
EventRecorder: c.EventRecorder,
|
EventRecorder: c.EventRecorder,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("error creating lock: %v", err)
|
klog.Fatalf("error creating lock: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
leaderelection.RunOrDie(context.TODO(), leaderelection.LeaderElectionConfig{
|
leaderelection.RunOrDie(context.TODO(), leaderelection.LeaderElectionConfig{
|
||||||
@ -237,7 +237,7 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
|
|||||||
Callbacks: leaderelection.LeaderCallbacks{
|
Callbacks: leaderelection.LeaderCallbacks{
|
||||||
OnStartedLeading: run,
|
OnStartedLeading: run,
|
||||||
OnStoppedLeading: func() {
|
OnStoppedLeading: func() {
|
||||||
glog.Fatalf("leaderelection lost")
|
klog.Fatalf("leaderelection lost")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -476,20 +476,20 @@ func StartControllers(ctx ControllerContext, startSATokenController InitFunc, co
|
|||||||
|
|
||||||
for controllerName, initFn := range controllers {
|
for controllerName, initFn := range controllers {
|
||||||
if !ctx.IsControllerEnabled(controllerName) {
|
if !ctx.IsControllerEnabled(controllerName) {
|
||||||
glog.Warningf("%q is disabled", controllerName)
|
klog.Warningf("%q is disabled", controllerName)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(wait.Jitter(ctx.ComponentConfig.Generic.ControllerStartInterval.Duration, ControllerStartJitter))
|
time.Sleep(wait.Jitter(ctx.ComponentConfig.Generic.ControllerStartInterval.Duration, ControllerStartJitter))
|
||||||
|
|
||||||
glog.V(1).Infof("Starting %q", controllerName)
|
klog.V(1).Infof("Starting %q", controllerName)
|
||||||
debugHandler, started, err := initFn(ctx)
|
debugHandler, started, err := initFn(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Error starting %q", controllerName)
|
klog.Errorf("Error starting %q", controllerName)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !started {
|
if !started {
|
||||||
glog.Warningf("Skipping %q", controllerName)
|
klog.Warningf("Skipping %q", controllerName)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if debugHandler != nil && unsecuredMux != nil {
|
if debugHandler != nil && unsecuredMux != nil {
|
||||||
@ -497,7 +497,7 @@ func StartControllers(ctx ControllerContext, startSATokenController InitFunc, co
|
|||||||
unsecuredMux.UnlistedHandle(basePath, http.StripPrefix(basePath, debugHandler))
|
unsecuredMux.UnlistedHandle(basePath, http.StripPrefix(basePath, debugHandler))
|
||||||
unsecuredMux.UnlistedHandlePrefix(basePath+"/", http.StripPrefix(basePath, debugHandler))
|
unsecuredMux.UnlistedHandlePrefix(basePath+"/", http.StripPrefix(basePath, debugHandler))
|
||||||
}
|
}
|
||||||
glog.Infof("Started %q", controllerName)
|
klog.Infof("Started %q", controllerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -512,12 +512,12 @@ type serviceAccountTokenControllerStarter struct {
|
|||||||
|
|
||||||
func (c serviceAccountTokenControllerStarter) startServiceAccountTokenController(ctx ControllerContext) (http.Handler, bool, error) {
|
func (c serviceAccountTokenControllerStarter) startServiceAccountTokenController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||||
if !ctx.IsControllerEnabled(saTokenControllerName) {
|
if !ctx.IsControllerEnabled(saTokenControllerName) {
|
||||||
glog.Warningf("%q is disabled", saTokenControllerName)
|
klog.Warningf("%q is disabled", saTokenControllerName)
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(ctx.ComponentConfig.SAController.ServiceAccountKeyFile) == 0 {
|
if len(ctx.ComponentConfig.SAController.ServiceAccountKeyFile) == 0 {
|
||||||
glog.Warningf("%q is disabled because there is no private key", saTokenControllerName)
|
klog.Warningf("%q is disabled because there is no private key", saTokenControllerName)
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
privateKey, err := certutil.PrivateKeyFromFile(ctx.ComponentConfig.SAController.ServiceAccountKeyFile)
|
privateKey, err := certutil.PrivateKeyFromFile(ctx.ComponentConfig.SAController.ServiceAccountKeyFile)
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ func startServiceController(ctx ControllerContext) (http.Handler, bool, error) {
|
|||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// This error shouldn't fail. It lives like this as a legacy.
|
// This error shouldn't fail. It lives like this as a legacy.
|
||||||
glog.Errorf("Failed to start service controller: %v", err)
|
klog.Errorf("Failed to start service controller: %v", err)
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
go serviceController.Run(ctx.Stop, int(ctx.ComponentConfig.ServiceController.ConcurrentServiceSyncs))
|
go serviceController.Run(ctx.Stop, int(ctx.ComponentConfig.ServiceController.ConcurrentServiceSyncs))
|
||||||
@ -92,14 +92,14 @@ func startNodeIpamController(ctx ControllerContext) (http.Handler, bool, error)
|
|||||||
if len(strings.TrimSpace(ctx.ComponentConfig.KubeCloudShared.ClusterCIDR)) != 0 {
|
if len(strings.TrimSpace(ctx.ComponentConfig.KubeCloudShared.ClusterCIDR)) != 0 {
|
||||||
_, clusterCIDR, err = net.ParseCIDR(ctx.ComponentConfig.KubeCloudShared.ClusterCIDR)
|
_, clusterCIDR, err = net.ParseCIDR(ctx.ComponentConfig.KubeCloudShared.ClusterCIDR)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", ctx.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
klog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", ctx.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(strings.TrimSpace(ctx.ComponentConfig.NodeIPAMController.ServiceCIDR)) != 0 {
|
if len(strings.TrimSpace(ctx.ComponentConfig.NodeIPAMController.ServiceCIDR)) != 0 {
|
||||||
_, serviceCIDR, err = net.ParseCIDR(ctx.ComponentConfig.NodeIPAMController.ServiceCIDR)
|
_, serviceCIDR, err = net.ParseCIDR(ctx.ComponentConfig.NodeIPAMController.ServiceCIDR)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Unsuccessful parsing of service CIDR %v: %v", ctx.ComponentConfig.NodeIPAMController.ServiceCIDR, err)
|
klog.Warningf("Unsuccessful parsing of service CIDR %v: %v", ctx.ComponentConfig.NodeIPAMController.ServiceCIDR, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,21 +148,21 @@ func startNodeLifecycleController(ctx ControllerContext) (http.Handler, bool, er
|
|||||||
|
|
||||||
func startRouteController(ctx ControllerContext) (http.Handler, bool, error) {
|
func startRouteController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||||
if !ctx.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs || !ctx.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes {
|
if !ctx.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs || !ctx.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes {
|
||||||
glog.Infof("Will not configure cloud provider routes for allocate-node-cidrs: %v, configure-cloud-routes: %v.", ctx.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs, ctx.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes)
|
klog.Infof("Will not configure cloud provider routes for allocate-node-cidrs: %v, configure-cloud-routes: %v.", ctx.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs, ctx.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes)
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
if ctx.Cloud == nil {
|
if ctx.Cloud == nil {
|
||||||
glog.Warning("configure-cloud-routes is set, but no cloud provider specified. Will not configure cloud provider routes.")
|
klog.Warning("configure-cloud-routes is set, but no cloud provider specified. Will not configure cloud provider routes.")
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
routes, ok := ctx.Cloud.Routes()
|
routes, ok := ctx.Cloud.Routes()
|
||||||
if !ok {
|
if !ok {
|
||||||
glog.Warning("configure-cloud-routes is set, but cloud provider does not support routes. Will not configure cloud provider routes.")
|
klog.Warning("configure-cloud-routes is set, but cloud provider does not support routes. Will not configure cloud provider routes.")
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
_, clusterCIDR, err := net.ParseCIDR(ctx.ComponentConfig.KubeCloudShared.ClusterCIDR)
|
_, clusterCIDR, err := net.ParseCIDR(ctx.ComponentConfig.KubeCloudShared.ClusterCIDR)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", ctx.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
klog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", ctx.ComponentConfig.KubeCloudShared.ClusterCIDR, err)
|
||||||
}
|
}
|
||||||
routeController := routecontroller.New(routes, ctx.ClientBuilder.ClientOrDie("route-controller"), ctx.InformerFactory.Core().V1().Nodes(), ctx.ComponentConfig.KubeCloudShared.ClusterName, clusterCIDR)
|
routeController := routecontroller.New(routes, ctx.ClientBuilder.ClientOrDie("route-controller"), ctx.InformerFactory.Core().V1().Nodes(), ctx.ComponentConfig.KubeCloudShared.ClusterName, clusterCIDR)
|
||||||
go routeController.Run(ctx.Stop, ctx.ComponentConfig.KubeCloudShared.RouteReconciliationPeriod.Duration)
|
go routeController.Run(ctx.Stop, ctx.ComponentConfig.KubeCloudShared.RouteReconciliationPeriod.Duration)
|
||||||
|
@ -53,8 +53,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||||
"//staging/src/k8s.io/kube-controller-manager/config/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/kube-controller-manager/config/v1alpha1:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ import (
|
|||||||
// add the kubernetes feature gates
|
// add the kubernetes feature gates
|
||||||
_ "k8s.io/kubernetes/pkg/features"
|
_ "k8s.io/kubernetes/pkg/features"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -438,7 +438,7 @@ func (s KubeControllerManagerOptions) Config(allControllers []string, disabledBy
|
|||||||
|
|
||||||
func createRecorder(kubeClient clientset.Interface, userAgent string) record.EventRecorder {
|
func createRecorder(kubeClient clientset.Interface, userAgent string) record.EventRecorder {
|
||||||
eventBroadcaster := record.NewBroadcaster()
|
eventBroadcaster := record.NewBroadcaster()
|
||||||
eventBroadcaster.StartLogging(glog.Infof)
|
eventBroadcaster.StartLogging(klog.Infof)
|
||||||
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
|
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
|
||||||
// TODO: remove dependency on the legacyscheme
|
// TODO: remove dependency on the legacyscheme
|
||||||
return eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: userAgent})
|
return eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: userAgent})
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
// Cloud providers
|
// Cloud providers
|
||||||
cloudprovider "k8s.io/cloud-provider"
|
cloudprovider "k8s.io/cloud-provider"
|
||||||
@ -133,7 +133,7 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config kubectrl
|
|||||||
ProvisioningEnabled: config.EnableHostPathProvisioning,
|
ProvisioningEnabled: config.EnableHostPathProvisioning,
|
||||||
}
|
}
|
||||||
if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, &hostPathConfig); err != nil {
|
if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, &hostPathConfig); err != nil {
|
||||||
glog.Fatalf("Could not create hostpath recycler pod from file %s: %+v", config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, err)
|
klog.Fatalf("Could not create hostpath recycler pod from file %s: %+v", config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, err)
|
||||||
}
|
}
|
||||||
allPlugins = append(allPlugins, host_path.ProbeVolumePlugins(hostPathConfig)...)
|
allPlugins = append(allPlugins, host_path.ProbeVolumePlugins(hostPathConfig)...)
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config kubectrl
|
|||||||
RecyclerPodTemplate: volume.NewPersistentVolumeRecyclerPodTemplate(),
|
RecyclerPodTemplate: volume.NewPersistentVolumeRecyclerPodTemplate(),
|
||||||
}
|
}
|
||||||
if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, &nfsConfig); err != nil {
|
if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, &nfsConfig); err != nil {
|
||||||
glog.Fatalf("Could not create NFS recycler pod from file %s: %+v", config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, err)
|
klog.Fatalf("Could not create NFS recycler pod from file %s: %+v", config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, err)
|
||||||
}
|
}
|
||||||
allPlugins = append(allPlugins, nfs.ProbeVolumePlugins(nfsConfig)...)
|
allPlugins = append(allPlugins, nfs.ProbeVolumePlugins(nfsConfig)...)
|
||||||
allPlugins = append(allPlugins, glusterfs.ProbeVolumePlugins()...)
|
allPlugins = append(allPlugins, glusterfs.ProbeVolumePlugins()...)
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func startDisruptionController(ctx ControllerContext) (http.Handler, bool, error) {
|
func startDisruptionController(ctx ControllerContext) (http.Handler, bool, error) {
|
||||||
@ -35,7 +35,7 @@ func startDisruptionController(ctx ControllerContext) (http.Handler, bool, error
|
|||||||
var resource = "poddisruptionbudgets"
|
var resource = "poddisruptionbudgets"
|
||||||
|
|
||||||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: group, Version: version, Resource: resource}] {
|
if !ctx.AvailableResources[schema.GroupVersionResource{Group: group, Version: version, Resource: resource}] {
|
||||||
glog.Infof(
|
klog.Infof(
|
||||||
"Refusing to start disruption because resource %q in group %q is not available.",
|
"Refusing to start disruption because resource %q in group %q is not available.",
|
||||||
resource, group+"/"+version)
|
resource, group+"/"+version)
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
|
@ -61,10 +61,10 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||||
"//staging/src/k8s.io/kube-proxy/config/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/kube-proxy/config/v1alpha1:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||||
"//vendor/k8s.io/utils/pointer:go_default_library",
|
"//vendor/k8s.io/utils/pointer:go_default_library",
|
||||||
] + select({
|
] + select({
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
"k8s.io/kubernetes/pkg/util/sysctl"
|
"k8s.io/kubernetes/pkg/util/sysctl"
|
||||||
@ -49,7 +49,7 @@ func (rct realConntracker) SetMax(max int) error {
|
|||||||
if err := rct.setIntSysCtl("nf_conntrack_max", max); err != nil {
|
if err := rct.setIntSysCtl("nf_conntrack_max", max); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
glog.Infof("Setting nf_conntrack_max to %d", max)
|
klog.Infof("Setting nf_conntrack_max to %d", max)
|
||||||
|
|
||||||
// Linux does not support writing to /sys/module/nf_conntrack/parameters/hashsize
|
// Linux does not support writing to /sys/module/nf_conntrack/parameters/hashsize
|
||||||
// when the writer process is not in the initial network namespace
|
// when the writer process is not in the initial network namespace
|
||||||
@ -80,7 +80,7 @@ func (rct realConntracker) SetMax(max int) error {
|
|||||||
return readOnlySysFSError
|
return readOnlySysFSError
|
||||||
}
|
}
|
||||||
// TODO: generify this and sysctl to a new sysfs.WriteInt()
|
// TODO: generify this and sysctl to a new sysfs.WriteInt()
|
||||||
glog.Infof("Setting conntrack hashsize to %d", max/4)
|
klog.Infof("Setting conntrack hashsize to %d", max/4)
|
||||||
return writeIntStringFile("/sys/module/nf_conntrack/parameters/hashsize", max/4)
|
return writeIntStringFile("/sys/module/nf_conntrack/parameters/hashsize", max/4)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ func (realConntracker) setIntSysCtl(name string, value int) error {
|
|||||||
|
|
||||||
sys := sysctl.New()
|
sys := sysctl.New()
|
||||||
if val, _ := sys.GetSysctl(entry); val != value {
|
if val, _ := sys.GetSysctl(entry); val != value {
|
||||||
glog.Infof("Set sysctl '%v' to %v", entry, value)
|
klog.Infof("Set sysctl '%v' to %v", entry, value)
|
||||||
if err := sys.SetSysctl(entry, value); err != nil {
|
if err := sys.SetSysctl(entry, value); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ func isSysFSWritable() (bool, error) {
|
|||||||
m := mount.New("" /* default mount path */)
|
m := mount.New("" /* default mount path */)
|
||||||
mountPoints, err := m.List()
|
mountPoints, err := m.List()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("failed to list mount points: %v", err)
|
klog.Errorf("failed to list mount points: %v", err)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ func isSysFSWritable() (bool, error) {
|
|||||||
if len(mountPoint.Opts) > 0 && mountPoint.Opts[0] == permWritable {
|
if len(mountPoint.Opts) > 0 && mountPoint.Opts[0] == permWritable {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
glog.Errorf("sysfs is not writable: %+v (mount options are %v)",
|
klog.Errorf("sysfs is not writable: %+v (mount options are %v)",
|
||||||
mountPoint, mountPoint.Opts)
|
mountPoint, mountPoint.Opts)
|
||||||
return false, readOnlySysFSError
|
return false, readOnlySysFSError
|
||||||
}
|
}
|
||||||
|
@ -72,10 +72,10 @@ import (
|
|||||||
"k8s.io/utils/exec"
|
"k8s.io/utils/exec"
|
||||||
utilpointer "k8s.io/utils/pointer"
|
utilpointer "k8s.io/utils/pointer"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -191,7 +191,7 @@ func NewOptions() *Options {
|
|||||||
// Complete completes all the required options.
|
// Complete completes all the required options.
|
||||||
func (o *Options) Complete() error {
|
func (o *Options) Complete() error {
|
||||||
if len(o.ConfigFile) == 0 && len(o.WriteConfigTo) == 0 {
|
if len(o.ConfigFile) == 0 && len(o.WriteConfigTo) == 0 {
|
||||||
glog.Warning("WARNING: all flags other than --config, --write-config-to, and --cleanup are deprecated. Please begin using a config file ASAP.")
|
klog.Warning("WARNING: all flags other than --config, --write-config-to, and --cleanup are deprecated. Please begin using a config file ASAP.")
|
||||||
o.applyDeprecatedHealthzPortToConfig()
|
o.applyDeprecatedHealthzPortToConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ func (o *Options) writeConfigFile() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("Wrote configuration to: %s\n", o.WriteConfigTo)
|
klog.Infof("Wrote configuration to: %s\n", o.WriteConfigTo)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -365,23 +365,23 @@ with the apiserver API to configure the proxy.`,
|
|||||||
utilflag.PrintFlags(cmd.Flags())
|
utilflag.PrintFlags(cmd.Flags())
|
||||||
|
|
||||||
if err := initForOS(opts.WindowsService); err != nil {
|
if err := initForOS(opts.WindowsService); err != nil {
|
||||||
glog.Fatalf("failed OS init: %v", err)
|
klog.Fatalf("failed OS init: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := opts.Complete(); err != nil {
|
if err := opts.Complete(); err != nil {
|
||||||
glog.Fatalf("failed complete: %v", err)
|
klog.Fatalf("failed complete: %v", err)
|
||||||
}
|
}
|
||||||
if err := opts.Validate(args); err != nil {
|
if err := opts.Validate(args); err != nil {
|
||||||
glog.Fatalf("failed validate: %v", err)
|
klog.Fatalf("failed validate: %v", err)
|
||||||
}
|
}
|
||||||
glog.Fatal(opts.Run())
|
klog.Fatal(opts.Run())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
opts.config, err = opts.ApplyDefaults(opts.config)
|
opts.config, err = opts.ApplyDefaults(opts.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("unable to create flag defaults: %v", err)
|
klog.Fatalf("unable to create flag defaults: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.AddFlags(cmd.Flags())
|
opts.AddFlags(cmd.Flags())
|
||||||
@ -426,7 +426,7 @@ func createClients(config apimachineryconfig.ClientConnectionConfiguration, mast
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
if len(config.Kubeconfig) == 0 && len(masterOverride) == 0 {
|
if len(config.Kubeconfig) == 0 && len(masterOverride) == 0 {
|
||||||
glog.Info("Neither kubeconfig file nor master URL was specified. Falling back to in-cluster config.")
|
klog.Info("Neither kubeconfig file nor master URL was specified. Falling back to in-cluster config.")
|
||||||
kubeConfig, err = rest.InClusterConfig()
|
kubeConfig, err = rest.InClusterConfig()
|
||||||
} else {
|
} else {
|
||||||
// This creates a client, first loading any specified kubeconfig
|
// This creates a client, first loading any specified kubeconfig
|
||||||
@ -461,7 +461,7 @@ func createClients(config apimachineryconfig.ClientConnectionConfiguration, mast
|
|||||||
// Run runs the specified ProxyServer. This should never exit (unless CleanupAndExit is set).
|
// Run runs the specified ProxyServer. This should never exit (unless CleanupAndExit is set).
|
||||||
func (s *ProxyServer) Run() error {
|
func (s *ProxyServer) Run() error {
|
||||||
// To help debugging, immediately log version
|
// To help debugging, immediately log version
|
||||||
glog.Infof("Version: %+v", version.Get())
|
klog.Infof("Version: %+v", version.Get())
|
||||||
// remove iptables rules and exit
|
// remove iptables rules and exit
|
||||||
if s.CleanupAndExit {
|
if s.CleanupAndExit {
|
||||||
encounteredError := userspace.CleanupLeftovers(s.IptInterface)
|
encounteredError := userspace.CleanupLeftovers(s.IptInterface)
|
||||||
@ -478,16 +478,16 @@ func (s *ProxyServer) Run() error {
|
|||||||
if s.OOMScoreAdj != nil {
|
if s.OOMScoreAdj != nil {
|
||||||
oomAdjuster = oom.NewOOMAdjuster()
|
oomAdjuster = oom.NewOOMAdjuster()
|
||||||
if err := oomAdjuster.ApplyOOMScoreAdj(0, int(*s.OOMScoreAdj)); err != nil {
|
if err := oomAdjuster.ApplyOOMScoreAdj(0, int(*s.OOMScoreAdj)); err != nil {
|
||||||
glog.V(2).Info(err)
|
klog.V(2).Info(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(s.ResourceContainer) != 0 {
|
if len(s.ResourceContainer) != 0 {
|
||||||
// Run in its own container.
|
// Run in its own container.
|
||||||
if err := resourcecontainer.RunInResourceContainer(s.ResourceContainer); err != nil {
|
if err := resourcecontainer.RunInResourceContainer(s.ResourceContainer); err != nil {
|
||||||
glog.Warningf("Failed to start in resource-only container %q: %v", s.ResourceContainer, err)
|
klog.Warningf("Failed to start in resource-only container %q: %v", s.ResourceContainer, err)
|
||||||
} else {
|
} else {
|
||||||
glog.V(2).Infof("Running in resource-only container %q", s.ResourceContainer)
|
klog.V(2).Infof("Running in resource-only container %q", s.ResourceContainer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,7 +595,7 @@ func getConntrackMax(config kubeproxyconfig.KubeProxyConntrackConfiguration) (in
|
|||||||
if config.MaxPerCore != nil && *config.MaxPerCore > 0 {
|
if config.MaxPerCore != nil && *config.MaxPerCore > 0 {
|
||||||
return -1, fmt.Errorf("invalid config: Conntrack Max and Conntrack MaxPerCore are mutually exclusive")
|
return -1, fmt.Errorf("invalid config: Conntrack Max and Conntrack MaxPerCore are mutually exclusive")
|
||||||
}
|
}
|
||||||
glog.V(3).Infof("getConntrackMax: using absolute conntrack-max (deprecated)")
|
klog.V(3).Infof("getConntrackMax: using absolute conntrack-max (deprecated)")
|
||||||
return int(*config.Max), nil
|
return int(*config.Max), nil
|
||||||
}
|
}
|
||||||
if config.MaxPerCore != nil && *config.MaxPerCore > 0 {
|
if config.MaxPerCore != nil && *config.MaxPerCore > 0 {
|
||||||
@ -605,10 +605,10 @@ func getConntrackMax(config kubeproxyconfig.KubeProxyConntrackConfiguration) (in
|
|||||||
}
|
}
|
||||||
scaled := int(*config.MaxPerCore) * goruntime.NumCPU()
|
scaled := int(*config.MaxPerCore) * goruntime.NumCPU()
|
||||||
if scaled > floor {
|
if scaled > floor {
|
||||||
glog.V(3).Infof("getConntrackMax: using scaled conntrack-max-per-core")
|
klog.V(3).Infof("getConntrackMax: using scaled conntrack-max-per-core")
|
||||||
return scaled, nil
|
return scaled, nil
|
||||||
}
|
}
|
||||||
glog.V(3).Infof("getConntrackMax: using conntrack-min")
|
klog.V(3).Infof("getConntrackMax: using conntrack-min")
|
||||||
return floor, nil
|
return floor, nil
|
||||||
}
|
}
|
||||||
return 0, nil
|
return 0, nil
|
||||||
|
@ -48,7 +48,7 @@ import (
|
|||||||
utilsysctl "k8s.io/kubernetes/pkg/util/sysctl"
|
utilsysctl "k8s.io/kubernetes/pkg/util/sysctl"
|
||||||
"k8s.io/utils/exec"
|
"k8s.io/utils/exec"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewProxyServer returns a new ProxyServer.
|
// NewProxyServer returns a new ProxyServer.
|
||||||
@ -75,7 +75,7 @@ func newProxyServer(
|
|||||||
|
|
||||||
protocol := utiliptables.ProtocolIpv4
|
protocol := utiliptables.ProtocolIpv4
|
||||||
if net.ParseIP(config.BindAddress).To4() == nil {
|
if net.ParseIP(config.BindAddress).To4() == nil {
|
||||||
glog.V(0).Infof("IPv6 bind address (%s), assume IPv6 operation", config.BindAddress)
|
klog.V(0).Infof("IPv6 bind address (%s), assume IPv6 operation", config.BindAddress)
|
||||||
protocol = utiliptables.ProtocolIpv6
|
protocol = utiliptables.ProtocolIpv6
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ func newProxyServer(
|
|||||||
nodeIP = utilnode.GetNodeIP(client, hostname)
|
nodeIP = utilnode.GetNodeIP(client, hostname)
|
||||||
}
|
}
|
||||||
if proxyMode == proxyModeIPTables {
|
if proxyMode == proxyModeIPTables {
|
||||||
glog.V(0).Info("Using iptables Proxier.")
|
klog.V(0).Info("Using iptables Proxier.")
|
||||||
if config.IPTables.MasqueradeBit == nil {
|
if config.IPTables.MasqueradeBit == nil {
|
||||||
// MasqueradeBit must be specified or defaulted.
|
// MasqueradeBit must be specified or defaulted.
|
||||||
return nil, fmt.Errorf("unable to read IPTables MasqueradeBit from config")
|
return nil, fmt.Errorf("unable to read IPTables MasqueradeBit from config")
|
||||||
@ -175,7 +175,7 @@ func newProxyServer(
|
|||||||
serviceEventHandler = proxierIPTables
|
serviceEventHandler = proxierIPTables
|
||||||
endpointsEventHandler = proxierIPTables
|
endpointsEventHandler = proxierIPTables
|
||||||
// No turning back. Remove artifacts that might still exist from the userspace Proxier.
|
// No turning back. Remove artifacts that might still exist from the userspace Proxier.
|
||||||
glog.V(0).Info("Tearing down inactive rules.")
|
klog.V(0).Info("Tearing down inactive rules.")
|
||||||
// TODO this has side effects that should only happen when Run() is invoked.
|
// TODO this has side effects that should only happen when Run() is invoked.
|
||||||
userspace.CleanupLeftovers(iptInterface)
|
userspace.CleanupLeftovers(iptInterface)
|
||||||
// IPVS Proxier will generate some iptables rules, need to clean them before switching to other proxy mode.
|
// IPVS Proxier will generate some iptables rules, need to clean them before switching to other proxy mode.
|
||||||
@ -186,7 +186,7 @@ func newProxyServer(
|
|||||||
ipvs.CleanupLeftovers(ipvsInterface, iptInterface, ipsetInterface, cleanupIPVS)
|
ipvs.CleanupLeftovers(ipvsInterface, iptInterface, ipsetInterface, cleanupIPVS)
|
||||||
}
|
}
|
||||||
} else if proxyMode == proxyModeIPVS {
|
} else if proxyMode == proxyModeIPVS {
|
||||||
glog.V(0).Info("Using ipvs Proxier.")
|
klog.V(0).Info("Using ipvs Proxier.")
|
||||||
proxierIPVS, err := ipvs.NewProxier(
|
proxierIPVS, err := ipvs.NewProxier(
|
||||||
iptInterface,
|
iptInterface,
|
||||||
ipvsInterface,
|
ipvsInterface,
|
||||||
@ -213,12 +213,12 @@ func newProxyServer(
|
|||||||
proxier = proxierIPVS
|
proxier = proxierIPVS
|
||||||
serviceEventHandler = proxierIPVS
|
serviceEventHandler = proxierIPVS
|
||||||
endpointsEventHandler = proxierIPVS
|
endpointsEventHandler = proxierIPVS
|
||||||
glog.V(0).Info("Tearing down inactive rules.")
|
klog.V(0).Info("Tearing down inactive rules.")
|
||||||
// TODO this has side effects that should only happen when Run() is invoked.
|
// TODO this has side effects that should only happen when Run() is invoked.
|
||||||
userspace.CleanupLeftovers(iptInterface)
|
userspace.CleanupLeftovers(iptInterface)
|
||||||
iptables.CleanupLeftovers(iptInterface)
|
iptables.CleanupLeftovers(iptInterface)
|
||||||
} else {
|
} else {
|
||||||
glog.V(0).Info("Using userspace Proxier.")
|
klog.V(0).Info("Using userspace Proxier.")
|
||||||
// This is a proxy.LoadBalancer which NewProxier needs but has methods we don't need for
|
// This is a proxy.LoadBalancer which NewProxier needs but has methods we don't need for
|
||||||
// our config.EndpointsConfigHandler.
|
// our config.EndpointsConfigHandler.
|
||||||
loadBalancer := userspace.NewLoadBalancerRR()
|
loadBalancer := userspace.NewLoadBalancerRR()
|
||||||
@ -244,7 +244,7 @@ func newProxyServer(
|
|||||||
proxier = proxierUserspace
|
proxier = proxierUserspace
|
||||||
|
|
||||||
// Remove artifacts from the iptables and ipvs Proxier, if not on Windows.
|
// Remove artifacts from the iptables and ipvs Proxier, if not on Windows.
|
||||||
glog.V(0).Info("Tearing down inactive rules.")
|
klog.V(0).Info("Tearing down inactive rules.")
|
||||||
// TODO this has side effects that should only happen when Run() is invoked.
|
// TODO this has side effects that should only happen when Run() is invoked.
|
||||||
iptables.CleanupLeftovers(iptInterface)
|
iptables.CleanupLeftovers(iptInterface)
|
||||||
// IPVS Proxier will generate some iptables rules, need to clean them before switching to other proxy mode.
|
// IPVS Proxier will generate some iptables rules, need to clean them before switching to other proxy mode.
|
||||||
@ -292,7 +292,7 @@ func getProxyMode(proxyMode string, iptver iptables.IPTablesVersioner, khandle i
|
|||||||
case proxyModeIPVS:
|
case proxyModeIPVS:
|
||||||
return tryIPVSProxy(iptver, khandle, ipsetver, kcompat)
|
return tryIPVSProxy(iptver, khandle, ipsetver, kcompat)
|
||||||
}
|
}
|
||||||
glog.Warningf("Flag proxy-mode=%q unknown, assuming iptables proxy", proxyMode)
|
klog.Warningf("Flag proxy-mode=%q unknown, assuming iptables proxy", proxyMode)
|
||||||
return tryIPTablesProxy(iptver, kcompat)
|
return tryIPTablesProxy(iptver, kcompat)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ func tryIPVSProxy(iptver iptables.IPTablesVersioner, khandle ipvs.KernelHandler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to fallback to iptables before falling back to userspace
|
// Try to fallback to iptables before falling back to userspace
|
||||||
glog.V(1).Infof("Can't use ipvs proxier, trying iptables proxier")
|
klog.V(1).Infof("Can't use ipvs proxier, trying iptables proxier")
|
||||||
return tryIPTablesProxy(iptver, kcompat)
|
return tryIPTablesProxy(iptver, kcompat)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,6 +324,6 @@ func tryIPTablesProxy(iptver iptables.IPTablesVersioner, kcompat iptables.Kernel
|
|||||||
return proxyModeIPTables
|
return proxyModeIPTables
|
||||||
}
|
}
|
||||||
// Fallback.
|
// Fallback.
|
||||||
glog.V(1).Infof("Can't use iptables proxy, using userspace proxier")
|
klog.V(1).Infof("Can't use iptables proxy, using userspace proxier")
|
||||||
return proxyModeUserspace
|
return proxyModeUserspace
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ import (
|
|||||||
utilnode "k8s.io/kubernetes/pkg/util/node"
|
utilnode "k8s.io/kubernetes/pkg/util/node"
|
||||||
"k8s.io/utils/exec"
|
"k8s.io/utils/exec"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewProxyServer returns a new ProxyServer.
|
// NewProxyServer returns a new ProxyServer.
|
||||||
@ -99,7 +99,7 @@ func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi
|
|||||||
|
|
||||||
proxyMode := getProxyMode(string(config.Mode), winkernel.WindowsKernelCompatTester{})
|
proxyMode := getProxyMode(string(config.Mode), winkernel.WindowsKernelCompatTester{})
|
||||||
if proxyMode == proxyModeKernelspace {
|
if proxyMode == proxyModeKernelspace {
|
||||||
glog.V(0).Info("Using Kernelspace Proxier.")
|
klog.V(0).Info("Using Kernelspace Proxier.")
|
||||||
proxierKernelspace, err := winkernel.NewProxier(
|
proxierKernelspace, err := winkernel.NewProxier(
|
||||||
config.IPTables.SyncPeriod.Duration,
|
config.IPTables.SyncPeriod.Duration,
|
||||||
config.IPTables.MinSyncPeriod.Duration,
|
config.IPTables.MinSyncPeriod.Duration,
|
||||||
@ -118,7 +118,7 @@ func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi
|
|||||||
endpointsEventHandler = proxierKernelspace
|
endpointsEventHandler = proxierKernelspace
|
||||||
serviceEventHandler = proxierKernelspace
|
serviceEventHandler = proxierKernelspace
|
||||||
} else {
|
} else {
|
||||||
glog.V(0).Info("Using userspace Proxier.")
|
klog.V(0).Info("Using userspace Proxier.")
|
||||||
execer := exec.New()
|
execer := exec.New()
|
||||||
var netshInterface utilnetsh.Interface
|
var netshInterface utilnetsh.Interface
|
||||||
netshInterface = utilnetsh.New(execer)
|
netshInterface = utilnetsh.New(execer)
|
||||||
@ -143,7 +143,7 @@ func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi
|
|||||||
}
|
}
|
||||||
proxier = proxierUserspace
|
proxier = proxierUserspace
|
||||||
serviceEventHandler = proxierUserspace
|
serviceEventHandler = proxierUserspace
|
||||||
glog.V(0).Info("Tearing down pure-winkernel proxy rules.")
|
klog.V(0).Info("Tearing down pure-winkernel proxy rules.")
|
||||||
winkernel.CleanupLeftovers()
|
winkernel.CleanupLeftovers()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,13 +182,13 @@ func tryWinKernelSpaceProxy(kcompat winkernel.KernelCompatTester) string {
|
|||||||
// guaranteed false on error, error only necessary for debugging
|
// guaranteed false on error, error only necessary for debugging
|
||||||
useWinKerelProxy, err := winkernel.CanUseWinKernelProxier(kcompat)
|
useWinKerelProxy, err := winkernel.CanUseWinKernelProxier(kcompat)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Can't determine whether to use windows kernel proxy, using userspace proxier: %v", err)
|
klog.Errorf("Can't determine whether to use windows kernel proxy, using userspace proxier: %v", err)
|
||||||
return proxyModeUserspace
|
return proxyModeUserspace
|
||||||
}
|
}
|
||||||
if useWinKerelProxy {
|
if useWinKerelProxy {
|
||||||
return proxyModeKernelspace
|
return proxyModeKernelspace
|
||||||
}
|
}
|
||||||
// Fallback.
|
// Fallback.
|
||||||
glog.V(1).Infof("Can't use winkernel proxy, using userspace proxier")
|
klog.V(1).Infof("Can't use winkernel proxy, using userspace proxier")
|
||||||
return proxyModeUserspace
|
return proxyModeUserspace
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/informers/storage/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/informers/storage/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/leaderelection:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/leaderelection:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/tools/leaderelection/resourcelock:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/leaderelection/resourcelock:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||||
"//staging/src/k8s.io/kube-scheduler/config/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/kube-scheduler/config/v1alpha1:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
apimachineryconfig "k8s.io/apimachinery/pkg/apis/config"
|
apimachineryconfig "k8s.io/apimachinery/pkg/apis/config"
|
||||||
@ -291,7 +291,7 @@ func makeLeaderElectionConfig(config kubeschedulerconfig.KubeSchedulerLeaderElec
|
|||||||
// TODO remove masterOverride when CLI flags are removed.
|
// TODO remove masterOverride when CLI flags are removed.
|
||||||
func createClients(config apimachineryconfig.ClientConnectionConfiguration, masterOverride string, timeout time.Duration) (clientset.Interface, clientset.Interface, v1core.EventsGetter, error) {
|
func createClients(config apimachineryconfig.ClientConnectionConfiguration, masterOverride string, timeout time.Duration) (clientset.Interface, clientset.Interface, v1core.EventsGetter, error) {
|
||||||
if len(config.Kubeconfig) == 0 && len(masterOverride) == 0 {
|
if len(config.Kubeconfig) == 0 && len(masterOverride) == 0 {
|
||||||
glog.Warningf("Neither --kubeconfig nor --master was specified. Using default API client. This might not work.")
|
klog.Warningf("Neither --kubeconfig nor --master was specified. Using default API client. This might not work.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// This creates a client, first loading any specified kubeconfig
|
// This creates a client, first loading any specified kubeconfig
|
||||||
|
@ -59,16 +59,16 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/version"
|
"k8s.io/kubernetes/pkg/version"
|
||||||
"k8s.io/kubernetes/pkg/version/verflag"
|
"k8s.io/kubernetes/pkg/version/verflag"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewSchedulerCommand creates a *cobra.Command object with default parameters
|
// NewSchedulerCommand creates a *cobra.Command object with default parameters
|
||||||
func NewSchedulerCommand() *cobra.Command {
|
func NewSchedulerCommand() *cobra.Command {
|
||||||
opts, err := options.NewOptions()
|
opts, err := options.NewOptions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("unable to initialize command options: %v", err)
|
klog.Fatalf("unable to initialize command options: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
@ -113,7 +113,7 @@ func runCommand(cmd *cobra.Command, args []string, opts *options.Options) error
|
|||||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
glog.Infof("Wrote configuration to: %s\n", opts.WriteConfigTo)
|
klog.Infof("Wrote configuration to: %s\n", opts.WriteConfigTo)
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := opts.Config()
|
c, err := opts.Config()
|
||||||
@ -128,7 +128,7 @@ func runCommand(cmd *cobra.Command, args []string, opts *options.Options) error
|
|||||||
cc := c.Complete()
|
cc := c.Complete()
|
||||||
|
|
||||||
// To help debugging, immediately log version
|
// To help debugging, immediately log version
|
||||||
glog.Infof("Version: %+v", version.Get())
|
klog.Infof("Version: %+v", version.Get())
|
||||||
|
|
||||||
// Apply algorithms based on feature gates.
|
// Apply algorithms based on feature gates.
|
||||||
// TODO: make configurable?
|
// TODO: make configurable?
|
||||||
|
@ -132,7 +132,6 @@
|
|||||||
"github.com/ghodss/yaml",
|
"github.com/ghodss/yaml",
|
||||||
"github.com/gogo/protobuf/proto",
|
"github.com/gogo/protobuf/proto",
|
||||||
"github.com/gogo/protobuf/sortkeys",
|
"github.com/gogo/protobuf/sortkeys",
|
||||||
"github.com/golang/glog",
|
|
||||||
"github.com/golang/groupcache/lru",
|
"github.com/golang/groupcache/lru",
|
||||||
"github.com/golang/protobuf/proto",
|
"github.com/golang/protobuf/proto",
|
||||||
"github.com/golang/protobuf/protoc-gen-go/descriptor",
|
"github.com/golang/protobuf/protoc-gen-go/descriptor",
|
||||||
|
@ -18,7 +18,10 @@ go_library(
|
|||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = ["kubeadm.go"],
|
srcs = ["kubeadm.go"],
|
||||||
importpath = "k8s.io/kubernetes/cmd/kubeadm",
|
importpath = "k8s.io/kubernetes/cmd/kubeadm",
|
||||||
deps = ["//cmd/kubeadm/app:go_default_library"],
|
deps = [
|
||||||
|
"//cmd/kubeadm/app:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
|
@ -12,8 +12,8 @@ go_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//cmd/kubeadm/app/cmd:go_default_library",
|
"//cmd/kubeadm/app/cmd:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -67,11 +67,11 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/util/cert:go_default_library",
|
"//staging/src/k8s.io/client-go/util/cert:go_default_library",
|
||||||
"//staging/src/k8s.io/cluster-bootstrap/token/api:go_default_library",
|
"//staging/src/k8s.io/cluster-bootstrap/token/api:go_default_library",
|
||||||
"//staging/src/k8s.io/cluster-bootstrap/token/util:go_default_library",
|
"//staging/src/k8s.io/cluster-bootstrap/token/util:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
"//vendor/github.com/renstrom/dedent:go_default_library",
|
"//vendor/github.com/renstrom/dedent:go_default_library",
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||||
"//vendor/sigs.k8s.io/yaml:go_default_library",
|
"//vendor/sigs.k8s.io/yaml:go_default_library",
|
||||||
],
|
],
|
||||||
|
@ -20,10 +20,10 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/renstrom/dedent"
|
"github.com/renstrom/dedent"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
||||||
)
|
)
|
||||||
@ -138,7 +138,7 @@ func RunCompletion(out io.Writer, boilerPlate string, cmd *cobra.Command, args [
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runCompletionBash(out io.Writer, kubeadm *cobra.Command) error {
|
func runCompletionBash(out io.Writer, kubeadm *cobra.Command) error {
|
||||||
glog.V(1).Infoln("[completion] writing completion code for Bash")
|
klog.V(1).Infoln("[completion] writing completion code for Bash")
|
||||||
return kubeadm.GenBashCompletion(out)
|
return kubeadm.GenBashCompletion(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,12 +284,12 @@ __kubeadm_convert_bash_to_zsh() {
|
|||||||
-e "s/\\\$(type${RWORD}/\$(__kubeadm_type/g" \
|
-e "s/\\\$(type${RWORD}/\$(__kubeadm_type/g" \
|
||||||
<<'BASH_COMPLETION_EOF'
|
<<'BASH_COMPLETION_EOF'
|
||||||
`
|
`
|
||||||
glog.V(1).Infoln("[completion] writing completion code for Zsh")
|
klog.V(1).Infoln("[completion] writing completion code for Zsh")
|
||||||
out.Write([]byte(zshInitialization))
|
out.Write([]byte(zshInitialization))
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
kubeadm.GenBashCompletion(buf)
|
kubeadm.GenBashCompletion(buf)
|
||||||
glog.V(1).Infoln("[completion] writing completion code for Bash")
|
klog.V(1).Infoln("[completion] writing completion code for Bash")
|
||||||
out.Write(buf.Bytes())
|
out.Write(buf.Bytes())
|
||||||
|
|
||||||
zshTail := `
|
zshTail := `
|
||||||
|
@ -23,11 +23,11 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/renstrom/dedent"
|
"github.com/renstrom/dedent"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
@ -373,7 +373,7 @@ func NewCmdConfigView(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
|||||||
The configuration is located in the %q namespace in the %q ConfigMap.
|
The configuration is located in the %q namespace in the %q ConfigMap.
|
||||||
`), metav1.NamespaceSystem, constants.KubeadmConfigConfigMap),
|
`), metav1.NamespaceSystem, constants.KubeadmConfigConfigMap),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
glog.V(1).Infoln("[config] retrieving ClientSet from file")
|
klog.V(1).Infoln("[config] retrieving ClientSet from file")
|
||||||
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
|
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
@ -402,15 +402,15 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co
|
|||||||
kubeadmutil.CheckErr(errors.New("The --config flag is mandatory"))
|
kubeadmutil.CheckErr(errors.New("The --config flag is mandatory"))
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infoln("[config] retrieving ClientSet from file")
|
klog.V(1).Infoln("[config] retrieving ClientSet from file")
|
||||||
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
|
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
// The default configuration is empty; everything should come from the file on disk
|
// The default configuration is empty; everything should come from the file on disk
|
||||||
glog.V(1).Infoln("[config] creating empty default configuration")
|
klog.V(1).Infoln("[config] creating empty default configuration")
|
||||||
defaultcfg := &kubeadmapiv1beta1.InitConfiguration{}
|
defaultcfg := &kubeadmapiv1beta1.InitConfiguration{}
|
||||||
// Upload the configuration using the file; don't care about the defaultcfg really
|
// Upload the configuration using the file; don't care about the defaultcfg really
|
||||||
glog.V(1).Infof("[config] uploading configuration")
|
klog.V(1).Infof("[config] uploading configuration")
|
||||||
err = uploadConfiguration(client, cfgPath, defaultcfg)
|
err = uploadConfiguration(client, cfgPath, defaultcfg)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
},
|
},
|
||||||
@ -438,17 +438,17 @@ func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.C
|
|||||||
`), metav1.NamespaceSystem, constants.KubeadmConfigConfigMap),
|
`), metav1.NamespaceSystem, constants.KubeadmConfigConfigMap),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
var err error
|
var err error
|
||||||
glog.V(1).Infoln("[config] creating new FeatureGates")
|
klog.V(1).Infoln("[config] creating new FeatureGates")
|
||||||
if cfg.FeatureGates, err = features.NewFeatureGate(&features.InitFeatureGates, featureGatesString); err != nil {
|
if cfg.FeatureGates, err = features.NewFeatureGate(&features.InitFeatureGates, featureGatesString); err != nil {
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
}
|
}
|
||||||
glog.V(1).Infoln("[config] retrieving ClientSet from file")
|
klog.V(1).Infoln("[config] retrieving ClientSet from file")
|
||||||
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
|
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
// Default both statically and dynamically, convert to internal API type, and validate everything
|
// Default both statically and dynamically, convert to internal API type, and validate everything
|
||||||
// The cfgPath argument is unset here as we shouldn't load a config file from disk, just go with cfg
|
// The cfgPath argument is unset here as we shouldn't load a config file from disk, just go with cfg
|
||||||
glog.V(1).Infof("[config] uploading configuration")
|
klog.V(1).Infof("[config] uploading configuration")
|
||||||
err = uploadConfiguration(client, "", cfg)
|
err = uploadConfiguration(client, "", cfg)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
},
|
},
|
||||||
@ -460,7 +460,7 @@ func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.C
|
|||||||
// RunConfigView gets the configuration persisted in the cluster
|
// RunConfigView gets the configuration persisted in the cluster
|
||||||
func RunConfigView(out io.Writer, client clientset.Interface) error {
|
func RunConfigView(out io.Writer, client clientset.Interface) error {
|
||||||
|
|
||||||
glog.V(1).Infoln("[config] getting the cluster configuration")
|
klog.V(1).Infoln("[config] getting the cluster configuration")
|
||||||
cfgConfigMap, err := client.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(constants.KubeadmConfigConfigMap, metav1.GetOptions{})
|
cfgConfigMap, err := client.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(constants.KubeadmConfigConfigMap, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -478,7 +478,7 @@ func uploadConfiguration(client clientset.Interface, cfgPath string, defaultcfg
|
|||||||
|
|
||||||
// Default both statically and dynamically, convert to internal API type, and validate everything
|
// Default both statically and dynamically, convert to internal API type, and validate everything
|
||||||
// First argument is unset here as we shouldn't load a config file from disk
|
// First argument is unset here as we shouldn't load a config file from disk
|
||||||
glog.V(1).Infoln("[config] converting to internal API type")
|
klog.V(1).Infoln("[config] converting to internal API type")
|
||||||
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, defaultcfg)
|
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, defaultcfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -25,13 +25,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/renstrom/dedent"
|
"github.com/renstrom/dedent"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
||||||
@ -460,7 +460,7 @@ func (d initData) Tokens() []string {
|
|||||||
func runInit(i *initData, out io.Writer) error {
|
func runInit(i *initData, out io.Writer) error {
|
||||||
|
|
||||||
// Get directories to write files to; can be faked if we're dry-running
|
// Get directories to write files to; can be faked if we're dry-running
|
||||||
glog.V(1).Infof("[init] Getting certificates directory from configuration")
|
klog.V(1).Infof("[init] Getting certificates directory from configuration")
|
||||||
certsDirToWriteTo, kubeConfigDir, _, _, err := getDirectoriesToUse(i.dryRun, i.dryRunDir, i.cfg.CertificatesDir)
|
certsDirToWriteTo, kubeConfigDir, _, _, err := getDirectoriesToUse(i.dryRun, i.dryRunDir, i.cfg.CertificatesDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error getting directories to use")
|
return errors.Wrap(err, "error getting directories to use")
|
||||||
@ -481,18 +481,18 @@ func runInit(i *initData, out io.Writer) error {
|
|||||||
// Upload currently used configuration to the cluster
|
// Upload currently used configuration to the cluster
|
||||||
// Note: This is done right in the beginning of cluster initialization; as we might want to make other phases
|
// Note: This is done right in the beginning of cluster initialization; as we might want to make other phases
|
||||||
// depend on centralized information from this source in the future
|
// depend on centralized information from this source in the future
|
||||||
glog.V(1).Infof("[init] uploading currently used configuration to the cluster")
|
klog.V(1).Infof("[init] uploading currently used configuration to the cluster")
|
||||||
if err := uploadconfigphase.UploadConfiguration(i.cfg, client); err != nil {
|
if err := uploadconfigphase.UploadConfiguration(i.cfg, client); err != nil {
|
||||||
return errors.Wrap(err, "error uploading configuration")
|
return errors.Wrap(err, "error uploading configuration")
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("[init] creating kubelet configuration configmap")
|
klog.V(1).Infof("[init] creating kubelet configuration configmap")
|
||||||
if err := kubeletphase.CreateConfigMap(i.cfg, client); err != nil {
|
if err := kubeletphase.CreateConfigMap(i.cfg, client); err != nil {
|
||||||
return errors.Wrap(err, "error creating kubelet configuration ConfigMap")
|
return errors.Wrap(err, "error creating kubelet configuration ConfigMap")
|
||||||
}
|
}
|
||||||
|
|
||||||
// PHASE 4: Mark the master with the right label/taint
|
// PHASE 4: Mark the master with the right label/taint
|
||||||
glog.V(1).Infof("[init] marking the master with right label")
|
klog.V(1).Infof("[init] marking the master with right label")
|
||||||
if err := markmasterphase.MarkMaster(client, i.cfg.NodeRegistration.Name, i.cfg.NodeRegistration.Taints); err != nil {
|
if err := markmasterphase.MarkMaster(client, i.cfg.NodeRegistration.Name, i.cfg.NodeRegistration.Taints); err != nil {
|
||||||
return errors.Wrap(err, "error marking master")
|
return errors.Wrap(err, "error marking master")
|
||||||
}
|
}
|
||||||
@ -510,12 +510,12 @@ func runInit(i *initData, out io.Writer) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("[init] ensuring DNS addon")
|
klog.V(1).Infof("[init] ensuring DNS addon")
|
||||||
if err := dnsaddonphase.EnsureDNSAddon(i.cfg, client); err != nil {
|
if err := dnsaddonphase.EnsureDNSAddon(i.cfg, client); err != nil {
|
||||||
return errors.Wrap(err, "error ensuring dns addon")
|
return errors.Wrap(err, "error ensuring dns addon")
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("[init] ensuring proxy addon")
|
klog.V(1).Infof("[init] ensuring proxy addon")
|
||||||
if err := proxyaddonphase.EnsureProxyAddon(i.cfg, client); err != nil {
|
if err := proxyaddonphase.EnsureProxyAddon(i.cfg, client); err != nil {
|
||||||
return errors.Wrap(err, "error ensuring proxy addon")
|
return errors.Wrap(err, "error ensuring proxy addon")
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/renstrom/dedent"
|
"github.com/renstrom/dedent"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -33,6 +32,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||||
certutil "k8s.io/client-go/util/cert"
|
certutil "k8s.io/client-go/util/cert"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
||||||
@ -180,7 +180,7 @@ func NewCmdJoin(out io.Writer) *cobra.Command {
|
|||||||
}
|
}
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
if len(cfgPath) == 0 && len(args) > 1 {
|
if len(cfgPath) == 0 && len(args) > 1 {
|
||||||
glog.Warningf("[join] WARNING: More than one API server endpoint supplied on command line %v. Using the first one.", args)
|
klog.Warningf("[join] WARNING: More than one API server endpoint supplied on command line %v. Using the first one.", args)
|
||||||
}
|
}
|
||||||
cfg.Discovery.BootstrapToken.APIServerEndpoint = args[0]
|
cfg.Discovery.BootstrapToken.APIServerEndpoint = args[0]
|
||||||
}
|
}
|
||||||
@ -289,11 +289,11 @@ type Join struct {
|
|||||||
func NewJoin(cfgPath string, defaultcfg *kubeadmapiv1beta1.JoinConfiguration, ignorePreflightErrors sets.String) (*Join, error) {
|
func NewJoin(cfgPath string, defaultcfg *kubeadmapiv1beta1.JoinConfiguration, ignorePreflightErrors sets.String) (*Join, error) {
|
||||||
|
|
||||||
if defaultcfg.NodeRegistration.Name == "" {
|
if defaultcfg.NodeRegistration.Name == "" {
|
||||||
glog.V(1).Infoln("[join] found NodeName empty; using OS hostname as NodeName")
|
klog.V(1).Infoln("[join] found NodeName empty; using OS hostname as NodeName")
|
||||||
}
|
}
|
||||||
|
|
||||||
if defaultcfg.APIEndpoint.AdvertiseAddress == "" {
|
if defaultcfg.APIEndpoint.AdvertiseAddress == "" {
|
||||||
glog.V(1).Infoln("[join] found advertiseAddress empty; using default interface's IP address as advertiseAddress")
|
klog.V(1).Infoln("[join] found advertiseAddress empty; using default interface's IP address as advertiseAddress")
|
||||||
}
|
}
|
||||||
|
|
||||||
internalCfg, err := configutil.JoinConfigFileAndDefaultsToInternalConfig(cfgPath, defaultcfg)
|
internalCfg, err := configutil.JoinConfigFileAndDefaultsToInternalConfig(cfgPath, defaultcfg)
|
||||||
@ -307,20 +307,20 @@ func NewJoin(cfgPath string, defaultcfg *kubeadmapiv1beta1.JoinConfiguration, ig
|
|||||||
fmt.Println("[preflight] Running pre-flight checks")
|
fmt.Println("[preflight] Running pre-flight checks")
|
||||||
|
|
||||||
// Start with general checks
|
// Start with general checks
|
||||||
glog.V(1).Infoln("[preflight] Running general checks")
|
klog.V(1).Infoln("[preflight] Running general checks")
|
||||||
if err := preflight.RunJoinNodeChecks(utilsexec.New(), internalCfg, ignorePreflightErrors); err != nil {
|
if err := preflight.RunJoinNodeChecks(utilsexec.New(), internalCfg, ignorePreflightErrors); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch the init configuration based on the join configuration
|
// Fetch the init configuration based on the join configuration
|
||||||
glog.V(1).Infoln("[preflight] Fetching init configuration")
|
klog.V(1).Infoln("[preflight] Fetching init configuration")
|
||||||
initCfg, tlsBootstrapCfg, err := fetchInitConfigurationFromJoinConfiguration(internalCfg)
|
initCfg, tlsBootstrapCfg, err := fetchInitConfigurationFromJoinConfiguration(internalCfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Continue with more specific checks based on the init configuration
|
// Continue with more specific checks based on the init configuration
|
||||||
glog.V(1).Infoln("[preflight] Running configuration dependant checks")
|
klog.V(1).Infoln("[preflight] Running configuration dependant checks")
|
||||||
if err := preflight.RunOptionalJoinNodeChecks(utilsexec.New(), initCfg, ignorePreflightErrors); err != nil {
|
if err := preflight.RunOptionalJoinNodeChecks(utilsexec.New(), initCfg, ignorePreflightErrors); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -457,7 +457,7 @@ func (j *Join) BootstrapKubelet(tlsBootstrapCfg *clientcmdapi.Config) error {
|
|||||||
bootstrapKubeConfigFile := kubeadmconstants.GetBootstrapKubeletKubeConfigPath()
|
bootstrapKubeConfigFile := kubeadmconstants.GetBootstrapKubeletKubeConfigPath()
|
||||||
|
|
||||||
// Write the bootstrap kubelet config file or the TLS-Boostrapped kubelet config file down to disk
|
// Write the bootstrap kubelet config file or the TLS-Boostrapped kubelet config file down to disk
|
||||||
glog.V(1).Infoln("[join] writing bootstrap kubelet config file at", bootstrapKubeConfigFile)
|
klog.V(1).Infoln("[join] writing bootstrap kubelet config file at", bootstrapKubeConfigFile)
|
||||||
if err := kubeconfigutil.WriteToDisk(bootstrapKubeConfigFile, tlsBootstrapCfg); err != nil {
|
if err := kubeconfigutil.WriteToDisk(bootstrapKubeConfigFile, tlsBootstrapCfg); err != nil {
|
||||||
return errors.Wrap(err, "couldn't save bootstrap-kubelet.conf to disk")
|
return errors.Wrap(err, "couldn't save bootstrap-kubelet.conf to disk")
|
||||||
}
|
}
|
||||||
@ -482,7 +482,7 @@ func (j *Join) BootstrapKubelet(tlsBootstrapCfg *clientcmdapi.Config) error {
|
|||||||
|
|
||||||
// Configure the kubelet. In this short timeframe, kubeadm is trying to stop/restart the kubelet
|
// Configure the kubelet. In this short timeframe, kubeadm is trying to stop/restart the kubelet
|
||||||
// Try to stop the kubelet service so no race conditions occur when configuring it
|
// Try to stop the kubelet service so no race conditions occur when configuring it
|
||||||
glog.V(1).Infof("Stopping the kubelet")
|
klog.V(1).Infof("Stopping the kubelet")
|
||||||
kubeletphase.TryStopKubelet()
|
kubeletphase.TryStopKubelet()
|
||||||
|
|
||||||
// Write the configuration for the kubelet (using the bootstrap token credentials) to disk so the kubelet can start
|
// Write the configuration for the kubelet (using the bootstrap token credentials) to disk so the kubelet can start
|
||||||
@ -499,7 +499,7 @@ func (j *Join) BootstrapKubelet(tlsBootstrapCfg *clientcmdapi.Config) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to start the kubelet service in case it's inactive
|
// Try to start the kubelet service in case it's inactive
|
||||||
glog.V(1).Infof("Starting the kubelet")
|
klog.V(1).Infof("Starting the kubelet")
|
||||||
kubeletphase.TryStartKubelet()
|
kubeletphase.TryStartKubelet()
|
||||||
|
|
||||||
// Now the kubelet will perform the TLS Bootstrap, transforming /etc/kubernetes/bootstrap-kubelet.conf to /etc/kubernetes/kubelet.conf
|
// Now the kubelet will perform the TLS Bootstrap, transforming /etc/kubernetes/bootstrap-kubelet.conf to /etc/kubernetes/kubelet.conf
|
||||||
@ -517,7 +517,7 @@ func (j *Join) BootstrapKubelet(tlsBootstrapCfg *clientcmdapi.Config) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("[join] preserving the crisocket information for the node")
|
klog.V(1).Infof("[join] preserving the crisocket information for the node")
|
||||||
if err := patchnodephase.AnnotateCRISocket(client, j.cfg.NodeRegistration.Name, j.cfg.NodeRegistration.CRISocket); err != nil {
|
if err := patchnodephase.AnnotateCRISocket(client, j.cfg.NodeRegistration.Name, j.cfg.NodeRegistration.CRISocket); err != nil {
|
||||||
return errors.Wrap(err, "error uploading crisocket")
|
return errors.Wrap(err, "error uploading crisocket")
|
||||||
}
|
}
|
||||||
@ -552,18 +552,18 @@ func (j *Join) PostInstallControlPlane(initConfiguration *kubeadmapi.InitConfigu
|
|||||||
// "If you add a new member to a 1-node cluster, the cluster cannot make progress before the new member starts
|
// "If you add a new member to a 1-node cluster, the cluster cannot make progress before the new member starts
|
||||||
// because it needs two members as majority to agree on the consensus. You will only see this behavior between the time
|
// because it needs two members as majority to agree on the consensus. You will only see this behavior between the time
|
||||||
// etcdctl member add informs the cluster about the new member and the new member successfully establishing a connection to the existing one."
|
// etcdctl member add informs the cluster about the new member and the new member successfully establishing a connection to the existing one."
|
||||||
glog.V(1).Info("[join] adding etcd")
|
klog.V(1).Info("[join] adding etcd")
|
||||||
if err := etcdphase.CreateStackedEtcdStaticPodManifestFile(client, kubeadmconstants.GetStaticPodDirectory(), initConfiguration); err != nil {
|
if err := etcdphase.CreateStackedEtcdStaticPodManifestFile(client, kubeadmconstants.GetStaticPodDirectory(), initConfiguration); err != nil {
|
||||||
return errors.Wrap(err, "error creating local etcd static pod manifest file")
|
return errors.Wrap(err, "error creating local etcd static pod manifest file")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Info("[join] uploading currently used configuration to the cluster")
|
klog.V(1).Info("[join] uploading currently used configuration to the cluster")
|
||||||
if err := uploadconfigphase.UploadConfiguration(initConfiguration, client); err != nil {
|
if err := uploadconfigphase.UploadConfiguration(initConfiguration, client); err != nil {
|
||||||
return errors.Wrap(err, "error uploading configuration")
|
return errors.Wrap(err, "error uploading configuration")
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Info("[join] marking the master with right label")
|
klog.V(1).Info("[join] marking the master with right label")
|
||||||
if err = markmasterphase.MarkMaster(client, initConfiguration.NodeRegistration.Name, initConfiguration.NodeRegistration.Taints); err != nil {
|
if err = markmasterphase.MarkMaster(client, initConfiguration.NodeRegistration.Name, initConfiguration.NodeRegistration.Taints); err != nil {
|
||||||
return errors.Wrap(err, "error applying master label and taints")
|
return errors.Wrap(err, "error applying master label and taints")
|
||||||
}
|
}
|
||||||
@ -587,14 +587,14 @@ func waitForTLSBootstrappedClient() error {
|
|||||||
func fetchInitConfigurationFromJoinConfiguration(cfg *kubeadmapi.JoinConfiguration) (*kubeadmapi.InitConfiguration, *clientcmdapi.Config, error) {
|
func fetchInitConfigurationFromJoinConfiguration(cfg *kubeadmapi.JoinConfiguration) (*kubeadmapi.InitConfiguration, *clientcmdapi.Config, error) {
|
||||||
// Perform the Discovery, which turns a Bootstrap Token and optionally (and preferably) a CA cert hash into a KubeConfig
|
// Perform the Discovery, which turns a Bootstrap Token and optionally (and preferably) a CA cert hash into a KubeConfig
|
||||||
// file that may be used for the TLS Bootstrapping process the kubelet performs using the Certificates API.
|
// file that may be used for the TLS Bootstrapping process the kubelet performs using the Certificates API.
|
||||||
glog.V(1).Infoln("[join] Discovering cluster-info")
|
klog.V(1).Infoln("[join] Discovering cluster-info")
|
||||||
tlsBootstrapCfg, err := discovery.For(cfg)
|
tlsBootstrapCfg, err := discovery.For(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieves the kubeadm configuration
|
// Retrieves the kubeadm configuration
|
||||||
glog.V(1).Infoln("[join] Retrieving KubeConfig objects")
|
klog.V(1).Infoln("[join] Retrieving KubeConfig objects")
|
||||||
initConfiguration, err := fetchInitConfiguration(tlsBootstrapCfg)
|
initConfiguration, err := fetchInitConfiguration(tlsBootstrapCfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -52,10 +52,10 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
"//vendor/github.com/renstrom/dedent:go_default_library",
|
"//vendor/github.com/renstrom/dedent:go_default_library",
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -19,8 +19,8 @@ package phases
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
@ -83,7 +83,7 @@ func EnsureAllAddons(cfg *kubeadmapi.InitConfiguration, client clientset.Interfa
|
|||||||
proxyaddon.EnsureProxyAddon,
|
proxyaddon.EnsureProxyAddon,
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infoln("[addon] installing all addons")
|
klog.V(1).Infoln("[addon] installing all addons")
|
||||||
for _, action := range addonActions {
|
for _, action := range addonActions {
|
||||||
err := action(cfg, client)
|
err := action(cfg, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -19,8 +19,8 @@ package phases
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
|
||||||
@ -93,7 +93,7 @@ func runEtcdPhaseLocal() func(c workflow.RunData) error {
|
|||||||
return errors.Wrap(err, "error creating local etcd static pod manifest file")
|
return errors.Wrap(err, "error creating local etcd static pod manifest file")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glog.V(1).Infof("[etcd] External etcd mode. Skipping the creation of a manifest for local etcd")
|
klog.V(1).Infof("[etcd] External etcd mode. Skipping the creation of a manifest for local etcd")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ limitations under the License.
|
|||||||
package phases
|
package phases
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
|
||||||
@ -68,7 +68,7 @@ func runKubeletStart(c workflow.RunData) error {
|
|||||||
// First off, configure the kubelet. In this short timeframe, kubeadm is trying to stop/restart the kubelet
|
// First off, configure the kubelet. In this short timeframe, kubeadm is trying to stop/restart the kubelet
|
||||||
// Try to stop the kubelet service so no race conditions occur when configuring it
|
// Try to stop the kubelet service so no race conditions occur when configuring it
|
||||||
if !data.DryRun() {
|
if !data.DryRun() {
|
||||||
glog.V(1).Infof("Stopping the kubelet")
|
klog.V(1).Infof("Stopping the kubelet")
|
||||||
kubeletphase.TryStopKubelet()
|
kubeletphase.TryStopKubelet()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ func runKubeletStart(c workflow.RunData) error {
|
|||||||
|
|
||||||
// Try to start the kubelet service in case it's inactive
|
// Try to start the kubelet service in case it's inactive
|
||||||
if !data.DryRun() {
|
if !data.DryRun() {
|
||||||
glog.V(1).Infof("Starting the kubelet")
|
klog.V(1).Infof("Starting the kubelet")
|
||||||
kubeletphase.TryStartKubelet()
|
kubeletphase.TryStartKubelet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@ package phases
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
|
||||||
@ -105,7 +105,7 @@ func runUploadKubeadmConfig(c workflow.RunData) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("[upload-config] Uploading the kubeadm ClusterConfiguration to a ConfigMap")
|
klog.V(1).Infof("[upload-config] Uploading the kubeadm ClusterConfiguration to a ConfigMap")
|
||||||
if err := uploadconfig.UploadConfiguration(cfg, client); err != nil {
|
if err := uploadconfig.UploadConfiguration(cfg, client); err != nil {
|
||||||
return errors.Wrap(err, "error uploading the kubeadm ClusterConfiguration")
|
return errors.Wrap(err, "error uploading the kubeadm ClusterConfiguration")
|
||||||
}
|
}
|
||||||
@ -119,12 +119,12 @@ func runUploadKubeletConfig(c workflow.RunData) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("[upload-config] Uploading the kubelet component config to a ConfigMap")
|
klog.V(1).Infof("[upload-config] Uploading the kubelet component config to a ConfigMap")
|
||||||
if err = kubeletphase.CreateConfigMap(cfg, client); err != nil {
|
if err = kubeletphase.CreateConfigMap(cfg, client); err != nil {
|
||||||
return errors.Wrap(err, "error creating kubelet configuration ConfigMap")
|
return errors.Wrap(err, "error creating kubelet configuration ConfigMap")
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("[upload-config] Preserving the CRISocket information for the control-plane node")
|
klog.V(1).Infof("[upload-config] Preserving the CRISocket information for the control-plane node")
|
||||||
if err := patchnodephase.AnnotateCRISocket(client, cfg.NodeRegistration.Name, cfg.NodeRegistration.CRISocket); err != nil {
|
if err := patchnodephase.AnnotateCRISocket(client, cfg.NodeRegistration.Name, cfg.NodeRegistration.CRISocket); err != nil {
|
||||||
return errors.Wrap(err, "Error writing Crisocket information for the control-plane node")
|
return errors.Wrap(err, "Error writing Crisocket information for the control-plane node")
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,10 @@ import (
|
|||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/renstrom/dedent"
|
"github.com/renstrom/dedent"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -86,7 +86,7 @@ func runWaitControlPlanePhase(c workflow.RunData) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// waiter holds the apiclient.Waiter implementation of choice, responsible for querying the API server in various ways and waiting for conditions to be fulfilled
|
// waiter holds the apiclient.Waiter implementation of choice, responsible for querying the API server in various ways and waiting for conditions to be fulfilled
|
||||||
glog.V(1).Infof("[wait-control-plane] Waiting for the API server to be healthy")
|
klog.V(1).Infof("[wait-control-plane] Waiting for the API server to be healthy")
|
||||||
|
|
||||||
client, err := data.Client()
|
client, err := data.Client()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -26,8 +26,8 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
@ -129,7 +129,7 @@ func (r *Reset) Run(out io.Writer, client clientset.Interface) error {
|
|||||||
// Only clear etcd data when using local etcd.
|
// Only clear etcd data when using local etcd.
|
||||||
etcdManifestPath := filepath.Join(kubeadmconstants.KubernetesDir, kubeadmconstants.ManifestsSubDirName, "etcd.yaml")
|
etcdManifestPath := filepath.Join(kubeadmconstants.KubernetesDir, kubeadmconstants.ManifestsSubDirName, "etcd.yaml")
|
||||||
|
|
||||||
glog.V(1).Infof("[reset] checking for etcd config")
|
klog.V(1).Infof("[reset] checking for etcd config")
|
||||||
etcdDataDir, err := getEtcdDataDir(etcdManifestPath, client)
|
etcdDataDir, err := getEtcdDataDir(etcdManifestPath, client)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
dirsToClean = append(dirsToClean, etcdDataDir)
|
dirsToClean = append(dirsToClean, etcdDataDir)
|
||||||
@ -139,16 +139,16 @@ func (r *Reset) Run(out io.Writer, client clientset.Interface) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to stop the kubelet service
|
// Try to stop the kubelet service
|
||||||
glog.V(1).Infof("[reset] getting init system")
|
klog.V(1).Infof("[reset] getting init system")
|
||||||
initSystem, err := initsystem.GetInitSystem()
|
initSystem, err := initsystem.GetInitSystem()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningln("[reset] the kubelet service could not be stopped by kubeadm. Unable to detect a supported init system!")
|
klog.Warningln("[reset] the kubelet service could not be stopped by kubeadm. Unable to detect a supported init system!")
|
||||||
glog.Warningln("[reset] please ensure kubelet is stopped manually")
|
klog.Warningln("[reset] please ensure kubelet is stopped manually")
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("[reset] stopping the kubelet service")
|
fmt.Println("[reset] stopping the kubelet service")
|
||||||
if err := initSystem.ServiceStop("kubelet"); err != nil {
|
if err := initSystem.ServiceStop("kubelet"); err != nil {
|
||||||
glog.Warningf("[reset] the kubelet service could not be stopped by kubeadm: [%v]\n", err)
|
klog.Warningf("[reset] the kubelet service could not be stopped by kubeadm: [%v]\n", err)
|
||||||
glog.Warningln("[reset] please ensure kubelet is stopped manually")
|
klog.Warningln("[reset] please ensure kubelet is stopped manually")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,29 +156,29 @@ func (r *Reset) Run(out io.Writer, client clientset.Interface) error {
|
|||||||
fmt.Printf("[reset] unmounting mounted directories in %q\n", kubeadmconstants.KubeletRunDirectory)
|
fmt.Printf("[reset] unmounting mounted directories in %q\n", kubeadmconstants.KubeletRunDirectory)
|
||||||
umountDirsCmd := fmt.Sprintf("awk '$2 ~ path {print $2}' path=%s /proc/mounts | xargs -r umount", kubeadmconstants.KubeletRunDirectory)
|
umountDirsCmd := fmt.Sprintf("awk '$2 ~ path {print $2}' path=%s /proc/mounts | xargs -r umount", kubeadmconstants.KubeletRunDirectory)
|
||||||
|
|
||||||
glog.V(1).Infof("[reset] executing command %q", umountDirsCmd)
|
klog.V(1).Infof("[reset] executing command %q", umountDirsCmd)
|
||||||
umountOutputBytes, err := exec.Command("sh", "-c", umountDirsCmd).Output()
|
umountOutputBytes, err := exec.Command("sh", "-c", umountDirsCmd).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("[reset] failed to unmount mounted directories in %s: %s\n", kubeadmconstants.KubeletRunDirectory, string(umountOutputBytes))
|
klog.Errorf("[reset] failed to unmount mounted directories in %s: %s\n", kubeadmconstants.KubeletRunDirectory, string(umountOutputBytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Info("[reset] removing Kubernetes-managed containers")
|
klog.V(1).Info("[reset] removing Kubernetes-managed containers")
|
||||||
if err := removeContainers(utilsexec.New(), r.criSocketPath); err != nil {
|
if err := removeContainers(utilsexec.New(), r.criSocketPath); err != nil {
|
||||||
glog.Errorf("[reset] failed to remove containers: %+v", err)
|
klog.Errorf("[reset] failed to remove containers: %+v", err)
|
||||||
}
|
}
|
||||||
dirsToClean = append(dirsToClean, []string{kubeadmconstants.KubeletRunDirectory, "/etc/cni/net.d", "/var/lib/dockershim", "/var/run/kubernetes"}...)
|
dirsToClean = append(dirsToClean, []string{kubeadmconstants.KubeletRunDirectory, "/etc/cni/net.d", "/var/lib/dockershim", "/var/run/kubernetes"}...)
|
||||||
|
|
||||||
// Then clean contents from the stateful kubelet, etcd and cni directories
|
// Then clean contents from the stateful kubelet, etcd and cni directories
|
||||||
fmt.Printf("[reset] deleting contents of stateful directories: %v\n", dirsToClean)
|
fmt.Printf("[reset] deleting contents of stateful directories: %v\n", dirsToClean)
|
||||||
for _, dir := range dirsToClean {
|
for _, dir := range dirsToClean {
|
||||||
glog.V(1).Infof("[reset] deleting content of %s", dir)
|
klog.V(1).Infof("[reset] deleting content of %s", dir)
|
||||||
cleanDir(dir)
|
cleanDir(dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove contents from the config and pki directories
|
// Remove contents from the config and pki directories
|
||||||
glog.V(1).Infoln("[reset] removing contents from the config and pki directories")
|
klog.V(1).Infoln("[reset] removing contents from the config and pki directories")
|
||||||
if r.certsDir != kubeadmapiv1beta1.DefaultCertificatesDir {
|
if r.certsDir != kubeadmapiv1beta1.DefaultCertificatesDir {
|
||||||
glog.Warningf("[reset] WARNING: cleaning a non-default certificates directory: %q\n", r.certsDir)
|
klog.Warningf("[reset] WARNING: cleaning a non-default certificates directory: %q\n", r.certsDir)
|
||||||
}
|
}
|
||||||
resetConfigDir(kubeadmconstants.KubernetesDir, r.certsDir)
|
resetConfigDir(kubeadmconstants.KubernetesDir, r.certsDir)
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ func getEtcdDataDir(manifestPath string, client clientset.Interface) (string, er
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
return cfg.Etcd.Local.DataDir, nil
|
return cfg.Etcd.Local.DataDir, nil
|
||||||
}
|
}
|
||||||
glog.Warningf("[reset] Unable to fetch the kubeadm-config ConfigMap, using etcd pod spec as fallback: %v", err)
|
klog.Warningf("[reset] Unable to fetch the kubeadm-config ConfigMap, using etcd pod spec as fallback: %v", err)
|
||||||
|
|
||||||
etcdPod, err := utilstaticpod.ReadStaticPodFromDisk(manifestPath)
|
etcdPod, err := utilstaticpod.ReadStaticPodFromDisk(manifestPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -261,7 +261,7 @@ func resetConfigDir(configPathDir, pkiPathDir string) {
|
|||||||
fmt.Printf("[reset] deleting contents of config directories: %v\n", dirsToClean)
|
fmt.Printf("[reset] deleting contents of config directories: %v\n", dirsToClean)
|
||||||
for _, dir := range dirsToClean {
|
for _, dir := range dirsToClean {
|
||||||
if err := cleanDir(dir); err != nil {
|
if err := cleanDir(dir); err != nil {
|
||||||
glog.Errorf("[reset] failed to remove directory: %q [%v]\n", dir, err)
|
klog.Errorf("[reset] failed to remove directory: %q [%v]\n", dir, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ func resetConfigDir(configPathDir, pkiPathDir string) {
|
|||||||
fmt.Printf("[reset] deleting files: %v\n", filesToClean)
|
fmt.Printf("[reset] deleting files: %v\n", filesToClean)
|
||||||
for _, path := range filesToClean {
|
for _, path := range filesToClean {
|
||||||
if err := os.RemoveAll(path); err != nil {
|
if err := os.RemoveAll(path); err != nil {
|
||||||
glog.Errorf("[reset] failed to remove file: %q [%v]\n", path, err)
|
klog.Errorf("[reset] failed to remove file: %q [%v]\n", path, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,10 @@ import (
|
|||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/renstrom/dedent"
|
"github.com/renstrom/dedent"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/fields"
|
"k8s.io/apimachinery/pkg/fields"
|
||||||
@ -113,14 +113,14 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
|
|||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
bto.TokenStr = args[0]
|
bto.TokenStr = args[0]
|
||||||
}
|
}
|
||||||
glog.V(1).Infoln("[token] validating mixed arguments")
|
klog.V(1).Infoln("[token] validating mixed arguments")
|
||||||
err := validation.ValidateMixedArguments(tokenCmd.Flags())
|
err := validation.ValidateMixedArguments(tokenCmd.Flags())
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
err = bto.ApplyTo(cfg)
|
err = bto.ApplyTo(cfg)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
glog.V(1).Infoln("[token] getting Clientsets from kubeconfig file")
|
klog.V(1).Infoln("[token] getting Clientsets from kubeconfig file")
|
||||||
kubeConfigFile = cmdutil.FindExistingKubeConfig(kubeConfigFile)
|
kubeConfigFile = cmdutil.FindExistingKubeConfig(kubeConfigFile)
|
||||||
client, err := getClientset(kubeConfigFile, dryRun)
|
client, err := getClientset(kubeConfigFile, dryRun)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
@ -215,13 +215,13 @@ func RunCreateToken(out io.Writer, client clientset.Interface, cfgPath string, c
|
|||||||
phaseutil.SetKubernetesVersion(cfg)
|
phaseutil.SetKubernetesVersion(cfg)
|
||||||
|
|
||||||
// This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags
|
// This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags
|
||||||
glog.V(1).Infoln("[token] loading configurations")
|
klog.V(1).Infoln("[token] loading configurations")
|
||||||
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg)
|
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infoln("[token] creating token")
|
klog.V(1).Infoln("[token] creating token")
|
||||||
if err := tokenphase.CreateNewTokens(client, internalcfg.BootstrapTokens); err != nil {
|
if err := tokenphase.CreateNewTokens(client, internalcfg.BootstrapTokens); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ func RunCreateToken(out io.Writer, client clientset.Interface, cfgPath string, c
|
|||||||
|
|
||||||
// RunGenerateToken just generates a random token for the user
|
// RunGenerateToken just generates a random token for the user
|
||||||
func RunGenerateToken(out io.Writer) error {
|
func RunGenerateToken(out io.Writer) error {
|
||||||
glog.V(1).Infoln("[token] generating random token")
|
klog.V(1).Infoln("[token] generating random token")
|
||||||
token, err := bootstraputil.GenerateBootstrapToken()
|
token, err := bootstraputil.GenerateBootstrapToken()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -256,7 +256,7 @@ func RunGenerateToken(out io.Writer) error {
|
|||||||
// RunListTokens lists details on all existing bootstrap tokens on the server.
|
// RunListTokens lists details on all existing bootstrap tokens on the server.
|
||||||
func RunListTokens(out io.Writer, errW io.Writer, client clientset.Interface) error {
|
func RunListTokens(out io.Writer, errW io.Writer, client clientset.Interface) error {
|
||||||
// First, build our selector for bootstrap tokens only
|
// First, build our selector for bootstrap tokens only
|
||||||
glog.V(1).Infoln("[token] preparing selector for bootstrap token")
|
klog.V(1).Infoln("[token] preparing selector for bootstrap token")
|
||||||
tokenSelector := fields.SelectorFromSet(
|
tokenSelector := fields.SelectorFromSet(
|
||||||
map[string]string{
|
map[string]string{
|
||||||
// TODO: We hard-code "type" here until `field_constants.go` that is
|
// TODO: We hard-code "type" here until `field_constants.go` that is
|
||||||
@ -269,7 +269,7 @@ func RunListTokens(out io.Writer, errW io.Writer, client clientset.Interface) er
|
|||||||
FieldSelector: tokenSelector.String(),
|
FieldSelector: tokenSelector.String(),
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infoln("[token] retrieving list of bootstrap tokens")
|
klog.V(1).Infoln("[token] retrieving list of bootstrap tokens")
|
||||||
secrets, err := client.CoreV1().Secrets(metav1.NamespaceSystem).List(listOptions)
|
secrets, err := client.CoreV1().Secrets(metav1.NamespaceSystem).List(listOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to list bootstrap tokens")
|
return errors.Wrap(err, "failed to list bootstrap tokens")
|
||||||
@ -298,7 +298,7 @@ func RunListTokens(out io.Writer, errW io.Writer, client clientset.Interface) er
|
|||||||
func RunDeleteToken(out io.Writer, client clientset.Interface, tokenIDOrToken string) error {
|
func RunDeleteToken(out io.Writer, client clientset.Interface, tokenIDOrToken string) error {
|
||||||
// Assume the given first argument is a token id and try to parse it
|
// Assume the given first argument is a token id and try to parse it
|
||||||
tokenID := tokenIDOrToken
|
tokenID := tokenIDOrToken
|
||||||
glog.V(1).Infoln("[token] parsing token ID")
|
klog.V(1).Infoln("[token] parsing token ID")
|
||||||
if !bootstraputil.IsValidBootstrapTokenID(tokenIDOrToken) {
|
if !bootstraputil.IsValidBootstrapTokenID(tokenIDOrToken) {
|
||||||
// Okay, the full token with both id and secret was probably passed. Parse it and extract the ID only
|
// Okay, the full token with both id and secret was probably passed. Parse it and extract the ID only
|
||||||
bts, err := kubeadmapiv1beta1.NewBootstrapTokenString(tokenIDOrToken)
|
bts, err := kubeadmapiv1beta1.NewBootstrapTokenString(tokenIDOrToken)
|
||||||
@ -310,7 +310,7 @@ func RunDeleteToken(out io.Writer, client clientset.Interface, tokenIDOrToken st
|
|||||||
}
|
}
|
||||||
|
|
||||||
tokenSecretName := bootstraputil.BootstrapTokenSecretName(tokenID)
|
tokenSecretName := bootstraputil.BootstrapTokenSecretName(tokenID)
|
||||||
glog.V(1).Infoln("[token] deleting token")
|
klog.V(1).Infoln("[token] deleting token")
|
||||||
if err := client.CoreV1().Secrets(metav1.NamespaceSystem).Delete(tokenSecretName, nil); err != nil {
|
if err := client.CoreV1().Secrets(metav1.NamespaceSystem).Delete(tokenSecretName, nil); err != nil {
|
||||||
return errors.Wrap(err, "failed to delete bootstrap token")
|
return errors.Wrap(err, "failed to delete bootstrap token")
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,11 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/discovery/fake:go_default_library",
|
"//staging/src/k8s.io/client-go/discovery/fake:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
"//vendor/github.com/pmezard/go-difflib/difflib:go_default_library",
|
"//vendor/github.com/pmezard/go-difflib/difflib:go_default_library",
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -21,11 +21,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/apimachinery/pkg/util/version"
|
"k8s.io/apimachinery/pkg/util/version"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
@ -83,13 +83,13 @@ func NewCmdApply(apf *applyPlanFlags) *cobra.Command {
|
|||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
// Ensure the user is root
|
// Ensure the user is root
|
||||||
glog.V(1).Infof("running preflight checks")
|
klog.V(1).Infof("running preflight checks")
|
||||||
err = runPreflightChecks(flags.ignorePreflightErrorsSet)
|
err = runPreflightChecks(flags.ignorePreflightErrorsSet)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
// If the version is specified in config file, pick up that value.
|
// If the version is specified in config file, pick up that value.
|
||||||
if flags.cfgPath != "" {
|
if flags.cfgPath != "" {
|
||||||
glog.V(1).Infof("fetching configuration from file %s", flags.cfgPath)
|
klog.V(1).Infof("fetching configuration from file %s", flags.cfgPath)
|
||||||
// Note that cfg isn't preserved here, it's just an one-off to populate flags.newK8sVersionStr based on --config
|
// Note that cfg isn't preserved here, it's just an one-off to populate flags.newK8sVersionStr based on --config
|
||||||
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1beta1.InitConfiguration{})
|
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1beta1.InitConfiguration{})
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
@ -147,8 +147,8 @@ func NewCmdApply(apf *applyPlanFlags) *cobra.Command {
|
|||||||
func RunApply(flags *applyFlags) error {
|
func RunApply(flags *applyFlags) error {
|
||||||
|
|
||||||
// Start with the basics, verify that the cluster is healthy and get the configuration from the cluster (using the ConfigMap)
|
// Start with the basics, verify that the cluster is healthy and get the configuration from the cluster (using the ConfigMap)
|
||||||
glog.V(1).Infof("[upgrade/apply] verifying health of cluster")
|
klog.V(1).Infof("[upgrade/apply] verifying health of cluster")
|
||||||
glog.V(1).Infof("[upgrade/apply] retrieving configuration from cluster")
|
klog.V(1).Infof("[upgrade/apply] retrieving configuration from cluster")
|
||||||
upgradeVars, err := enforceRequirements(flags.applyPlanFlags, flags.dryRun, flags.newK8sVersionStr)
|
upgradeVars, err := enforceRequirements(flags.applyPlanFlags, flags.dryRun, flags.newK8sVersionStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -160,7 +160,7 @@ func RunApply(flags *applyFlags) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate requested and validate actual version
|
// Validate requested and validate actual version
|
||||||
glog.V(1).Infof("[upgrade/apply] validating requested and actual version")
|
klog.V(1).Infof("[upgrade/apply] validating requested and actual version")
|
||||||
if err := configutil.NormalizeKubernetesVersion(&upgradeVars.cfg.ClusterConfiguration); err != nil {
|
if err := configutil.NormalizeKubernetesVersion(&upgradeVars.cfg.ClusterConfiguration); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ func RunApply(flags *applyFlags) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enforce the version skew policies
|
// Enforce the version skew policies
|
||||||
glog.V(1).Infof("[upgrade/version] enforcing version skew policies")
|
klog.V(1).Infof("[upgrade/version] enforcing version skew policies")
|
||||||
if err := EnforceVersionPolicies(flags, upgradeVars.versionGetter); err != nil {
|
if err := EnforceVersionPolicies(flags, upgradeVars.versionGetter); err != nil {
|
||||||
return errors.Wrap(err, "[upgrade/version] FATAL")
|
return errors.Wrap(err, "[upgrade/version] FATAL")
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ func RunApply(flags *applyFlags) error {
|
|||||||
|
|
||||||
// Use a prepuller implementation based on creating DaemonSets
|
// Use a prepuller implementation based on creating DaemonSets
|
||||||
// and block until all DaemonSets are ready; then we know for sure that all control plane images are cached locally
|
// and block until all DaemonSets are ready; then we know for sure that all control plane images are cached locally
|
||||||
glog.V(1).Infof("[upgrade/apply] creating prepuller")
|
klog.V(1).Infof("[upgrade/apply] creating prepuller")
|
||||||
prepuller := upgrade.NewDaemonSetPrepuller(upgradeVars.client, upgradeVars.waiter, &upgradeVars.cfg.ClusterConfiguration)
|
prepuller := upgrade.NewDaemonSetPrepuller(upgradeVars.client, upgradeVars.waiter, &upgradeVars.cfg.ClusterConfiguration)
|
||||||
componentsToPrepull := constants.MasterComponents
|
componentsToPrepull := constants.MasterComponents
|
||||||
if upgradeVars.cfg.Etcd.External != nil {
|
if upgradeVars.cfg.Etcd.External != nil {
|
||||||
@ -203,13 +203,13 @@ func RunApply(flags *applyFlags) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now; perform the upgrade procedure
|
// Now; perform the upgrade procedure
|
||||||
glog.V(1).Infof("[upgrade/apply] performing upgrade")
|
klog.V(1).Infof("[upgrade/apply] performing upgrade")
|
||||||
if err := PerformControlPlaneUpgrade(flags, upgradeVars.client, upgradeVars.waiter, upgradeVars.cfg); err != nil {
|
if err := PerformControlPlaneUpgrade(flags, upgradeVars.client, upgradeVars.waiter, upgradeVars.cfg); err != nil {
|
||||||
return errors.Wrap(err, "[upgrade/apply] FATAL")
|
return errors.Wrap(err, "[upgrade/apply] FATAL")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upgrade RBAC rules and addons.
|
// Upgrade RBAC rules and addons.
|
||||||
glog.V(1).Infof("[upgrade/postupgrade] upgrading RBAC rules and addons")
|
klog.V(1).Infof("[upgrade/postupgrade] upgrading RBAC rules and addons")
|
||||||
if err := upgrade.PerformPostUpgradeTasks(upgradeVars.client, upgradeVars.cfg, flags.newK8sVersion, flags.dryRun); err != nil {
|
if err := upgrade.PerformPostUpgradeTasks(upgradeVars.client, upgradeVars.cfg, flags.newK8sVersion, flags.dryRun); err != nil {
|
||||||
return errors.Wrap(err, "[upgrade/postupgrade] FATAL post-upgrade error")
|
return errors.Wrap(err, "[upgrade/postupgrade] FATAL post-upgrade error")
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,12 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/pmezard/go-difflib/difflib"
|
"github.com/pmezard/go-difflib/difflib"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/version"
|
"k8s.io/apimachinery/pkg/util/version"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
@ -78,7 +78,7 @@ func NewCmdDiff(out io.Writer) *cobra.Command {
|
|||||||
func runDiff(flags *diffFlags, args []string) error {
|
func runDiff(flags *diffFlags, args []string) error {
|
||||||
|
|
||||||
// If the version is specified in config file, pick up that value.
|
// If the version is specified in config file, pick up that value.
|
||||||
glog.V(1).Infof("fetching configuration from file %s", flags.cfgPath)
|
klog.V(1).Infof("fetching configuration from file %s", flags.cfgPath)
|
||||||
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1beta1.InitConfiguration{})
|
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1beta1.InitConfiguration{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -116,7 +116,7 @@ func runDiff(flags *diffFlags, args []string) error {
|
|||||||
case constants.KubeScheduler:
|
case constants.KubeScheduler:
|
||||||
path = flags.schedulerManifestPath
|
path = flags.schedulerManifestPath
|
||||||
default:
|
default:
|
||||||
glog.Errorf("[diff] unknown spec %v", spec)
|
klog.Errorf("[diff] unknown spec %v", spec)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/apimachinery/pkg/util/version"
|
"k8s.io/apimachinery/pkg/util/version"
|
||||||
|
"k8s.io/klog"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -126,7 +126,7 @@ func NewCmdUpgradeControlPlane() *cobra.Command {
|
|||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
if flags.nodeName == "" {
|
if flags.nodeName == "" {
|
||||||
glog.V(1).Infoln("[upgrade] found NodeName empty; considered OS hostname as NodeName")
|
klog.V(1).Infoln("[upgrade] found NodeName empty; considered OS hostname as NodeName")
|
||||||
}
|
}
|
||||||
nodeName, err := node.GetHostname(flags.nodeName)
|
nodeName, err := node.GetHostname(flags.nodeName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -24,10 +24,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"k8s.io/apimachinery/pkg/util/version"
|
"k8s.io/apimachinery/pkg/util/version"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -62,7 +62,7 @@ func NewCmdPlan(apf *applyPlanFlags) *cobra.Command {
|
|||||||
|
|
||||||
// If the version is specified in config file, pick up that value.
|
// If the version is specified in config file, pick up that value.
|
||||||
if flags.cfgPath != "" {
|
if flags.cfgPath != "" {
|
||||||
glog.V(1).Infof("fetching configuration from file %s", flags.cfgPath)
|
klog.V(1).Infof("fetching configuration from file %s", flags.cfgPath)
|
||||||
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1beta1.InitConfiguration{})
|
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(flags.cfgPath, &kubeadmapiv1beta1.InitConfiguration{})
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
@ -88,8 +88,8 @@ func NewCmdPlan(apf *applyPlanFlags) *cobra.Command {
|
|||||||
// RunPlan takes care of outputting available versions to upgrade to for the user
|
// RunPlan takes care of outputting available versions to upgrade to for the user
|
||||||
func RunPlan(flags *planFlags) error {
|
func RunPlan(flags *planFlags) error {
|
||||||
// Start with the basics, verify that the cluster is healthy, build a client and a versionGetter. Never dry-run when planning.
|
// Start with the basics, verify that the cluster is healthy, build a client and a versionGetter. Never dry-run when planning.
|
||||||
glog.V(1).Infof("[upgrade/plan] verifying health of cluster")
|
klog.V(1).Infof("[upgrade/plan] verifying health of cluster")
|
||||||
glog.V(1).Infof("[upgrade/plan] retrieving configuration from cluster")
|
klog.V(1).Infof("[upgrade/plan] retrieving configuration from cluster")
|
||||||
upgradeVars, err := enforceRequirements(flags.applyPlanFlags, false, flags.newK8sVersionStr)
|
upgradeVars, err := enforceRequirements(flags.applyPlanFlags, false, flags.newK8sVersionStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -120,7 +120,7 @@ func RunPlan(flags *planFlags) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compute which upgrade possibilities there are
|
// Compute which upgrade possibilities there are
|
||||||
glog.V(1).Infof("[upgrade/plan] computing upgrade possibilities")
|
klog.V(1).Infof("[upgrade/plan] computing upgrade possibilities")
|
||||||
availUpgrades, err := upgrade.GetAvailableUpgrades(upgradeVars.versionGetter, flags.allowExperimentalUpgrades, flags.allowRCUpgrades, etcdClient, upgradeVars.cfg.FeatureGates, upgradeVars.client)
|
availUpgrades, err := upgrade.GetAvailableUpgrades(upgradeVars.versionGetter, flags.allowExperimentalUpgrades, flags.allowRCUpgrades, etcdClient, upgradeVars.cfg.FeatureGates, upgradeVars.client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "[upgrade/versions] FATAL")
|
return errors.Wrap(err, "[upgrade/versions] FATAL")
|
||||||
|
@ -21,9 +21,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"k8s.io/klog"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
|
|
||||||
apimachineryversion "k8s.io/apimachinery/pkg/version"
|
apimachineryversion "k8s.io/apimachinery/pkg/version"
|
||||||
@ -53,7 +53,7 @@ func NewCmdVersion(out io.Writer) *cobra.Command {
|
|||||||
// RunVersion provides the version information of kubeadm in format depending on arguments
|
// RunVersion provides the version information of kubeadm in format depending on arguments
|
||||||
// specified in cobra.Command.
|
// specified in cobra.Command.
|
||||||
func RunVersion(out io.Writer, cmd *cobra.Command) error {
|
func RunVersion(out io.Writer, cmd *cobra.Command) error {
|
||||||
glog.V(1).Infoln("[version] retrieving version info")
|
klog.V(1).Infoln("[version] retrieving version info")
|
||||||
clientVersion := version.Get()
|
clientVersion := version.Get()
|
||||||
v := Version{
|
v := Version{
|
||||||
ClientVersion: &clientVersion,
|
ClientVersion: &clientVersion,
|
||||||
@ -62,7 +62,7 @@ func RunVersion(out io.Writer, cmd *cobra.Command) error {
|
|||||||
const flag = "output"
|
const flag = "output"
|
||||||
of, err := cmd.Flags().GetString(flag)
|
of, err := cmd.Flags().GetString(flag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("error accessing flag %s for command %s: %v", flag, cmd.Name(), err)
|
klog.Fatalf("error accessing flag %s for command %s: %v", flag, cmd.Name(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch of {
|
switch of {
|
||||||
|
@ -20,8 +20,8 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
_ "github.com/golang/glog"
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
_ "k8s.io/klog"
|
||||||
|
|
||||||
utilflag "k8s.io/apiserver/pkg/util/flag"
|
utilflag "k8s.io/apiserver/pkg/util/flag"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd"
|
||||||
|
@ -34,8 +34,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
||||||
"//staging/src/k8s.io/cluster-bootstrap/token/api:go_default_library",
|
"//staging/src/k8s.io/cluster-bootstrap/token/api:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ package clusterinfo
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
rbac "k8s.io/api/rbac/v1"
|
rbac "k8s.io/api/rbac/v1"
|
||||||
@ -44,7 +44,7 @@ func CreateBootstrapConfigMapIfNotExists(client clientset.Interface, file string
|
|||||||
|
|
||||||
fmt.Printf("[bootstraptoken] creating the %q ConfigMap in the %q namespace\n", bootstrapapi.ConfigMapClusterInfo, metav1.NamespacePublic)
|
fmt.Printf("[bootstraptoken] creating the %q ConfigMap in the %q namespace\n", bootstrapapi.ConfigMapClusterInfo, metav1.NamespacePublic)
|
||||||
|
|
||||||
glog.V(1).Infoln("[bootstraptoken] loading admin kubeconfig")
|
klog.V(1).Infoln("[bootstraptoken] loading admin kubeconfig")
|
||||||
adminConfig, err := clientcmd.LoadFromFile(file)
|
adminConfig, err := clientcmd.LoadFromFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to load admin kubeconfig")
|
return errors.Wrap(err, "failed to load admin kubeconfig")
|
||||||
@ -52,7 +52,7 @@ func CreateBootstrapConfigMapIfNotExists(client clientset.Interface, file string
|
|||||||
|
|
||||||
adminCluster := adminConfig.Contexts[adminConfig.CurrentContext].Cluster
|
adminCluster := adminConfig.Contexts[adminConfig.CurrentContext].Cluster
|
||||||
// Copy the cluster from admin.conf to the bootstrap kubeconfig, contains the CA cert and the server URL
|
// Copy the cluster from admin.conf to the bootstrap kubeconfig, contains the CA cert and the server URL
|
||||||
glog.V(1).Infoln("[bootstraptoken] copying the cluster from admin.conf to the bootstrap kubeconfig")
|
klog.V(1).Infoln("[bootstraptoken] copying the cluster from admin.conf to the bootstrap kubeconfig")
|
||||||
bootstrapConfig := &clientcmdapi.Config{
|
bootstrapConfig := &clientcmdapi.Config{
|
||||||
Clusters: map[string]*clientcmdapi.Cluster{
|
Clusters: map[string]*clientcmdapi.Cluster{
|
||||||
"": adminConfig.Clusters[adminCluster],
|
"": adminConfig.Clusters[adminCluster],
|
||||||
@ -64,7 +64,7 @@ func CreateBootstrapConfigMapIfNotExists(client clientset.Interface, file string
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create or update the ConfigMap in the kube-public namespace
|
// Create or update the ConfigMap in the kube-public namespace
|
||||||
glog.V(1).Infoln("[bootstraptoken] creating/updating ConfigMap in kube-public namespace")
|
klog.V(1).Infoln("[bootstraptoken] creating/updating ConfigMap in kube-public namespace")
|
||||||
return apiclient.CreateOrUpdateConfigMap(client, &v1.ConfigMap{
|
return apiclient.CreateOrUpdateConfigMap(client, &v1.ConfigMap{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: bootstrapapi.ConfigMapClusterInfo,
|
Name: bootstrapapi.ConfigMapClusterInfo,
|
||||||
@ -78,7 +78,7 @@ func CreateBootstrapConfigMapIfNotExists(client clientset.Interface, file string
|
|||||||
|
|
||||||
// CreateClusterInfoRBACRules creates the RBAC rules for exposing the cluster-info ConfigMap in the kube-public namespace to unauthenticated users
|
// CreateClusterInfoRBACRules creates the RBAC rules for exposing the cluster-info ConfigMap in the kube-public namespace to unauthenticated users
|
||||||
func CreateClusterInfoRBACRules(client clientset.Interface) error {
|
func CreateClusterInfoRBACRules(client clientset.Interface) error {
|
||||||
glog.V(1).Infoln("creating the RBAC rules for exposing the cluster-info ConfigMap in the kube-public namespace")
|
klog.V(1).Infoln("creating the RBAC rules for exposing the cluster-info ConfigMap in the kube-public namespace")
|
||||||
err := apiclient.CreateOrUpdateRole(client, &rbac.Role{
|
err := apiclient.CreateOrUpdateRole(client, &rbac.Role{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: BootstrapSignerClusterRoleName,
|
Name: BootstrapSignerClusterRoleName,
|
||||||
|
@ -37,8 +37,8 @@ go_library(
|
|||||||
"//cmd/kubeadm/app/constants:go_default_library",
|
"//cmd/kubeadm/app/constants:go_default_library",
|
||||||
"//cmd/kubeadm/app/util/pkiutil:go_default_library",
|
"//cmd/kubeadm/app/util/pkiutil:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/util/cert:go_default_library",
|
"//staging/src/k8s.io/client-go/util/cert:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
certutil "k8s.io/client-go/util/cert"
|
certutil "k8s.io/client-go/util/cert"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/util/pkiutil"
|
"k8s.io/kubernetes/cmd/kubeadm/app/util/pkiutil"
|
||||||
@ -34,7 +34,7 @@ import (
|
|||||||
// CreatePKIAssets will create and write to disk all PKI assets necessary to establish the control plane.
|
// CreatePKIAssets will create and write to disk all PKI assets necessary to establish the control plane.
|
||||||
// If the PKI assets already exists in the target folder, they are used only if evaluated equal; otherwise an error is returned.
|
// If the PKI assets already exists in the target folder, they are used only if evaluated equal; otherwise an error is returned.
|
||||||
func CreatePKIAssets(cfg *kubeadmapi.InitConfiguration) error {
|
func CreatePKIAssets(cfg *kubeadmapi.InitConfiguration) error {
|
||||||
glog.V(1).Infoln("creating PKI assets")
|
klog.V(1).Infoln("creating PKI assets")
|
||||||
|
|
||||||
// This structure cannot handle multilevel CA hierarchies.
|
// This structure cannot handle multilevel CA hierarchies.
|
||||||
// This isn't a problem right now, but may become one in the future.
|
// This isn't a problem right now, but may become one in the future.
|
||||||
@ -69,7 +69,7 @@ func CreatePKIAssets(cfg *kubeadmapi.InitConfiguration) error {
|
|||||||
// CreateServiceAccountKeyAndPublicKeyFiles create a new public/private key files for signing service account users.
|
// CreateServiceAccountKeyAndPublicKeyFiles create a new public/private key files for signing service account users.
|
||||||
// If the sa public/private key files already exists in the target folder, they are used only if evaluated equals; otherwise an error is returned.
|
// If the sa public/private key files already exists in the target folder, they are used only if evaluated equals; otherwise an error is returned.
|
||||||
func CreateServiceAccountKeyAndPublicKeyFiles(cfg *kubeadmapi.InitConfiguration) error {
|
func CreateServiceAccountKeyAndPublicKeyFiles(cfg *kubeadmapi.InitConfiguration) error {
|
||||||
glog.V(1).Infoln("creating a new public/private key files for signing service account users")
|
klog.V(1).Infoln("creating a new public/private key files for signing service account users")
|
||||||
saSigningKey, err := NewServiceAccountSigningKey()
|
saSigningKey, err := NewServiceAccountSigningKey()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -110,7 +110,7 @@ func CreateCACertAndKeyFiles(certSpec *KubeadmCert, cfg *kubeadmapi.InitConfigur
|
|||||||
if certSpec.CAName != "" {
|
if certSpec.CAName != "" {
|
||||||
return errors.Errorf("this function should only be used for CAs, but cert %s has CA %s", certSpec.Name, certSpec.CAName)
|
return errors.Errorf("this function should only be used for CAs, but cert %s has CA %s", certSpec.Name, certSpec.CAName)
|
||||||
}
|
}
|
||||||
glog.V(1).Infof("creating a new certificate authority for %s", certSpec.Name)
|
klog.V(1).Infof("creating a new certificate authority for %s", certSpec.Name)
|
||||||
|
|
||||||
certConfig, err := certSpec.GetConfig(cfg)
|
certConfig, err := certSpec.GetConfig(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -47,8 +47,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/version"
|
"k8s.io/apimachinery/pkg/util/version"
|
||||||
@ -42,7 +42,7 @@ import (
|
|||||||
|
|
||||||
// CreateInitStaticPodManifestFiles will write all static pod manifest files needed to bring up the control plane.
|
// CreateInitStaticPodManifestFiles will write all static pod manifest files needed to bring up the control plane.
|
||||||
func CreateInitStaticPodManifestFiles(manifestDir string, cfg *kubeadmapi.InitConfiguration) error {
|
func CreateInitStaticPodManifestFiles(manifestDir string, cfg *kubeadmapi.InitConfiguration) error {
|
||||||
glog.V(1).Infoln("[control-plane] creating static Pod files")
|
klog.V(1).Infoln("[control-plane] creating static Pod files")
|
||||||
return CreateStaticPodFiles(manifestDir, cfg, kubeadmconstants.KubeAPIServer, kubeadmconstants.KubeControllerManager, kubeadmconstants.KubeScheduler)
|
return CreateStaticPodFiles(manifestDir, cfg, kubeadmconstants.KubeAPIServer, kubeadmconstants.KubeControllerManager, kubeadmconstants.KubeScheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ func CreateStaticPodFiles(manifestDir string, cfg *kubeadmapi.InitConfiguration,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// gets the StaticPodSpecs, actualized for the current InitConfiguration
|
// gets the StaticPodSpecs, actualized for the current InitConfiguration
|
||||||
glog.V(1).Infoln("[control-plane] getting StaticPodSpecs")
|
klog.V(1).Infoln("[control-plane] getting StaticPodSpecs")
|
||||||
specs := GetStaticPodSpecs(cfg, k8sVersion)
|
specs := GetStaticPodSpecs(cfg, k8sVersion)
|
||||||
|
|
||||||
// creates required static pod specs
|
// creates required static pod specs
|
||||||
@ -113,7 +113,7 @@ func CreateStaticPodFiles(manifestDir string, cfg *kubeadmapi.InitConfiguration,
|
|||||||
return errors.Wrapf(err, "failed to create static pod manifest file for %q", componentName)
|
return errors.Wrapf(err, "failed to create static pod manifest file for %q", componentName)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("[control-plane] wrote static Pod manifest for component %q to %q\n", componentName, kubeadmconstants.GetStaticPodFilepath(componentName, manifestDir))
|
klog.V(1).Infof("[control-plane] wrote static Pod manifest for component %q to %q\n", componentName, kubeadmconstants.GetStaticPodFilepath(componentName, manifestDir))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -31,8 +31,8 @@ go_library(
|
|||||||
"//cmd/kubeadm/app/util/staticpod:go_default_library",
|
"//cmd/kubeadm/app/util/staticpod:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
@ -54,7 +54,7 @@ func CreateLocalEtcdStaticPodManifestFile(manifestDir string, cfg *kubeadmapi.In
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("[etcd] wrote Static Pod manifest for a local etcd instance to %q\n", kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.Etcd, manifestDir))
|
klog.V(1).Infof("[etcd] wrote Static Pod manifest for a local etcd instance to %q\n", kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.Etcd, manifestDir))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ func CheckLocalEtcdClusterStatus(client clientset.Interface, cfg *kubeadmapi.Ini
|
|||||||
fmt.Println("[etcd] Checking Etcd cluster health")
|
fmt.Println("[etcd] Checking Etcd cluster health")
|
||||||
|
|
||||||
// creates an etcd client that connects to all the local/stacked etcd members
|
// creates an etcd client that connects to all the local/stacked etcd members
|
||||||
glog.V(1).Info("creating etcd client that connects to etcd pods")
|
klog.V(1).Info("creating etcd client that connects to etcd pods")
|
||||||
etcdClient, err := etcdutil.NewFromCluster(client, cfg.CertificatesDir)
|
etcdClient, err := etcdutil.NewFromCluster(client, cfg.CertificatesDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -83,7 +83,7 @@ func CheckLocalEtcdClusterStatus(client clientset.Interface, cfg *kubeadmapi.Ini
|
|||||||
// Other members of the etcd cluster will be notified of the joining node in beforehand as well.
|
// Other members of the etcd cluster will be notified of the joining node in beforehand as well.
|
||||||
func CreateStackedEtcdStaticPodManifestFile(client clientset.Interface, manifestDir string, cfg *kubeadmapi.InitConfiguration) error {
|
func CreateStackedEtcdStaticPodManifestFile(client clientset.Interface, manifestDir string, cfg *kubeadmapi.InitConfiguration) error {
|
||||||
// creates an etcd client that connects to all the local/stacked etcd members
|
// creates an etcd client that connects to all the local/stacked etcd members
|
||||||
glog.V(1).Info("creating etcd client that connects to etcd pods")
|
klog.V(1).Info("creating etcd client that connects to etcd pods")
|
||||||
etcdClient, err := etcdutil.NewFromCluster(client, cfg.CertificatesDir)
|
etcdClient, err := etcdutil.NewFromCluster(client, cfg.CertificatesDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -92,15 +92,15 @@ func CreateStackedEtcdStaticPodManifestFile(client clientset.Interface, manifest
|
|||||||
// notifies the other members of the etcd cluster about the joining member
|
// notifies the other members of the etcd cluster about the joining member
|
||||||
etcdPeerAddress := fmt.Sprintf("https://%s:%d", cfg.LocalAPIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort)
|
etcdPeerAddress := fmt.Sprintf("https://%s:%d", cfg.LocalAPIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort)
|
||||||
|
|
||||||
glog.V(1).Infof("Adding etcd member: %s", etcdPeerAddress)
|
klog.V(1).Infof("Adding etcd member: %s", etcdPeerAddress)
|
||||||
initialCluster, err := etcdClient.AddMember(cfg.NodeRegistration.Name, etcdPeerAddress)
|
initialCluster, err := etcdClient.AddMember(cfg.NodeRegistration.Name, etcdPeerAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println("[etcd] Announced new etcd member joining to the existing etcd cluster")
|
fmt.Println("[etcd] Announced new etcd member joining to the existing etcd cluster")
|
||||||
glog.V(1).Infof("Updated etcd member list: %v", initialCluster)
|
klog.V(1).Infof("Updated etcd member list: %v", initialCluster)
|
||||||
|
|
||||||
glog.V(1).Info("Creating local etcd static pod manifest file")
|
klog.V(1).Info("Creating local etcd static pod manifest file")
|
||||||
// gets etcd StaticPodSpec, actualized for the current InitConfiguration and the new list of etcd members
|
// gets etcd StaticPodSpec, actualized for the current InitConfiguration and the new list of etcd members
|
||||||
spec := GetEtcdPodSpec(cfg, initialCluster)
|
spec := GetEtcdPodSpec(cfg, initialCluster)
|
||||||
// writes etcd StaticPod to disk
|
// writes etcd StaticPod to disk
|
||||||
|
@ -22,8 +22,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/util/cert:go_default_library",
|
"//staging/src/k8s.io/client-go/util/cert:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||||
certutil "k8s.io/client-go/util/cert"
|
certutil "k8s.io/client-go/util/cert"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
||||||
@ -61,7 +61,7 @@ type kubeConfigSpec struct {
|
|||||||
// to establish the control plane, including also the admin kubeconfig file.
|
// to establish the control plane, including also the admin kubeconfig file.
|
||||||
// If kubeconfig files already exists, they are used only if evaluated equal; otherwise an error is returned.
|
// If kubeconfig files already exists, they are used only if evaluated equal; otherwise an error is returned.
|
||||||
func CreateInitKubeConfigFiles(outDir string, cfg *kubeadmapi.InitConfiguration) error {
|
func CreateInitKubeConfigFiles(outDir string, cfg *kubeadmapi.InitConfiguration) error {
|
||||||
glog.V(1).Infoln("creating all kubeconfig files")
|
klog.V(1).Infoln("creating all kubeconfig files")
|
||||||
return createKubeConfigFiles(
|
return createKubeConfigFiles(
|
||||||
outDir,
|
outDir,
|
||||||
cfg,
|
cfg,
|
||||||
@ -89,7 +89,7 @@ func CreateJoinControlPlaneKubeConfigFiles(outDir string, cfg *kubeadmapi.InitCo
|
|||||||
// CreateKubeConfigFile creates a kubeconfig file.
|
// CreateKubeConfigFile creates a kubeconfig file.
|
||||||
// If the kubeconfig file already exists, it is used only if evaluated equal; otherwise an error is returned.
|
// If the kubeconfig file already exists, it is used only if evaluated equal; otherwise an error is returned.
|
||||||
func CreateKubeConfigFile(kubeConfigFileName string, outDir string, cfg *kubeadmapi.InitConfiguration) error {
|
func CreateKubeConfigFile(kubeConfigFileName string, outDir string, cfg *kubeadmapi.InitConfiguration) error {
|
||||||
glog.V(1).Infof("creating kubeconfig file for %s", kubeConfigFileName)
|
klog.V(1).Infof("creating kubeconfig file for %s", kubeConfigFileName)
|
||||||
return createKubeConfigFiles(outDir, cfg, kubeConfigFileName)
|
return createKubeConfigFiles(outDir, cfg, kubeConfigFileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -23,8 +23,8 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
||||||
@ -78,7 +78,7 @@ func buildKubeletArgMap(opts kubeletFlagsOpts) map[string]string {
|
|||||||
kubeletFlags["network-plugin"] = "cni"
|
kubeletFlags["network-plugin"] = "cni"
|
||||||
driver, err := kubeadmutil.GetCgroupDriverDocker(opts.execer)
|
driver, err := kubeadmutil.GetCgroupDriverDocker(opts.execer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("cannot automatically assign a '--cgroup-driver' value when starting the Kubelet: %v\n", err)
|
klog.Warningf("cannot automatically assign a '--cgroup-driver' value when starting the Kubelet: %v\n", err)
|
||||||
} else {
|
} else {
|
||||||
kubeletFlags["cgroup-driver"] = driver
|
kubeletFlags["cgroup-driver"] = driver
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ func buildKubeletArgMap(opts kubeletFlagsOpts) map[string]string {
|
|||||||
|
|
||||||
// Make sure the node name we're passed will work with Kubelet
|
// Make sure the node name we're passed will work with Kubelet
|
||||||
if opts.nodeRegOpts.Name != "" && opts.nodeRegOpts.Name != opts.defaultHostname {
|
if opts.nodeRegOpts.Name != "" && opts.nodeRegOpts.Name != opts.defaultHostname {
|
||||||
glog.V(1).Infof("setting kubelet hostname-override to %q", opts.nodeRegOpts.Name)
|
klog.V(1).Infof("setting kubelet hostname-override to %q", opts.nodeRegOpts.Name)
|
||||||
kubeletFlags["hostname-override"] = opts.nodeRegOpts.Name
|
kubeletFlags["hostname-override"] = opts.nodeRegOpts.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
apps "k8s.io/api/apps/v1"
|
apps "k8s.io/api/apps/v1"
|
||||||
@ -57,12 +57,12 @@ const (
|
|||||||
// Otherwise, there is a race condition when we proceed without kubelet having restarted the API server correctly and the next .Create call flakes
|
// Otherwise, there is a race condition when we proceed without kubelet having restarted the API server correctly and the next .Create call flakes
|
||||||
// 9. Do that for the kube-apiserver, kube-controller-manager and kube-scheduler in a loop
|
// 9. Do that for the kube-apiserver, kube-controller-manager and kube-scheduler in a loop
|
||||||
func CreateSelfHostedControlPlane(manifestsDir, kubeConfigDir string, cfg *kubeadmapi.InitConfiguration, client clientset.Interface, waiter apiclient.Waiter, dryRun bool, certsInSecrets bool) error {
|
func CreateSelfHostedControlPlane(manifestsDir, kubeConfigDir string, cfg *kubeadmapi.InitConfiguration, client clientset.Interface, waiter apiclient.Waiter, dryRun bool, certsInSecrets bool) error {
|
||||||
glog.V(1).Infoln("creating self hosted control plane")
|
klog.V(1).Infoln("creating self hosted control plane")
|
||||||
// Adjust the timeout slightly to something self-hosting specific
|
// Adjust the timeout slightly to something self-hosting specific
|
||||||
waiter.SetTimeout(selfHostingWaitTimeout)
|
waiter.SetTimeout(selfHostingWaitTimeout)
|
||||||
|
|
||||||
// Here the map of different mutators to use for the control plane's PodSpec is stored
|
// Here the map of different mutators to use for the control plane's PodSpec is stored
|
||||||
glog.V(1).Infoln("getting mutators")
|
klog.V(1).Infoln("getting mutators")
|
||||||
mutators := GetMutatorsFromFeatureGates(certsInSecrets)
|
mutators := GetMutatorsFromFeatureGates(certsInSecrets)
|
||||||
|
|
||||||
if certsInSecrets {
|
if certsInSecrets {
|
||||||
|
@ -30,8 +30,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||||
"//vendor/github.com/PuerkitoBio/purell:go_default_library",
|
"//vendor/github.com/PuerkitoBio/purell:go_default_library",
|
||||||
"//vendor/github.com/blang/semver:go_default_library",
|
"//vendor/github.com/blang/semver:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -36,8 +36,8 @@ import (
|
|||||||
|
|
||||||
"github.com/PuerkitoBio/purell"
|
"github.com/PuerkitoBio/purell"
|
||||||
"github.com/blang/semver"
|
"github.com/blang/semver"
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
netutil "k8s.io/apimachinery/pkg/util/net"
|
netutil "k8s.io/apimachinery/pkg/util/net"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
@ -102,7 +102,7 @@ func (ContainerRuntimeCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates the container runtime
|
// Check validates the container runtime
|
||||||
func (crc ContainerRuntimeCheck) Check() (warnings, errorList []error) {
|
func (crc ContainerRuntimeCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infoln("validating the container runtime")
|
klog.V(1).Infoln("validating the container runtime")
|
||||||
if err := crc.runtime.IsRunning(); err != nil {
|
if err := crc.runtime.IsRunning(); err != nil {
|
||||||
errorList = append(errorList, err)
|
errorList = append(errorList, err)
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ func (sc ServiceCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates if the service is enabled and active.
|
// Check validates if the service is enabled and active.
|
||||||
func (sc ServiceCheck) Check() (warnings, errorList []error) {
|
func (sc ServiceCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infoln("validating if the service is enabled and active")
|
klog.V(1).Infoln("validating if the service is enabled and active")
|
||||||
initSystem, err := initsystem.GetInitSystem()
|
initSystem, err := initsystem.GetInitSystem()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []error{err}, nil
|
return []error{err}, nil
|
||||||
@ -169,7 +169,7 @@ func (FirewalldCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates if the firewall is enabled and active.
|
// Check validates if the firewall is enabled and active.
|
||||||
func (fc FirewalldCheck) Check() (warnings, errorList []error) {
|
func (fc FirewalldCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infoln("validating if the firewall is enabled and active")
|
klog.V(1).Infoln("validating if the firewall is enabled and active")
|
||||||
initSystem, err := initsystem.GetInitSystem()
|
initSystem, err := initsystem.GetInitSystem()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []error{err}, nil
|
return []error{err}, nil
|
||||||
@ -206,7 +206,7 @@ func (poc PortOpenCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates if the particular port is available.
|
// Check validates if the particular port is available.
|
||||||
func (poc PortOpenCheck) Check() (warnings, errorList []error) {
|
func (poc PortOpenCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infof("validating availability of port %d", poc.port)
|
klog.V(1).Infof("validating availability of port %d", poc.port)
|
||||||
errorList = []error{}
|
errorList = []error{}
|
||||||
ln, err := net.Listen("tcp", fmt.Sprintf(":%d", poc.port))
|
ln, err := net.Listen("tcp", fmt.Sprintf(":%d", poc.port))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -243,7 +243,7 @@ func (dac DirAvailableCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates if a directory does not exist or empty.
|
// Check validates if a directory does not exist or empty.
|
||||||
func (dac DirAvailableCheck) Check() (warnings, errorList []error) {
|
func (dac DirAvailableCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infof("validating the existence and emptiness of directory %s", dac.Path)
|
klog.V(1).Infof("validating the existence and emptiness of directory %s", dac.Path)
|
||||||
errorList = []error{}
|
errorList = []error{}
|
||||||
// If it doesn't exist we are good:
|
// If it doesn't exist we are good:
|
||||||
if _, err := os.Stat(dac.Path); os.IsNotExist(err) {
|
if _, err := os.Stat(dac.Path); os.IsNotExist(err) {
|
||||||
@ -281,7 +281,7 @@ func (fac FileAvailableCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates if the given file does not already exist.
|
// Check validates if the given file does not already exist.
|
||||||
func (fac FileAvailableCheck) Check() (warnings, errorList []error) {
|
func (fac FileAvailableCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infof("validating the existence of file %s", fac.Path)
|
klog.V(1).Infof("validating the existence of file %s", fac.Path)
|
||||||
errorList = []error{}
|
errorList = []error{}
|
||||||
if _, err := os.Stat(fac.Path); err == nil {
|
if _, err := os.Stat(fac.Path); err == nil {
|
||||||
errorList = append(errorList, errors.Errorf("%s already exists", fac.Path))
|
errorList = append(errorList, errors.Errorf("%s already exists", fac.Path))
|
||||||
@ -305,7 +305,7 @@ func (fac FileExistingCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates if the given file already exists.
|
// Check validates if the given file already exists.
|
||||||
func (fac FileExistingCheck) Check() (warnings, errorList []error) {
|
func (fac FileExistingCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infof("validating the existence of file %s", fac.Path)
|
klog.V(1).Infof("validating the existence of file %s", fac.Path)
|
||||||
errorList = []error{}
|
errorList = []error{}
|
||||||
if _, err := os.Stat(fac.Path); err != nil {
|
if _, err := os.Stat(fac.Path); err != nil {
|
||||||
errorList = append(errorList, errors.Errorf("%s doesn't exist", fac.Path))
|
errorList = append(errorList, errors.Errorf("%s doesn't exist", fac.Path))
|
||||||
@ -330,7 +330,7 @@ func (fcc FileContentCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates if the given file contains the given content.
|
// Check validates if the given file contains the given content.
|
||||||
func (fcc FileContentCheck) Check() (warnings, errorList []error) {
|
func (fcc FileContentCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infof("validating the contents of file %s", fcc.Path)
|
klog.V(1).Infof("validating the contents of file %s", fcc.Path)
|
||||||
f, err := os.Open(fcc.Path)
|
f, err := os.Open(fcc.Path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, []error{errors.Errorf("%s does not exist", fcc.Path)}
|
return nil, []error{errors.Errorf("%s does not exist", fcc.Path)}
|
||||||
@ -371,7 +371,7 @@ func (ipc InPathCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates if the given executable is present in the path.
|
// Check validates if the given executable is present in the path.
|
||||||
func (ipc InPathCheck) Check() (warnings, errs []error) {
|
func (ipc InPathCheck) Check() (warnings, errs []error) {
|
||||||
glog.V(1).Infof("validating the presence of executable %s", ipc.executable)
|
klog.V(1).Infof("validating the presence of executable %s", ipc.executable)
|
||||||
_, err := ipc.exec.LookPath(ipc.executable)
|
_, err := ipc.exec.LookPath(ipc.executable)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if ipc.mandatory {
|
if ipc.mandatory {
|
||||||
@ -401,7 +401,7 @@ func (HostnameCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates if hostname match dns sub domain regex.
|
// Check validates if hostname match dns sub domain regex.
|
||||||
func (hc HostnameCheck) Check() (warnings, errorList []error) {
|
func (hc HostnameCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infof("checking whether the given node name is reachable using net.LookupHost")
|
klog.V(1).Infof("checking whether the given node name is reachable using net.LookupHost")
|
||||||
errorList = []error{}
|
errorList = []error{}
|
||||||
warnings = []error{}
|
warnings = []error{}
|
||||||
addr, err := net.LookupHost(hc.nodeName)
|
addr, err := net.LookupHost(hc.nodeName)
|
||||||
@ -428,7 +428,7 @@ func (hst HTTPProxyCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates http connectivity type, direct or via proxy.
|
// Check validates http connectivity type, direct or via proxy.
|
||||||
func (hst HTTPProxyCheck) Check() (warnings, errorList []error) {
|
func (hst HTTPProxyCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infof("validating if the connectivity type is via proxy or direct")
|
klog.V(1).Infof("validating if the connectivity type is via proxy or direct")
|
||||||
u := (&url.URL{Scheme: hst.Proto, Host: hst.Host}).String()
|
u := (&url.URL{Scheme: hst.Proto, Host: hst.Host}).String()
|
||||||
|
|
||||||
req, err := http.NewRequest("GET", u, nil)
|
req, err := http.NewRequest("GET", u, nil)
|
||||||
@ -464,7 +464,7 @@ func (HTTPProxyCIDRCheck) Name() string {
|
|||||||
// Check validates http connectivity to first IP address in the CIDR.
|
// Check validates http connectivity to first IP address in the CIDR.
|
||||||
// If it is not directly connected and goes via proxy it will produce warning.
|
// If it is not directly connected and goes via proxy it will produce warning.
|
||||||
func (subnet HTTPProxyCIDRCheck) Check() (warnings, errorList []error) {
|
func (subnet HTTPProxyCIDRCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infoln("validating http connectivity to first IP address in the CIDR")
|
klog.V(1).Infoln("validating http connectivity to first IP address in the CIDR")
|
||||||
if len(subnet.CIDR) == 0 {
|
if len(subnet.CIDR) == 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -513,7 +513,7 @@ func (SystemVerificationCheck) Name() string {
|
|||||||
|
|
||||||
// Check runs all individual checks
|
// Check runs all individual checks
|
||||||
func (sysver SystemVerificationCheck) Check() (warnings, errorList []error) {
|
func (sysver SystemVerificationCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infoln("running all checks")
|
klog.V(1).Infoln("running all checks")
|
||||||
// Create a buffered writer and choose a quite large value (1M) and suppose the output from the system verification test won't exceed the limit
|
// Create a buffered writer and choose a quite large value (1M) and suppose the output from the system verification test won't exceed the limit
|
||||||
// Run the system verification check, but write to out buffered writer instead of stdout
|
// Run the system verification check, but write to out buffered writer instead of stdout
|
||||||
bufw := bufio.NewWriterSize(os.Stdout, 1*1024*1024)
|
bufw := bufio.NewWriterSize(os.Stdout, 1*1024*1024)
|
||||||
@ -570,7 +570,7 @@ func (KubernetesVersionCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates Kubernetes and kubeadm versions
|
// Check validates Kubernetes and kubeadm versions
|
||||||
func (kubever KubernetesVersionCheck) Check() (warnings, errorList []error) {
|
func (kubever KubernetesVersionCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infoln("validating Kubernetes and kubeadm version")
|
klog.V(1).Infoln("validating Kubernetes and kubeadm version")
|
||||||
// Skip this check for "super-custom builds", where apimachinery/the overall codebase version is not set.
|
// Skip this check for "super-custom builds", where apimachinery/the overall codebase version is not set.
|
||||||
if strings.HasPrefix(kubever.KubeadmVersion, "v0.0.0") {
|
if strings.HasPrefix(kubever.KubeadmVersion, "v0.0.0") {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@ -611,7 +611,7 @@ func (KubeletVersionCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates kubelet version. It should be not less than minimal supported version
|
// Check validates kubelet version. It should be not less than minimal supported version
|
||||||
func (kubever KubeletVersionCheck) Check() (warnings, errorList []error) {
|
func (kubever KubeletVersionCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infoln("validating kubelet version")
|
klog.V(1).Infoln("validating kubelet version")
|
||||||
kubeletVersion, err := GetKubeletVersion(kubever.exec)
|
kubeletVersion, err := GetKubeletVersion(kubever.exec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, []error{errors.Wrap(err, "couldn't get kubelet version")}
|
return nil, []error{errors.Wrap(err, "couldn't get kubelet version")}
|
||||||
@ -642,7 +642,7 @@ func (SwapCheck) Name() string {
|
|||||||
|
|
||||||
// Check validates whether swap is enabled or not
|
// Check validates whether swap is enabled or not
|
||||||
func (swc SwapCheck) Check() (warnings, errorList []error) {
|
func (swc SwapCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infoln("validating whether swap is enabled or not")
|
klog.V(1).Infoln("validating whether swap is enabled or not")
|
||||||
f, err := os.Open("/proc/swaps")
|
f, err := os.Open("/proc/swaps")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// /proc/swaps not available, thus no reasons to warn
|
// /proc/swaps not available, thus no reasons to warn
|
||||||
@ -683,7 +683,7 @@ func (ExternalEtcdVersionCheck) Name() string {
|
|||||||
// Check validates external etcd version
|
// Check validates external etcd version
|
||||||
// TODO: Use the official etcd Golang client for this instead?
|
// TODO: Use the official etcd Golang client for this instead?
|
||||||
func (evc ExternalEtcdVersionCheck) Check() (warnings, errorList []error) {
|
func (evc ExternalEtcdVersionCheck) Check() (warnings, errorList []error) {
|
||||||
glog.V(1).Infoln("validating the external etcd version")
|
klog.V(1).Infoln("validating the external etcd version")
|
||||||
|
|
||||||
// Return quickly if the user isn't using external etcd
|
// Return quickly if the user isn't using external etcd
|
||||||
if evc.Etcd.External.Endpoints == nil {
|
if evc.Etcd.External.Endpoints == nil {
|
||||||
@ -831,13 +831,13 @@ func (ipc ImagePullCheck) Check() (warnings, errorList []error) {
|
|||||||
for _, image := range ipc.imageList {
|
for _, image := range ipc.imageList {
|
||||||
ret, err := ipc.runtime.ImageExists(image)
|
ret, err := ipc.runtime.ImageExists(image)
|
||||||
if ret && err == nil {
|
if ret && err == nil {
|
||||||
glog.V(1).Infof("image exists: %s", image)
|
klog.V(1).Infof("image exists: %s", image)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorList = append(errorList, errors.Wrapf(err, "failed to check if image %s exists", image))
|
errorList = append(errorList, errors.Wrapf(err, "failed to check if image %s exists", image))
|
||||||
}
|
}
|
||||||
glog.V(1).Infof("pulling %s", image)
|
klog.V(1).Infof("pulling %s", image)
|
||||||
if err := ipc.runtime.PullImage(image); err != nil {
|
if err := ipc.runtime.PullImage(image); err != nil {
|
||||||
errorList = append(errorList, errors.Wrapf(err, "failed to pull image %s", image))
|
errorList = append(errorList, errors.Wrapf(err, "failed to pull image %s", image))
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/yaml:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/yaml:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||||
"//vendor/sigs.k8s.io/yaml:go_default_library",
|
"//vendor/sigs.k8s.io/yaml:go_default_library",
|
||||||
],
|
],
|
||||||
|
@ -35,8 +35,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/util/cert:go_default_library",
|
"//staging/src/k8s.io/client-go/util/cert:go_default_library",
|
||||||
"//staging/src/k8s.io/cluster-bootstrap/token/util:go_default_library",
|
"//staging/src/k8s.io/cluster-bootstrap/token/util:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
netutil "k8s.io/apimachinery/pkg/util/net"
|
netutil "k8s.io/apimachinery/pkg/util/net"
|
||||||
@ -103,7 +103,7 @@ func DetectUnsupportedVersion(b []byte) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if mutuallyExclusiveCount > 1 {
|
if mutuallyExclusiveCount > 1 {
|
||||||
glog.Warningf("WARNING: Detected resource kinds that may not apply: %v", mutuallyExclusive)
|
klog.Warningf("WARNING: Detected resource kinds that may not apply: %v", mutuallyExclusive)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -141,7 +141,7 @@ func LowercaseSANs(sans []string) {
|
|||||||
for i, san := range sans {
|
for i, san := range sans {
|
||||||
lowercase := strings.ToLower(san)
|
lowercase := strings.ToLower(san)
|
||||||
if lowercase != san {
|
if lowercase != san {
|
||||||
glog.V(1).Infof("lowercasing SAN %q to %q", san, lowercase)
|
klog.V(1).Infof("lowercasing SAN %q to %q", san, lowercase)
|
||||||
sans[i] = lowercase
|
sans[i] = lowercase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ func ChooseAPIServerBindAddress(bindAddress net.IP) (net.IP, error) {
|
|||||||
ip, err := netutil.ChooseBindAddress(bindAddress)
|
ip, err := netutil.ChooseBindAddress(bindAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if netutil.IsNoRoutesError(err) {
|
if netutil.IsNoRoutesError(err) {
|
||||||
glog.Warningf("WARNING: could not obtain a bind address for the API Server: %v; using: %s", err, constants.DefaultAPIServerBindAddress)
|
klog.Warningf("WARNING: could not obtain a bind address for the API Server: %v; using: %s", err, constants.DefaultAPIServerBindAddress)
|
||||||
defaultIP := net.ParseIP(constants.DefaultAPIServerBindAddress)
|
defaultIP := net.ParseIP(constants.DefaultAPIServerBindAddress)
|
||||||
if defaultIP == nil {
|
if defaultIP == nil {
|
||||||
return nil, errors.Errorf("cannot parse default IP address: %s", constants.DefaultAPIServerBindAddress)
|
return nil, errors.Errorf("cannot parse default IP address: %s", constants.DefaultAPIServerBindAddress)
|
||||||
|
@ -25,8 +25,8 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
@ -165,7 +165,7 @@ func ConfigFileAndDefaultsToInternalConfig(cfgPath string, defaultversionedcfg *
|
|||||||
if cfgPath != "" {
|
if cfgPath != "" {
|
||||||
// Loads configuration from config file, if provided
|
// Loads configuration from config file, if provided
|
||||||
// Nb. --config overrides command line flags
|
// Nb. --config overrides command line flags
|
||||||
glog.V(1).Infoln("loading configuration from the given file")
|
klog.V(1).Infoln("loading configuration from the given file")
|
||||||
|
|
||||||
b, err := ioutil.ReadFile(cfgPath)
|
b, err := ioutil.ReadFile(cfgPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -19,8 +19,8 @@ package config
|
|||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
@ -56,7 +56,7 @@ func JoinConfigFileAndDefaultsToInternalConfig(cfgPath string, defaultversionedc
|
|||||||
if cfgPath != "" {
|
if cfgPath != "" {
|
||||||
// Loads configuration from config file, if provided
|
// Loads configuration from config file, if provided
|
||||||
// Nb. --config overrides command line flags, TODO: fix this
|
// Nb. --config overrides command line flags, TODO: fix this
|
||||||
glog.V(1).Infoln("loading configuration from the given file")
|
klog.V(1).Infoln("loading configuration from the given file")
|
||||||
|
|
||||||
b, err := ioutil.ReadFile(cfgPath)
|
b, err := ioutil.ReadFile(cfgPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -13,8 +13,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//vendor/github.com/coreos/etcd/clientv3:go_default_library",
|
"//vendor/github.com/coreos/etcd/clientv3:go_default_library",
|
||||||
"//vendor/github.com/coreos/etcd/pkg/transport:go_default_library",
|
"//vendor/github.com/coreos/etcd/pkg/transport:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ import (
|
|||||||
|
|
||||||
"github.com/coreos/etcd/clientv3"
|
"github.com/coreos/etcd/clientv3"
|
||||||
"github.com/coreos/etcd/pkg/transport"
|
"github.com/coreos/etcd/pkg/transport"
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/klog"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/util/config"
|
"k8s.io/kubernetes/cmd/kubeadm/app/util/config"
|
||||||
@ -145,7 +145,7 @@ func NewFromCluster(client clientset.Interface, certificatesDir string) (*Client
|
|||||||
for _, e := range clusterStatus.APIEndpoints {
|
for _, e := range clusterStatus.APIEndpoints {
|
||||||
endpoints = append(endpoints, fmt.Sprintf("https://%s:%d", e.AdvertiseAddress, constants.EtcdListenClientPort))
|
endpoints = append(endpoints, fmt.Sprintf("https://%s:%d", e.AdvertiseAddress, constants.EtcdListenClientPort))
|
||||||
}
|
}
|
||||||
glog.V(1).Infof("etcd endpoints read from pods: %s", strings.Join(endpoints, ","))
|
klog.V(1).Infof("etcd endpoints read from pods: %s", strings.Join(endpoints, ","))
|
||||||
|
|
||||||
// Creates an etcd client
|
// Creates an etcd client
|
||||||
etcdClient, err := New(
|
etcdClient, err := New(
|
||||||
@ -185,7 +185,7 @@ func (c Client) Sync() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
glog.V(1).Infof("etcd endpoints read from etcd: %s", strings.Join(cli.Endpoints(), ","))
|
klog.V(1).Infof("etcd endpoints read from etcd: %s", strings.Join(cli.Endpoints(), ","))
|
||||||
|
|
||||||
c.Endpoints = cli.Endpoints()
|
c.Endpoints = cli.Endpoints()
|
||||||
return nil
|
return nil
|
||||||
|
@ -27,8 +27,8 @@ go_library(
|
|||||||
"//vendor/github.com/blang/semver:go_default_library",
|
"//vendor/github.com/blang/semver:go_default_library",
|
||||||
"//vendor/github.com/docker/docker/api/types:go_default_library",
|
"//vendor/github.com/docker/docker/api/types:go_default_library",
|
||||||
"//vendor/github.com/docker/docker/client:go_default_library",
|
"//vendor/github.com/docker/docker/client:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/pkg/errors:go_default_library",
|
"//vendor/github.com/pkg/errors:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
pkgerrors "github.com/pkg/errors"
|
pkgerrors "github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/errors"
|
"k8s.io/apimachinery/pkg/util/errors"
|
||||||
)
|
)
|
||||||
@ -254,7 +254,7 @@ func (k *KernelValidator) parseKernelConfig(r io.Reader) (map[string]kConfigOpti
|
|||||||
}
|
}
|
||||||
fields := strings.Split(line, "=")
|
fields := strings.Split(line, "=")
|
||||||
if len(fields) != 2 {
|
if len(fields) != 2 {
|
||||||
glog.Errorf("Unexpected fields number in config %q", line)
|
klog.Errorf("Unexpected fields number in config %q", line)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
config[fields[0]] = kConfigOption(fields[1])
|
config[fields[0]] = kConfigOption(fields[1])
|
||||||
|
@ -25,8 +25,8 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/errors"
|
"k8s.io/apimachinery/pkg/util/errors"
|
||||||
|
|
||||||
"github.com/blang/semver"
|
"github.com/blang/semver"
|
||||||
"github.com/golang/glog"
|
|
||||||
pkgerrors "github.com/pkg/errors"
|
pkgerrors "github.com/pkg/errors"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// semVerDotsCount is the number of dots in a valid semantic version.
|
// semVerDotsCount is the number of dots in a valid semantic version.
|
||||||
@ -127,7 +127,7 @@ func (self *packageValidator) validate(packageSpecs []PackageSpec, manager packa
|
|||||||
// Get the version of the package on the running machine.
|
// Get the version of the package on the running machine.
|
||||||
version, err := manager.getPackageVersion(packageName)
|
version, err := manager.getPackageVersion(packageName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(1).Infof("Failed to get the version for the package %q: %s\n", packageName, err)
|
klog.V(1).Infof("Failed to get the version for the package %q: %s\n", packageName, err)
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
self.reporter.Report(nameWithVerRange, "not installed", bad)
|
self.reporter.Report(nameWithVerRange, "not installed", bad)
|
||||||
continue
|
continue
|
||||||
@ -145,7 +145,7 @@ func (self *packageValidator) validate(packageSpecs []PackageSpec, manager packa
|
|||||||
// the version is in the range.
|
// the version is in the range.
|
||||||
sv, err := semver.Make(toSemVer(version))
|
sv, err := semver.Make(toSemVer(version))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to convert %q to semantic version: %s\n", version, err)
|
klog.Errorf("Failed to convert %q to semantic version: %s\n", version, err)
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
self.reporter.Report(nameWithVerRange, "internal error", bad)
|
self.reporter.Report(nameWithVerRange, "internal error", bad)
|
||||||
continue
|
continue
|
||||||
|
@ -25,10 +25,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
pkgerrors "github.com/pkg/errors"
|
pkgerrors "github.com/pkg/errors"
|
||||||
netutil "k8s.io/apimachinery/pkg/util/net"
|
netutil "k8s.io/apimachinery/pkg/util/net"
|
||||||
versionutil "k8s.io/apimachinery/pkg/util/version"
|
versionutil "k8s.io/apimachinery/pkg/util/version"
|
||||||
|
"k8s.io/klog"
|
||||||
pkgversion "k8s.io/kubernetes/pkg/version"
|
pkgversion "k8s.io/kubernetes/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -91,8 +91,8 @@ func KubernetesReleaseVersion(version string) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
// Handle air-gapped environments by falling back to the client version.
|
// Handle air-gapped environments by falling back to the client version.
|
||||||
glog.Infof("could not fetch a Kubernetes version from the internet: %v", err)
|
klog.Infof("could not fetch a Kubernetes version from the internet: %v", err)
|
||||||
glog.Infof("falling back to the local client version: %s", clientVersion)
|
klog.Infof("falling back to the local client version: %s", clientVersion)
|
||||||
return KubernetesReleaseVersion(clientVersion)
|
return KubernetesReleaseVersion(clientVersion)
|
||||||
}
|
}
|
||||||
// both the client and the remote version are obtained; validate them and pick a stable version
|
// both the client and the remote version are obtained; validate them and pick a stable version
|
||||||
@ -160,7 +160,7 @@ func splitVersion(version string) (string, string, error) {
|
|||||||
|
|
||||||
// Internal helper: return content of URL
|
// Internal helper: return content of URL
|
||||||
func fetchFromURL(url string, timeout time.Duration) (string, error) {
|
func fetchFromURL(url string, timeout time.Duration) (string, error) {
|
||||||
glog.V(2).Infof("fetching Kubernetes version from URL: %s", url)
|
klog.V(2).Infof("fetching Kubernetes version from URL: %s", url)
|
||||||
client := &http.Client{Timeout: timeout, Transport: netutil.SetOldTransportDefaults(&http.Transport{})}
|
client := &http.Client{Timeout: timeout, Transport: netutil.SetOldTransportDefaults(&http.Transport{})}
|
||||||
resp, err := client.Get(url)
|
resp, err := client.Get(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -217,7 +217,7 @@ func kubeadmVersion(info string) (string, error) {
|
|||||||
// the same Patch level release.
|
// the same Patch level release.
|
||||||
func validateStableVersion(remoteVersion, clientVersion string) (string, error) {
|
func validateStableVersion(remoteVersion, clientVersion string) (string, error) {
|
||||||
if clientVersion == "" {
|
if clientVersion == "" {
|
||||||
glog.Infof("could not obtain client version; using remote version: %s", remoteVersion)
|
klog.Infof("could not obtain client version; using remote version: %s", remoteVersion)
|
||||||
return remoteVersion, nil
|
return remoteVersion, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ func validateStableVersion(remoteVersion, clientVersion string) (string, error)
|
|||||||
if verClient.Major() < verRemote.Major() ||
|
if verClient.Major() < verRemote.Major() ||
|
||||||
(verClient.Major() == verRemote.Major()) && verClient.Minor() < verRemote.Minor() {
|
(verClient.Major() == verRemote.Major()) && verClient.Minor() < verRemote.Minor() {
|
||||||
estimatedRelease := fmt.Sprintf("stable-%d.%d", verClient.Major(), verClient.Minor())
|
estimatedRelease := fmt.Sprintf("stable-%d.%d", verClient.Major(), verClient.Minor())
|
||||||
glog.Infof("remote version is much newer: %s; falling back to: %s", remoteVersion, estimatedRelease)
|
klog.Infof("remote version is much newer: %s; falling back to: %s", remoteVersion, estimatedRelease)
|
||||||
return estimatedRelease, nil
|
return estimatedRelease, nil
|
||||||
}
|
}
|
||||||
return remoteVersion, nil
|
return remoteVersion, nil
|
||||||
|
@ -20,10 +20,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"k8s.io/klog"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app"
|
"k8s.io/kubernetes/cmd/kubeadm/app"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
klog.InitFlags(nil)
|
||||||
if err := app.Run(); err != nil {
|
if err := app.Run(); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -123,9 +123,9 @@ go_library(
|
|||||||
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned:go_default_library",
|
||||||
"//staging/src/k8s.io/kubelet/config/v1beta1:go_default_library",
|
"//staging/src/k8s.io/kubelet/config/v1beta1:go_default_library",
|
||||||
"//vendor/github.com/coreos/go-systemd/daemon:go_default_library",
|
"//vendor/github.com/coreos/go-systemd/daemon:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec:go_default_library",
|
"//vendor/k8s.io/utils/exec:go_default_library",
|
||||||
] + select({
|
] + select({
|
||||||
"@io_bazel_rules_go//go/platform:linux": [
|
"@io_bazel_rules_go//go/platform:linux": [
|
||||||
|
@ -37,8 +37,8 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/util/logs:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/util/logs:go_default_library",
|
||||||
"//staging/src/k8s.io/kubelet/config/v1beta1:go_default_library",
|
"//staging/src/k8s.io/kubelet/config/v1beta1:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
] + select({
|
] + select({
|
||||||
"@io_bazel_rules_go//go/platform:linux": [
|
"@io_bazel_rules_go//go/platform:linux": [
|
||||||
"//vendor/github.com/google/cadvisor/container/common:go_default_library",
|
"//vendor/github.com/google/cadvisor/container/common:go_default_library",
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/version/verflag"
|
"k8s.io/kubernetes/pkg/version/verflag"
|
||||||
|
|
||||||
// ensure libs have a chance to globally register their flags
|
// ensure libs have a chance to globally register their flags
|
||||||
_ "github.com/golang/glog"
|
_ "k8s.io/klog"
|
||||||
_ "k8s.io/kubernetes/pkg/credentialprovider/azure"
|
_ "k8s.io/kubernetes/pkg/credentialprovider/azure"
|
||||||
_ "k8s.io/kubernetes/pkg/credentialprovider/gcp"
|
_ "k8s.io/kubernetes/pkg/credentialprovider/gcp"
|
||||||
)
|
)
|
||||||
@ -91,7 +91,7 @@ func addCredentialProviderFlags(fs *pflag.FlagSet) {
|
|||||||
fs.AddFlagSet(local)
|
fs.AddFlagSet(local)
|
||||||
}
|
}
|
||||||
|
|
||||||
// addGlogFlags adds flags from github.com/golang/glog
|
// addGlogFlags adds flags from k8s.io/klog
|
||||||
func addGlogFlags(fs *pflag.FlagSet) {
|
func addGlogFlags(fs *pflag.FlagSet) {
|
||||||
// lookup flags in global flag set and re-register the values with our flagset
|
// lookup flags in global flag set and re-register the values with our flagset
|
||||||
global := flag.CommandLine
|
global := flag.CommandLine
|
||||||
|
@ -34,9 +34,9 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/go-systemd/daemon"
|
"github.com/coreos/go-systemd/daemon"
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
@ -111,7 +111,7 @@ func NewKubeletCommand(stopCh <-chan struct{}) *cobra.Command {
|
|||||||
kubeletConfig, err := options.NewKubeletConfiguration()
|
kubeletConfig, err := options.NewKubeletConfiguration()
|
||||||
// programmer error
|
// programmer error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
@ -144,20 +144,20 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
|
|||||||
// initial flag parse, since we disable cobra's flag parsing
|
// initial flag parse, since we disable cobra's flag parsing
|
||||||
if err := cleanFlagSet.Parse(args); err != nil {
|
if err := cleanFlagSet.Parse(args); err != nil {
|
||||||
cmd.Usage()
|
cmd.Usage()
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if there are non-flag arguments in the command line
|
// check if there are non-flag arguments in the command line
|
||||||
cmds := cleanFlagSet.Args()
|
cmds := cleanFlagSet.Args()
|
||||||
if len(cmds) > 0 {
|
if len(cmds) > 0 {
|
||||||
cmd.Usage()
|
cmd.Usage()
|
||||||
glog.Fatalf("unknown command: %s", cmds[0])
|
klog.Fatalf("unknown command: %s", cmds[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
// short-circuit on help
|
// short-circuit on help
|
||||||
help, err := cleanFlagSet.GetBool("help")
|
help, err := cleanFlagSet.GetBool("help")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatal(`"help" flag is non-bool, programmer error, please correct`)
|
klog.Fatal(`"help" flag is non-bool, programmer error, please correct`)
|
||||||
}
|
}
|
||||||
if help {
|
if help {
|
||||||
cmd.Help()
|
cmd.Help()
|
||||||
@ -170,40 +170,40 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
|
|||||||
|
|
||||||
// set feature gates from initial flags-based config
|
// set feature gates from initial flags-based config
|
||||||
if err := utilfeature.DefaultFeatureGate.SetFromMap(kubeletConfig.FeatureGates); err != nil {
|
if err := utilfeature.DefaultFeatureGate.SetFromMap(kubeletConfig.FeatureGates); err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate the initial KubeletFlags
|
// validate the initial KubeletFlags
|
||||||
if err := options.ValidateKubeletFlags(kubeletFlags); err != nil {
|
if err := options.ValidateKubeletFlags(kubeletFlags); err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if kubeletFlags.ContainerRuntime == "remote" && cleanFlagSet.Changed("pod-infra-container-image") {
|
if kubeletFlags.ContainerRuntime == "remote" && cleanFlagSet.Changed("pod-infra-container-image") {
|
||||||
glog.Warning("Warning: For remote container runtime, --pod-infra-container-image is ignored in kubelet, which should be set in that remote runtime instead")
|
klog.Warning("Warning: For remote container runtime, --pod-infra-container-image is ignored in kubelet, which should be set in that remote runtime instead")
|
||||||
}
|
}
|
||||||
|
|
||||||
// load kubelet config file, if provided
|
// load kubelet config file, if provided
|
||||||
if configFile := kubeletFlags.KubeletConfigFile; len(configFile) > 0 {
|
if configFile := kubeletFlags.KubeletConfigFile; len(configFile) > 0 {
|
||||||
kubeletConfig, err = loadConfigFile(configFile)
|
kubeletConfig, err = loadConfigFile(configFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
// We must enforce flag precedence by re-parsing the command line into the new object.
|
// We must enforce flag precedence by re-parsing the command line into the new object.
|
||||||
// This is necessary to preserve backwards-compatibility across binary upgrades.
|
// This is necessary to preserve backwards-compatibility across binary upgrades.
|
||||||
// See issue #56171 for more details.
|
// See issue #56171 for more details.
|
||||||
if err := kubeletConfigFlagPrecedence(kubeletConfig, args); err != nil {
|
if err := kubeletConfigFlagPrecedence(kubeletConfig, args); err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
// update feature gates based on new config
|
// update feature gates based on new config
|
||||||
if err := utilfeature.DefaultFeatureGate.SetFromMap(kubeletConfig.FeatureGates); err != nil {
|
if err := utilfeature.DefaultFeatureGate.SetFromMap(kubeletConfig.FeatureGates); err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We always validate the local configuration (command line + config file).
|
// We always validate the local configuration (command line + config file).
|
||||||
// This is the default "last-known-good" config for dynamic config, and must always remain valid.
|
// This is the default "last-known-good" config for dynamic config, and must always remain valid.
|
||||||
if err := kubeletconfigvalidation.ValidateKubeletConfiguration(kubeletConfig); err != nil {
|
if err := kubeletconfigvalidation.ValidateKubeletConfiguration(kubeletConfig); err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// use dynamic kubelet config, if enabled
|
// use dynamic kubelet config, if enabled
|
||||||
@ -219,7 +219,7 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
|
|||||||
return kubeletConfigFlagPrecedence(kc, args)
|
return kubeletConfigFlagPrecedence(kc, args)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
// If we should just use our existing, local config, the controller will return a nil config
|
// If we should just use our existing, local config, the controller will return a nil config
|
||||||
if dynamicKubeletConfig != nil {
|
if dynamicKubeletConfig != nil {
|
||||||
@ -227,7 +227,7 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
|
|||||||
// Note: flag precedence was already enforced in the controller, prior to validation,
|
// Note: flag precedence was already enforced in the controller, prior to validation,
|
||||||
// by our above transform function. Now we simply update feature gates from the new config.
|
// by our above transform function. Now we simply update feature gates from the new config.
|
||||||
if err := utilfeature.DefaultFeatureGate.SetFromMap(kubeletConfig.FeatureGates); err != nil {
|
if err := utilfeature.DefaultFeatureGate.SetFromMap(kubeletConfig.FeatureGates); err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
|
|||||||
// use kubeletServer to construct the default KubeletDeps
|
// use kubeletServer to construct the default KubeletDeps
|
||||||
kubeletDeps, err := UnsecuredDependencies(kubeletServer)
|
kubeletDeps, err := UnsecuredDependencies(kubeletServer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the kubelet config controller to kubeletDeps
|
// add the kubelet config controller to kubeletDeps
|
||||||
@ -250,15 +250,15 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
|
|||||||
// start the experimental docker shim, if enabled
|
// start the experimental docker shim, if enabled
|
||||||
if kubeletServer.KubeletFlags.ExperimentalDockershim {
|
if kubeletServer.KubeletFlags.ExperimentalDockershim {
|
||||||
if err := RunDockershim(&kubeletServer.KubeletFlags, kubeletConfig, stopCh); err != nil {
|
if err := RunDockershim(&kubeletServer.KubeletFlags, kubeletConfig, stopCh); err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// run the kubelet
|
// run the kubelet
|
||||||
glog.V(5).Infof("KubeletConfiguration: %#v", kubeletServer.KubeletConfiguration)
|
klog.V(5).Infof("KubeletConfiguration: %#v", kubeletServer.KubeletConfiguration)
|
||||||
if err := Run(kubeletServer, kubeletDeps, stopCh); err != nil {
|
if err := Run(kubeletServer, kubeletDeps, stopCh); err != nil {
|
||||||
glog.Fatal(err)
|
klog.Fatal(err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -361,7 +361,7 @@ func UnsecuredDependencies(s *options.KubeletServer) (*kubelet.Dependencies, err
|
|||||||
mounter := mount.New(s.ExperimentalMounterPath)
|
mounter := mount.New(s.ExperimentalMounterPath)
|
||||||
var pluginRunner = exec.New()
|
var pluginRunner = exec.New()
|
||||||
if s.Containerized {
|
if s.Containerized {
|
||||||
glog.V(2).Info("Running kubelet in containerized mode")
|
klog.V(2).Info("Running kubelet in containerized mode")
|
||||||
ne, err := nsenter.NewNsenter(nsenter.DefaultHostRootFsPath, exec.New())
|
ne, err := nsenter.NewNsenter(nsenter.DefaultHostRootFsPath, exec.New())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -404,7 +404,7 @@ func UnsecuredDependencies(s *options.KubeletServer) (*kubelet.Dependencies, err
|
|||||||
// not be generated.
|
// not be generated.
|
||||||
func Run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan struct{}) error {
|
func Run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan struct{}) error {
|
||||||
// To help debugging, immediately log version
|
// To help debugging, immediately log version
|
||||||
glog.Infof("Version: %+v", version.Get())
|
klog.Infof("Version: %+v", version.Get())
|
||||||
if err := initForOS(s.KubeletFlags.WindowsService); err != nil {
|
if err := initForOS(s.KubeletFlags.WindowsService); err != nil {
|
||||||
return fmt.Errorf("failed OS init: %v", err)
|
return fmt.Errorf("failed OS init: %v", err)
|
||||||
}
|
}
|
||||||
@ -439,11 +439,11 @@ func setConfigz(cz *configz.Config, kc *kubeletconfiginternal.KubeletConfigurati
|
|||||||
func initConfigz(kc *kubeletconfiginternal.KubeletConfiguration) error {
|
func initConfigz(kc *kubeletconfiginternal.KubeletConfiguration) error {
|
||||||
cz, err := configz.New("kubeletconfig")
|
cz, err := configz.New("kubeletconfig")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("unable to register configz: %s", err)
|
klog.Errorf("unable to register configz: %s", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := setConfigz(cz, kc); err != nil {
|
if err := setConfigz(cz, kc); err != nil {
|
||||||
glog.Errorf("unable to register config: %s", err)
|
klog.Errorf("unable to register config: %s", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -456,12 +456,12 @@ func makeEventRecorder(kubeDeps *kubelet.Dependencies, nodeName types.NodeName)
|
|||||||
}
|
}
|
||||||
eventBroadcaster := record.NewBroadcaster()
|
eventBroadcaster := record.NewBroadcaster()
|
||||||
kubeDeps.Recorder = eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: componentKubelet, Host: string(nodeName)})
|
kubeDeps.Recorder = eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: componentKubelet, Host: string(nodeName)})
|
||||||
eventBroadcaster.StartLogging(glog.V(3).Infof)
|
eventBroadcaster.StartLogging(klog.V(3).Infof)
|
||||||
if kubeDeps.EventClient != nil {
|
if kubeDeps.EventClient != nil {
|
||||||
glog.V(4).Infof("Sending events to api server.")
|
klog.V(4).Infof("Sending events to api server.")
|
||||||
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeDeps.EventClient.Events("")})
|
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeDeps.EventClient.Events("")})
|
||||||
} else {
|
} else {
|
||||||
glog.Warning("No api server defined - no events will be sent to API server.")
|
klog.Warning("No api server defined - no events will be sent to API server.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,12 +482,12 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
}
|
}
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
if s.LockFilePath != "" {
|
if s.LockFilePath != "" {
|
||||||
glog.Infof("acquiring file lock on %q", s.LockFilePath)
|
klog.Infof("acquiring file lock on %q", s.LockFilePath)
|
||||||
if err := flock.Acquire(s.LockFilePath); err != nil {
|
if err := flock.Acquire(s.LockFilePath); err != nil {
|
||||||
return fmt.Errorf("unable to acquire file lock on %q: %v", s.LockFilePath, err)
|
return fmt.Errorf("unable to acquire file lock on %q: %v", s.LockFilePath, err)
|
||||||
}
|
}
|
||||||
if s.ExitOnLockContention {
|
if s.ExitOnLockContention {
|
||||||
glog.Infof("watching for inotify events for: %v", s.LockFilePath)
|
klog.Infof("watching for inotify events for: %v", s.LockFilePath)
|
||||||
if err := watchForLockfileContention(s.LockFilePath, done); err != nil {
|
if err := watchForLockfileContention(s.LockFilePath, done); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -497,7 +497,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
// Register current configuration with /configz endpoint
|
// Register current configuration with /configz endpoint
|
||||||
err = initConfigz(&s.KubeletConfiguration)
|
err = initConfigz(&s.KubeletConfiguration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("unable to register KubeletConfiguration with configz, error: %v", err)
|
klog.Errorf("unable to register KubeletConfiguration with configz, error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// About to get clients and such, detect standaloneMode
|
// About to get clients and such, detect standaloneMode
|
||||||
@ -520,9 +520,9 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if cloud == nil {
|
if cloud == nil {
|
||||||
glog.V(2).Infof("No cloud provider specified: %q from the config file: %q\n", s.CloudProvider, s.CloudConfigFile)
|
klog.V(2).Infof("No cloud provider specified: %q from the config file: %q\n", s.CloudProvider, s.CloudConfigFile)
|
||||||
} else {
|
} else {
|
||||||
glog.V(2).Infof("Successfully initialized cloud provider: %q from the config file: %q\n", s.CloudProvider, s.CloudConfigFile)
|
klog.V(2).Infof("Successfully initialized cloud provider: %q from the config file: %q\n", s.CloudProvider, s.CloudConfigFile)
|
||||||
}
|
}
|
||||||
kubeDeps.Cloud = cloud
|
kubeDeps.Cloud = cloud
|
||||||
}
|
}
|
||||||
@ -549,7 +549,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
kubeDeps.DynamicKubeClient = nil
|
kubeDeps.DynamicKubeClient = nil
|
||||||
kubeDeps.EventClient = nil
|
kubeDeps.EventClient = nil
|
||||||
kubeDeps.HeartbeatClient = nil
|
kubeDeps.HeartbeatClient = nil
|
||||||
glog.Warningf("standalone mode, no API client")
|
klog.Warningf("standalone mode, no API client")
|
||||||
} else if kubeDeps.KubeClient == nil || kubeDeps.EventClient == nil || kubeDeps.HeartbeatClient == nil || kubeDeps.DynamicKubeClient == nil {
|
} else if kubeDeps.KubeClient == nil || kubeDeps.EventClient == nil || kubeDeps.HeartbeatClient == nil || kubeDeps.DynamicKubeClient == nil {
|
||||||
// initialize clients if not standalone mode and any of the clients are not provided
|
// initialize clients if not standalone mode and any of the clients are not provided
|
||||||
var kubeClient clientset.Interface
|
var kubeClient clientset.Interface
|
||||||
@ -579,15 +579,15 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
|
|
||||||
kubeClient, err = clientset.NewForConfig(clientConfig)
|
kubeClient, err = clientset.NewForConfig(clientConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("New kubeClient from clientConfig error: %v", err)
|
klog.Warningf("New kubeClient from clientConfig error: %v", err)
|
||||||
} else if kubeClient.CertificatesV1beta1() != nil && clientCertificateManager != nil {
|
} else if kubeClient.CertificatesV1beta1() != nil && clientCertificateManager != nil {
|
||||||
glog.V(2).Info("Starting client certificate rotation.")
|
klog.V(2).Info("Starting client certificate rotation.")
|
||||||
clientCertificateManager.SetCertificateSigningRequestClient(kubeClient.CertificatesV1beta1().CertificateSigningRequests())
|
clientCertificateManager.SetCertificateSigningRequestClient(kubeClient.CertificatesV1beta1().CertificateSigningRequests())
|
||||||
clientCertificateManager.Start()
|
clientCertificateManager.Start()
|
||||||
}
|
}
|
||||||
dynamicKubeClient, err = dynamic.NewForConfig(clientConfig)
|
dynamicKubeClient, err = dynamic.NewForConfig(clientConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Failed to initialize dynamic KubeClient: %v", err)
|
klog.Warningf("Failed to initialize dynamic KubeClient: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// make a separate client for events
|
// make a separate client for events
|
||||||
@ -596,7 +596,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
eventClientConfig.Burst = int(s.EventBurst)
|
eventClientConfig.Burst = int(s.EventBurst)
|
||||||
eventClient, err = v1core.NewForConfig(&eventClientConfig)
|
eventClient, err = v1core.NewForConfig(&eventClientConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Failed to create API Server client for Events: %v", err)
|
klog.Warningf("Failed to create API Server client for Events: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// make a separate client for heartbeat with throttling disabled and a timeout attached
|
// make a separate client for heartbeat with throttling disabled and a timeout attached
|
||||||
@ -612,14 +612,14 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
heartbeatClientConfig.QPS = float32(-1)
|
heartbeatClientConfig.QPS = float32(-1)
|
||||||
heartbeatClient, err = clientset.NewForConfig(&heartbeatClientConfig)
|
heartbeatClient, err = clientset.NewForConfig(&heartbeatClientConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Failed to create API Server client for heartbeat: %v", err)
|
klog.Warningf("Failed to create API Server client for heartbeat: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// csiClient works with CRDs that support json only
|
// csiClient works with CRDs that support json only
|
||||||
clientConfig.ContentType = "application/json"
|
clientConfig.ContentType = "application/json"
|
||||||
csiClient, err := csiclientset.NewForConfig(clientConfig)
|
csiClient, err := csiclientset.NewForConfig(clientConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Failed to create CSI API client: %v", err)
|
klog.Warningf("Failed to create CSI API client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
kubeDeps.KubeClient = kubeClient
|
kubeDeps.KubeClient = kubeClient
|
||||||
@ -663,7 +663,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
|
|
||||||
if kubeDeps.ContainerManager == nil {
|
if kubeDeps.ContainerManager == nil {
|
||||||
if s.CgroupsPerQOS && s.CgroupRoot == "" {
|
if s.CgroupsPerQOS && s.CgroupRoot == "" {
|
||||||
glog.Infof("--cgroups-per-qos enabled, but --cgroup-root was not specified. defaulting to /")
|
klog.Infof("--cgroups-per-qos enabled, but --cgroup-root was not specified. defaulting to /")
|
||||||
s.CgroupRoot = "/"
|
s.CgroupRoot = "/"
|
||||||
}
|
}
|
||||||
kubeReserved, err := parseResourceList(s.KubeReserved)
|
kubeReserved, err := parseResourceList(s.KubeReserved)
|
||||||
@ -727,7 +727,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := checkPermissions(); err != nil {
|
if err := checkPermissions(); err != nil {
|
||||||
glog.Error(err)
|
klog.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
utilruntime.ReallyCrash = s.ReallyCrashForTesting
|
utilruntime.ReallyCrash = s.ReallyCrashForTesting
|
||||||
@ -737,7 +737,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
// TODO(vmarmol): Do this through container config.
|
// TODO(vmarmol): Do this through container config.
|
||||||
oomAdjuster := kubeDeps.OOMAdjuster
|
oomAdjuster := kubeDeps.OOMAdjuster
|
||||||
if err := oomAdjuster.ApplyOOMScoreAdj(0, int(s.OOMScoreAdj)); err != nil {
|
if err := oomAdjuster.ApplyOOMScoreAdj(0, int(s.OOMScoreAdj)); err != nil {
|
||||||
glog.Warning(err)
|
klog.Warning(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := RunKubelet(s, kubeDeps, s.RunOnce); err != nil {
|
if err := RunKubelet(s, kubeDeps, s.RunOnce); err != nil {
|
||||||
@ -749,7 +749,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
|||||||
go wait.Until(func() {
|
go wait.Until(func() {
|
||||||
err := http.ListenAndServe(net.JoinHostPort(s.HealthzBindAddress, strconv.Itoa(int(s.HealthzPort))), nil)
|
err := http.ListenAndServe(net.JoinHostPort(s.HealthzBindAddress, strconv.Itoa(int(s.HealthzPort))), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Starting health server failed: %v", err)
|
klog.Errorf("Starting health server failed: %v", err)
|
||||||
}
|
}
|
||||||
}, 5*time.Second, wait.NeverStop)
|
}, 5*time.Second, wait.NeverStop)
|
||||||
}
|
}
|
||||||
@ -788,7 +788,7 @@ func getNodeName(cloud cloudprovider.Interface, hostname string) (types.NodeName
|
|||||||
return "", fmt.Errorf("error fetching current node name from cloud provider: %v", err)
|
return "", fmt.Errorf("error fetching current node name from cloud provider: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(2).Infof("cloud provider determined current node name to be %s", nodeName)
|
klog.V(2).Infof("cloud provider determined current node name to be %s", nodeName)
|
||||||
|
|
||||||
return nodeName, nil
|
return nodeName, nil
|
||||||
}
|
}
|
||||||
@ -822,7 +822,7 @@ func InitializeTLS(kf *options.KubeletFlags, kc *kubeletconfiginternal.KubeletCo
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(4).Infof("Using self-signed cert (%s, %s)", kc.TLSCertFile, kc.TLSPrivateKeyFile)
|
klog.V(4).Infof("Using self-signed cert (%s, %s)", kc.TLSCertFile, kc.TLSPrivateKeyFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,7 +938,7 @@ func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencie
|
|||||||
capabilities.Setup(kubeServer.AllowPrivileged, privilegedSources, 0)
|
capabilities.Setup(kubeServer.AllowPrivileged, privilegedSources, 0)
|
||||||
|
|
||||||
credentialprovider.SetPreferredDockercfgPath(kubeServer.RootDirectory)
|
credentialprovider.SetPreferredDockercfgPath(kubeServer.RootDirectory)
|
||||||
glog.V(2).Infof("Using root directory: %v", kubeServer.RootDirectory)
|
klog.V(2).Infof("Using root directory: %v", kubeServer.RootDirectory)
|
||||||
|
|
||||||
if kubeDeps.OSInterface == nil {
|
if kubeDeps.OSInterface == nil {
|
||||||
kubeDeps.OSInterface = kubecontainer.RealOS{}
|
kubeDeps.OSInterface = kubecontainer.RealOS{}
|
||||||
@ -993,10 +993,10 @@ func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencie
|
|||||||
if _, err := k.RunOnce(podCfg.Updates()); err != nil {
|
if _, err := k.RunOnce(podCfg.Updates()); err != nil {
|
||||||
return fmt.Errorf("runonce failed: %v", err)
|
return fmt.Errorf("runonce failed: %v", err)
|
||||||
}
|
}
|
||||||
glog.Infof("Started kubelet as runonce")
|
klog.Infof("Started kubelet as runonce")
|
||||||
} else {
|
} else {
|
||||||
startKubelet(k, podCfg, &kubeServer.KubeletConfiguration, kubeDeps, kubeServer.EnableServer)
|
startKubelet(k, podCfg, &kubeServer.KubeletConfiguration, kubeDeps, kubeServer.EnableServer)
|
||||||
glog.Infof("Started kubelet")
|
klog.Infof("Started kubelet")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1180,7 +1180,7 @@ func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConf
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
glog.V(2).Infof("Starting the GRPC server for the docker CRI shim.")
|
klog.V(2).Infof("Starting the GRPC server for the docker CRI shim.")
|
||||||
server := dockerremote.NewDockerServer(f.RemoteRuntimeEndpoint, ds)
|
server := dockerremote.NewDockerServer(f.RemoteRuntimeEndpoint, ds)
|
||||||
if err := server.Start(); err != nil {
|
if err := server.Start(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -17,26 +17,26 @@ limitations under the License.
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/golang/glog"
|
|
||||||
"golang.org/x/exp/inotify"
|
"golang.org/x/exp/inotify"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func watchForLockfileContention(path string, done chan struct{}) error {
|
func watchForLockfileContention(path string, done chan struct{}) error {
|
||||||
watcher, err := inotify.NewWatcher()
|
watcher, err := inotify.NewWatcher()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("unable to create watcher for lockfile: %v", err)
|
klog.Errorf("unable to create watcher for lockfile: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err = watcher.AddWatch(path, inotify.IN_OPEN|inotify.IN_DELETE_SELF); err != nil {
|
if err = watcher.AddWatch(path, inotify.IN_OPEN|inotify.IN_DELETE_SELF); err != nil {
|
||||||
glog.Errorf("unable to watch lockfile: %v", err)
|
klog.Errorf("unable to watch lockfile: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case ev := <-watcher.Event:
|
case ev := <-watcher.Event:
|
||||||
glog.Infof("inotify event: %v", ev)
|
klog.Infof("inotify event: %v", ev)
|
||||||
case err = <-watcher.Error:
|
case err = <-watcher.Error:
|
||||||
glog.Errorf("inotify watcher error: %v", err)
|
klog.Errorf("inotify watcher error: %v", err)
|
||||||
}
|
}
|
||||||
close(done)
|
close(done)
|
||||||
}()
|
}()
|
||||||
|
@ -35,9 +35,9 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/utils/exec/testing:go_default_library",
|
"//vendor/k8s.io/utils/exec/testing:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -23,9 +23,9 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
@ -138,18 +138,18 @@ func newHollowNodeCommand() *cobra.Command {
|
|||||||
|
|
||||||
func run(config *HollowNodeConfig) {
|
func run(config *HollowNodeConfig) {
|
||||||
if !knownMorphs.Has(config.Morph) {
|
if !knownMorphs.Has(config.Morph) {
|
||||||
glog.Fatalf("Unknown morph: %v. Allowed values: %v", config.Morph, knownMorphs.List())
|
klog.Fatalf("Unknown morph: %v. Allowed values: %v", config.Morph, knownMorphs.List())
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a client to communicate with API server.
|
// create a client to communicate with API server.
|
||||||
clientConfig, err := config.createClientConfigFromFile()
|
clientConfig, err := config.createClientConfigFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Failed to create a ClientConfig: %v. Exiting.", err)
|
klog.Fatalf("Failed to create a ClientConfig: %v. Exiting.", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := clientset.NewForConfig(clientConfig)
|
client, err := clientset.NewForConfig(clientConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Failed to create a ClientSet: %v. Exiting.", err)
|
klog.Fatalf("Failed to create a ClientSet: %v. Exiting.", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Morph == "kubelet" {
|
if config.Morph == "kubelet" {
|
||||||
@ -181,7 +181,7 @@ func run(config *HollowNodeConfig) {
|
|||||||
if config.Morph == "proxy" {
|
if config.Morph == "proxy" {
|
||||||
client, err := clientset.NewForConfig(clientConfig)
|
client, err := clientset.NewForConfig(clientConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Failed to create API Server client: %v", err)
|
klog.Fatalf("Failed to create API Server client: %v", err)
|
||||||
}
|
}
|
||||||
iptInterface := fakeiptables.NewFake()
|
iptInterface := fakeiptables.NewFake()
|
||||||
sysctl := fakesysctl.NewFake()
|
sysctl := fakesysctl.NewFake()
|
||||||
@ -203,7 +203,7 @@ func run(config *HollowNodeConfig) {
|
|||||||
config.ProxierMinSyncPeriod,
|
config.ProxierMinSyncPeriod,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Failed to create hollowProxy instance: %v", err)
|
klog.Fatalf("Failed to create hollowProxy instance: %v", err)
|
||||||
}
|
}
|
||||||
hollowProxy.Run()
|
hollowProxy.Run()
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/util/validation:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/validation:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||||
@ -4301,7 +4301,7 @@ func ValidateNodeUpdate(node, oldNode *core.Node) field.ErrorList {
|
|||||||
// We made allowed changes to oldNode, and now we compare oldNode to node. Any remaining differences indicate changes to protected fields.
|
// We made allowed changes to oldNode, and now we compare oldNode to node. Any remaining differences indicate changes to protected fields.
|
||||||
// TODO: Add a 'real' error type for this error and provide print actual diffs.
|
// TODO: Add a 'real' error type for this error and provide print actual diffs.
|
||||||
if !apiequality.Semantic.DeepEqual(oldNode, node) {
|
if !apiequality.Semantic.DeepEqual(oldNode, node) {
|
||||||
glog.V(4).Infof("Update failed validation %#v vs %#v", oldNode, node)
|
klog.V(4).Infof("Update failed validation %#v vs %#v", oldNode, node)
|
||||||
allErrs = append(allErrs, field.Forbidden(field.NewPath(""), "node updates may only change labels, taints, or capacity (or configSource, if the DynamicKubeletConfig feature gate is enabled)"))
|
allErrs = append(allErrs, field.Forbidden(field.NewPath(""), "node updates may only change labels, taints, or capacity (or configSource, if the DynamicKubeletConfig feature gate is enabled)"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user