Skip to content

Commit

Permalink
Add first redmine/ruby application yaml to evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
vutuong committed Jan 26, 2021
1 parent bc9800e commit 6800856
Show file tree
Hide file tree
Showing 19 changed files with 322 additions and 10 deletions.
7 changes: 4 additions & 3 deletions api-server/endpoints/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ type from struct{}
func (c *from) Object(pm *v1.Podmigration) *Podmigration {
return &Podmigration{
Name: pm.Name,
Replicas: pm.Spec.Replicas,
Selector: pm.Spec.Selector,
Action: pm.Spec.Action,
SnapshotPath: pm.Spec.SnapshotPath,
Replicas: pm.Spec.Replicas,
SourcePod: pm.Spec.SourcePod,
DestHost: pm.Spec.DestHost,
SnapshotPath: pm.Spec.SnapshotPath,
Selector: pm.Spec.Selector,
Status: &pm.Status,
}
}
Expand Down
8 changes: 3 additions & 5 deletions api-server/endpoints/podmigration.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,8 @@ func (pe *PodmigrationEndpoint) create(request *restful.Request, response *restf
pm := new(Podmigration)
err := request.ReadEntity(pm)
pm.Action = strings.ToLower(pm.Action)
// fmt.Println("Calling an action: - %v", pm.Action)
fmt.Println(pm)
fmt.Println(pm.Action)
fmt.Println(pm.SourcePod)
fmt.Println(pm)
fmt.Println("what the hell")
if err != nil {
writeError(response, 400, Error{
Title: "Bad Request",
Expand Down Expand Up @@ -149,10 +146,11 @@ func (pe *PodmigrationEndpoint) create(request *restful.Request, response *restf
ObjectMeta: metav1.ObjectMeta{Name: pm.Name, Namespace: "default"},
Spec: v1.PodmigrationSpec{
Replicas: pm.Replicas,
SourcePod: pm.SourcePod,
DestHost: pm.DestHost,
Selector: pm.Selector,
Action: pm.Action,
SnapshotPath: pm.SnapshotPath,
SourcePod: pm.SourcePod,
Template: template,
},
}
Expand Down
34 changes: 34 additions & 0 deletions config/samples/checkpoint-example/eval.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# RUBY application
dcn@dcn:~/podmigration-operator/config/samples/checkpoint-example$ bash test2.sh
pod/red created

real 0m5.245s
user 0m0.121s
sys 0m0.085s
pod "red" deleted
dcn@dcn:~/podmigration-operator/config/samples/checkpoint-example$ kubectl get pods
No resources found in default namespace.
dcn@dcn:~/podmigration-operator/config/samples/checkpoint-example$ bash test.sh
pod/tuongvx created

real 0m40.275s
user 0m23.235s
sys 0m9.541s

# Redmine application
dcn@dcn:~/podmigration-operator/config/samples/checkpoint-example$ bash test.sh
pod/tuongvx created

real 0m12.536s
user 0m4.649s
sys 0m1.916s
Operation cannot be fulfilled on pods "tuongvx": the object has been modified; please apply your changes to the latest version and try again
pod "tuongvx" deleted

dcn@dcn:~/podmigration-operator/config/samples/checkpoint-example$ bash test2.sh
pod/red created

real 0m6.345s
user 0m0.146s
sys 0m0.072s
pod "red" deleted
26 changes: 26 additions & 0 deletions config/samples/checkpoint-example/jenkin-restore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v1
kind: Pod
metadata:
name: jenkins-restore
labels:
app: redmineapp
annotations:
snapshotPolicy: "restore"
snapshotPath: "/var/lib/kubelet/migration/xxx/tuongvx"
spec:
containers:
- name: tuong
image: jenkins/jenkins:lts
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 50000
volumeMounts:
- name: nfs-tmp
mountPath: /tmp
nodeSelector:
kubernetes.io/hostname: worker1
volumes:
- name: nfs-tmp
hostPath:
path: /var/lib/kubelet/migration/jenkins
11 changes: 11 additions & 0 deletions config/samples/checkpoint-example/jenkin-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: jenkins-service
spec:
type: NodePort
selector:
app: redmineapp
ports:
- port: 8080
targetPort: 8080
26 changes: 26 additions & 0 deletions config/samples/checkpoint-example/jenkin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v1
kind: Pod
metadata:
name: tuongvx
labels:
app: redmineapp
#annotations:
#snapshotPolicy: "checkpoint"
#snapshotPath: "/var/lib/kubelet/migration/abc"
spec:
containers:
- name: tuong
image: jenkins/jenkins:lts
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 50000
volumeMounts:
- name: nfs-tmp
mountPath: /tmp
nodeSelector:
kubernetes.io/hostname: worker1
volumes:
- name: nfs-tmp
hostPath:
path: /var/lib/kubelet/migration/jenkins
56 changes: 56 additions & 0 deletions config/samples/checkpoint-example/redmine-restore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
kind: Pod
metadata:
name: red
labels:
app: redmineapp
annotations:
snapshotPolicy: "restore"
snapshotPath: "/var/lib/kubelet/migration/ooo/tuongvx"
spec:
containers:
- name: tuong
image: tuongvx/redmine
ports:
- containerPort: 3000
protocol: TCP
volumeMounts:
# name must match the volume name below
- name: nfs-log
mountPath: /usr/src/redmine/log
- name: nfs-files
mountPath: /usr/src/redmine/files
# - name: nfs-publib
# mountPath: /usr/src/redmine/publib
# - name: nfs-plugins
# mountPath: /usr/src/redmine/plugins
# - name: nfs-public
# mountPath: /usr/src/redmine/public
- name: nfs-sqlite
mountPath: /usr/src/redmine/sqlite
volumes:
- name: nfs-log
hostPath:
path: /var/lib/kubelet/migration/redmine/log
type: Directory
- name: nfs-files
hostPath:
path: /var/lib/kubelet/migration/redmine/files
type: Directory
# - name: nfs-publib
# hostPath:
# path: /var/lib/kubelet/migration/redmine/publib
# type: Directory
# - name: nfs-plugins
# hostPath:
# path: /var/lib/kubelet/migration/redmine/plugins
# type: Directory
# - name: nfs-public
# hostPath:
# path: /var/lib/kubelet/migration/redmine/public
# type: Directory
- name: nfs-sqlite
hostPath:
path: /var/lib/kubelet/migration/redmine/sqlite
nodeSelector:
kubernetes.io/hostname: worker1
11 changes: 11 additions & 0 deletions config/samples/checkpoint-example/redmine-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: redmine-service
spec:
type: NodePort
selector:
app: redmineapp
ports:
- port: 3000
targetPort: 3000
57 changes: 57 additions & 0 deletions config/samples/checkpoint-example/redmine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: v1
kind: Pod
metadata:
name: tuongvx
labels:
app: redmineapp
#annotations:
#snapshotPolicy: "checkpoint"
#snapshotPath: "/var/lib/kubelet/migration/abc"
spec:
containers:
- name: tuong
image: tuongvx/redmine
imagePullPolicy: Always
ports:
- containerPort: 3000
protocol: TCP
volumeMounts:
# name must match the volume name below
- name: nfs-log
mountPath: /usr/src/redmine/log
- name: nfs-files
mountPath: /usr/src/redmine/files
# - name: nfs-publib
# mountPath: /usr/src/redmine/publib
# - name: nfs-plugins
# mountPath: /usr/src/redmine/plugins
# - name: nfs-public
# mountPath: /usr/src/redmine/public
- name: nfs-sqlite
mountPath: /usr/src/redmine/sqlite
volumes:
- name: nfs-log
hostPath:
path: /var/lib/kubelet/migration/redmine/log
type: Directory
- name: nfs-files
hostPath:
path: /var/lib/kubelet/migration/redmine/files
type: Directory
# - name: nfs-publib
# hostPath:
# path: /var/lib/kubelet/migration/redmine/publib
# type: Directory
# - name: nfs-plugins
# hostPath:
# path: /var/lib/kubelet/migration/redmine/plugins
# type: Directory
# - name: nfs-public
# hostPath:
# path: /var/lib/kubelet/migration/redmine/public
# type: Directory
- name: nfs-sqlite
hostPath:
path: /var/lib/kubelet/migration/redmine/sqlite
nodeSelector:
kubernetes.io/hostname: worker1
18 changes: 18 additions & 0 deletions config/samples/checkpoint-example/ruby-restore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Pod
metadata:
name: red
labels:
app: rubyapp
annotations:
snapshotPolicy: "restore"
snapshotPath: "/var/lib/kubelet/migration/fff/tuongvx"
spec:
containers:
- name: tuong
image: tylerfowler/superset
ports:
- containerPort: 8088
protocol: TCP
nodeSelector:
kubernetes.io/hostname: worker1
11 changes: 11 additions & 0 deletions config/samples/checkpoint-example/ruby-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: ruby-service
spec:
type: NodePort
selector:
app: rubyapp
ports:
- port: 8088
targetPort: 8088
18 changes: 18 additions & 0 deletions config/samples/checkpoint-example/ruby.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Pod
metadata:
name: tuongvx
labels:
app: rubyapp
#annotations:
#snapshotPolicy: "checkpoint"
#snapshotPath: "/var/lib/kubelet/migration/abc"
spec:
containers:
- name: tuong
image: tylerfowler/superset
ports:
- containerPort: 8088
protocol: TCP
nodeSelector:
kubernetes.io/hostname: worker1
16 changes: 16 additions & 0 deletions config/samples/checkpoint-example/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# # test1 with Redmine
# kubectl apply -f redmine.yaml
# time (while ! curl http://192.168.10.13:31764/ > /dev/null 2>&1; do : ; done )
# kubectl checkpoint tuongvx /var/lib/kubelet/migration/ooo
# kubectl delete -f redmine.yaml

# # test with Web Rail application
# kubectl apply -f ruby.yaml
# time (while ! curl http://192.168.10.13:30087/ > /dev/null 2>&1; do : ; done ) > eval.txt
# kubectl checkpoint tuongvx /var/lib/kubelet/migration/fff
# kubectl delete -f ruby.yaml

kubectl apply -f video.yaml
time (while ! curl http://192.168.10.13:31764/ > /dev/null 2>&1; do : ; done )
kubectl checkpoint tuongvx /var/lib/kubelet/migration/ooo
kubectl delete -f redmine.yaml
9 changes: 9 additions & 0 deletions config/samples/checkpoint-example/test2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Test1: with Redmine
kubectl apply -f redmine-restore.yaml
time (while ! curl http://192.168.10.13:31764/ > /dev/null 2>&1; do : ; done )
kubectl delete -f redmine-restore.yaml

# Test1: with Redmine
# kubectl apply -f ruby-restore.yaml
# time (while ! curl http://192.168.10.13:30087/ > /dev/null 2>&1; do : ; done )
# kubectl delete -f ruby-restore.yaml
2 changes: 1 addition & 1 deletion config/samples/migration-example/2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ spec:
#args: ["big_buck_bunny.mp4","--loop","--sout", "#transcode{scodec=none}:http{mux=ffmpeg{mux=flv},dst=:8080/}"]
args: ["frozen.mp4","--loop","--sout", "#transcode{scodec=none}:http{mux=ffmpeg{mux=flv},dst=:8080/}"]
nodeSelector:
kubernetes.io/hostname: worker2
kubernetes.io/hostname: worker1
20 changes: 20 additions & 0 deletions config/samples/migration-example/3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Pod
metadata:
name: migration
labels:
app: video
annotations:
snapshotPolicy: "restore"
snapshotPath: "/var/lib/kubelet/migration/ooo/video"
spec:
containers:
- name: vlc
image: tuongvx/vlc-app:latest
ports:
- containerPort: 8080
protocol: TCP
#args: ["big_buck_bunny.mp4","--loop","--sout", "#transcode{scodec=none}:http{mux=ffmpeg{mux=flv},dst=:8080/}"]
args: ["frozen.mp4","--loop","--sout", "#transcode{scodec=none}:http{mux=ffmpeg{mux=flv},dst=:8080/}"]
nodeSelector:
kubernetes.io/hostname: worker2
2 changes: 1 addition & 1 deletion config/samples/migration-example/test2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ spec:
protocol: TCP
#args: ["big_buck_bunny.mp4","--loop","--sout", "#transcode{scodec=none}:http{mux=ffmpeg{mux=flv},dst=:8080/}"]
nodeSelector:
kubernetes.io/hostname: worker1
kubernetes.io/hostname: worker2
Binary file added criu-3.14.tar.bz2
Binary file not shown.
Binary file modified kubectl-plugin/migrate-command/kubectl-migrate
Binary file not shown.

0 comments on commit 6800856

Please sign in to comment.