Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
f441de6b
Commit
f441de6b
authored
Aug 27, 2017
by
zhengjiajin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add bash test for kubectl scale --selector and --all
parent
a24be450
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
0 deletions
+94
-0
test-cmd-util.sh
hack/make-rules/test-cmd-util.sh
+19
-0
scale-deploy-1.yaml
hack/testdata/scale-deploy-1.yaml
+25
-0
scale-deploy-2.yaml
hack/testdata/scale-deploy-2.yaml
+25
-0
scale-deploy-3.yaml
hack/testdata/scale-deploy-3.yaml
+25
-0
No files found.
hack/make-rules/test-cmd-util.sh
View file @
f441de6b
...
@@ -2899,8 +2899,27 @@ run_rs_tests() {
...
@@ -2899,8 +2899,27 @@ run_rs_tests() {
kubectl scale
--current-replicas
=
3
--replicas
=
2 replicasets frontend
"
${
kube_flags
[@]
}
"
kubectl scale
--current-replicas
=
3
--replicas
=
2 replicasets frontend
"
${
kube_flags
[@]
}
"
# Post-condition: 2 replicas
# Post-condition: 2 replicas
kube::test::get_object_assert
'rs frontend'
"{{
$rs_replicas_field
}}"
'2'
kube::test::get_object_assert
'rs frontend'
"{{
$rs_replicas_field
}}"
'2'
# Set up three deploy, two deploy have same label
kubectl create
-f
hack/testdata/scale-deploy-1.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
hack/testdata/scale-deploy-2.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
hack/testdata/scale-deploy-3.yaml
"
${
kube_flags
[@]
}
"
kube::test::get_object_assert
'deploy scale-1'
"{{.spec.replicas}}"
'1'
kube::test::get_object_assert
'deploy scale-2'
"{{.spec.replicas}}"
'1'
kube::test::get_object_assert
'deploy scale-3'
"{{.spec.replicas}}"
'1'
# Test kubectl scale --selector
kubectl scale deploy
--replicas
=
2
-l
run
=
hello
kube::test::get_object_assert
'deploy scale-1'
"{{.spec.replicas}}"
'2'
kube::test::get_object_assert
'deploy scale-2'
"{{.spec.replicas}}"
'2'
kube::test::get_object_assert
'deploy scale-3'
"{{.spec.replicas}}"
'1'
# Test kubectl scale --all
kubectl scale deploy
--replicas
=
3
--all
kube::test::get_object_assert
'deploy scale-1'
"{{.spec.replicas}}"
'3'
kube::test::get_object_assert
'deploy scale-2'
"{{.spec.replicas}}"
'3'
kube::test::get_object_assert
'deploy scale-3'
"{{.spec.replicas}}"
'3'
# Clean-up
# Clean-up
kubectl delete rs frontend
"
${
kube_flags
[@]
}
"
kubectl delete rs frontend
"
${
kube_flags
[@]
}
"
kubectl delete deploy scale-1 scale-2 scale-3
"
${
kube_flags
[@]
}
"
### Expose replica set as service
### Expose replica set as service
kubectl create
-f
hack/testdata/frontend-replicaset.yaml
"
${
kube_flags
[@]
}
"
kubectl create
-f
hack/testdata/frontend-replicaset.yaml
"
${
kube_flags
[@]
}
"
...
...
hack/testdata/scale-deploy-1.yaml
0 → 100644
View file @
f441de6b
apiVersion
:
extensions/v1beta1
kind
:
Deployment
metadata
:
labels
:
run
:
hello
name
:
scale-1
spec
:
replicas
:
1
selector
:
matchLabels
:
run
:
hello
strategy
:
rollingUpdate
:
maxSurge
:
1
maxUnavailable
:
1
type
:
RollingUpdate
template
:
metadata
:
labels
:
run
:
hello
spec
:
containers
:
-
image
:
aronchick/hello-node:2.0
imagePullPolicy
:
IfNotPresent
name
:
hello
hack/testdata/scale-deploy-2.yaml
0 → 100644
View file @
f441de6b
apiVersion
:
extensions/v1beta1
kind
:
Deployment
metadata
:
labels
:
run
:
hello
name
:
scale-2
spec
:
replicas
:
1
selector
:
matchLabels
:
run
:
hello
strategy
:
rollingUpdate
:
maxSurge
:
1
maxUnavailable
:
1
type
:
RollingUpdate
template
:
metadata
:
labels
:
run
:
hello
spec
:
containers
:
-
image
:
aronchick/hello-node:2.0
imagePullPolicy
:
IfNotPresent
name
:
hello
hack/testdata/scale-deploy-3.yaml
0 → 100644
View file @
f441de6b
apiVersion
:
extensions/v1beta1
kind
:
Deployment
metadata
:
labels
:
foo
:
boo
name
:
scale-3
spec
:
replicas
:
1
selector
:
matchLabels
:
run
:
hello
strategy
:
rollingUpdate
:
maxSurge
:
1
maxUnavailable
:
1
type
:
RollingUpdate
template
:
metadata
:
labels
:
run
:
hello
spec
:
containers
:
-
image
:
aronchick/hello-node:2.0
imagePullPolicy
:
IfNotPresent
name
:
hello
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment