mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-29 05:22:37 +00:00
Merge pull request #20517 from janetkuo/enable-deployments-default
Auto commit by PR queue bot
This commit is contained in:
commit
8a4a73e372
File diff suppressed because it is too large
Load Diff
@ -83,7 +83,6 @@ MASTER_RESERVED_IP="${MASTER_RESERVED_IP:-}"
|
||||
RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}"
|
||||
|
||||
# Enable various v1beta1 features
|
||||
ENABLE_DEPLOYMENTS="${KUBE_ENABLE_DEPLOYMENTS:-true}"
|
||||
ENABLE_DAEMONSETS="${KUBE_ENABLE_DAEMONSETS:-true}"
|
||||
|
||||
# Optional: Cluster monitoring to setup as part of the cluster bring up:
|
||||
|
@ -422,15 +422,6 @@ function yaml-quote {
|
||||
|
||||
# Builds the RUNTIME_CONFIG var from other feature enable options
|
||||
function build-runtime-config() {
|
||||
if [[ "${ENABLE_DEPLOYMENTS}" == "true" ]]; then
|
||||
if [[ -z "${RUNTIME_CONFIG}" ]]; then
|
||||
RUNTIME_CONFIG="extensions/v1beta1/deployments=true"
|
||||
else
|
||||
if echo "${RUNTIME_CONFIG}" | grep -q -v "extensions/v1beta1/deployments=true"; then
|
||||
RUNTIME_CONFIG="${RUNTIME_CONFIG},extensions/v1beta1/deployments=true"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [[ "${ENABLE_DAEMONSETS}" == "true" ]]; then
|
||||
if [[ -z "${RUNTIME_CONFIG}" ]]; then
|
||||
RUNTIME_CONFIG="extensions/v1beta1/daemonsets=true"
|
||||
|
@ -51,7 +51,6 @@ RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}"
|
||||
TERMINATED_POD_GC_THRESHOLD=${TERMINATED_POD_GC_THRESHOLD:-100}
|
||||
|
||||
# Optional: enable v1beta1 related features
|
||||
ENABLE_DEPLOYMENTS="${KUBE_ENABLE_DEPLOYMENTS:-true}"
|
||||
ENABLE_DAEMONSETS="${KUBE_ENABLE_DAEMONSETS:-true}"
|
||||
ENABLE_REPLICASETS="${KUBE_ENABLE_REPLICASETS:-true}"
|
||||
|
||||
|
@ -42,7 +42,6 @@ RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}"
|
||||
TERMINATED_POD_GC_THRESHOLD=${TERMINATED_POD_GC_THRESHOLD:-100}
|
||||
|
||||
# Optional: enable v1beta1 related features
|
||||
ENABLE_DEPLOYMENTS="${KUBE_ENABLE_DEPLOYMENTS:-true}"
|
||||
ENABLE_DAEMONSETS="${KUBE_ENABLE_DAEMONSETS:-true}"
|
||||
|
||||
TEST_CLUSTER_LOG_LEVEL="${TEST_CLUSTER_LOG_LEVEL:---v=2}"
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -113,10 +113,10 @@ create their own API groups](design/extending-api.md), and to avoid naming colli
|
||||
|
||||
## Enabling resources in the extensions group
|
||||
|
||||
HorizontalPodAutoscalers, Jobs, Ingress and ReplicaSets are enabled by default.
|
||||
HorizontalPodAutoscalers, Jobs, Ingress, Deployments and ReplicaSets are enabled by default.
|
||||
Other extensions resources can be enabled by setting runtime-config on
|
||||
apiserver. runtime-config accepts comma separated values. For ex: to enable deployments and disable jobs, set
|
||||
`--runtime-config=extensions/v1beta1/deployments=true,extensions/v1beta1/jobs=false`
|
||||
apiserver. runtime-config accepts comma separated values. For ex: to disable deployments and jobs, set
|
||||
`--runtime-config=extensions/v1beta1/deployments=false,extensions/v1beta1/jobs=false`
|
||||
|
||||
## v1beta1, v1beta2, and v1beta3 are deprecated; please move to v1 ASAP
|
||||
|
||||
|
@ -14,7 +14,7 @@ kubectl run \- Run a particular image on the cluster.
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Create and run a particular image, possibly replicated.
|
||||
Creates a replication controller or job to manage the created container(s).
|
||||
Creates a deployment or job to manage the created container(s).
|
||||
|
||||
|
||||
.SH OPTIONS
|
||||
@ -40,7 +40,7 @@ Creates a replication controller or job to manage the created container(s).
|
||||
|
||||
.PP
|
||||
\fB\-\-generator\fP=""
|
||||
The name of the API generator to use. Default is 'run/v1' if \-\-restart=Always, otherwise the default is 'job/v1beta1'.
|
||||
The name of the API generator to use. Default is 'deployment/v1beta1' if \-\-restart=Always, otherwise the default is 'job/v1beta1'.
|
||||
|
||||
.PP
|
||||
\fB\-\-hostport\fP=\-1
|
||||
@ -98,7 +98,7 @@ Creates a replication controller or job to manage the created container(s).
|
||||
|
||||
.PP
|
||||
\fB\-\-restart\fP="Always"
|
||||
The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a replication controller is created for this pod, if set to OnFailure or Never, a job is created for this pod and \-\-replicas must be 1. Default 'Always'
|
||||
The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and \-\-replicas must be 1. Default 'Always'
|
||||
|
||||
.PP
|
||||
\fB\-\-rm\fP=false
|
||||
@ -256,7 +256,7 @@ $ kubectl run nginx \-\-image=nginx \-\-replicas=5
|
||||
# Dry run. Print the corresponding API objects without creating them.
|
||||
$ kubectl run nginx \-\-image=nginx \-\-dry\-run
|
||||
|
||||
# Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
|
||||
# Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
|
||||
$ kubectl run nginx \-\-image=nginx \-\-overrides='{ "apiVersion": "v1", "spec": { ... } }'
|
||||
|
||||
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
|
||||
|
@ -39,7 +39,6 @@ Documentation for other releases can be found at
|
||||
|
||||
- [Deployments](#deployments)
|
||||
- [What is a _Deployment_?](#what-is-a-deployment)
|
||||
- [Enabling Deployments on a Kubernetes cluster](#enabling-deployments-on-a-kubernetes-cluster)
|
||||
- [Creating a Deployment](#creating-a-deployment)
|
||||
- [Updating a Deployment](#updating-a-deployment)
|
||||
- [Multiple Updates](#multiple-updates)
|
||||
@ -70,21 +69,6 @@ A typical use case is:
|
||||
* Create a Deployment to bring up a replication controller and pods.
|
||||
* Later, update that Deployment to recreate the pods (for example, to use a new image).
|
||||
|
||||
## Enabling Deployments on a Kubernetes cluster
|
||||
|
||||
Deployment objects are part of the [`extensions` API Group](../api.md#api-groups) and this feature
|
||||
is not enabled by default.
|
||||
Set `--runtime-config=extensions/v1beta1/deployments=true` on the API server to
|
||||
enable it.
|
||||
This can be achieved by exporting `KUBE_ENABLE_DEPLOYMENTS=true` before running the
|
||||
`kube-up.sh` script on GCE.
|
||||
|
||||
Note that Deployment objects effectively have [API version
|
||||
`v1alpha1`](../api.md#api-versioning).
|
||||
Alpha objects may change or even be discontinued in future software releases.
|
||||
However, due to to a known issue, they will appear as API version `v1beta1` if
|
||||
enabled.
|
||||
|
||||
## Creating a Deployment
|
||||
|
||||
Here is an example Deployment. It creates a replication controller to
|
||||
|
@ -40,7 +40,7 @@ Run a particular image on the cluster.
|
||||
|
||||
|
||||
Create and run a particular image, possibly replicated.
|
||||
Creates a replication controller or job to manage the created container(s).
|
||||
Creates a deployment or job to manage the created container(s).
|
||||
|
||||
```
|
||||
kubectl run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]
|
||||
@ -64,7 +64,7 @@ $ kubectl run nginx --image=nginx --replicas=5
|
||||
# Dry run. Print the corresponding API objects without creating them.
|
||||
$ kubectl run nginx --image=nginx --dry-run
|
||||
|
||||
# Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
|
||||
# Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
|
||||
$ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
|
||||
|
||||
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
|
||||
@ -88,7 +88,7 @@ $ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'pri
|
||||
--dry-run[=false]: If true, only print the object that would be sent, without sending it.
|
||||
--env=[]: Environment variables to set in the container
|
||||
--expose[=false]: If true, a public, external service is created for the container(s) which are run
|
||||
--generator="": The name of the API generator to use. Default is 'run/v1' if --restart=Always, otherwise the default is 'job/v1beta1'.
|
||||
--generator="": The name of the API generator to use. Default is 'deployment/v1beta1' if --restart=Always, otherwise the default is 'job/v1beta1'.
|
||||
--hostport=-1: The host port mapping for the container port. To demonstrate a single-machine container.
|
||||
--image="": The image for the container to run.
|
||||
-l, --labels="": Labels to apply to the pod(s).
|
||||
@ -102,7 +102,7 @@ $ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'pri
|
||||
--record[=false]: Record current kubectl command in the resource annotation.
|
||||
-r, --replicas=1: Number of replicas to create for this container. Default is 1.
|
||||
--requests="": The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'
|
||||
--restart="Always": The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a replication controller is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'
|
||||
--restart="Always": The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'
|
||||
--rm[=false]: If true, delete resources created in this command for attached containers.
|
||||
--save-config[=false]: If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future.
|
||||
--service-generator="service/v2": The name of the generator to use for creating a service. Only used if --expose is true
|
||||
@ -147,7 +147,7 @@ $ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'pri
|
||||
|
||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||
|
||||
###### Auto generated by spf13/cobra on 22-Jan-2016
|
||||
###### Auto generated by spf13/cobra on 2-Feb-2016
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||
[]()
|
||||
|
@ -178,8 +178,6 @@ func Up() bool {
|
||||
}
|
||||
}
|
||||
|
||||
// Enable deployments for e2e tests.
|
||||
os.Setenv("KUBE_ENABLE_DEPLOYMENTS", "true")
|
||||
return finishRunning("up", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-up.sh")))
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,6 @@ function configure_upgrade_step() {
|
||||
if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then
|
||||
KUBE_GCE_INSTANCE_PREFIX="$cluster_name"
|
||||
NUM_NODES=5
|
||||
KUBE_ENABLE_DEPLOYMENTS=true
|
||||
KUBE_ENABLE_DAEMONSETS=true
|
||||
fi
|
||||
|
||||
@ -230,7 +229,6 @@ case ${JOB_NAME} in
|
||||
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=\[Slow\]|\[Serial\]|\[Disruptive\]|\[Flaky\]|\[Feature:.+\]|\[Skipped\]"}
|
||||
: ${KUBE_GCE_INSTANCE_PREFIX:="e2e-gce-${NODE_NAME}-${EXECUTOR_NUMBER}"}
|
||||
: ${PROJECT:="kubernetes-jenkins-pull"}
|
||||
: ${ENABLE_DEPLOYMENTS:=true}
|
||||
# Override GCE defaults
|
||||
NUM_NODES=${NUM_NODES_PARALLEL}
|
||||
;;
|
||||
@ -248,7 +246,6 @@ case ${JOB_NAME} in
|
||||
: ${GINKGO_PARALLEL:="y"}
|
||||
: ${KUBE_GCE_INSTANCE_PREFIX="e2e-gce"}
|
||||
: ${PROJECT:="k8s-jkns-e2e-gce"}
|
||||
: ${ENABLE_DEPLOYMENTS:=true}
|
||||
: ${FAIL_ON_GCP_RESOURCE_LEAK:="true"}
|
||||
;;
|
||||
|
||||
@ -393,7 +390,6 @@ case ${JOB_NAME} in
|
||||
: ${GINKGO_PARALLEL:="y"}
|
||||
: ${KUBE_GCE_INSTANCE_PREFIX="e2e-aws"}
|
||||
: ${PROJECT:="k8s-jkns-e2e-aws"}
|
||||
: ${ENABLE_DEPLOYMENTS:=true}
|
||||
: ${AWS_CONFIG_FILE:='/var/lib/jenkins/.aws/credentials'}
|
||||
: ${AWS_SSH_KEY:='/var/lib/jenkins/.ssh/kube_aws_rsa'}
|
||||
: ${KUBE_SSH_USER:='ubuntu'}
|
||||
@ -439,7 +435,6 @@ case ${JOB_NAME} in
|
||||
: ${KUBE_GCE_INSTANCE_PREFIX:="e2e-autoscaling"}
|
||||
: ${PROJECT:="k8s-jnks-e2e-gce-autoscaling"}
|
||||
: ${FAIL_ON_GCP_RESOURCE_LEAK:="true"}
|
||||
: ${ENABLE_DEPLOYMENTS:=true}
|
||||
# Override GCE default for cluster size autoscaling purposes.
|
||||
ENABLE_CLUSTER_MONITORING="googleinfluxdb"
|
||||
ADMISSION_CONTROL="NamespaceLifecycle,InitialResources,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
|
||||
@ -798,7 +793,6 @@ case ${JOB_NAME} in
|
||||
: ${GINKGO_TEST_ARGS:="--ginkgo.focus=\[Feature:Upgrade\].*upgrade-master --upgrade-target=${CURRENT_RELEASE_PUBLISHED_VERSION}"}
|
||||
: ${KUBE_GCE_INSTANCE_PREFIX:="e2e-upgrade-1-0"}
|
||||
: ${NUM_NODES:=5}
|
||||
: ${KUBE_ENABLE_DEPLOYMENTS:=true}
|
||||
: ${KUBE_ENABLE_DAEMONSETS:=true}
|
||||
;;
|
||||
|
||||
@ -831,7 +825,6 @@ case ${JOB_NAME} in
|
||||
: ${GINKGO_TEST_ARGS:="--ginkgo.focus=\[Feature:Upgrade\].*upgrade-cluster --upgrade-target=${CURRENT_RELEASE_PUBLISHED_VERSION}"}
|
||||
: ${KUBE_GCE_INSTANCE_PREFIX:="e2e-upgrade-1-0"}
|
||||
: ${NUM_NODES:=5}
|
||||
: ${KUBE_ENABLE_DEPLOYMENTS:=true}
|
||||
: ${KUBE_ENABLE_DAEMONSETS:=true}
|
||||
;;
|
||||
|
||||
|
@ -188,7 +188,6 @@ KUBE_API_VERSIONS="v1,extensions/v1beta1" "${KUBE_OUTPUT_HOSTBIN}/kube-apiserver
|
||||
--kubelet-port=${KUBELET_PORT} \
|
||||
--runtime-config=api/v1 \
|
||||
--cert-dir="${TMPDIR:-/tmp/}" \
|
||||
--runtime_config="extensions/v1beta1/deployments=true" \
|
||||
--service-cluster-ip-range="10.0.0.0/24" 1>&2 &
|
||||
APISERVER_PID=$!
|
||||
|
||||
|
@ -92,7 +92,6 @@ hack/jenkins/update-jobs.sh: # jenkins_jobs.ini contains administrative credent
|
||||
hack/jenkins/update-jobs.sh: if [[ -e jenkins_jobs.ini ]]; then
|
||||
hack/local-up-cluster.sh: runtime_config="--runtime-config=${RUNTIME_CONFIG}"
|
||||
hack/local-up-cluster.sh: runtime_config=""
|
||||
hack/test-cmd.sh: --runtime_config="extensions/v1beta1/deployments=true" \
|
||||
pkg/kubelet/qos/memory_policy_test.go: t.Errorf("oom_score_adj should be between %d and %d, but was %d", test.lowOOMScoreAdj, test.highOOMScoreAdj, oomScoreAdj)
|
||||
pkg/kubelet/qos/memory_policy_test.go: highOOMScoreAdj int // The min oom_score_adj score the container should be assigned.
|
||||
pkg/kubelet/qos/memory_policy_test.go: lowOOMScoreAdj int // The max oom_score_adj score the container should be assigned.
|
||||
|
@ -34,7 +34,7 @@ import (
|
||||
|
||||
const (
|
||||
run_long = `Create and run a particular image, possibly replicated.
|
||||
Creates a replication controller or job to manage the created container(s).`
|
||||
Creates a deployment or job to manage the created container(s).`
|
||||
run_example = `# Start a single instance of nginx.
|
||||
$ kubectl run nginx --image=nginx
|
||||
|
||||
@ -50,7 +50,7 @@ $ kubectl run nginx --image=nginx --replicas=5
|
||||
# Dry run. Print the corresponding API objects without creating them.
|
||||
$ kubectl run nginx --image=nginx --dry-run
|
||||
|
||||
# Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
|
||||
# Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
|
||||
$ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
|
||||
|
||||
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
|
||||
@ -88,8 +88,7 @@ func NewCmdRun(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *c
|
||||
}
|
||||
|
||||
func addRunFlags(cmd *cobra.Command) {
|
||||
// TODO: Change the default to "deployment/v1beta1" (which is a valid generator) when deployment reaches beta (#15313)
|
||||
cmd.Flags().String("generator", "", "The name of the API generator to use. Default is 'run/v1' if --restart=Always, otherwise the default is 'job/v1beta1'.")
|
||||
cmd.Flags().String("generator", "", "The name of the API generator to use. Default is 'deployment/v1beta1' if --restart=Always, otherwise the default is 'job/v1beta1'.")
|
||||
cmd.Flags().String("image", "", "The image for the container to run.")
|
||||
cmd.MarkFlagRequired("image")
|
||||
cmd.Flags().IntP("replicas", "r", 1, "Number of replicas to create for this container. Default is 1.")
|
||||
@ -104,7 +103,7 @@ func addRunFlags(cmd *cobra.Command) {
|
||||
cmd.Flags().Bool("tty", false, "Allocated a TTY for each container in the pod. Because -t is currently shorthand for --template, -t is not supported for --tty. This shorthand is deprecated and we expect to adopt -t for --tty soon.")
|
||||
cmd.Flags().Bool("attach", false, "If true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...' were called. Default false, unless '-i/--interactive' is set, in which case the default is true.")
|
||||
cmd.Flags().Bool("leave-stdin-open", false, "If the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach completes.")
|
||||
cmd.Flags().String("restart", "Always", "The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a replication controller is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'")
|
||||
cmd.Flags().String("restart", "Always", "The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'")
|
||||
cmd.Flags().Bool("command", false, "If true and extra arguments are present, use them as the 'command' field in the container, rather than the 'args' field which is the default.")
|
||||
cmd.Flags().String("requests", "", "The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'")
|
||||
cmd.Flags().String("limits", "", "The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'")
|
||||
@ -147,9 +146,8 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob
|
||||
|
||||
generatorName := cmdutil.GetFlagString(cmd, "generator")
|
||||
if len(generatorName) == 0 {
|
||||
// TODO: Change the default to "deployment/v1beta1" when deployment reaches beta (#15313)
|
||||
if restartPolicy == api.RestartPolicyAlways {
|
||||
generatorName = "run/v1"
|
||||
generatorName = "deployment/v1beta1"
|
||||
} else {
|
||||
generatorName = "job/v1beta1"
|
||||
}
|
||||
|
@ -160,6 +160,7 @@ func TestRunArgsFollowDashRules(t *testing.T) {
|
||||
tf.ClientConfig = &client.Config{}
|
||||
cmd := NewCmdRun(f, os.Stdin, os.Stdout, os.Stderr)
|
||||
cmd.Flags().Set("image", "nginx")
|
||||
cmd.Flags().Set("generator", "run/v1")
|
||||
err := Run(f, os.Stdin, os.Stdout, os.Stderr, cmd, test.args, test.argsLenAtDash)
|
||||
if test.expectError && err == nil {
|
||||
t.Errorf("unexpected non-error (%s)", test.name)
|
||||
|
@ -574,7 +574,7 @@ func (m *Master) thirdpartyapi(group, kind, version string) *apiserver.APIGroupV
|
||||
// getExperimentalResources returns the resources for extenstions api
|
||||
func (m *Master) getExtensionResources(c *Config) map[string]rest.Storage {
|
||||
// All resources except these are disabled by default.
|
||||
enabledResources := sets.NewString("horizontalpodautoscalers", "ingresses", "jobs", "replicasets")
|
||||
enabledResources := sets.NewString("horizontalpodautoscalers", "ingresses", "jobs", "replicasets", "deployments")
|
||||
resourceOverrides := m.ApiGroupVersionOverrides["extensions/v1beta1"].ResourceOverrides
|
||||
isEnabled := func(resource string) bool {
|
||||
// Check if the resource has been overriden.
|
||||
|
@ -870,7 +870,7 @@ var _ = Describe("Kubectl client", func() {
|
||||
image := "nginx"
|
||||
|
||||
By("running the image " + image)
|
||||
runKubectlOrDie("run", rcName, "--image="+image, nsFlag)
|
||||
runKubectlOrDie("run", rcName, "--image="+image, "--generator=run/v1", nsFlag)
|
||||
By("verifying the rc " + rcName + " was created")
|
||||
rc, err := c.ReplicationControllers(ns).Get(rcName)
|
||||
if err != nil {
|
||||
@ -896,6 +896,49 @@ var _ = Describe("Kubectl client", func() {
|
||||
|
||||
})
|
||||
|
||||
Describe("Kubectl run deployment", func() {
|
||||
var nsFlag string
|
||||
var dName string
|
||||
|
||||
BeforeEach(func() {
|
||||
nsFlag = fmt.Sprintf("--namespace=%v", ns)
|
||||
dName = "e2e-test-nginx-deployment"
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
runKubectlOrDie("delete", "deployment", dName, nsFlag)
|
||||
})
|
||||
|
||||
It("should create a deployment from an image [Conformance]", func() {
|
||||
image := "nginx"
|
||||
|
||||
By("running the image " + image)
|
||||
runKubectlOrDie("run", dName, "--image="+image, nsFlag)
|
||||
By("verifying the deployment " + dName + " was created")
|
||||
d, err := c.Extensions().Deployments(ns).Get(dName)
|
||||
if err != nil {
|
||||
Failf("Failed getting deployment %s: %v", dName, err)
|
||||
}
|
||||
containers := d.Spec.Template.Spec.Containers
|
||||
if containers == nil || len(containers) != 1 || containers[0].Image != image {
|
||||
Failf("Failed creating deployment %s for 1 pod with expected image %s", dName, image)
|
||||
}
|
||||
|
||||
By("verifying the pod controlled by deployment " + dName + " was created")
|
||||
label := labels.SelectorFromSet(labels.Set(map[string]string{"run": dName}))
|
||||
podlist, err := waitForPodsWithLabel(c, ns, label)
|
||||
if err != nil {
|
||||
Failf("Failed getting pod controlled by deployment %s: %v", dName, err)
|
||||
}
|
||||
pods := podlist.Items
|
||||
if pods == nil || len(pods) != 1 || len(pods[0].Spec.Containers) != 1 || pods[0].Spec.Containers[0].Image != image {
|
||||
runKubectlOrDie("get", "pods", "-L", "run", nsFlag)
|
||||
Failf("Failed creating 1 pod with expected image %s. Number of pods = %v", image, len(pods))
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Describe("Kubectl run job", func() {
|
||||
var nsFlag string
|
||||
var jobName string
|
||||
|
Loading…
Reference in New Issue
Block a user