mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Handle TERM signal to reduce pod terminating time.
This commit is contained in:
parent
09c9ecd3fd
commit
55bc8d74a2
@ -231,7 +231,7 @@ func CreateDeployment(client clientset.Interface, replicas int32, podLabels map[
|
|||||||
// name. A slice of BASH commands can be supplied as args to be run by the pod
|
// name. A slice of BASH commands can be supplied as args to be run by the pod
|
||||||
func MakeDeployment(replicas int32, podLabels map[string]string, nodeSelector map[string]string, namespace string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) *extensions.Deployment {
|
func MakeDeployment(replicas int32, podLabels map[string]string, nodeSelector map[string]string, namespace string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) *extensions.Deployment {
|
||||||
if len(command) == 0 {
|
if len(command) == 0 {
|
||||||
command = "while true; do sleep 1; done"
|
command = "trap exit TERM; while true; do sleep 1; done"
|
||||||
}
|
}
|
||||||
zero := int64(0)
|
zero := int64(0)
|
||||||
deploymentName := "deployment-" + string(uuid.NewUUID())
|
deploymentName := "deployment-" + string(uuid.NewUUID())
|
||||||
|
@ -815,7 +815,7 @@ func MakeWritePod(ns string, pvc *v1.PersistentVolumeClaim) *v1.Pod {
|
|||||||
// name. A slice of BASH commands can be supplied as args to be run by the pod
|
// name. A slice of BASH commands can be supplied as args to be run by the pod
|
||||||
func MakePod(ns string, nodeSelector map[string]string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) *v1.Pod {
|
func MakePod(ns string, nodeSelector map[string]string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) *v1.Pod {
|
||||||
if len(command) == 0 {
|
if len(command) == 0 {
|
||||||
command = "while true; do sleep 1; done"
|
command = "trap exit TERM; while true; do sleep 1; done"
|
||||||
}
|
}
|
||||||
podSpec := &v1.Pod{
|
podSpec := &v1.Pod{
|
||||||
TypeMeta: metav1.TypeMeta{
|
TypeMeta: metav1.TypeMeta{
|
||||||
@ -902,7 +902,7 @@ func MakeNginxPod(ns string, nodeSelector map[string]string, pvclaims []*v1.Pers
|
|||||||
// SELinux testing requires to pass HostIPC and HostPID as booleansi arguments.
|
// SELinux testing requires to pass HostIPC and HostPID as booleansi arguments.
|
||||||
func MakeSecPod(ns string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64) *v1.Pod {
|
func MakeSecPod(ns string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64) *v1.Pod {
|
||||||
if len(command) == 0 {
|
if len(command) == 0 {
|
||||||
command = "while true; do sleep 1; done"
|
command = "trap exit TERM; while true; do sleep 1; done"
|
||||||
}
|
}
|
||||||
podName := "security-context-" + string(uuid.NewUUID())
|
podName := "security-context-" + string(uuid.NewUUID())
|
||||||
if fsGroup == nil {
|
if fsGroup == nil {
|
||||||
|
@ -3472,7 +3472,7 @@ func newExecPodSpec(ns, generateName string) *v1.Pod {
|
|||||||
{
|
{
|
||||||
Name: "exec",
|
Name: "exec",
|
||||||
Image: BusyBoxImage,
|
Image: BusyBoxImage,
|
||||||
Command: []string{"sh", "-c", "while true; do sleep 5; done"},
|
Command: []string{"sh", "-c", "trap exit TERM; while true; do sleep 5; done"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user