2015-05-22 01:14:26 +00:00
|
|
|
/*
|
|
|
|
Copyright 2015 The Kubernetes Authors All rights reserved.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package e2e
|
|
|
|
|
|
|
|
import (
|
2015-07-20 02:00:10 +00:00
|
|
|
"bytes"
|
2015-05-22 01:14:26 +00:00
|
|
|
"fmt"
|
2016-01-13 14:50:08 +00:00
|
|
|
"reflect"
|
2015-07-20 02:00:10 +00:00
|
|
|
"strings"
|
2015-11-26 14:43:30 +00:00
|
|
|
"sync"
|
2015-07-09 18:38:10 +00:00
|
|
|
"time"
|
2015-05-22 01:14:26 +00:00
|
|
|
|
2015-08-05 22:03:47 +00:00
|
|
|
"k8s.io/kubernetes/pkg/api"
|
2016-02-17 13:52:38 +00:00
|
|
|
apierrs "k8s.io/kubernetes/pkg/api/errors"
|
2016-02-08 21:00:09 +00:00
|
|
|
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_2"
|
2015-08-13 19:01:50 +00:00
|
|
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
2015-08-05 22:03:47 +00:00
|
|
|
"k8s.io/kubernetes/pkg/fields"
|
2015-12-23 14:56:56 +00:00
|
|
|
"k8s.io/kubernetes/pkg/metrics"
|
2015-05-22 01:14:26 +00:00
|
|
|
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
2016-02-09 21:36:48 +00:00
|
|
|
const (
|
|
|
|
maxKubectlExecRetries = 5
|
|
|
|
)
|
|
|
|
|
2015-05-22 01:14:26 +00:00
|
|
|
// Framework supports common operations used by e2e tests; it will keep a client & a namespace for you.
|
|
|
|
// Eventual goal is to merge this with integration test framework.
|
|
|
|
type Framework struct {
|
|
|
|
BaseName string
|
|
|
|
|
2016-02-06 05:38:52 +00:00
|
|
|
Client *client.Client
|
|
|
|
Clientset_1_2 *release_1_2.Clientset
|
|
|
|
|
|
|
|
Namespace *api.Namespace // Every test has at least one namespace
|
|
|
|
namespacesToDelete []*api.Namespace // Some tests have more than one.
|
2015-09-24 08:02:07 +00:00
|
|
|
NamespaceDeletionTimeout time.Duration
|
2015-10-29 14:49:23 +00:00
|
|
|
|
2016-02-23 15:45:42 +00:00
|
|
|
gatherer *containerResourceGatherer
|
2016-02-12 19:33:32 +00:00
|
|
|
// Constraints that passed to a check which is executed after data is gathered to
|
2015-11-30 14:29:40 +00:00
|
|
|
// see if 99% of results are within acceptable bounds. It as to be injected in the test,
|
|
|
|
// as expectations vary greatly. Constraints are groupped by the container names.
|
|
|
|
addonResourceConstraints map[string]resourceConstraint
|
2015-11-26 14:43:30 +00:00
|
|
|
|
|
|
|
logsSizeWaitGroup sync.WaitGroup
|
|
|
|
logsSizeCloseChannel chan bool
|
|
|
|
logsSizeVerifier *LogsSizeVerifier
|
2016-02-06 05:12:33 +00:00
|
|
|
|
|
|
|
// To make sure that this framework cleans up after itself, no matter what,
|
|
|
|
// we install a cleanup action before each test and clear it after. If we
|
|
|
|
// should abort, the AfterSuite hook should run all cleanup actions.
|
|
|
|
cleanupHandle CleanupActionHandle
|
2015-05-22 01:14:26 +00:00
|
|
|
}
|
|
|
|
|
2015-12-29 08:19:54 +00:00
|
|
|
type TestDataSummary interface {
|
|
|
|
PrintHumanReadable() string
|
|
|
|
PrintJSON() string
|
|
|
|
}
|
|
|
|
|
2015-05-22 01:14:26 +00:00
|
|
|
// NewFramework makes a new framework and sets up a BeforeEach/AfterEach for
|
|
|
|
// you (you can write additional before/after each functions).
|
|
|
|
func NewFramework(baseName string) *Framework {
|
|
|
|
f := &Framework{
|
2015-11-30 14:29:40 +00:00
|
|
|
BaseName: baseName,
|
|
|
|
addonResourceConstraints: make(map[string]resourceConstraint),
|
2015-05-22 01:14:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BeforeEach(f.beforeEach)
|
|
|
|
AfterEach(f.afterEach)
|
|
|
|
|
|
|
|
return f
|
|
|
|
}
|
|
|
|
|
|
|
|
// beforeEach gets a client and makes a namespace.
|
|
|
|
func (f *Framework) beforeEach() {
|
2016-02-06 05:12:33 +00:00
|
|
|
// The fact that we need this feels like a bug in ginkgo.
|
|
|
|
// https://github.com/onsi/ginkgo/issues/222
|
|
|
|
f.cleanupHandle = AddCleanupAction(f.afterEach)
|
|
|
|
|
2015-05-22 01:14:26 +00:00
|
|
|
By("Creating a kubernetes client")
|
|
|
|
c, err := loadClient()
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
|
|
|
|
f.Client = c
|
2016-02-08 21:00:09 +00:00
|
|
|
f.Clientset_1_2 = release_1_2.FromUnversionedClient(c)
|
2015-05-22 01:14:26 +00:00
|
|
|
|
|
|
|
By("Building a namespace api object")
|
2016-02-06 05:38:52 +00:00
|
|
|
namespace, err := f.CreateNamespace(f.BaseName, map[string]string{
|
2015-12-10 22:20:48 +00:00
|
|
|
"e2e-framework": f.BaseName,
|
|
|
|
})
|
2015-05-22 01:14:26 +00:00
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
|
|
|
|
f.Namespace = namespace
|
2015-05-22 20:46:52 +00:00
|
|
|
|
2015-09-15 16:22:12 +00:00
|
|
|
if testContext.VerifyServiceAccount {
|
|
|
|
By("Waiting for a default service account to be provisioned in namespace")
|
|
|
|
err = waitForDefaultServiceAccountInNamespace(c, namespace.Name)
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
} else {
|
|
|
|
Logf("Skipping waiting for service account")
|
|
|
|
}
|
2015-10-29 14:49:23 +00:00
|
|
|
|
2015-11-25 12:24:40 +00:00
|
|
|
if testContext.GatherKubeSystemResourceUsageData {
|
2016-02-23 15:45:42 +00:00
|
|
|
f.gatherer, err = NewResourceUsageGatherer(c)
|
|
|
|
if err != nil {
|
|
|
|
Logf("Error while creating NewResourceUsageGatherer: %v", err)
|
|
|
|
} else {
|
|
|
|
go f.gatherer.startGatheringData()
|
|
|
|
}
|
2015-10-29 14:49:23 +00:00
|
|
|
}
|
2015-11-26 14:43:30 +00:00
|
|
|
|
|
|
|
if testContext.GatherLogsSizes {
|
|
|
|
f.logsSizeWaitGroup = sync.WaitGroup{}
|
|
|
|
f.logsSizeWaitGroup.Add(1)
|
|
|
|
f.logsSizeCloseChannel = make(chan bool)
|
|
|
|
f.logsSizeVerifier = NewLogsVerifier(c, f.logsSizeCloseChannel)
|
|
|
|
go func() {
|
|
|
|
f.logsSizeVerifier.Run()
|
|
|
|
f.logsSizeWaitGroup.Done()
|
|
|
|
}()
|
|
|
|
}
|
2015-05-22 01:14:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// afterEach deletes the namespace, after reading its events.
|
|
|
|
func (f *Framework) afterEach() {
|
2016-02-06 05:12:33 +00:00
|
|
|
RemoveCleanupAction(f.cleanupHandle)
|
|
|
|
|
2016-02-15 09:19:04 +00:00
|
|
|
// DeleteNamespace at the very end in defer, to avoid any
|
|
|
|
// expectation failures preventing deleting the namespace.
|
|
|
|
defer func() {
|
|
|
|
if testContext.DeleteNamespace {
|
|
|
|
for _, ns := range f.namespacesToDelete {
|
|
|
|
By(fmt.Sprintf("Destroying namespace %q for this suite.", ns.Name))
|
|
|
|
|
|
|
|
timeout := 5 * time.Minute
|
|
|
|
if f.NamespaceDeletionTimeout != 0 {
|
|
|
|
timeout = f.NamespaceDeletionTimeout
|
|
|
|
}
|
|
|
|
if err := deleteNS(f.Client, ns.Name, timeout); err != nil {
|
2016-02-17 13:52:38 +00:00
|
|
|
if !apierrs.IsNotFound(err) {
|
|
|
|
Failf("Couldn't delete ns %q: %s", ns.Name, err)
|
|
|
|
} else {
|
|
|
|
Logf("Namespace %v was already deleted", ns.Name)
|
|
|
|
}
|
2016-02-15 09:19:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
f.namespacesToDelete = nil
|
|
|
|
} else {
|
|
|
|
Logf("Found DeleteNamespace=false, skipping namespace deletion!")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Paranoia-- prevent reuse!
|
|
|
|
f.Namespace = nil
|
|
|
|
f.Client = nil
|
|
|
|
}()
|
|
|
|
|
2015-05-22 01:14:26 +00:00
|
|
|
// Print events if the test failed.
|
|
|
|
if CurrentGinkgoTestDescription().Failed {
|
2016-02-17 19:46:25 +00:00
|
|
|
dumpAllNamespaceInfo(f.Client, f.Namespace.Name)
|
2015-05-22 01:14:26 +00:00
|
|
|
}
|
|
|
|
|
2015-12-29 08:19:54 +00:00
|
|
|
summaries := make([]TestDataSummary, 0)
|
2016-02-23 15:45:42 +00:00
|
|
|
if testContext.GatherKubeSystemResourceUsageData && f.gatherer != nil {
|
2016-02-16 16:02:42 +00:00
|
|
|
By("Collecting resource usage data")
|
2016-01-08 08:33:06 +00:00
|
|
|
summaries = append(summaries, f.gatherer.stopAndSummarize([]int{90, 99}, f.addonResourceConstraints))
|
2015-10-29 14:49:23 +00:00
|
|
|
}
|
2015-11-26 14:43:30 +00:00
|
|
|
|
|
|
|
if testContext.GatherLogsSizes {
|
2016-02-16 16:02:42 +00:00
|
|
|
By("Gathering log sizes data")
|
2015-11-26 14:43:30 +00:00
|
|
|
close(f.logsSizeCloseChannel)
|
|
|
|
f.logsSizeWaitGroup.Wait()
|
2015-12-29 08:19:54 +00:00
|
|
|
summaries = append(summaries, f.logsSizeVerifier.GetSummary())
|
|
|
|
}
|
|
|
|
|
2016-01-04 15:42:51 +00:00
|
|
|
if testContext.GatherMetricsAfterTest {
|
2016-02-16 16:02:42 +00:00
|
|
|
By("Gathering metrics")
|
2016-01-04 15:42:51 +00:00
|
|
|
// TODO: enable Scheduler and ControllerManager metrics grabbing when Master's Kubelet will be registered.
|
|
|
|
grabber, err := metrics.NewMetricsGrabber(f.Client, true, false, false, true)
|
|
|
|
if err != nil {
|
|
|
|
Logf("Failed to create MetricsGrabber. Skipping metrics gathering.")
|
|
|
|
} else {
|
|
|
|
received, err := grabber.Grab(nil)
|
|
|
|
if err != nil {
|
|
|
|
Logf("MetricsGrabber failed grab metrics. Skipping metrics gathering.")
|
|
|
|
} else {
|
2016-01-12 12:23:47 +00:00
|
|
|
summaries = append(summaries, (*MetricsForE2E)(&received))
|
2016-01-04 15:42:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-29 08:19:54 +00:00
|
|
|
outputTypes := strings.Split(testContext.OutputPrintType, ",")
|
|
|
|
for _, printType := range outputTypes {
|
|
|
|
switch printType {
|
|
|
|
case "hr":
|
|
|
|
for i := range summaries {
|
|
|
|
Logf(summaries[i].PrintHumanReadable())
|
|
|
|
}
|
|
|
|
case "json":
|
|
|
|
for i := range summaries {
|
2016-01-13 14:50:08 +00:00
|
|
|
typeName := reflect.TypeOf(summaries[i]).String()
|
|
|
|
Logf("%v JSON\n%v", typeName[strings.LastIndex(typeName, ".")+1:len(typeName)], summaries[i].PrintJSON())
|
|
|
|
Logf("Finished")
|
2015-12-29 08:19:54 +00:00
|
|
|
}
|
|
|
|
default:
|
2016-02-12 05:26:38 +00:00
|
|
|
Logf("Unknown output type: %v. Skipping.", printType)
|
2015-12-29 08:19:54 +00:00
|
|
|
}
|
2015-11-26 14:43:30 +00:00
|
|
|
}
|
2015-12-23 14:56:56 +00:00
|
|
|
|
2016-02-11 12:14:32 +00:00
|
|
|
// Check whether all nodes are ready after the test.
|
|
|
|
// This is explicitly done at the very end of the test, to avoid
|
|
|
|
// e.g. not removing namespace in case of this failure.
|
|
|
|
if err := allNodesReady(f.Client, time.Minute); err != nil {
|
|
|
|
Failf("All nodes should be ready after test, %v", err)
|
|
|
|
}
|
2015-05-22 01:14:26 +00:00
|
|
|
}
|
|
|
|
|
2016-02-06 05:38:52 +00:00
|
|
|
func (f *Framework) CreateNamespace(baseName string, labels map[string]string) (*api.Namespace, error) {
|
2016-02-08 13:25:14 +00:00
|
|
|
createTestingNS := testContext.CreateTestingNS
|
|
|
|
if createTestingNS == nil {
|
|
|
|
createTestingNS = CreateTestingNS
|
|
|
|
}
|
2016-02-06 05:38:52 +00:00
|
|
|
ns, err := createTestingNS(baseName, f.Client, labels)
|
|
|
|
if err == nil {
|
|
|
|
f.namespacesToDelete = append(f.namespacesToDelete, ns)
|
|
|
|
}
|
|
|
|
return ns, err
|
|
|
|
}
|
|
|
|
|
2016-01-26 20:52:14 +00:00
|
|
|
// WaitForPodTerminated waits for the pod to be terminated with the given reason.
|
|
|
|
func (f *Framework) WaitForPodTerminated(podName, reason string) error {
|
|
|
|
return waitForPodTerminatedInNamespace(f.Client, podName, reason, f.Namespace.Name)
|
|
|
|
}
|
|
|
|
|
2015-05-22 01:14:26 +00:00
|
|
|
// WaitForPodRunning waits for the pod to run in the namespace.
|
|
|
|
func (f *Framework) WaitForPodRunning(podName string) error {
|
|
|
|
return waitForPodRunningInNamespace(f.Client, podName, f.Namespace.Name)
|
|
|
|
}
|
2015-05-22 20:12:55 +00:00
|
|
|
|
2015-11-03 23:57:37 +00:00
|
|
|
// WaitForPodRunningSlow waits for the pod to run in the namespace.
|
|
|
|
// It has a longer timeout then WaitForPodRunning (util.slowPodStartTimeout).
|
|
|
|
func (f *Framework) WaitForPodRunningSlow(podName string) error {
|
|
|
|
return waitForPodRunningInNamespaceSlow(f.Client, podName, f.Namespace.Name)
|
|
|
|
}
|
|
|
|
|
2016-02-19 19:27:25 +00:00
|
|
|
// WaitForPodNoLongerRunning waits for the pod to no longer be running in the namespace, for either
|
|
|
|
// success or failure.
|
|
|
|
func (f *Framework) WaitForPodNoLongerRunning(podName string) error {
|
|
|
|
return waitForPodNoLongerRunningInNamespace(f.Client, podName, f.Namespace.Name)
|
|
|
|
}
|
|
|
|
|
2015-06-23 08:03:31 +00:00
|
|
|
// Runs the given pod and verifies that the output of exact container matches the desired output.
|
|
|
|
func (f *Framework) TestContainerOutput(scenarioName string, pod *api.Pod, containerIndex int, expectedOutput []string) {
|
2015-10-13 19:51:37 +00:00
|
|
|
testContainerOutput(scenarioName, f.Client, pod, containerIndex, expectedOutput, f.Namespace.Name)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Runs the given pod and verifies that the output of exact container matches the desired regexps.
|
|
|
|
func (f *Framework) TestContainerOutputRegexp(scenarioName string, pod *api.Pod, containerIndex int, expectedOutput []string) {
|
|
|
|
testContainerOutputRegexp(scenarioName, f.Client, pod, containerIndex, expectedOutput, f.Namespace.Name)
|
2015-05-22 20:12:55 +00:00
|
|
|
}
|
2015-06-11 22:55:25 +00:00
|
|
|
|
|
|
|
// WaitForAnEndpoint waits for at least one endpoint to become available in the
|
|
|
|
// service's corresponding endpoints object.
|
|
|
|
func (f *Framework) WaitForAnEndpoint(serviceName string) error {
|
|
|
|
for {
|
|
|
|
// TODO: Endpoints client should take a field selector so we
|
|
|
|
// don't have to list everything.
|
2015-12-10 09:39:03 +00:00
|
|
|
list, err := f.Client.Endpoints(f.Namespace.Name).List(api.ListOptions{})
|
2015-06-11 22:55:25 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
rv := list.ResourceVersion
|
|
|
|
|
|
|
|
isOK := func(e *api.Endpoints) bool {
|
|
|
|
return e.Name == serviceName && len(e.Subsets) > 0 && len(e.Subsets[0].Addresses) > 0
|
|
|
|
}
|
|
|
|
for i := range list.Items {
|
|
|
|
if isOK(&list.Items[i]) {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-10 09:39:03 +00:00
|
|
|
options := api.ListOptions{
|
|
|
|
FieldSelector: fields.Set{"metadata.name": serviceName}.AsSelector(),
|
2015-11-26 15:27:45 +00:00
|
|
|
ResourceVersion: rv,
|
|
|
|
}
|
|
|
|
w, err := f.Client.Endpoints(f.Namespace.Name).Watch(options)
|
2015-06-11 22:55:25 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
defer w.Stop()
|
|
|
|
|
|
|
|
for {
|
|
|
|
val, ok := <-w.ResultChan()
|
|
|
|
if !ok {
|
|
|
|
// reget and re-watch
|
|
|
|
break
|
|
|
|
}
|
|
|
|
if e, ok := val.Object.(*api.Endpoints); ok {
|
|
|
|
if isOK(e) {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-07-20 02:00:10 +00:00
|
|
|
|
|
|
|
// Write a file using kubectl exec echo <contents> > <path> via specified container
|
|
|
|
// Because of the primitive technique we're using here, we only allow ASCII alphanumeric characters
|
|
|
|
func (f *Framework) WriteFileViaContainer(podName, containerName string, path string, contents string) error {
|
|
|
|
By("writing a file in the container")
|
|
|
|
allowedCharacters := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
|
|
for _, c := range contents {
|
|
|
|
if !strings.ContainsRune(allowedCharacters, c) {
|
|
|
|
return fmt.Errorf("Unsupported character in string to write: %v", c)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
command := fmt.Sprintf("echo '%s' > '%s'", contents, path)
|
2016-02-09 21:36:48 +00:00
|
|
|
stdout, stderr, err := kubectlExecWithRetry(f.Namespace.Name, podName, containerName, "--", "/bin/sh", "-c", command)
|
2015-07-20 02:00:10 +00:00
|
|
|
if err != nil {
|
|
|
|
Logf("error running kubectl exec to write file: %v\nstdout=%v\nstderr=%v)", err, string(stdout), string(stderr))
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read a file using kubectl exec cat <path>
|
|
|
|
func (f *Framework) ReadFileViaContainer(podName, containerName string, path string) (string, error) {
|
|
|
|
By("reading a file in the container")
|
|
|
|
|
2016-02-09 21:36:48 +00:00
|
|
|
stdout, stderr, err := kubectlExecWithRetry(f.Namespace.Name, podName, containerName, "--", "cat", path)
|
2015-07-20 02:00:10 +00:00
|
|
|
if err != nil {
|
|
|
|
Logf("error running kubectl exec to read file: %v\nstdout=%v\nstderr=%v)", err, string(stdout), string(stderr))
|
|
|
|
}
|
|
|
|
return string(stdout), err
|
|
|
|
}
|
|
|
|
|
2016-02-09 21:36:48 +00:00
|
|
|
func kubectlExecWithRetry(namespace string, podName, containerName string, args ...string) ([]byte, []byte, error) {
|
|
|
|
for numRetries := 0; numRetries < maxKubectlExecRetries; numRetries++ {
|
|
|
|
if numRetries > 0 {
|
|
|
|
Logf("Retrying kubectl exec (retry count=%v/%v)", numRetries+1, maxKubectlExecRetries)
|
|
|
|
}
|
|
|
|
|
|
|
|
stdOutBytes, stdErrBytes, err := kubectlExec(namespace, podName, containerName, args...)
|
|
|
|
if err != nil {
|
|
|
|
if strings.Contains(strings.ToLower(string(stdErrBytes)), "i/o timeout") {
|
|
|
|
// Retry on "i/o timeout" errors
|
|
|
|
Logf("Warning: kubectl exec encountered i/o timeout.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return stdOutBytes, stdErrBytes, err
|
|
|
|
}
|
|
|
|
err := fmt.Errorf("Failed: kubectl exec failed %d times with \"i/o timeout\". Giving up.", maxKubectlExecRetries)
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
|
|
|
|
2015-07-20 02:00:10 +00:00
|
|
|
func kubectlExec(namespace string, podName, containerName string, args ...string) ([]byte, []byte, error) {
|
|
|
|
var stdout, stderr bytes.Buffer
|
|
|
|
cmdArgs := []string{
|
|
|
|
"exec",
|
|
|
|
fmt.Sprintf("--namespace=%v", namespace),
|
|
|
|
podName,
|
|
|
|
fmt.Sprintf("-c=%v", containerName),
|
|
|
|
}
|
|
|
|
cmdArgs = append(cmdArgs, args...)
|
|
|
|
|
|
|
|
cmd := kubectlCmd(cmdArgs...)
|
|
|
|
cmd.Stdout, cmd.Stderr = &stdout, &stderr
|
|
|
|
|
|
|
|
Logf("Running '%s %s'", cmd.Path, strings.Join(cmd.Args, " "))
|
|
|
|
err := cmd.Run()
|
|
|
|
return stdout.Bytes(), stderr.Bytes(), err
|
|
|
|
}
|