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
4523ce8f
Commit
4523ce8f
authored
Nov 01, 2016
by
Zihong Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a test for apply --prune --prune-whitelist
parent
af048bdb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
test-cmd.sh
hack/make-rules/test-cmd.sh
+18
-0
svc.yaml
hack/testdata/prune/svc.yaml
+12
-0
No files found.
hack/make-rules/test-cmd.sh
View file @
4523ce8f
...
@@ -1138,6 +1138,24 @@ __EOF__
...
@@ -1138,6 +1138,24 @@ __EOF__
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kubectl delete pvc b-pvc 2>&1
"
${
kube_flags
[@]
}
"
kubectl delete pvc b-pvc 2>&1
"
${
kube_flags
[@]
}
"
## kubectl apply --prune --prune-whitelist(-w)
# Pre-Condition: no POD exists
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# apply pod a
kubectl apply
--prune
-l
prune-group
=
true
-f
hack/testdata/prune/a.yaml
"
${
kube_flags
[@]
}
"
# check right pod exists
kube::test::get_object_assert
'pods a'
"{{
${
id_field
}
}}"
'a'
# apply svc and don't prune pod a by overwriting whitelist
kubectl apply
--prune
-l
prune-group
=
true
-f
hack/testdata/prune/svc.yaml
-w
core/v1/Service 2>&1
"
${
kube_flags
[@]
}
"
kube::test::get_object_assert
'service prune-svc'
"{{
${
id_field
}
}}"
'prune-svc'
kube::test::get_object_assert
'pods a'
"{{
${
id_field
}
}}"
'a'
# apply svc and prune pod a with default whitelist
kubectl apply
--prune
-l
prune-group
=
true
-f
hack/testdata/prune/svc.yaml 2>&1
"
${
kube_flags
[@]
}
"
kube::test::get_object_assert
'service prune-svc'
"{{
${
id_field
}
}}"
'prune-svc'
kube::test::get_object_assert pods
"{{range.items}}{{
$id_field
}}:{{end}}"
''
# cleanup
kubectl delete svc prune-svc 2>&1
"
${
kube_flags
[@]
}
"
## kubectl run should create deployments or jobs
## kubectl run should create deployments or jobs
# Pre-Condition: no Job exists
# Pre-Condition: no Job exists
kube::test::get_object_assert
jobs
"{{range.items}}{{
$id_field
}}:{{end}}"
''
kube::test::get_object_assert
jobs
"{{range.items}}{{
$id_field
}}:{{end}}"
''
...
...
hack/testdata/prune/svc.yaml
0 → 100644
View file @
4523ce8f
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
prune-svc
labels
:
prune-group
:
"
true"
spec
:
selector
:
prune-group-nomatch
:
"
true"
ports
:
-
port
:
80
protocol
:
TCP
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