mirror of https://github.com/kubernetes/kops.git
Use NewVFSContext in examples
This commit is contained in:
parent
e04fc1314f
commit
373cd4220f
|
@ -24,8 +24,8 @@ import (
|
|||
"k8s.io/kops/util/pkg/vfs"
|
||||
)
|
||||
|
||||
func apply(ctx context.Context) error {
|
||||
clientset := vfsclientset.NewVFSClientset(vfs.Context, registryBase)
|
||||
func apply(vfsContext *vfs.VFSContext, ctx context.Context) error {
|
||||
clientset := vfsclientset.NewVFSClientset(vfsContext, registryBase)
|
||||
|
||||
cluster, err := clientset.GetCluster(ctx, clusterName)
|
||||
if err != nil {
|
||||
|
|
|
@ -51,7 +51,9 @@ var (
|
|||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
err := parseFlags()
|
||||
vfsContext := vfs.NewVFSContext()
|
||||
|
||||
err := parseFlags(vfsContext)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
|
@ -59,23 +61,23 @@ func main() {
|
|||
|
||||
ctx := context.TODO()
|
||||
|
||||
err = up(ctx)
|
||||
err = up(vfsContext, ctx)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error from up: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = apply(ctx)
|
||||
err = apply(vfsContext, ctx)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error from apply: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func parseFlags() error {
|
||||
func parseFlags(vfsContext *vfs.VFSContext) error {
|
||||
var err error
|
||||
|
||||
registryBase, err = vfs.Context.BuildVfsPath(*flagRegistryBase)
|
||||
registryBase, err = vfsContext.BuildVfsPath(*flagRegistryBase)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing registry path %q: %v", *flagRegistryBase, err)
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ import (
|
|||
"k8s.io/kops/util/pkg/vfs"
|
||||
)
|
||||
|
||||
func up(ctx context.Context) error {
|
||||
clientset := vfsclientset.NewVFSClientset(vfs.Context, registryBase)
|
||||
func up(vfsContext *vfs.VFSContext, ctx context.Context) error {
|
||||
clientset := vfsclientset.NewVFSClientset(vfsContext, registryBase)
|
||||
|
||||
cluster := &api.Cluster{}
|
||||
cluster.ObjectMeta.Name = clusterName
|
||||
|
|
Loading…
Reference in New Issue