mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-16 22:53:22 +00:00
Add context object to kubecfg/client
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
@@ -126,7 +127,8 @@ func main() {
|
||||
Port: *minionPort,
|
||||
}
|
||||
|
||||
client, err := client.New(net.JoinHostPort(*address, strconv.Itoa(int(*port))), *storageVersion, nil)
|
||||
ctx := api.NewContext()
|
||||
client, err := client.New(ctx, net.JoinHostPort(*address, strconv.Itoa(int(*port))), *storageVersion, nil)
|
||||
if err != nil {
|
||||
glog.Fatalf("Invalid server address: %v", err)
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller"
|
||||
@@ -53,8 +54,8 @@ func main() {
|
||||
if len(*master) == 0 {
|
||||
glog.Fatal("usage: controller-manager -master <master>")
|
||||
}
|
||||
|
||||
kubeClient, err := client.New(*master, latest.OldestVersion, nil)
|
||||
ctx := api.NewContext()
|
||||
kubeClient, err := client.New(ctx, *master, latest.OldestVersion, nil)
|
||||
if err != nil {
|
||||
glog.Fatalf("Invalid -master: %v", err)
|
||||
}
|
||||
|
@@ -173,7 +173,11 @@ func main() {
|
||||
} else {
|
||||
masterServer = "http://localhost:8080"
|
||||
}
|
||||
kubeClient, err := client.New(masterServer, *apiVersion, nil)
|
||||
|
||||
// TODO: get the namespace context when kubecfg ns is completed
|
||||
ctx := api.NewContext()
|
||||
|
||||
kubeClient, err := client.New(ctx, masterServer, *apiVersion, nil)
|
||||
if err != nil {
|
||||
glog.Fatalf("Can't configure client: %v", err)
|
||||
}
|
||||
@@ -194,7 +198,7 @@ func main() {
|
||||
if *keyFile != "" {
|
||||
auth.KeyFile = *keyFile
|
||||
}
|
||||
kubeClient, err = client.New(masterServer, *apiVersion, auth)
|
||||
kubeClient, err = client.New(ctx, masterServer, *apiVersion, auth)
|
||||
if err != nil {
|
||||
glog.Fatalf("Can't configure client: %v", err)
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ import (
|
||||
"flag"
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy"
|
||||
@@ -54,8 +55,9 @@ func main() {
|
||||
// define api config source
|
||||
if *master != "" {
|
||||
glog.Infof("Using api calls to get config %v", *master)
|
||||
ctx := api.NewContext()
|
||||
//TODO: add auth info
|
||||
client, err := client.New(*master, latest.OldestVersion, nil)
|
||||
client, err := client.New(ctx, *master, latest.OldestVersion, nil)
|
||||
if err != nil {
|
||||
glog.Fatalf("Invalid -master: %v", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user