From 75b6274c9428ae6635a2d239eab26b98d6eaf992 Mon Sep 17 00:00:00 2001
From: weekface
Date: Wed, 24 Jun 2020 21:11:25 +0800
Subject: [PATCH 1/2] graceful stop tidb
---
docs/api-references/docs.md | 34 +++
manifests/crd.yaml | 204 ++++++++++++++++++
.../pingcap/v1alpha1/openapi_generated.go | 30 ++-
pkg/apis/pingcap/v1alpha1/types.go | 16 ++
.../pingcap/v1alpha1/zz_generated.deepcopy.go | 10 +
pkg/manager/member/tidb_member_manager.go | 14 +-
6 files changed, 304 insertions(+), 4 deletions(-)
diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md
index a5267898f36..4638280d2f6 100644
--- a/docs/api-references/docs.md
+++ b/docs/api-references/docs.md
@@ -10139,6 +10139,40 @@ TiDBConfig
Config is the Configuration of tidb-servers
+
+
+terminationGracePeriodSeconds
+
+int64
+
+ |
+
+(Optional)
+ Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
+Value must be non-negative integer. The value zero indicates delete immediately.
+If this value is nil, the default grace period will be used instead.
+The grace period is the duration in seconds after the processes running in the pod are sent
+a termination signal and the time when the processes are forcibly halted with a kill signal.
+Set this value longer than the expected cleanup time for your process.
+Defaults to 30 seconds.
+ |
+
+
+
+lifecycle
+
+
+Kubernetes core/v1.Lifecycle
+
+
+ |
+
+(Optional)
+ Lifecycle describes actions that the management system should take in response to container lifecycle
+events. For the PostStart and PreStop lifecycle handlers, management of the container blocks
+until the action is complete, unless the container process fails, in which case the handler is aborted.
+ |
+
TiDBStatus
diff --git a/manifests/crd.yaml b/manifests/crd.yaml
index 16bfbd77499..e2a9b5f52af 100644
--- a/manifests/crd.yaml
+++ b/manifests/crd.yaml
@@ -6849,6 +6849,105 @@ spec:
type: string
type: object
type: array
+ lifecycle:
+ properties:
+ postStart:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ preStop:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ type: object
limits:
type: object
maxFailoverCount:
@@ -6936,6 +7035,9 @@ spec:
requests:
type: object
type: object
+ terminationGracePeriodSeconds:
+ format: int64
+ type: integer
tlsClient: {}
tolerations:
items:
@@ -14693,6 +14795,105 @@ spec:
type: string
type: object
type: array
+ lifecycle:
+ properties:
+ postStart:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ preStop:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ type: object
limits:
type: object
maxFailoverCount:
@@ -14780,6 +14981,9 @@ spec:
requests:
type: object
type: object
+ terminationGracePeriodSeconds:
+ format: int64
+ type: integer
tlsClient: {}
tolerations:
items:
diff --git a/pkg/apis/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/pingcap/v1alpha1/openapi_generated.go
index d5cdbf1323b..ce76471ce9b 100644
--- a/pkg/apis/pingcap/v1alpha1/openapi_generated.go
+++ b/pkg/apis/pingcap/v1alpha1/openapi_generated.go
@@ -5240,6 +5240,19 @@ func schema_pkg_apis_pingcap_v1alpha1_TiDBGroupSpec(ref common.ReferenceCallback
Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBConfig"),
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
"clusterName": {
SchemaProps: spec.SchemaProps{
Description: "ClusterName describe the target TidbCluster in the same namespace",
@@ -5252,7 +5265,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TiDBGroupSpec(ref common.ReferenceCallback
},
},
Dependencies: []string{
- "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBServiceSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBSlowLogTailerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBTLSClient", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBServiceSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBSlowLogTailerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBTLSClient", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
@@ -5582,12 +5595,25 @@ func schema_pkg_apis_pingcap_v1alpha1_TiDBSpec(ref common.ReferenceCallback) com
Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBConfig"),
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
},
Required: []string{"replicas"},
},
},
Dependencies: []string{
- "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBServiceSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBSlowLogTailerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBTLSClient", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBServiceSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBSlowLogTailerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBTLSClient", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go
index 13cbfcac9d9..0a29c2eb062 100644
--- a/pkg/apis/pingcap/v1alpha1/types.go
+++ b/pkg/apis/pingcap/v1alpha1/types.go
@@ -549,6 +549,22 @@ type TiDBSpec struct {
// Config is the Configuration of tidb-servers
// +optional
Config *TiDBConfig `json:"config,omitempty"`
+
+ // Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
+ // Value must be non-negative integer. The value zero indicates delete immediately.
+ // If this value is nil, the default grace period will be used instead.
+ // The grace period is the duration in seconds after the processes running in the pod are sent
+ // a termination signal and the time when the processes are forcibly halted with a kill signal.
+ // Set this value longer than the expected cleanup time for your process.
+ // Defaults to 30 seconds.
+ // +optional
+ TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
+
+ // Lifecycle describes actions that the management system should take in response to container lifecycle
+ // events. For the PostStart and PreStop lifecycle handlers, management of the container blocks
+ // until the action is complete, unless the container process fails, in which case the handler is aborted.
+ // +optional
+ Lifecycle *corev1.Lifecycle `json:"lifecycle,omitempty"`
}
// +k8s:openapi-gen=true
diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go
index 05687a05dc8..bec46dab09a 100644
--- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go
@@ -4232,6 +4232,16 @@ func (in *TiDBSpec) DeepCopyInto(out *TiDBSpec) {
*out = new(TiDBConfig)
(*in).DeepCopyInto(*out)
}
+ if in.TerminationGracePeriodSeconds != nil {
+ in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
+ *out = new(int64)
+ **out = **in
+ }
+ if in.Lifecycle != nil {
+ in, out := &in.Lifecycle, &out.Lifecycle
+ *out = new(v1.Lifecycle)
+ (*in).DeepCopyInto(*out)
+ }
return
}
diff --git a/pkg/manager/member/tidb_member_manager.go b/pkg/manager/member/tidb_member_manager.go
index c37fb935ffa..0150bddf7fb 100644
--- a/pkg/manager/member/tidb_member_manager.go
+++ b/pkg/manager/member/tidb_member_manager.go
@@ -691,7 +691,7 @@ func getNewTiDBSetForTidbCluster(tc *v1alpha1.TidbCluster, cm *corev1.ConfigMap)
},
}
- containers = append(containers, corev1.Container{
+ c := corev1.Container{
Name: v1alpha1.TiDBMemberType.String(),
Image: tc.TiDBImage(),
Command: []string{"/bin/sh", "/usr/local/bin/tidb_start_script.sh"},
@@ -719,7 +719,12 @@ func getNewTiDBSetForTidbCluster(tc *v1alpha1.TidbCluster, cm *corev1.ConfigMap)
},
InitialDelaySeconds: int32(10),
},
- })
+ }
+ if tc.Spec.TiDB.Lifecycle != nil {
+ c.Lifecycle = tc.Spec.TiDB.Lifecycle
+ }
+
+ containers = append(containers, c)
podSpec := baseTiDBSpec.BuildPodSpec()
podSpec.Containers = append(containers, baseTiDBSpec.AdditionalContainers()...)
@@ -759,6 +764,11 @@ func getNewTiDBSetForTidbCluster(tc *v1alpha1.TidbCluster, cm *corev1.ConfigMap)
},
},
}
+
+ if tc.Spec.TiDB.TerminationGracePeriodSeconds != nil {
+ tidbSet.Spec.Template.Spec.TerminationGracePeriodSeconds = tc.Spec.TiDB.TerminationGracePeriodSeconds
+ }
+
return tidbSet
}
From 89c0a37b7089a068fe4c3b764b1c8a48d6783a76 Mon Sep 17 00:00:00 2001
From: weekface
Date: Wed, 1 Jul 2020 11:38:34 +0800
Subject: [PATCH 2/2] address comment
---
docs/api-references/docs.md | 68 +-
manifests/crd.yaml | 612 ++++++++++++++++++
.../pingcap/v1alpha1/openapi_generated.go | 157 ++++-
pkg/apis/pingcap/v1alpha1/types.go | 32 +-
.../pingcap/v1alpha1/zz_generated.deepcopy.go | 20 +-
5 files changed, 796 insertions(+), 93 deletions(-)
diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md
index 4638280d2f6..9e9f3a3af9b 100644
--- a/docs/api-references/docs.md
+++ b/docs/api-references/docs.md
@@ -3283,6 +3283,40 @@ tidb-operator built envs.
supports additional volume mounts for sidecar containers.
+
+
+terminationGracePeriodSeconds
+
+int64
+
+ |
+
+(Optional)
+ Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
+Value must be non-negative integer. The value zero indicates delete immediately.
+If this value is nil, the default grace period will be used instead.
+The grace period is the duration in seconds after the processes running in the pod are sent
+a termination signal and the time when the processes are forcibly halted with a kill signal.
+Set this value longer than the expected cleanup time for your process.
+Defaults to 30 seconds.
+ |
+
+
+
+lifecycle
+
+
+Kubernetes core/v1.Lifecycle
+
+
+ |
+
+(Optional)
+ Lifecycle describes actions that the management system should take in response to container lifecycle
+events. For the PostStart and PreStop lifecycle handlers, management of the container blocks
+until the action is complete, unless the container process fails, in which case the handler is aborted.
+ |
+
ConfigMapRef
@@ -10139,40 +10173,6 @@ TiDBConfig
Config is the Configuration of tidb-servers
-
-
-terminationGracePeriodSeconds
-
-int64
-
- |
-
-(Optional)
- Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
-Value must be non-negative integer. The value zero indicates delete immediately.
-If this value is nil, the default grace period will be used instead.
-The grace period is the duration in seconds after the processes running in the pod are sent
-a termination signal and the time when the processes are forcibly halted with a kill signal.
-Set this value longer than the expected cleanup time for your process.
-Defaults to 30 seconds.
- |
-
-
-
-lifecycle
-
-
-Kubernetes core/v1.Lifecycle
-
-
- |
-
-(Optional)
- Lifecycle describes actions that the management system should take in response to container lifecycle
-events. For the PostStart and PreStop lifecycle handlers, management of the container blocks
-until the action is complete, unless the container process fails, in which case the handler is aborted.
- |
-
TiDBStatus
diff --git a/manifests/crd.yaml b/manifests/crd.yaml
index e2a9b5f52af..31b8093a3c2 100644
--- a/manifests/crd.yaml
+++ b/manifests/crd.yaml
@@ -1976,6 +1976,105 @@ spec:
type: string
type: object
type: array
+ lifecycle:
+ properties:
+ postStart:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ preStop:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ type: object
limits:
type: object
maxFailoverCount:
@@ -2062,6 +2161,9 @@ spec:
type: object
storageClassName:
type: string
+ terminationGracePeriodSeconds:
+ format: int64
+ type: integer
tlsClientSecretName:
type: string
tolerations:
@@ -3496,6 +3598,105 @@ spec:
type: string
type: object
type: array
+ lifecycle:
+ properties:
+ postStart:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ preStop:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ type: object
limits:
type: object
nodeSelector:
@@ -3562,6 +3763,9 @@ spec:
type: string
storageClassName:
type: string
+ terminationGracePeriodSeconds:
+ format: int64
+ type: integer
tolerations:
items:
properties:
@@ -5006,6 +5210,105 @@ spec:
type: string
type: object
type: array
+ lifecycle:
+ properties:
+ postStart:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ preStop:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ type: object
limits:
type: object
nodeSelector:
@@ -5072,6 +5375,9 @@ spec:
type: string
serviceAccount:
type: string
+ terminationGracePeriodSeconds:
+ format: int64
+ type: integer
tolerations:
items:
properties:
@@ -8512,6 +8818,105 @@ spec:
type: string
type: object
type: array
+ lifecycle:
+ properties:
+ postStart:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ preStop:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ type: object
limits:
type: object
logTailer:
@@ -8604,6 +9009,9 @@ spec:
type: string
type: object
type: array
+ terminationGracePeriodSeconds:
+ format: int64
+ type: integer
tolerations:
items:
properties:
@@ -11125,6 +11533,105 @@ spec:
type: string
type: object
type: array
+ lifecycle:
+ properties:
+ postStart:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ preStop:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ type: object
limits:
type: object
maxFailoverCount:
@@ -11198,6 +11705,9 @@ spec:
type: string
storageClassName:
type: string
+ terminationGracePeriodSeconds:
+ format: int64
+ type: integer
tolerations:
items:
properties:
@@ -17529,6 +18039,105 @@ spec:
type: string
type: object
type: array
+ lifecycle:
+ properties:
+ postStart:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ preStop:
+ properties:
+ exec:
+ properties:
+ command:
+ items:
+ type: string
+ type: array
+ type: object
+ httpGet:
+ properties:
+ host:
+ type: string
+ httpHeaders:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ scheme:
+ type: string
+ required:
+ - port
+ type: object
+ tcpSocket:
+ properties:
+ host:
+ type: string
+ port:
+ anyOf:
+ - type: string
+ - type: integer
+ required:
+ - port
+ type: object
+ type: object
+ type: object
limits:
type: object
maxFailoverCount:
@@ -17602,6 +18211,9 @@ spec:
type: string
storageClassName:
type: string
+ terminationGracePeriodSeconds:
+ format: int64
+ type: integer
tolerations:
items:
properties:
diff --git a/pkg/apis/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/pingcap/v1alpha1/openapi_generated.go
index ce76471ce9b..f27ac155a1e 100644
--- a/pkg/apis/pingcap/v1alpha1/openapi_generated.go
+++ b/pkg/apis/pingcap/v1alpha1/openapi_generated.go
@@ -1238,11 +1238,24 @@ func schema_pkg_apis_pingcap_v1alpha1_ComponentSpec(ref common.ReferenceCallback
},
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
},
},
},
Dependencies: []string{
- "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume"},
+ "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume"},
}
}
@@ -3074,6 +3087,19 @@ func schema_pkg_apis_pingcap_v1alpha1_PDSpec(ref common.ReferenceCallback) commo
},
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
"limits": {
SchemaProps: spec.SchemaProps{
Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
@@ -3168,7 +3194,7 @@ func schema_pkg_apis_pingcap_v1alpha1_PDSpec(ref common.ReferenceCallback) commo
},
},
Dependencies: []string{
- "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ServiceSpec", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.PDConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ServiceSpec", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
@@ -3660,6 +3686,19 @@ func schema_pkg_apis_pingcap_v1alpha1_PumpSpec(ref common.ReferenceCallback) com
},
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
"limits": {
SchemaProps: spec.SchemaProps{
Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
@@ -3728,7 +3767,7 @@ func schema_pkg_apis_pingcap_v1alpha1_PumpSpec(ref common.ReferenceCallback) com
},
},
Dependencies: []string{
- "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
@@ -4518,6 +4557,19 @@ func schema_pkg_apis_pingcap_v1alpha1_TiCDCSpec(ref common.ReferenceCallback) co
},
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
"limits": {
SchemaProps: spec.SchemaProps{
Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
@@ -4578,7 +4630,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TiCDCSpec(ref common.ReferenceCallback) co
},
},
Dependencies: []string{
- "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiCDCConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiCDCConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
@@ -5139,6 +5191,19 @@ func schema_pkg_apis_pingcap_v1alpha1_TiDBGroupSpec(ref common.ReferenceCallback
},
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
"limits": {
SchemaProps: spec.SchemaProps{
Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
@@ -5240,19 +5305,6 @@ func schema_pkg_apis_pingcap_v1alpha1_TiDBGroupSpec(ref common.ReferenceCallback
Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBConfig"),
},
},
- "terminationGracePeriodSeconds": {
- SchemaProps: spec.SchemaProps{
- Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
- Type: []string{"integer"},
- Format: "int64",
- },
- },
- "lifecycle": {
- SchemaProps: spec.SchemaProps{
- Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
- Ref: ref("k8s.io/api/core/v1.Lifecycle"),
- },
- },
"clusterName": {
SchemaProps: spec.SchemaProps{
Description: "ClusterName describe the target TidbCluster in the same namespace",
@@ -5494,6 +5546,19 @@ func schema_pkg_apis_pingcap_v1alpha1_TiDBSpec(ref common.ReferenceCallback) com
},
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
"limits": {
SchemaProps: spec.SchemaProps{
Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
@@ -5595,19 +5660,6 @@ func schema_pkg_apis_pingcap_v1alpha1_TiDBSpec(ref common.ReferenceCallback) com
Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBConfig"),
},
},
- "terminationGracePeriodSeconds": {
- SchemaProps: spec.SchemaProps{
- Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
- Type: []string{"integer"},
- Format: "int64",
- },
- },
- "lifecycle": {
- SchemaProps: spec.SchemaProps{
- Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
- Ref: ref("k8s.io/api/core/v1.Lifecycle"),
- },
- },
},
Required: []string{"replicas"},
},
@@ -5794,6 +5846,19 @@ func schema_pkg_apis_pingcap_v1alpha1_TiFlashSpec(ref common.ReferenceCallback)
},
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
"limits": {
SchemaProps: spec.SchemaProps{
Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
@@ -5887,7 +5952,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TiFlashSpec(ref common.ReferenceCallback)
},
},
Dependencies: []string{
- "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.LogTailerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.StorageClaim", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiFlashConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.LogTailerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.StorageClaim", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiFlashConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
@@ -7011,6 +7076,19 @@ func schema_pkg_apis_pingcap_v1alpha1_TiKVGroupSpec(ref common.ReferenceCallback
},
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
"limits": {
SchemaProps: spec.SchemaProps{
Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
@@ -7106,7 +7184,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TiKVGroupSpec(ref common.ReferenceCallback
},
},
Dependencies: []string{
- "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
@@ -8288,6 +8366,19 @@ func schema_pkg_apis_pingcap_v1alpha1_TiKVSpec(ref common.ReferenceCallback) com
},
},
},
+ "terminationGracePeriodSeconds": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "lifecycle": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
+ Ref: ref("k8s.io/api/core/v1.Lifecycle"),
+ },
+ },
"limits": {
SchemaProps: spec.SchemaProps{
Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
@@ -8376,7 +8467,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TiKVSpec(ref common.ReferenceCallback) com
},
},
Dependencies: []string{
- "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
}
}
diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go
index 0a29c2eb062..c3299c2853b 100644
--- a/pkg/apis/pingcap/v1alpha1/types.go
+++ b/pkg/apis/pingcap/v1alpha1/types.go
@@ -549,22 +549,6 @@ type TiDBSpec struct {
// Config is the Configuration of tidb-servers
// +optional
Config *TiDBConfig `json:"config,omitempty"`
-
- // Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
- // Value must be non-negative integer. The value zero indicates delete immediately.
- // If this value is nil, the default grace period will be used instead.
- // The grace period is the duration in seconds after the processes running in the pod are sent
- // a termination signal and the time when the processes are forcibly halted with a kill signal.
- // Set this value longer than the expected cleanup time for your process.
- // Defaults to 30 seconds.
- // +optional
- TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
-
- // Lifecycle describes actions that the management system should take in response to container lifecycle
- // events. For the PostStart and PreStop lifecycle handlers, management of the container blocks
- // until the action is complete, unless the container process fails, in which case the handler is aborted.
- // +optional
- Lifecycle *corev1.Lifecycle `json:"lifecycle,omitempty"`
}
// +k8s:openapi-gen=true
@@ -720,6 +704,22 @@ type ComponentSpec struct {
// supports additional volume mounts for sidecar containers.
// +optional
AdditionalVolumes []corev1.Volume `json:"additionalVolumes,omitempty"`
+
+ // Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
+ // Value must be non-negative integer. The value zero indicates delete immediately.
+ // If this value is nil, the default grace period will be used instead.
+ // The grace period is the duration in seconds after the processes running in the pod are sent
+ // a termination signal and the time when the processes are forcibly halted with a kill signal.
+ // Set this value longer than the expected cleanup time for your process.
+ // Defaults to 30 seconds.
+ // +optional
+ TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
+
+ // Lifecycle describes actions that the management system should take in response to container lifecycle
+ // events. For the PostStart and PreStop lifecycle handlers, management of the container blocks
+ // until the action is complete, unless the container process fails, in which case the handler is aborted.
+ // +optional
+ Lifecycle *corev1.Lifecycle `json:"lifecycle,omitempty"`
}
// +k8s:openapi-gen=true
diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go
index bec46dab09a..eb92ccb5109 100644
--- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go
@@ -670,6 +670,16 @@ func (in *ComponentSpec) DeepCopyInto(out *ComponentSpec) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
+ if in.TerminationGracePeriodSeconds != nil {
+ in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
+ *out = new(int64)
+ **out = **in
+ }
+ if in.Lifecycle != nil {
+ in, out := &in.Lifecycle, &out.Lifecycle
+ *out = new(v1.Lifecycle)
+ (*in).DeepCopyInto(*out)
+ }
return
}
@@ -4232,16 +4242,6 @@ func (in *TiDBSpec) DeepCopyInto(out *TiDBSpec) {
*out = new(TiDBConfig)
(*in).DeepCopyInto(*out)
}
- if in.TerminationGracePeriodSeconds != nil {
- in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
- *out = new(int64)
- **out = **in
- }
- if in.Lifecycle != nil {
- in, out := &in.Lifecycle, &out.Lifecycle
- *out = new(v1.Lifecycle)
- (*in).DeepCopyInto(*out)
- }
return
}