-
Notifications
You must be signed in to change notification settings - Fork 716
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an e2etest to verify clean pod policy in TF job operator (#795)
* Add jsonnet Fix syntax Params.libsonnet Add jsonnet Fix import Fix syntax Debug: no teardown Fix component name Add cleanup policy check Revert some changes Fix a few things Fix format Fix format * Modify images in test jsonnet * Add tests for cleanPodPolicy = Running and None * Fix tests; refactor code * Fix tests * Add comments to jsonnet files
- Loading branch information
1 parent
e63ea46
commit 037e915
Showing
6 changed files
with
353 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Tests that when cleanPodPolicy is set to "All", all of the pods are deleted | ||
// when the TFJob completes. | ||
local params = std.extVar("__ksonnet/params").components.clean_pod_all; | ||
|
||
local k = import "k.libsonnet"; | ||
|
||
local parts(namespace, name, image) = { | ||
job:: { | ||
apiVersion: "kubeflow.org/v1alpha2", | ||
kind: "TFJob", | ||
metadata: { | ||
name: name, | ||
namespace: namespace, | ||
}, | ||
spec: { | ||
cleanPodPolicy: "All", | ||
tfReplicaSpecs: { | ||
Chief: { | ||
replicas: 1, | ||
restartPolicy: "Never", | ||
template: { | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "tensorflow", | ||
image: "ubuntu", | ||
command: [ | ||
"echo", | ||
"Hello", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
PS: { | ||
replicas: 2, | ||
restartPolicy: "Never", | ||
template: { | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "tensorflow", | ||
image: "ubuntu", | ||
command: [ | ||
"tail", | ||
"-f", | ||
"/dev/null", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
Worker: { | ||
replicas: 4, | ||
restartPolicy: "Never", | ||
template: { | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "tensorflow", | ||
image: "ubuntu", | ||
command: [ | ||
"echo", | ||
"Hello", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
std.prune(k.core.v1.list.new([parts(params.namespace, params.name, params.image).job])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Tests that when cleanPodPolicy is set to "None", none of the pods are deleted | ||
// when the TFJob completes. | ||
|
||
local params = std.extVar("__ksonnet/params").components.clean_pod_none; | ||
|
||
local k = import "k.libsonnet"; | ||
|
||
local parts(namespace, name, image) = { | ||
job:: { | ||
apiVersion: "kubeflow.org/v1alpha2", | ||
kind: "TFJob", | ||
metadata: { | ||
name: name, | ||
namespace: namespace, | ||
}, | ||
spec: { | ||
cleanPodPolicy: "None", | ||
tfReplicaSpecs: { | ||
Chief: { | ||
replicas: 1, | ||
restartPolicy: "Never", | ||
template: { | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "tensorflow", | ||
image: "ubuntu", | ||
command: [ | ||
"echo", | ||
"Hello", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
PS: { | ||
replicas: 2, | ||
restartPolicy: "Never", | ||
template: { | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "tensorflow", | ||
image: "ubuntu", | ||
command: [ | ||
"tail", | ||
"-f", | ||
"/dev/null", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
Worker: { | ||
replicas: 4, | ||
restartPolicy: "Never", | ||
template: { | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "tensorflow", | ||
image: "ubuntu", | ||
command: [ | ||
"echo", | ||
"Hello", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
std.prune(k.core.v1.list.new([parts(params.namespace, params.name, params.image).job])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Tests that when cleanPodPolicy is set to "Running", only the Running pods are deleted | ||
// when the TFJob completes. The completed pods will not be deleted. | ||
local params = std.extVar("__ksonnet/params").components.clean_pod_running; | ||
|
||
local k = import "k.libsonnet"; | ||
|
||
local parts(namespace, name, image) = { | ||
job:: { | ||
apiVersion: "kubeflow.org/v1alpha2", | ||
kind: "TFJob", | ||
metadata: { | ||
name: name, | ||
namespace: namespace, | ||
}, | ||
spec: { | ||
cleanPodPolicy: "Running", | ||
tfReplicaSpecs: { | ||
Chief: { | ||
replicas: 1, | ||
restartPolicy: "Never", | ||
template: { | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "tensorflow", | ||
image: "ubuntu", | ||
command: [ | ||
"echo", | ||
"Hello", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
PS: { | ||
replicas: 2, | ||
restartPolicy: "Never", | ||
template: { | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "tensorflow", | ||
image: "ubuntu", | ||
command: [ | ||
"tail", | ||
"-f", | ||
"/dev/null", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
Worker: { | ||
replicas: 4, | ||
restartPolicy: "Never", | ||
template: { | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "tensorflow", | ||
image: "ubuntu", | ||
command: [ | ||
"echo", | ||
"Hello", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
std.prune(k.core.v1.list.new([parts(params.namespace, params.name, params.image).job])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.