From b72e6c7cbd06a9bf9c16eb31efe4108915c708e2 Mon Sep 17 00:00:00 2001 From: Shiori Date: Tue, 7 Feb 2023 10:11:23 +0800 Subject: [PATCH 01/10] WIP --- pkg/manager/member/tikv_upgrader.go | 174 ++++++++++++++++++++--- pkg/manager/member/tikv_upgrader_test.go | 28 ++-- 2 files changed, 166 insertions(+), 36 deletions(-) diff --git a/pkg/manager/member/tikv_upgrader.go b/pkg/manager/member/tikv_upgrader.go index fa06249282..cb6c769388 100644 --- a/pkg/manager/member/tikv_upgrader.go +++ b/pkg/manager/member/tikv_upgrader.go @@ -35,9 +35,12 @@ import ( ) const ( - // EvictLeaderBeginTime is the key of evict Leader begin time - EvictLeaderBeginTime = "evictLeaderBeginTime" - + // annoKeyEvictLeaderBeginTime is the annotation key in a pod to record the time to begin leader eviction + annoKeyEvictLeaderBeginTime = "evictLeaderBeginTime" + // annoKeyEvictLeaderEndTime is the annotation key in a pod to record the time to end leader eviction + annoKeyEvictLeaderEndTime = "tidb.pingcap.com/tikv-evict-leader-end-at" + // EvictLeaderTimeout is the annotation key in a pod to record the leader count before upgrade + annoKeyTiKVLeaderCountBeforeUpgrade = "tidb.pingcap.com/tikv-leader-count-before-upgrade" // TODO: change to use minReadySeconds in sts spec // See https://kubernetes.io/blog/2021/08/27/minreadyseconds-statefulsets/ annoKeyTiKVMinReadySeconds = "tidb.pingcap.com/tikv-min-ready-seconds" @@ -161,13 +164,14 @@ func (u *tikvUpgrader) Upgrade(meta metav1.Object, oldSet *apps.StatefulSet, new } // If pods recreated successfully, endEvictLeader for the store on this Pod. - storeID, err := strconv.ParseUint(store.ID, 10, 64) + done, err := u.endEvictLeaderAfterUpgrade(tc, pod) if err != nil { return err } - if err := endEvictLeaderbyStoreID(u.deps, tc, storeID); err != nil { - return err + if !done { + return controller.RequeueErrorf("waiting to end evict leader of pod %s for tc %s/%s", podName, ns, tcName) } + continue } @@ -209,7 +213,7 @@ func (u *tikvUpgrader) upgradeTiKVPod(tc *v1alpha1.TidbCluster, ordinal int32, n } func (u *tikvUpgrader) evictLeaderBeforeUpgrade(tc *v1alpha1.TidbCluster, upgradePod *corev1.Pod) (bool, error) { - logPrefix := fmt.Sprintf("evict leader before upgrading tikv pod %s/%s", upgradePod.Namespace, upgradePod.Name) + logPrefix := fmt.Sprintf("evictLeaderBeforeUpgrade: for tikv pod %s/%s", upgradePod.Namespace, upgradePod.Name) storeID, err := TiKVStoreIDFromStatus(tc, upgradePod.Name) if err != nil { @@ -217,17 +221,17 @@ func (u *tikvUpgrader) evictLeaderBeforeUpgrade(tc *v1alpha1.TidbCluster, upgrad } // evict leader if needed - _, evicting := upgradePod.Annotations[EvictLeaderBeginTime] + _, evicting := upgradePod.Annotations[annoKeyEvictLeaderBeginTime] if !evicting { return false, u.beginEvictLeader(tc, storeID, upgradePod) } // wait for leader eviction to complete or timeout evictLeaderTimeout := tc.TiKVEvictLeaderTimeout() - if evictLeaderBeginTimeStr, evicting := upgradePod.Annotations[EvictLeaderBeginTime]; evicting { + if evictLeaderBeginTimeStr, evicting := upgradePod.Annotations[annoKeyEvictLeaderBeginTime]; evicting { evictLeaderBeginTime, err := time.Parse(time.RFC3339, evictLeaderBeginTimeStr) if err != nil { - klog.Errorf("%s: parse annotation %q to time failed", logPrefix, EvictLeaderBeginTime) + klog.Errorf("%s: parse annotation %q to time failed", logPrefix, annoKeyEvictLeaderBeginTime) return false, nil } if time.Now().After(evictLeaderBeginTime.Add(evictLeaderTimeout)) { @@ -270,32 +274,157 @@ func (u *tikvUpgrader) modifyVolumesBeforeUpgrade(tc *v1alpha1.TidbCluster, upgr return true, nil } +func (u *tikvUpgrader) endEvictLeaderAfterUpgrade(tc *v1alpha1.TidbCluster, pod *corev1.Pod) (bool /*done*/, error) { + logPrefix := fmt.Sprintf("endEvictLeaderAfterUpgrade: for tikv pod %s/%s", pod.Namespace, pod.Name) + + storeID, err := TiKVStoreIDFromStatus(tc, pod.Name) + if err != nil { + return false, err + } + + // evict leader if needed + + evictLeaderEndTimeStr, ended := pod.Annotations[annoKeyEvictLeaderEndTime] + if !ended { + return false, u.endEvictLeader(tc, storeID, pod) + } + + // wait for leaders to transfer back or timeout + // + // 1. 2/3 of leaders are already transferred back. + // + // 2. Original leader count is less than 200. + // Though the accurate threshold is 57, it can be set to a larger value, for example 200. + // Moreover, clusters which have small number of leaders are supposed to has low pressure, + // and this recovering strategy may be unnecessary for them. Clusters in production env + // usually has thousands of leaders. + // + // Since PD considers it as balance when the leader count delta is less than 10, so + // these two conditions should be taken into consideration + // + // - When the original leader count is less than 20, there is possibility that + // no leader will transfer back. + // For example: The target store's leader count is 19. Other stores' leader count are 9. + // There are 20 stores in total. In this case, there may be no leader to transfer back. + // + // - When the leader count is less than 57, there is possibility that only less than 2/3 + // leaders are transfered back. `(N-10-9 >= 2/3*N) -> (N>=57)`. + // For example: The target store's leader count is 56. Other stores' leader count are 46. + // There are 57 stores in total. In this case, there may be only 37 leaders to transfer back, + // and 37/56 < 2/3. Accordingly, if the target store's leader count is 57, then there may be + // 38 leaders to transfer back, and 38/57 == 2/3. + // + // 3. Time out waiting for leaders to transfer back + + timeout := time.Minute * 5 + leaderCountBeforeStr, exist := pod.Annotations[annoKeyTiKVLeaderCountBeforeUpgrade] + if !exist { + return true, nil + } + leaderCountBefore, err := strconv.Atoi(leaderCountBeforeStr) + if err != nil { + klog.Errorf("%s: parse annotation %q to int failed", logPrefix, annoKeyTiKVLeaderCountBeforeUpgrade) + return true, nil + } + evictLeaderEndTime, err := time.Parse(time.RFC3339, evictLeaderEndTimeStr) + if err != nil { + klog.Errorf("%s: parse annotation %q to time failed", logPrefix, annoKeyEvictLeaderBeginTime) + return true, nil + } + + if leaderCountBefore < 200 { + return true, nil + } + + if time.Now().After(evictLeaderEndTime.Add(timeout)) { + klog.Infof("%s: time out for leaders transfer back threshold %v, so skip waiting", logPrefix, timeout) + return true, nil + } + + leaderCountNow, err := u.deps.TiKVControl.GetTiKVPodClient(tc.Namespace, tc.Name, pod.Name, tc.IsTLSClusterEnabled()).GetLeaderCount() + if err != nil { + klog.Warningf("%s: failed to get leader count, error: %v", logPrefix, err) + return false, nil + } + if leaderCountNow >= leaderCountBefore*2/3 { + klog.Infof("%s: leader count is %d and greater than 2/3 of original count %d, so ready to upgrade next store", + logPrefix, leaderCountNow, leaderCountBefore) + return true, nil + } + + klog.Infof("%s: leader count is %d and less than 2/3 of original count %d, and wait for leaders to transfer back", + logPrefix, leaderCountNow, leaderCountBefore) + return false, nil +} + func (u *tikvUpgrader) beginEvictLeader(tc *v1alpha1.TidbCluster, storeID uint64, pod *corev1.Pod) error { ns := tc.GetNamespace() podName := pod.GetName() - err := controller.GetPDClient(u.deps.PDControl, tc).BeginEvictLeader(storeID) + annosToRecordInfo := map[string]string{} + + leaderCount, err := u.deps.TiKVControl.GetTiKVPodClient(tc.Namespace, tc.Name, pod.Name, tc.IsTLSClusterEnabled()).GetLeaderCount() + if err == nil { + annosToRecordInfo[annoKeyTiKVLeaderCountBeforeUpgrade] = strconv.Itoa(leaderCount) + } + + err = controller.GetPDClient(u.deps.PDControl, tc).BeginEvictLeader(storeID) if err != nil { - klog.Errorf("tikv upgrader: failed to begin evict leader: %d, %s/%s, %v", + klog.Errorf("beginEvictLeader: failed to begin evict leader: %d, %s/%s, %v", storeID, ns, podName, err) return err } - klog.Infof("tikv upgrader: begin evict leader: %d, %s/%s successfully", storeID, ns, podName) + klog.Infof("beginEvictLeader: begin evict leader: %d, %s/%s successfully", storeID, ns, podName) + annosToRecordInfo[annoKeyEvictLeaderBeginTime] = time.Now().Format(time.RFC3339) + if pod.Annotations == nil { pod.Annotations = map[string]string{} } - now := time.Now().Format(time.RFC3339) - pod.Annotations[EvictLeaderBeginTime] = now + for k, v := range annosToRecordInfo { + pod.Annotations[k] = v + } _, err = u.deps.PodControl.UpdatePod(tc, pod) if err != nil { - klog.Errorf("tikv upgrader: failed to set pod %s/%s annotation %s to %s, %v", - ns, podName, EvictLeaderBeginTime, now, err) + klog.Errorf("beginEvictLeader: failed to set pod %s/%s annotation to record info, annos:%v err:%v", + ns, podName, annosToRecordInfo, err) return err } - klog.Infof("tikv upgrader: set pod %s/%s annotation %s to %s successfully", - ns, podName, EvictLeaderBeginTime, now) + + klog.Infof("beginEvictLeader: set pod %s/%s annotation to record info successfully, annos:%v", + ns, podName, annosToRecordInfo) return nil } +func (u *tikvUpgrader) endEvictLeader(tc *v1alpha1.TidbCluster, storeID uint64, pod *corev1.Pod) error { + ns := tc.GetNamespace() + podName := pod.GetName() + annosToRecordInfo := map[string]string{} + + // call pd to end evict leader + if err := endEvictLeaderbyStoreID(u.deps, tc, storeID); err != nil { + return fmt.Errorf("end evict leader for store %d failed: %v", storeID, err) + } + klog.Infof("endEvictLeader: end evict leader: %d, %s/%s successfully", storeID, ns, podName) + annosToRecordInfo[annoKeyEvictLeaderEndTime] = time.Now().Format(time.RFC3339) + + if pod.Annotations == nil { + pod.Annotations = map[string]string{} + } + for k, v := range annosToRecordInfo { + pod.Annotations[k] = v + } + _, err := u.deps.PodControl.UpdatePod(tc, pod) + if err != nil { + klog.Errorf("endEvictLeader: failed to set pod %s/%s annotation to record info, annos:%v err:%v", + ns, podName, annosToRecordInfo, err) + return fmt.Errorf("end evict leader for store %d failed: %v", storeID, err) + } + + klog.Infof("endEvictLeader: set pod %s/%s annotation to record info successfully, annos:%v", + ns, podName, annosToRecordInfo) + return nil + +} + // endEvictLeaderForAllStore end evict leader for all stores of a tc func endEvictLeaderForAllStore(deps *controller.Dependencies, tc *v1alpha1.TidbCluster) error { storeIDs := make([]uint64, 0, len(tc.Status.TiKV.Stores)+len(tc.Status.TiKV.TombstoneStores)) @@ -341,7 +470,7 @@ func endEvictLeaderForAllStore(deps *controller.Dependencies, tc *v1alpha1.TidbC func endEvictLeader(deps *controller.Dependencies, tc *v1alpha1.TidbCluster, ordinal int32) error { store := getStoreByOrdinal(tc.GetName(), tc.Status.TiKV, ordinal) if store == nil { - klog.Errorf("tikv: no store found for TiKV ordinal %v of %s/%s", ordinal, tc.Namespace, tc.Name) + klog.Errorf("endEvictLeader: no store found for TiKV ordinal %v of %s/%s", ordinal, tc.Namespace, tc.Name) return nil } storeID, err := strconv.ParseUint(store.ID, 10, 64) @@ -360,10 +489,11 @@ func endEvictLeaderbyStoreID(deps *controller.Dependencies, tc *v1alpha1.TidbClu err := controller.GetPDClient(deps.PDControl, tc).EndEvictLeader(storeID) if err != nil { - klog.Errorf("tikv: failed to end evict leader for store: %d of %s/%s, error: %v", storeID, tc.Namespace, tc.Name, err) + klog.Errorf("endEvictLeaderbyStoreID: failed to end evict leader for store: %d of %s/%s, error: %v", storeID, tc.Namespace, tc.Name, err) return err } - klog.Infof("tikv: end evict leader for store: %d of %s/%s successfully", storeID, tc.Namespace, tc.Name) + klog.Infof("endEvictLeaderbyStoreID: end evict leader for store: %d of %s/%s successfully", storeID, tc.Namespace, tc.Name) + return nil } diff --git a/pkg/manager/member/tikv_upgrader_test.go b/pkg/manager/member/tikv_upgrader_test.go index 62cbbbdbdc..10fb378c86 100644 --- a/pkg/manager/member/tikv_upgrader_test.go +++ b/pkg/manager/member/tikv_upgrader_test.go @@ -212,7 +212,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 2) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Add(-1 * time.Minute).Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Add(-1 * time.Minute).Format(time.RFC3339)} } } }, @@ -249,7 +249,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 1) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Add(-1 * time.Minute).Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Add(-1 * time.Minute).Format(time.RFC3339)} } } }, @@ -420,7 +420,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { }, expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet, pods map[string]*corev1.Pod) { g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(2))) - _, exist := pods[TikvPodName(upgradeTcName, 1)].Annotations[EvictLeaderBeginTime] + _, exist := pods[TikvPodName(upgradeTcName, 1)].Annotations[annoKeyEvictLeaderBeginTime] g.Expect(exist).To(BeTrue()) }, }, @@ -442,7 +442,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 1) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Format(time.RFC3339)} } } }, @@ -478,7 +478,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 1) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Format(time.RFC3339)} } } }, @@ -520,7 +520,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { }, expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet, pods map[string]*corev1.Pod) { g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(2))) - _, exist := pods[TikvPodName(upgradeTcName, 1)].Annotations[EvictLeaderBeginTime] + _, exist := pods[TikvPodName(upgradeTcName, 1)].Annotations[annoKeyEvictLeaderBeginTime] g.Expect(exist).To(BeFalse()) }, }, @@ -542,7 +542,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 1) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Add(-2000 * time.Minute).Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Add(-2000 * time.Minute).Format(time.RFC3339)} } } }, @@ -578,7 +578,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 0) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Format(time.RFC3339)} } } }, @@ -615,7 +615,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 0) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Format(time.RFC3339)} } } }, @@ -649,7 +649,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 1) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Format(time.RFC3339)} } } }, @@ -707,7 +707,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 2) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Format(time.RFC3339)} } } }, @@ -743,7 +743,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 1) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Now().Format(time.RFC3339)} + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Format(time.RFC3339)} pod.Status.Conditions[0].LastTransitionTime = metav1.Now() } } @@ -777,7 +777,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 1) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Time{}.Format(time.RFC3339)} // skip evict leader + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Time{}.Format(time.RFC3339)} // skip evict leader } } }, @@ -814,7 +814,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { changePods: func(pods []*corev1.Pod) { for _, pod := range pods { if pod.GetName() == TikvPodName(upgradeTcName, 1) { - pod.Annotations = map[string]string{EvictLeaderBeginTime: time.Time{}.Format(time.RFC3339)} // skip evict leader + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Time{}.Format(time.RFC3339)} // skip evict leader } } }, From 18bb2ebc19c30be6d43403ad81616a9cae76ea53 Mon Sep 17 00:00:00 2001 From: Shiori Date: Tue, 7 Feb 2023 10:27:15 +0800 Subject: [PATCH 02/10] version one --- pkg/apis/pingcap/v1alpha1/tidbcluster.go | 10 +++++++++- pkg/apis/pingcap/v1alpha1/types.go | 9 ++++++++- pkg/manager/member/tikv_upgrader.go | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/pkg/apis/pingcap/v1alpha1/tidbcluster.go b/pkg/apis/pingcap/v1alpha1/tidbcluster.go index e19578154c..e6669f442f 100644 --- a/pkg/apis/pingcap/v1alpha1/tidbcluster.go +++ b/pkg/apis/pingcap/v1alpha1/tidbcluster.go @@ -38,7 +38,8 @@ const ( defaultSeparateRaftLog = false defaultEnablePVReclaim = false // defaultEvictLeaderTimeout is the timeout limit of evict leader - defaultEvictLeaderTimeout = 1500 * time.Minute + defaultEvictLeaderTimeout = 1500 * time.Minute + defaultWaitLeaderTransferBackTimeout = 4 * time.Minute // defaultTiCDCGracefulShutdownTimeout is the timeout limit of graceful // shutdown a TiCDC pod. defaultTiCDCGracefulShutdownTimeout = 10 * time.Minute @@ -147,6 +148,13 @@ func (tc *TidbCluster) TiKVEvictLeaderTimeout() time.Duration { return defaultEvictLeaderTimeout } +func (tc *TidbCluster) TiKVWaitLeaderTransferBackTimeout() time.Duration { + if tc.Spec.TiKV != nil && tc.Spec.TiKV.WaitLeaderTransferBackTimeout != nil { + return tc.Spec.TiKV.WaitLeaderTransferBackTimeout.Duration + } + return defaultEvictLeaderTimeout +} + // TiFlashImage return the image used by TiFlash. // // If TiFlash isn't specified, return empty string. diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go index 87a7680744..495de6b45a 100644 --- a/pkg/apis/pingcap/v1alpha1/types.go +++ b/pkg/apis/pingcap/v1alpha1/types.go @@ -603,10 +603,17 @@ type TiKVSpec struct { MountClusterClientSecret *bool `json:"mountClusterClientSecret,omitempty"` // EvictLeaderTimeout indicates the timeout to evict tikv leader, in the format of Go Duration. - // Defaults to 10m + // Defaults to 1500min // +optional EvictLeaderTimeout *string `json:"evictLeaderTimeout,omitempty"` + // WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back after + // upgarde for a tikv. + // + // Defaults to 400s + // +optional + WaitLeaderTransferBackTimeout *metav1.Duration `json:"waitLeaderTransferBackTimeout,omitempty"` + // StorageVolumes configure additional storage for TiKV pods. // +optional StorageVolumes []StorageVolume `json:"storageVolumes,omitempty"` diff --git a/pkg/manager/member/tikv_upgrader.go b/pkg/manager/member/tikv_upgrader.go index cb6c769388..7d13039ee1 100644 --- a/pkg/manager/member/tikv_upgrader.go +++ b/pkg/manager/member/tikv_upgrader.go @@ -316,7 +316,7 @@ func (u *tikvUpgrader) endEvictLeaderAfterUpgrade(tc *v1alpha1.TidbCluster, pod // // 3. Time out waiting for leaders to transfer back - timeout := time.Minute * 5 + timeout := tc.TiKVWaitLeaderTransferBackTimeout() leaderCountBeforeStr, exist := pod.Annotations[annoKeyTiKVLeaderCountBeforeUpgrade] if !exist { return true, nil From 147fbf8afe39e22be3448ff71df50f0c7250feb3 Mon Sep 17 00:00:00 2001 From: Shiori Date: Tue, 7 Feb 2023 10:40:53 +0800 Subject: [PATCH 03/10] update all --- docs/api-references/docs.md | 18 +- manifests/crd.yaml | 5102 +++++++++-------- .../crd/v1/pingcap.com_tidbclusters.yaml | 2 + .../crd/v1beta1/pingcap.com_tidbclusters.yaml | 2 + manifests/crd_v1beta1.yaml | 5096 ++++++++-------- .../pingcap/v1alpha1/openapi_generated.go | 10 +- .../pingcap/v1alpha1/zz_generated.deepcopy.go | 5 + 7 files changed, 5135 insertions(+), 5100 deletions(-) diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 695853e463..2cf24324de 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -21193,7 +21193,23 @@ string (Optional)

EvictLeaderTimeout indicates the timeout to evict tikv leader, in the format of Go Duration. -Defaults to 10m

+Defaults to 1500min

+ + + + +waitLeaderTransferBackTimeout
+ + +Kubernetes meta/v1.Duration + + + + +(Optional) +

WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back after +upgarde for a tikv.

+

Defaults to 400s

diff --git a/manifests/crd.yaml b/manifests/crd.yaml index d9962e0c38..137ecd7324 100644 --- a/manifests/crd.yaml +++ b/manifests/crd.yaml @@ -6,56 +6,35 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.6.2 creationTimestamp: null - name: backups.pingcap.com + name: backupschedules.pingcap.com spec: group: pingcap.com names: - kind: Backup - listKind: BackupList - plural: backups + kind: BackupSchedule + listKind: BackupScheduleList + plural: backupschedules shortNames: - - bk - singular: backup + - bks + singular: backupschedule scope: Namespaced versions: - additionalPrinterColumns: - - description: the type of backup, such as full, db, table. Only used when Mode - = snapshot. - jsonPath: .spec.backupType - name: Type - type: string - - description: the mode of backup, such as snapshot, log. - jsonPath: .spec.backupMode - name: Mode - type: string - - description: The current status of the backup - jsonPath: .status.phase - name: Status - type: string - - description: The full path of backup data - jsonPath: .status.backupPath - name: BackupPath - type: string - - description: The data size of the backup - jsonPath: .status.backupSizeReadable - name: BackupSize - type: string - - description: The commit ts of the backup - jsonPath: .status.commitTs - name: CommitTS - type: string - - description: The log backup truncate until ts - jsonPath: .status.logSuccessTruncateUntil - name: LogTruncateUntil + - description: The cron format string used for backup scheduling + jsonPath: .spec.schedule + name: Schedule type: string - - description: The time at which the backup was started - jsonPath: .status.timeStarted - name: Started + - description: The max number of backups we want to keep + jsonPath: .spec.maxBackups + name: MaxBackups + type: integer + - description: The last backup CR name + jsonPath: .status.lastBackup + name: LastBackup priority: 1 - type: date - - description: The time at which the backup was completed - jsonPath: .status.timeCompleted - name: Completed + type: string + - description: The last time the backup was successfully created + jsonPath: .status.lastBackupTime + name: LastBackupTime priority: 1 type: date - jsonPath: .metadata.creationTimestamp @@ -73,107 +52,16 @@ spec: type: object spec: properties: - affinity: + backupTemplate: properties: - nodeAffinity: + affinity: properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - preference: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - weight: - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: + nodeAffinity: properties: - nodeSelectorTerms: + preferredDuringSchedulingIgnoredDuringExecution: items: properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - type: array - required: - - nodeSelectorTerms - type: object - type: object - podAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: + preference: properties: matchExpressions: items: @@ -191,73 +79,35 @@ spec: - operator type: object type: array - matchLabels: - additionalProperties: - type: string - type: object + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string + weight: + format: int32 + type: integer required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object + - preference + - weight type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array - type: object - podAntiAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: + type: array + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: properties: matchExpressions: items: @@ -275,10 +125,100 @@ spec: - operator type: object type: array - matchLabels: - additionalProperties: - type: string - type: object + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + type: array + required: + - nodeSelectorTerms + type: object + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object type: object namespaces: items: @@ -289,2601 +229,2661 @@ spec: required: - topologyKey type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: + type: array + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: properties: - matchExpressions: - items: - properties: - key: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: type: string - operator: + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string + type: object type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array + type: array + type: object type: object - type: object - azblob: - properties: - accessTier: - type: string - container: - type: string - path: - type: string - prefix: - type: string - secretName: + azblob: + properties: + accessTier: + type: string + container: + type: string + path: + type: string + prefix: + type: string + secretName: + type: string + type: object + backupMode: + default: snapshot type: string - type: object - backupMode: - default: snapshot - type: string - backupType: - type: string - br: - properties: - checkRequirements: - type: boolean - checksum: - type: boolean - cluster: + backupType: type: string - clusterNamespace: - type: string - concurrency: - format: int32 - type: integer - db: - type: string - logLevel: - type: string - onLine: - type: boolean - options: - items: - type: string - type: array - rateLimit: - type: integer - sendCredToTikv: - type: boolean - statusAddr: - type: string - table: + br: + properties: + checkRequirements: + type: boolean + checksum: + type: boolean + cluster: + type: string + clusterNamespace: + type: string + concurrency: + format: int32 + type: integer + db: + type: string + logLevel: + type: string + onLine: + type: boolean + options: + items: + type: string + type: array + rateLimit: + type: integer + sendCredToTikv: + type: boolean + statusAddr: + type: string + table: + type: string + timeAgo: + type: string + required: + - cluster + type: object + cleanOption: + properties: + backoffEnabled: + type: boolean + batchConcurrency: + format: int32 + type: integer + disableBatchConcurrency: + type: boolean + pageSize: + format: int64 + type: integer + retryCount: + default: 5 + type: integer + routineConcurrency: + format: int32 + type: integer + type: object + cleanPolicy: type: string - timeAgo: + commitTs: type: string - required: - - cluster - type: object - cleanOption: - properties: - backoffEnabled: - type: boolean - batchConcurrency: - format: int32 - type: integer - disableBatchConcurrency: - type: boolean - pageSize: - format: int64 - type: integer - retryCount: - default: 5 - type: integer - routineConcurrency: - format: int32 - type: integer - type: object - cleanPolicy: - type: string - commitTs: - type: string - dumpling: - properties: - options: - items: - type: string - type: array - tableFilter: + dumpling: + properties: + options: + items: + type: string + type: array + tableFilter: + items: + type: string + type: array + type: object + env: items: - type: string - type: array - type: object - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: + name: + type: string + value: + type: string + valueFrom: properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object type: object + required: + - name type: object - required: - - name - type: object - type: array - from: - properties: - host: - type: string - port: - format: int32 - type: integer - secretName: - type: string - tlsClientSecretName: - type: string - user: - type: string - required: - - host - - secretName - type: object - gcs: - properties: - bucket: - type: string - bucketAcl: - type: string - location: - type: string - objectAcl: - type: string - path: - type: string - prefix: - type: string - projectId: - type: string - secretName: - type: string - storageClass: - type: string - required: - - projectId - type: object - imagePullSecrets: - items: - properties: - name: - type: string - type: object - type: array - local: - properties: - prefix: - type: string - volume: + type: array + from: properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: - properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: - type: string - readOnly: - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - properties: - readOnly: - type: boolean - secretName: - type: string - shareName: - type: string - required: - - secretName - - shareName - type: object - cephfs: + host: + type: string + port: + format: int32 + type: integer + secretName: + type: string + tlsClientSecretName: + type: string + user: + type: string + required: + - host + - secretName + type: object + gcs: + properties: + bucket: + type: string + bucketAcl: + type: string + location: + type: string + objectAcl: + type: string + path: + type: string + prefix: + type: string + projectId: + type: string + secretName: + type: string + storageClass: + type: string + required: + - projectId + type: object + imagePullSecrets: + items: + properties: + name: + type: string + type: object + type: array + local: + properties: + prefix: + type: string + volume: properties: - monitors: - items: - type: string - type: array - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: + awsElasticBlockStore: properties: - name: + fsType: + type: string + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: type: string + required: + - volumeID type: object - user: - type: string - required: - - monitors - type: object - cinder: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: + azureDisk: properties: - name: + cachingMode: + type: string + diskName: + type: string + diskURI: + type: string + fsType: + type: string + kind: type: string + readOnly: + type: boolean + required: + - diskName + - diskURI type: object - volumeID: - type: string - required: - - volumeID - type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: + azureFile: properties: - name: + readOnly: + type: boolean + secretName: + type: string + shareName: type: string + required: + - secretName + - shareName type: object - readOnly: - type: boolean - volumeAttributes: - additionalProperties: - type: string + cephfs: + properties: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: + properties: + name: + type: string + type: object + user: + type: string + required: + - monitors type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: properties: - containerName: + key: type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: + mode: + format: int32 + type: integer + path: type: string required: - - resource + - key + - path type: object - required: - - path - type: object - type: array - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: - properties: - readOnly: - type: boolean - volumeClaimTemplate: + type: array + name: + type: string + optional: + type: boolean + type: object + csi: properties: - metadata: - type: object - spec: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: properties: - accessModes: - items: + name: + type: string + type: object + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string + type: object + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + mode: + format: int32 + type: integer + path: type: string - type: array - dataSource: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: + resourceFieldRef: + properties: + containerName: + type: string + divisor: anyOf: - type: integer - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - type: object - type: object - selector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: + resource: type: string - type: object - type: object - storageClassName: - type: string - volumeMode: - type: string - volumeName: - type: string - type: object - required: - - spec - type: object - type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - wwids: - items: - type: string - type: array - type: object - flexVolume: - properties: - driver: - type: string - fsType: - type: string - options: - additionalProperties: - type: string + required: + - resource + type: object + required: + - path + type: object + type: array type: object - readOnly: - type: boolean - secretRef: + emptyDir: properties: - name: + medium: type: string + sizeLimit: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: - type: string - type: object - gcePersistentDisk: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: - type: string - readOnly: - type: boolean - required: - - pdName - type: object - gitRepo: - properties: - directory: - type: string - repository: - type: string - revision: - type: string - required: - - repository - type: object - glusterfs: - properties: - endpoints: - type: string - path: - type: string - readOnly: - type: boolean - required: - - endpoints - - path - type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path - type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: - type: string - type: array - readOnly: - type: boolean - secretRef: + ephemeral: properties: - name: - type: string - type: object - targetPortal: - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: - type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName - type: object - photonPersistentDisk: - properties: - fsType: - type: string - pdID: - type: string - required: - - pdID - type: object - portworxVolume: - properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: - properties: - configMap: - properties: - items: - items: + readOnly: + type: boolean + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: properties: - key: + apiGroup: type: string - mode: - format: int32 - type: integer - path: + kind: + type: string + name: type: string required: - - key - - path + - kind + - name type: object - type: array - name: - type: string - optional: - type: boolean - type: object - downwardAPI: - properties: - items: - items: + resources: properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - required: - - path type: object - type: array - type: object - secret: - properties: - items: - items: + selector: properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object type: object - type: array - name: - type: string - optional: - type: boolean - type: object - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object - type: object - type: array - required: - - sources - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - pool: - type: string - readOnly: - type: boolean - secretRef: + storageClassName: + type: string + volumeMode: + type: string + volumeName: + type: string + type: object + required: + - spec + type: object + type: object + fc: properties: - name: + fsType: type: string + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array type: object - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: + flexVolume: properties: - name: + driver: type: string - type: object - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: + fsType: + type: string + options: + additionalProperties: type: string - required: - - key - - path - type: object - type: array - optional: - type: boolean - secretName: - type: string - type: object - storageos: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + required: + - driver + type: object + flocker: properties: - name: + datasetName: + type: string + datasetUUID: type: string type: object - volumeName: - type: string - volumeNamespace: + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + required: + - repository + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: type: string - type: object - vsphereVolume: - properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: - type: string - required: - - volumePath - type: object - required: - - name - type: object - volumeMount: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - required: - - volume - - volumeMount - type: object - logStop: - type: boolean - logTruncateUntil: - type: string - podSecurityContext: - properties: - fsGroup: - format: int64 - type: integer - fsGroupChangePolicy: - type: string - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - supplementalGroups: - items: - format: int64 - type: integer - type: array - sysctls: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - runAsUserName: - type: string - type: object - type: object - priorityClassName: - type: string - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - s3: - properties: - acl: - type: string - bucket: - type: string - endpoint: - type: string - options: - items: - type: string - type: array - path: - type: string - prefix: - type: string - provider: - type: string - region: - type: string - secretName: - type: string - sse: - type: string - storageClass: - type: string - required: - - provider - type: object - serviceAccount: - type: string - storageClassName: - type: string - storageSize: - type: string - tableFilter: - items: - type: string - type: array - tikvGCLifeTime: - type: string - tolerations: - items: - properties: - effect: - type: string - key: - type: string - operator: - type: string - tolerationSeconds: - format: int64 - type: integer - value: - type: string - type: object - type: array - toolImage: - type: string - useKMS: - type: boolean - type: object - status: - properties: - backupPath: - type: string - backupSize: - format: int64 - type: integer - backupSizeReadable: - type: string - commitTs: - type: string - conditions: - items: - properties: - command: - type: string - lastTransitionTime: - format: date-time - nullable: true - type: string - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - status - - type - type: object - nullable: true - type: array - logCheckpointTs: - type: string - logSubCommandStatuses: - additionalProperties: - properties: - command: - type: string - conditions: - items: - properties: - command: - type: string - lastTransitionTime: - format: date-time - nullable: true - type: string - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - status - - type - type: object - nullable: true - type: array - logTruncatingUntil: - type: string - phase: - type: string - timeCompleted: - format: date-time - nullable: true - type: string - timeStarted: - format: date-time - nullable: true - type: string - type: object - type: object - logSuccessTruncateUntil: - type: string - phase: - type: string - progresses: - items: - properties: - lastTransitionTime: - format: date-time - nullable: true - type: string - progress: - type: number - step: - type: string - type: object - nullable: true - type: array - timeCompleted: - format: date-time - nullable: true - type: string - timeStarted: - format: date-time - nullable: true - type: string - type: object - required: - - metadata - - spec - type: object - served: true - storage: true - subresources: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.6.2 - creationTimestamp: null - name: backupschedules.pingcap.com -spec: - group: pingcap.com - names: - kind: BackupSchedule - listKind: BackupScheduleList - plural: backupschedules - shortNames: - - bks - singular: backupschedule - scope: Namespaced - versions: - - additionalPrinterColumns: - - description: The cron format string used for backup scheduling - jsonPath: .spec.schedule - name: Schedule - type: string - - description: The max number of backups we want to keep - jsonPath: .spec.maxBackups - name: MaxBackups - type: integer - - description: The last backup CR name - jsonPath: .status.lastBackup - name: LastBackup - priority: 1 - type: string - - description: The last time the backup was successfully created - jsonPath: .status.lastBackupTime - name: LastBackupTime - priority: 1 - type: date - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - backupTemplate: - properties: - affinity: - properties: - nodeAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - preference: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - weight: - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: + nfs: properties: - nodeSelectorTerms: - items: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - type: array + path: + type: string + readOnly: + type: boolean + server: + type: string required: - - nodeSelectorTerms + - path + - server type: object - type: object - podAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: properties: - labelSelector: + configMap: properties: - matchExpressions: + items: items: properties: key: type: string - operator: + mode: + format: int32 + type: integer + path: type: string - values: - items: - type: string - type: array required: - key - - operator + - path type: object type: array - matchLabels: - additionalProperties: - type: string - type: object + name: + type: string + optional: + type: boolean type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + required: + - path + type: object + type: array type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array - type: object - podAntiAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: + secret: properties: - matchExpressions: + items: items: properties: key: type: string - operator: + mode: + format: int32 + type: integer + path: type: string - values: - items: - type: string - type: array required: - key - - operator + - path type: object type: array - matchLabels: - additionalProperties: - type: string - type: object + name: + type: string + optional: + type: boolean type: object - namespaces: - items: - type: string - type: array - topologyKey: + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + type: object + quobyte: + properties: + group: + type: string + readOnly: + type: boolean + registry: + type: string + tenant: + type: string + user: + type: string + volume: + type: string + required: + - registry + - volume + type: object + rbd: + properties: + fsType: + type: string + image: + type: string + keyring: + type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + user: + type: string + required: + - image + - monitors + type: object + scaleIO: + properties: + fsType: + type: string + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: type: string required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object + - key + - path type: object - namespaces: - items: + type: array + optional: + type: boolean + secretName: + type: string + type: object + storageos: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array + type: object + volumeName: + type: string + volumeNamespace: + type: string + type: object + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string + required: + - volumePath + type: object + required: + - name + type: object + volumeMount: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name type: object - type: object - azblob: - properties: - accessTier: - type: string - container: - type: string - path: - type: string - prefix: - type: string - secretName: - type: string - type: object - backupMode: - default: snapshot - type: string - backupType: - type: string - br: - properties: - checkRequirements: - type: boolean - checksum: - type: boolean - cluster: - type: string - clusterNamespace: - type: string - concurrency: - format: int32 - type: integer - db: - type: string - logLevel: - type: string - onLine: - type: boolean - options: - items: - type: string - type: array - rateLimit: - type: integer - sendCredToTikv: - type: boolean - statusAddr: - type: string - table: - type: string - timeAgo: - type: string required: - - cluster - type: object - cleanOption: - properties: - backoffEnabled: - type: boolean - batchConcurrency: - format: int32 - type: integer - disableBatchConcurrency: - type: boolean - pageSize: - format: int64 - type: integer - retryCount: - default: 5 - type: integer - routineConcurrency: - format: int32 - type: integer - type: object - cleanPolicy: - type: string - commitTs: - type: string - dumpling: - properties: - options: - items: - type: string - type: array - tableFilter: - items: - type: string - type: array + - volume + - volumeMount type: object - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - from: + logStop: + type: boolean + logTruncateUntil: + type: string + podSecurityContext: properties: - host: - type: string - port: - format: int32 + fsGroup: + format: int64 type: integer - secretName: - type: string - tlsClientSecretName: - type: string - user: + fsGroupChangePolicy: type: string - required: - - host - - secretName + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object type: object - gcs: + priorityClassName: + type: string + resources: properties: - bucket: - type: string - bucketAcl: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + s3: + properties: + acl: type: string - location: + bucket: type: string - objectAcl: + endpoint: type: string + options: + items: + type: string + type: array path: type: string prefix: type: string - projectId: + provider: + type: string + region: type: string secretName: type: string + sse: + type: string storageClass: type: string required: - - projectId + - provider type: object - imagePullSecrets: + serviceAccount: + type: string + storageClassName: + type: string + storageSize: + type: string + tableFilter: + items: + type: string + type: array + tikvGCLifeTime: + type: string + tolerations: items: properties: - name: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: type: string type: object type: array - local: + toolImage: + type: string + useKMS: + type: boolean + type: object + imagePullSecrets: + items: + properties: + name: + type: string + type: object + type: array + maxBackups: + format: int32 + type: integer + maxReservedTime: + type: string + pause: + type: boolean + schedule: + type: string + storageClassName: + type: string + storageSize: + type: string + required: + - backupTemplate + - schedule + type: object + status: + properties: + allBackupCleanTime: + format: date-time + type: string + lastBackup: + type: string + lastBackupTime: + format: date-time + type: string + type: object + required: + - metadata + - spec + type: object + served: true + storage: true + subresources: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null + name: backups.pingcap.com +spec: + group: pingcap.com + names: + kind: Backup + listKind: BackupList + plural: backups + shortNames: + - bk + singular: backup + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: the type of backup, such as full, db, table. Only used when Mode + = snapshot. + jsonPath: .spec.backupType + name: Type + type: string + - description: the mode of backup, such as snapshot, log. + jsonPath: .spec.backupMode + name: Mode + type: string + - description: The current status of the backup + jsonPath: .status.phase + name: Status + type: string + - description: The full path of backup data + jsonPath: .status.backupPath + name: BackupPath + type: string + - description: The data size of the backup + jsonPath: .status.backupSizeReadable + name: BackupSize + type: string + - description: The commit ts of the backup + jsonPath: .status.commitTs + name: CommitTS + type: string + - description: The log backup truncate until ts + jsonPath: .status.logSuccessTruncateUntil + name: LogTruncateUntil + type: string + - description: The time at which the backup was started + jsonPath: .status.timeStarted + name: Started + priority: 1 + type: date + - description: The time at which the backup was completed + jsonPath: .status.timeCompleted + name: Completed + priority: 1 + type: date + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + affinity: + properties: + nodeAffinity: properties: - prefix: - type: string - volume: - properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: - properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: - type: string - readOnly: - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - properties: - readOnly: - type: boolean - secretName: - type: string - shareName: - type: string - required: - - secretName - - shareName - type: object - cephfs: - properties: - monitors: - items: - type: string - type: array - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: - properties: - name: - type: string - type: object - user: - type: string - required: - - monitors - type: object - cinder: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - volumeID: - type: string - required: - - volumeID - type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: - properties: - name: - type: string - type: object - readOnly: - type: boolean - volumeAttributes: - additionalProperties: - type: string - type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + preference: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: type: string - required: - - resource - type: object - required: - - path - type: object - type: array - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: - properties: - readOnly: - type: boolean - volumeClaimTemplate: - properties: - metadata: + type: array + required: + - key + - operator + type: object + type: array + type: object + weight: + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator type: object - spec: + type: array + matchFields: + items: properties: - accessModes: + key: + type: string + operator: + type: string + values: items: type: string type: array - dataSource: + required: + - key + - operator + type: object + type: array + type: object + type: array + required: + - nodeSelectorTerms + type: object + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: properties: - apiGroup: - type: string - kind: + key: type: string - name: + operator: type: string - required: - - kind - - name - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - selector: - properties: - matchExpressions: + values: items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: type: string - type: object + type: array + required: + - key + - operator type: object - storageClassName: + type: array + matchLabels: + additionalProperties: type: string - volumeMode: + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: type: string - volumeName: + operator: type: string + values: + items: + type: string + type: array + required: + - key + - operator type: object - required: - - spec - type: object - type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - wwids: - items: - type: string - type: array - type: object - flexVolume: - properties: - driver: - type: string - fsType: + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: type: string - options: - additionalProperties: + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: type: string - type: object - readOnly: - type: boolean - secretRef: - properties: - name: + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: type: string - type: object - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: + type: object + type: object + namespaces: + items: type: string - type: object - gcePersistentDisk: + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + azblob: + properties: + accessTier: + type: string + container: + type: string + path: + type: string + prefix: + type: string + secretName: + type: string + type: object + backupMode: + default: snapshot + type: string + backupType: + type: string + br: + properties: + checkRequirements: + type: boolean + checksum: + type: boolean + cluster: + type: string + clusterNamespace: + type: string + concurrency: + format: int32 + type: integer + db: + type: string + logLevel: + type: string + onLine: + type: boolean + options: + items: + type: string + type: array + rateLimit: + type: integer + sendCredToTikv: + type: boolean + statusAddr: + type: string + table: + type: string + timeAgo: + type: string + required: + - cluster + type: object + cleanOption: + properties: + backoffEnabled: + type: boolean + batchConcurrency: + format: int32 + type: integer + disableBatchConcurrency: + type: boolean + pageSize: + format: int64 + type: integer + retryCount: + default: 5 + type: integer + routineConcurrency: + format: int32 + type: integer + type: object + cleanPolicy: + type: string + commitTs: + type: string + dumpling: + properties: + options: + items: + type: string + type: array + tableFilter: + items: + type: string + type: array + type: object + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + from: + properties: + host: + type: string + port: + format: int32 + type: integer + secretName: + type: string + tlsClientSecretName: + type: string + user: + type: string + required: + - host + - secretName + type: object + gcs: + properties: + bucket: + type: string + bucketAcl: + type: string + location: + type: string + objectAcl: + type: string + path: + type: string + prefix: + type: string + projectId: + type: string + secretName: + type: string + storageClass: + type: string + required: + - projectId + type: object + imagePullSecrets: + items: + properties: + name: + type: string + type: object + type: array + local: + properties: + prefix: + type: string + volume: + properties: + awsElasticBlockStore: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + azureDisk: + properties: + cachingMode: + type: string + diskName: + type: string + diskURI: + type: string + fsType: + type: string + kind: + type: string + readOnly: + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + properties: + readOnly: + type: boolean + secretName: + type: string + shareName: + type: string + required: + - secretName + - shareName + type: object + cephfs: + properties: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: + name: type: string - readOnly: - type: boolean - required: - - pdName type: object - gitRepo: + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: properties: - directory: - type: string - repository: - type: string - revision: + name: type: string - required: - - repository type: object - glusterfs: + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: properties: - endpoints: - type: string - path: + name: type: string - readOnly: - type: boolean - required: - - endpoints - - path type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + mode: + format: int32 + type: integer + path: type: string - type: array - readOnly: - type: boolean - secretRef: + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + required: + - path + type: object + type: array + type: object + emptyDir: + properties: + medium: + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + properties: + readOnly: + type: boolean + volumeClaimTemplate: + properties: + metadata: + type: object + spec: properties: - name: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + resources: + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + storageClassName: + type: string + volumeMode: + type: string + volumeName: type: string type: object - targetPortal: - type: string required: - - iqn - - lun - - targetPortal + - spec type: object - name: + type: object + fc: + properties: + fsType: type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array + type: object + flexVolume: + properties: + driver: + type: string + fsType: + type: string + options: + additionalProperties: + type: string type: object - photonPersistentDisk: + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - pdID: + name: type: string - required: - - pdID type: object - portworxVolume: + required: + - driver + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + required: + - repository + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: + name: type: string - required: - - volumeID type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + type: string + nfs: + properties: + path: + type: string + readOnly: + type: boolean + server: + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: + properties: + configMap: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + downwardAPI: properties: - configMap: - properties: - items: - items: + items: + items: + properties: + fieldRef: properties: - key: - type: string - mode: - format: int32 - type: integer - path: + apiVersion: type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - downwardAPI: - properties: - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: + fieldPath: type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object required: - - path + - fieldPath type: object - type: array - type: object - secret: - properties: - items: - items: + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: properties: - key: + containerName: type: string - mode: - format: int32 - type: integer - path: + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: type: string required: - - key - - path + - resource type: object - type: array - name: - type: string - optional: - type: boolean - type: object - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object + required: + - path + type: object + type: array type: object - type: array - required: - - sources - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - pool: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: + secret: properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - optional: - type: boolean - secretName: - type: string - type: object - storageos: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - volumeName: - type: string - volumeNamespace: - type: string - type: object - vsphereVolume: - properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: - type: string - required: - - volumePath - type: object + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array required: - - name + - sources type: object - volumeMount: + quobyte: properties: - mountPath: - type: string - mountPropagation: - type: string - name: + group: type: string readOnly: type: boolean - subPath: + registry: type: string - subPathExpr: + tenant: + type: string + user: + type: string + volume: type: string required: - - mountPath - - name + - registry + - volume type: object - required: - - volume - - volumeMount - type: object - logStop: - type: boolean - logTruncateUntil: - type: string - podSecurityContext: - properties: - fsGroup: - format: int64 - type: integer - fsGroupChangePolicy: - type: string - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: + rbd: properties: - level: + fsType: type: string - role: + image: type: string - type: + keyring: type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object user: type: string + required: + - image + - monitors type: object - seccompProfile: + scaleIO: properties: - localhostProfile: + fsType: type: string - type: + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: type: string required: - - type + - gateway + - secretRef + - system type: object - supplementalGroups: - items: - format: int64 - type: integer - type: array - sysctls: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - windowsOptions: + secret: properties: - gmsaCredentialSpec: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + optional: + type: boolean + secretName: type: string - gmsaCredentialSpecName: + type: object + storageos: + properties: + fsType: type: string - runAsUserName: + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + volumeName: + type: string + volumeNamespace: type: string type: object - type: object - priorityClassName: - type: string - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string + required: + - volumePath type: object + required: + - name type: object - s3: + volumeMount: properties: - acl: + mountPath: type: string - bucket: + mountPropagation: type: string - endpoint: + name: type: string - options: - items: - type: string - type: array - path: + readOnly: + type: boolean + subPath: type: string - prefix: + subPathExpr: + type: string + required: + - mountPath + - name + type: object + required: + - volume + - volumeMount + type: object + logStop: + type: boolean + logTruncateUntil: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: type: string - provider: + role: type: string - region: + type: type: string - secretName: + user: type: string - sse: + type: object + seccompProfile: + properties: + localhostProfile: type: string - storageClass: + type: type: string required: - - provider + - type type: object - serviceAccount: - type: string - storageClassName: - type: string - storageSize: - type: string - tableFilter: + supplementalGroups: items: - type: string + format: int64 + type: integer type: array - tikvGCLifeTime: - type: string - tolerations: + sysctls: items: properties: - effect: - type: string - key: - type: string - operator: + name: type: string - tolerationSeconds: - format: int64 - type: integer value: type: string + required: + - name + - value type: object type: array - toolImage: + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + resources: + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + s3: + properties: + acl: type: string - useKMS: - type: boolean + bucket: + type: string + endpoint: + type: string + options: + items: + type: string + type: array + path: + type: string + prefix: + type: string + provider: + type: string + region: + type: string + secretName: + type: string + sse: + type: string + storageClass: + type: string + required: + - provider type: object - imagePullSecrets: + serviceAccount: + type: string + storageClassName: + type: string + storageSize: + type: string + tableFilter: + items: + type: string + type: array + tikvGCLifeTime: + type: string + tolerations: items: properties: - name: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: type: string type: object type: array - maxBackups: - format: int32 - type: integer - maxReservedTime: + toolImage: type: string - pause: + useKMS: type: boolean - schedule: - type: string - storageClassName: - type: string - storageSize: - type: string - required: - - backupTemplate - - schedule type: object status: properties: - allBackupCleanTime: - format: date-time + backupPath: type: string - lastBackup: + backupSize: + format: int64 + type: integer + backupSizeReadable: type: string - lastBackupTime: + commitTs: + type: string + conditions: + items: + properties: + command: + type: string + lastTransitionTime: + format: date-time + nullable: true + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + nullable: true + type: array + logCheckpointTs: + type: string + logSubCommandStatuses: + additionalProperties: + properties: + command: + type: string + conditions: + items: + properties: + command: + type: string + lastTransitionTime: + format: date-time + nullable: true + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + nullable: true + type: array + logTruncatingUntil: + type: string + phase: + type: string + timeCompleted: + format: date-time + nullable: true + type: string + timeStarted: + format: date-time + nullable: true + type: string + type: object + type: object + logSuccessTruncateUntil: + type: string + phase: + type: string + progresses: + items: + properties: + lastTransitionTime: + format: date-time + nullable: true + type: string + progress: + type: number + step: + type: string + type: object + nullable: true + type: array + timeCompleted: + format: date-time + nullable: true + type: string + timeStarted: format: date-time + nullable: true type: string type: object required: @@ -30590,6 +30590,8 @@ spec: x-kubernetes-list-type: map version: type: string + waitLeaderTransferBackTimeout: + type: string required: - replicas type: object diff --git a/manifests/crd/v1/pingcap.com_tidbclusters.yaml b/manifests/crd/v1/pingcap.com_tidbclusters.yaml index d1258fc32d..d85126be53 100644 --- a/manifests/crd/v1/pingcap.com_tidbclusters.yaml +++ b/manifests/crd/v1/pingcap.com_tidbclusters.yaml @@ -17335,6 +17335,8 @@ spec: x-kubernetes-list-type: map version: type: string + waitLeaderTransferBackTimeout: + type: string required: - replicas type: object diff --git a/manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml b/manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml index f73148298d..7d99237db2 100644 --- a/manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml +++ b/manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml @@ -17308,6 +17308,8 @@ spec: x-kubernetes-list-type: map version: type: string + waitLeaderTransferBackTimeout: + type: string required: - replicas type: object diff --git a/manifests/crd_v1beta1.yaml b/manifests/crd_v1beta1.yaml index 539abaab91..80e5d0b232 100644 --- a/manifests/crd_v1beta1.yaml +++ b/manifests/crd_v1beta1.yaml @@ -6,46 +6,25 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.6.2 creationTimestamp: null - name: backups.pingcap.com + name: backupschedules.pingcap.com spec: additionalPrinterColumns: - - JSONPath: .spec.backupType - description: the type of backup, such as full, db, table. Only used when Mode - = snapshot. - name: Type - type: string - - JSONPath: .spec.backupMode - description: the mode of backup, such as snapshot, log. - name: Mode - type: string - - JSONPath: .status.phase - description: The current status of the backup - name: Status - type: string - - JSONPath: .status.backupPath - description: The full path of backup data - name: BackupPath - type: string - - JSONPath: .status.backupSizeReadable - description: The data size of the backup - name: BackupSize - type: string - - JSONPath: .status.commitTs - description: The commit ts of the backup - name: CommitTS - type: string - - JSONPath: .status.logSuccessTruncateUntil - description: The log backup truncate until ts - name: LogTruncateUntil + - JSONPath: .spec.schedule + description: The cron format string used for backup scheduling + name: Schedule type: string - - JSONPath: .status.timeStarted - description: The time at which the backup was started - name: Started + - JSONPath: .spec.maxBackups + description: The max number of backups we want to keep + name: MaxBackups + type: integer + - JSONPath: .status.lastBackup + description: The last backup CR name + name: LastBackup priority: 1 - type: date - - JSONPath: .status.timeCompleted - description: The time at which the backup was completed - name: Completed + type: string + - JSONPath: .status.lastBackupTime + description: The last time the backup was successfully created + name: LastBackupTime priority: 1 type: date - JSONPath: .metadata.creationTimestamp @@ -53,12 +32,12 @@ spec: type: date group: pingcap.com names: - kind: Backup - listKind: BackupList - plural: backups + kind: BackupSchedule + listKind: BackupScheduleList + plural: backupschedules shortNames: - - bk - singular: backup + - bks + singular: backupschedule preserveUnknownFields: false scope: Namespaced subresources: {} @@ -73,107 +52,16 @@ spec: type: object spec: properties: - affinity: + backupTemplate: properties: - nodeAffinity: + affinity: properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - preference: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - weight: - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: + nodeAffinity: properties: - nodeSelectorTerms: + preferredDuringSchedulingIgnoredDuringExecution: items: properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - type: array - required: - - nodeSelectorTerms - type: object - type: object - podAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: + preference: properties: matchExpressions: items: @@ -191,73 +79,35 @@ spec: - operator type: object type: array - matchLabels: - additionalProperties: - type: string - type: object + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string + weight: + format: int32 + type: integer required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object + - preference + - weight type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array - type: object - podAntiAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: + type: array + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: properties: matchExpressions: items: @@ -275,10 +125,100 @@ spec: - operator type: object type: array - matchLabels: - additionalProperties: - type: string - type: object + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + type: array + required: + - nodeSelectorTerms + type: object + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object type: object namespaces: items: @@ -289,2599 +229,2659 @@ spec: required: - topologyKey type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: + type: array + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: properties: - matchExpressions: - items: - properties: - key: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: type: string - operator: + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string + type: object type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array + type: array + type: object type: object - type: object - azblob: - properties: - accessTier: - type: string - container: - type: string - path: - type: string - prefix: - type: string - secretName: - type: string - type: object - backupMode: - type: string - backupType: - type: string - br: - properties: - checkRequirements: - type: boolean - checksum: - type: boolean - cluster: + azblob: + properties: + accessTier: + type: string + container: + type: string + path: + type: string + prefix: + type: string + secretName: + type: string + type: object + backupMode: type: string - clusterNamespace: + backupType: type: string - concurrency: - format: int32 - type: integer - db: - type: string - logLevel: - type: string - onLine: - type: boolean - options: - items: - type: string - type: array - rateLimit: - type: integer - sendCredToTikv: - type: boolean - statusAddr: - type: string - table: + br: + properties: + checkRequirements: + type: boolean + checksum: + type: boolean + cluster: + type: string + clusterNamespace: + type: string + concurrency: + format: int32 + type: integer + db: + type: string + logLevel: + type: string + onLine: + type: boolean + options: + items: + type: string + type: array + rateLimit: + type: integer + sendCredToTikv: + type: boolean + statusAddr: + type: string + table: + type: string + timeAgo: + type: string + required: + - cluster + type: object + cleanOption: + properties: + backoffEnabled: + type: boolean + batchConcurrency: + format: int32 + type: integer + disableBatchConcurrency: + type: boolean + pageSize: + format: int64 + type: integer + retryCount: + type: integer + routineConcurrency: + format: int32 + type: integer + type: object + cleanPolicy: type: string - timeAgo: + commitTs: type: string - required: - - cluster - type: object - cleanOption: - properties: - backoffEnabled: - type: boolean - batchConcurrency: - format: int32 - type: integer - disableBatchConcurrency: - type: boolean - pageSize: - format: int64 - type: integer - retryCount: - type: integer - routineConcurrency: - format: int32 - type: integer - type: object - cleanPolicy: - type: string - commitTs: - type: string - dumpling: - properties: - options: - items: - type: string - type: array - tableFilter: + dumpling: + properties: + options: + items: + type: string + type: array + tableFilter: + items: + type: string + type: array + type: object + env: items: - type: string - type: array - type: object - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: + name: + type: string + value: + type: string + valueFrom: properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object type: object + required: + - name type: object - required: - - name - type: object - type: array - from: - properties: - host: - type: string - port: - format: int32 - type: integer - secretName: - type: string - tlsClientSecretName: - type: string - user: - type: string - required: - - host - - secretName - type: object - gcs: - properties: - bucket: - type: string - bucketAcl: - type: string - location: - type: string - objectAcl: - type: string - path: - type: string - prefix: - type: string - projectId: - type: string - secretName: - type: string - storageClass: - type: string - required: - - projectId - type: object - imagePullSecrets: - items: - properties: - name: - type: string - type: object - type: array - local: - properties: - prefix: - type: string - volume: + type: array + from: properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: - properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: - type: string - readOnly: - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - properties: - readOnly: - type: boolean - secretName: - type: string - shareName: - type: string - required: - - secretName - - shareName - type: object - cephfs: + host: + type: string + port: + format: int32 + type: integer + secretName: + type: string + tlsClientSecretName: + type: string + user: + type: string + required: + - host + - secretName + type: object + gcs: + properties: + bucket: + type: string + bucketAcl: + type: string + location: + type: string + objectAcl: + type: string + path: + type: string + prefix: + type: string + projectId: + type: string + secretName: + type: string + storageClass: + type: string + required: + - projectId + type: object + imagePullSecrets: + items: + properties: + name: + type: string + type: object + type: array + local: + properties: + prefix: + type: string + volume: properties: - monitors: - items: - type: string - type: array - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: + awsElasticBlockStore: properties: - name: + fsType: + type: string + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: type: string + required: + - volumeID type: object - user: - type: string - required: - - monitors - type: object - cinder: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: + azureDisk: properties: - name: + cachingMode: + type: string + diskName: + type: string + diskURI: + type: string + fsType: + type: string + kind: type: string + readOnly: + type: boolean + required: + - diskName + - diskURI type: object - volumeID: - type: string - required: - - volumeID - type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: + azureFile: properties: - name: + readOnly: + type: boolean + secretName: + type: string + shareName: type: string + required: + - secretName + - shareName type: object - readOnly: - type: boolean - volumeAttributes: - additionalProperties: - type: string + cephfs: + properties: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: + properties: + name: + type: string + type: object + user: + type: string + required: + - monitors type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: properties: - containerName: + key: type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: + mode: + format: int32 + type: integer + path: type: string required: - - resource + - key + - path type: object - required: - - path - type: object - type: array - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: - properties: - readOnly: - type: boolean - volumeClaimTemplate: + type: array + name: + type: string + optional: + type: boolean + type: object + csi: properties: - metadata: - type: object - spec: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: properties: - accessModes: - items: + name: + type: string + type: object + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string + type: object + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + mode: + format: int32 + type: integer + path: type: string - type: array - dataSource: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: + resourceFieldRef: + properties: + containerName: + type: string + divisor: anyOf: - type: integer - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - type: object - type: object - selector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: + resource: type: string - type: object - type: object - storageClassName: - type: string - volumeMode: - type: string - volumeName: - type: string - type: object - required: - - spec - type: object - type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - wwids: - items: - type: string - type: array - type: object - flexVolume: - properties: - driver: - type: string - fsType: - type: string - options: - additionalProperties: - type: string + required: + - resource + type: object + required: + - path + type: object + type: array type: object - readOnly: - type: boolean - secretRef: + emptyDir: properties: - name: + medium: type: string + sizeLimit: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: - type: string - type: object - gcePersistentDisk: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: - type: string - readOnly: - type: boolean - required: - - pdName - type: object - gitRepo: - properties: - directory: - type: string - repository: - type: string - revision: - type: string - required: - - repository - type: object - glusterfs: - properties: - endpoints: - type: string - path: - type: string - readOnly: - type: boolean - required: - - endpoints - - path - type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path - type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: - type: string - type: array - readOnly: - type: boolean - secretRef: + ephemeral: properties: - name: - type: string - type: object - targetPortal: - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: - type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName - type: object - photonPersistentDisk: - properties: - fsType: - type: string - pdID: - type: string - required: - - pdID - type: object - portworxVolume: - properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: - properties: - configMap: - properties: - items: - items: + readOnly: + type: boolean + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: properties: - key: + apiGroup: type: string - mode: - format: int32 - type: integer - path: + kind: + type: string + name: type: string required: - - key - - path + - kind + - name type: object - type: array - name: - type: string - optional: - type: boolean - type: object - downwardAPI: - properties: - items: - items: + resources: properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true type: object - required: - - path type: object - type: array - type: object - secret: - properties: - items: - items: + selector: properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object type: object - type: array - name: - type: string - optional: - type: boolean - type: object - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object - type: object - type: array - required: - - sources - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - pool: - type: string - readOnly: - type: boolean - secretRef: + storageClassName: + type: string + volumeMode: + type: string + volumeName: + type: string + type: object + required: + - spec + type: object + type: object + fc: properties: - name: + fsType: type: string + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array type: object - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: + flexVolume: properties: - name: + driver: type: string - type: object - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: + fsType: + type: string + options: + additionalProperties: type: string - mode: - format: int32 - type: integer - path: + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + required: + - driver + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + required: + - repository + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: type: string - required: - - key - - path - type: object - type: array - optional: - type: boolean - secretName: - type: string - type: object - storageos: - properties: - fsType: + type: array + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: type: string - readOnly: - type: boolean - secretRef: + nfs: properties: - name: + path: type: string + readOnly: + type: boolean + server: + type: string + required: + - path + - server type: object - volumeName: - type: string - volumeNamespace: - type: string - type: object - vsphereVolume: - properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: - type: string - required: - - volumePath - type: object - required: - - name - type: object - volumeMount: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - required: - - volume - - volumeMount - type: object - logStop: - type: boolean - logTruncateUntil: - type: string - podSecurityContext: - properties: - fsGroup: - format: int64 - type: integer - fsGroupChangePolicy: - type: string - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - supplementalGroups: - items: - format: int64 - type: integer - type: array - sysctls: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - runAsUserName: - type: string - type: object - type: object - priorityClassName: - type: string - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - s3: - properties: - acl: - type: string - bucket: - type: string - endpoint: - type: string - options: - items: - type: string - type: array - path: - type: string - prefix: - type: string - provider: - type: string - region: - type: string - secretName: - type: string - sse: - type: string - storageClass: - type: string - required: - - provider - type: object - serviceAccount: - type: string - storageClassName: - type: string - storageSize: - type: string - tableFilter: - items: - type: string - type: array - tikvGCLifeTime: - type: string - tolerations: - items: - properties: - effect: - type: string - key: - type: string - operator: - type: string - tolerationSeconds: - format: int64 - type: integer - value: - type: string - type: object - type: array - toolImage: - type: string - useKMS: - type: boolean - type: object - status: - properties: - backupPath: - type: string - backupSize: - format: int64 - type: integer - backupSizeReadable: - type: string - commitTs: - type: string - conditions: - items: - properties: - command: - type: string - lastTransitionTime: - format: date-time - nullable: true - type: string - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - status - - type - type: object - nullable: true - type: array - logCheckpointTs: - type: string - logSubCommandStatuses: - additionalProperties: - properties: - command: - type: string - conditions: - items: - properties: - command: - type: string - lastTransitionTime: - format: date-time - nullable: true - type: string - message: - type: string - reason: - type: string - status: - type: string - type: - type: string - required: - - status - - type - type: object - nullable: true - type: array - logTruncatingUntil: - type: string - phase: - type: string - timeCompleted: - format: date-time - nullable: true - type: string - timeStarted: - format: date-time - nullable: true - type: string - type: object - type: object - logSuccessTruncateUntil: - type: string - phase: - type: string - progresses: - items: - properties: - lastTransitionTime: - format: date-time - nullable: true - type: string - progress: - type: number - step: - type: string - type: object - nullable: true - type: array - timeCompleted: - format: date-time - nullable: true - type: string - timeStarted: - format: date-time - nullable: true - type: string - type: object - required: - - metadata - - spec - type: object - version: v1alpha1 - versions: - - name: v1alpha1 - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] - ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.6.2 - creationTimestamp: null - name: backupschedules.pingcap.com -spec: - additionalPrinterColumns: - - JSONPath: .spec.schedule - description: The cron format string used for backup scheduling - name: Schedule - type: string - - JSONPath: .spec.maxBackups - description: The max number of backups we want to keep - name: MaxBackups - type: integer - - JSONPath: .status.lastBackup - description: The last backup CR name - name: LastBackup - priority: 1 - type: string - - JSONPath: .status.lastBackupTime - description: The last time the backup was successfully created - name: LastBackupTime - priority: 1 - type: date - - JSONPath: .metadata.creationTimestamp - name: Age - type: date - group: pingcap.com - names: - kind: BackupSchedule - listKind: BackupScheduleList - plural: backupschedules - shortNames: - - bks - singular: backupschedule - preserveUnknownFields: false - scope: Namespaced - subresources: {} - validation: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - backupTemplate: - properties: - affinity: - properties: - nodeAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - preference: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - weight: - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: + persistentVolumeClaim: properties: - nodeSelectorTerms: - items: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - type: array + claimName: + type: string + readOnly: + type: boolean required: - - nodeSelectorTerms + - claimName type: object - type: object - podAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: properties: - labelSelector: + configMap: properties: - matchExpressions: + items: items: properties: key: type: string - operator: + mode: + format: int32 + type: integer + path: type: string - values: - items: - type: string - type: array required: - key - - operator + - path type: object type: array - matchLabels: - additionalProperties: - type: string - type: object + name: + type: string + optional: + type: boolean type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + required: + - path + type: object + type: array type: object - type: object - namespaces: - items: - type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array - type: object - podAntiAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - labelSelector: + secret: properties: - matchExpressions: + items: items: properties: key: type: string - operator: + mode: + format: int32 + type: integer + path: type: string - values: - items: - type: string - type: array required: - key - - operator + - path type: object type: array - matchLabels: - additionalProperties: - type: string - type: object + name: + type: string + optional: + type: boolean type: object - namespaces: - items: - type: string - type: array - topologyKey: + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + type: object + quobyte: + properties: + group: + type: string + readOnly: + type: boolean + registry: + type: string + tenant: + type: string + user: + type: string + volume: + type: string + required: + - registry + - volume + type: object + rbd: + properties: + fsType: + type: string + image: + type: string + keyring: + type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + user: + type: string + required: + - image + - monitors + type: object + scaleIO: + properties: + fsType: + type: string + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: type: string required: - - topologyKey - type: object - weight: - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object + - key + - path type: object - namespaces: - items: + type: array + optional: + type: boolean + secretName: + type: string + type: object + storageos: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: type: string - type: array - topologyKey: - type: string - required: - - topologyKey - type: object - type: array + type: object + volumeName: + type: string + volumeNamespace: + type: string + type: object + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string + required: + - volumePath + type: object + required: + - name + type: object + volumeMount: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name type: object - type: object - azblob: - properties: - accessTier: - type: string - container: - type: string - path: - type: string - prefix: - type: string - secretName: - type: string - type: object - backupMode: - type: string - backupType: - type: string - br: - properties: - checkRequirements: - type: boolean - checksum: - type: boolean - cluster: - type: string - clusterNamespace: - type: string - concurrency: - format: int32 - type: integer - db: - type: string - logLevel: - type: string - onLine: - type: boolean - options: - items: - type: string - type: array - rateLimit: - type: integer - sendCredToTikv: - type: boolean - statusAddr: - type: string - table: - type: string - timeAgo: - type: string required: - - cluster - type: object - cleanOption: - properties: - backoffEnabled: - type: boolean - batchConcurrency: - format: int32 - type: integer - disableBatchConcurrency: - type: boolean - pageSize: - format: int64 - type: integer - retryCount: - type: integer - routineConcurrency: - format: int32 - type: integer - type: object - cleanPolicy: - type: string - commitTs: - type: string - dumpling: - properties: - options: - items: - type: string - type: array - tableFilter: - items: - type: string - type: array + - volume + - volumeMount type: object - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - secretKeyRef: - properties: - key: - type: string - name: - type: string - optional: - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - from: + logStop: + type: boolean + logTruncateUntil: + type: string + podSecurityContext: properties: - host: - type: string - port: - format: int32 + fsGroup: + format: int64 type: integer - secretName: - type: string - tlsClientSecretName: - type: string - user: + fsGroupChangePolicy: type: string - required: - - host - - secretName + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object type: object - gcs: + priorityClassName: + type: string + resources: properties: - bucket: - type: string - bucketAcl: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + s3: + properties: + acl: type: string - location: + bucket: type: string - objectAcl: + endpoint: type: string + options: + items: + type: string + type: array path: type: string prefix: type: string - projectId: + provider: + type: string + region: type: string secretName: type: string + sse: + type: string storageClass: type: string required: - - projectId + - provider type: object - imagePullSecrets: + serviceAccount: + type: string + storageClassName: + type: string + storageSize: + type: string + tableFilter: + items: + type: string + type: array + tikvGCLifeTime: + type: string + tolerations: items: properties: - name: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: type: string type: object type: array - local: + toolImage: + type: string + useKMS: + type: boolean + type: object + imagePullSecrets: + items: + properties: + name: + type: string + type: object + type: array + maxBackups: + format: int32 + type: integer + maxReservedTime: + type: string + pause: + type: boolean + schedule: + type: string + storageClassName: + type: string + storageSize: + type: string + required: + - backupTemplate + - schedule + type: object + status: + properties: + allBackupCleanTime: + format: date-time + type: string + lastBackup: + type: string + lastBackupTime: + format: date-time + type: string + type: object + required: + - metadata + - spec + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + creationTimestamp: null + name: backups.pingcap.com +spec: + additionalPrinterColumns: + - JSONPath: .spec.backupType + description: the type of backup, such as full, db, table. Only used when Mode + = snapshot. + name: Type + type: string + - JSONPath: .spec.backupMode + description: the mode of backup, such as snapshot, log. + name: Mode + type: string + - JSONPath: .status.phase + description: The current status of the backup + name: Status + type: string + - JSONPath: .status.backupPath + description: The full path of backup data + name: BackupPath + type: string + - JSONPath: .status.backupSizeReadable + description: The data size of the backup + name: BackupSize + type: string + - JSONPath: .status.commitTs + description: The commit ts of the backup + name: CommitTS + type: string + - JSONPath: .status.logSuccessTruncateUntil + description: The log backup truncate until ts + name: LogTruncateUntil + type: string + - JSONPath: .status.timeStarted + description: The time at which the backup was started + name: Started + priority: 1 + type: date + - JSONPath: .status.timeCompleted + description: The time at which the backup was completed + name: Completed + priority: 1 + type: date + - JSONPath: .metadata.creationTimestamp + name: Age + type: date + group: pingcap.com + names: + kind: Backup + listKind: BackupList + plural: backups + shortNames: + - bk + singular: backup + preserveUnknownFields: false + scope: Namespaced + subresources: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + affinity: + properties: + nodeAffinity: properties: - prefix: - type: string - volume: - properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: - properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: - type: string - readOnly: - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - properties: - readOnly: - type: boolean - secretName: - type: string - shareName: - type: string - required: - - secretName - - shareName - type: object - cephfs: - properties: - monitors: - items: - type: string - type: array - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: - properties: - name: - type: string - type: object - user: - type: string - required: - - monitors - type: object - cinder: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - volumeID: - type: string - required: - - volumeID - type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: - properties: - name: - type: string - type: object - readOnly: - type: boolean - volumeAttributes: - additionalProperties: - type: string - type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + preference: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: type: string - required: - - resource - type: object - required: - - path - type: object - type: array - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: - properties: - readOnly: - type: boolean - volumeClaimTemplate: - properties: - metadata: + type: array + required: + - key + - operator + type: object + type: array + type: object + weight: + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator type: object - spec: + type: array + matchFields: + items: properties: - accessModes: + key: + type: string + operator: + type: string + values: items: type: string type: array - dataSource: + required: + - key + - operator + type: object + type: array + type: object + type: array + required: + - nodeSelectorTerms + type: object + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: properties: - apiGroup: - type: string - kind: + key: type: string - name: + operator: type: string - required: - - kind - - name - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - selector: - properties: - matchExpressions: + values: items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: type: string - type: object + type: array + required: + - key + - operator type: object - storageClassName: + type: array + matchLabels: + additionalProperties: type: string - volumeMode: + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: type: string - volumeName: + operator: type: string + values: + items: + type: string + type: array + required: + - key + - operator type: object - required: - - spec - type: object - type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - wwids: - items: - type: string - type: array - type: object - flexVolume: - properties: - driver: - type: string - fsType: + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: type: string - options: - additionalProperties: + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: type: string - type: object - readOnly: - type: boolean - secretRef: - properties: - name: + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: type: string - type: object - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: + type: object + type: object + namespaces: + items: type: string - type: object - gcePersistentDisk: + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + azblob: + properties: + accessTier: + type: string + container: + type: string + path: + type: string + prefix: + type: string + secretName: + type: string + type: object + backupMode: + type: string + backupType: + type: string + br: + properties: + checkRequirements: + type: boolean + checksum: + type: boolean + cluster: + type: string + clusterNamespace: + type: string + concurrency: + format: int32 + type: integer + db: + type: string + logLevel: + type: string + onLine: + type: boolean + options: + items: + type: string + type: array + rateLimit: + type: integer + sendCredToTikv: + type: boolean + statusAddr: + type: string + table: + type: string + timeAgo: + type: string + required: + - cluster + type: object + cleanOption: + properties: + backoffEnabled: + type: boolean + batchConcurrency: + format: int32 + type: integer + disableBatchConcurrency: + type: boolean + pageSize: + format: int64 + type: integer + retryCount: + type: integer + routineConcurrency: + format: int32 + type: integer + type: object + cleanPolicy: + type: string + commitTs: + type: string + dumpling: + properties: + options: + items: + type: string + type: array + tableFilter: + items: + type: string + type: array + type: object + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + type: object + required: + - name + type: object + type: array + from: + properties: + host: + type: string + port: + format: int32 + type: integer + secretName: + type: string + tlsClientSecretName: + type: string + user: + type: string + required: + - host + - secretName + type: object + gcs: + properties: + bucket: + type: string + bucketAcl: + type: string + location: + type: string + objectAcl: + type: string + path: + type: string + prefix: + type: string + projectId: + type: string + secretName: + type: string + storageClass: + type: string + required: + - projectId + type: object + imagePullSecrets: + items: + properties: + name: + type: string + type: object + type: array + local: + properties: + prefix: + type: string + volume: + properties: + awsElasticBlockStore: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + azureDisk: + properties: + cachingMode: + type: string + diskName: + type: string + diskURI: + type: string + fsType: + type: string + kind: + type: string + readOnly: + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + properties: + readOnly: + type: boolean + secretName: + type: string + shareName: + type: string + required: + - secretName + - shareName + type: object + cephfs: + properties: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: + name: type: string - readOnly: - type: boolean - required: - - pdName type: object - gitRepo: + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: properties: - directory: - type: string - repository: - type: string - revision: + name: type: string - required: - - repository type: object - glusterfs: + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: properties: - endpoints: - type: string - path: + name: type: string - readOnly: - type: boolean - required: - - endpoints - - path type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + mode: + format: int32 + type: integer + path: type: string - type: array - readOnly: - type: boolean - secretRef: + resourceFieldRef: + properties: + containerName: + type: string + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + type: string + required: + - resource + type: object + required: + - path + type: object + type: array + type: object + emptyDir: + properties: + medium: + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + properties: + readOnly: + type: boolean + volumeClaimTemplate: + properties: + metadata: + type: object + spec: properties: - name: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + resources: + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + storageClassName: + type: string + volumeMode: + type: string + volumeName: type: string type: object - targetPortal: - type: string required: - - iqn - - lun - - targetPortal + - spec type: object - name: + type: object + fc: + properties: + fsType: type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array + type: object + flexVolume: + properties: + driver: + type: string + fsType: + type: string + options: + additionalProperties: + type: string type: object - photonPersistentDisk: + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - pdID: + name: type: string - required: - - pdID type: object - portworxVolume: + required: + - driver + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + required: + - repository + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: + name: type: string - required: - - volumeID type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + type: string + nfs: + properties: + path: + type: string + readOnly: + type: boolean + server: + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: + properties: + configMap: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + downwardAPI: properties: - configMap: - properties: - items: - items: + items: + items: + properties: + fieldRef: properties: - key: - type: string - mode: - format: int32 - type: integer - path: + apiVersion: type: string - required: - - key - - path - type: object - type: array - name: - type: string - optional: - type: boolean - type: object - downwardAPI: - properties: - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - mode: - format: int32 - type: integer - path: + fieldPath: type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object required: - - path + - fieldPath type: object - type: array - type: object - secret: - properties: - items: - items: + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: properties: - key: + containerName: type: string - mode: - format: int32 - type: integer - path: + divisor: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: type: string required: - - key - - path + - resource type: object - type: array - name: - type: string - optional: - type: boolean - type: object - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object + required: + - path + type: object + type: array type: object - type: array - required: - - sources - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - pool: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: + secret: properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - optional: - type: boolean - secretName: - type: string - type: object - storageos: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - volumeName: - type: string - volumeNamespace: - type: string - type: object - vsphereVolume: - properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: - type: string - required: - - volumePath - type: object + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array required: - - name + - sources type: object - volumeMount: + quobyte: properties: - mountPath: - type: string - mountPropagation: - type: string - name: + group: type: string readOnly: type: boolean - subPath: + registry: type: string - subPathExpr: + tenant: + type: string + user: + type: string + volume: type: string required: - - mountPath - - name + - registry + - volume type: object - required: - - volume - - volumeMount - type: object - logStop: - type: boolean - logTruncateUntil: - type: string - podSecurityContext: - properties: - fsGroup: - format: int64 - type: integer - fsGroupChangePolicy: - type: string - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: + rbd: properties: - level: + fsType: type: string - role: + image: type: string - type: + keyring: type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object user: type: string + required: + - image + - monitors type: object - seccompProfile: + scaleIO: properties: - localhostProfile: + fsType: type: string - type: + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: type: string required: - - type + - gateway + - secretRef + - system type: object - supplementalGroups: - items: - format: int64 - type: integer - type: array - sysctls: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - windowsOptions: + secret: properties: - gmsaCredentialSpec: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + optional: + type: boolean + secretName: type: string - gmsaCredentialSpecName: + type: object + storageos: + properties: + fsType: type: string - runAsUserName: + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + volumeName: + type: string + volumeNamespace: type: string type: object - type: object - priorityClassName: - type: string - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string + required: + - volumePath type: object + required: + - name type: object - s3: + volumeMount: properties: - acl: + mountPath: type: string - bucket: + mountPropagation: type: string - endpoint: + name: type: string - options: - items: - type: string - type: array - path: + readOnly: + type: boolean + subPath: type: string - prefix: + subPathExpr: + type: string + required: + - mountPath + - name + type: object + required: + - volume + - volumeMount + type: object + logStop: + type: boolean + logTruncateUntil: + type: string + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: type: string - provider: + role: type: string - region: + type: type: string - secretName: + user: type: string - sse: + type: object + seccompProfile: + properties: + localhostProfile: type: string - storageClass: + type: type: string required: - - provider + - type type: object - serviceAccount: - type: string - storageClassName: - type: string - storageSize: - type: string - tableFilter: + supplementalGroups: items: - type: string + format: int64 + type: integer type: array - tikvGCLifeTime: - type: string - tolerations: + sysctls: items: properties: - effect: - type: string - key: - type: string - operator: + name: type: string - tolerationSeconds: - format: int64 - type: integer value: type: string + required: + - name + - value type: object type: array - toolImage: + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + resources: + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + s3: + properties: + acl: type: string - useKMS: - type: boolean + bucket: + type: string + endpoint: + type: string + options: + items: + type: string + type: array + path: + type: string + prefix: + type: string + provider: + type: string + region: + type: string + secretName: + type: string + sse: + type: string + storageClass: + type: string + required: + - provider type: object - imagePullSecrets: + serviceAccount: + type: string + storageClassName: + type: string + storageSize: + type: string + tableFilter: + items: + type: string + type: array + tikvGCLifeTime: + type: string + tolerations: items: properties: - name: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: type: string type: object type: array - maxBackups: - format: int32 - type: integer - maxReservedTime: + toolImage: type: string - pause: + useKMS: type: boolean - schedule: - type: string - storageClassName: - type: string - storageSize: - type: string - required: - - backupTemplate - - schedule type: object status: properties: - allBackupCleanTime: - format: date-time + backupPath: type: string - lastBackup: + backupSize: + format: int64 + type: integer + backupSizeReadable: type: string - lastBackupTime: + commitTs: + type: string + conditions: + items: + properties: + command: + type: string + lastTransitionTime: + format: date-time + nullable: true + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + nullable: true + type: array + logCheckpointTs: + type: string + logSubCommandStatuses: + additionalProperties: + properties: + command: + type: string + conditions: + items: + properties: + command: + type: string + lastTransitionTime: + format: date-time + nullable: true + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + nullable: true + type: array + logTruncatingUntil: + type: string + phase: + type: string + timeCompleted: + format: date-time + nullable: true + type: string + timeStarted: + format: date-time + nullable: true + type: string + type: object + type: object + logSuccessTruncateUntil: + type: string + phase: + type: string + progresses: + items: + properties: + lastTransitionTime: + format: date-time + nullable: true + type: string + progress: + type: number + step: + type: string + type: object + nullable: true + type: array + timeCompleted: + format: date-time + nullable: true + type: string + timeStarted: format: date-time + nullable: true type: string type: object required: @@ -30558,6 +30558,8 @@ spec: x-kubernetes-list-type: map version: type: string + waitLeaderTransferBackTimeout: + type: string required: - replicas type: object diff --git a/pkg/apis/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/pingcap/v1alpha1/openapi_generated.go index 63cd9d6f04..1f374af9fc 100644 --- a/pkg/apis/pingcap/v1alpha1/openapi_generated.go +++ b/pkg/apis/pingcap/v1alpha1/openapi_generated.go @@ -11515,11 +11515,17 @@ func schema_pkg_apis_pingcap_v1alpha1_TiKVSpec(ref common.ReferenceCallback) com }, "evictLeaderTimeout": { SchemaProps: spec.SchemaProps{ - Description: "EvictLeaderTimeout indicates the timeout to evict tikv leader, in the format of Go Duration. Defaults to 10m", + Description: "EvictLeaderTimeout indicates the timeout to evict tikv leader, in the format of Go Duration. Defaults to 1500min", Type: []string{"string"}, Format: "", }, }, + "waitLeaderTransferBackTimeout": { + SchemaProps: spec.SchemaProps{ + Description: "WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back after upgarde for a tikv.\n\nDefaults to 400s", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, "storageVolumes": { SchemaProps: spec.SchemaProps{ Description: "StorageVolumes configure additional storage for TiKV pods.", @@ -11565,7 +11571,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TiKVSpec(ref common.ReferenceCallback) com }, }, Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.Failover", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.LogTailerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.Probe", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ScalePolicy", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.StorageVolume", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.SuspendAction", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVConfigWraper", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvFromSource", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodDNSConfig", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/api/core/v1.VolumeMount", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.Failover", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.LogTailerSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.Probe", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.ScalePolicy", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.StorageVolume", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.SuspendAction", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVConfigWraper", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TopologySpreadConstraint", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.EnvFromSource", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodDNSConfig", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/api/core/v1.VolumeMount", "k8s.io/apimachinery/pkg/api/resource.Quantity", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, } } diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go index 863a464595..e157eaa813 100644 --- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go @@ -8052,6 +8052,11 @@ func (in *TiKVSpec) DeepCopyInto(out *TiKVSpec) { *out = new(string) **out = **in } + if in.WaitLeaderTransferBackTimeout != nil { + in, out := &in.WaitLeaderTransferBackTimeout, &out.WaitLeaderTransferBackTimeout + *out = new(metav1.Duration) + **out = **in + } if in.StorageVolumes != nil { in, out := &in.StorageVolumes, &out.StorageVolumes *out = make([]StorageVolume, len(*in)) From 4698ca35004066a99089c017921a06a5877b99a5 Mon Sep 17 00:00:00 2001 From: Shiori Date: Wed, 8 Feb 2023 11:50:11 +0800 Subject: [PATCH 04/10] WIP --- docs/api-references/docs.md | 11 +++++ manifests/crd.yaml | 18 +++++++++ .../crd/v1/pingcap.com_tidbclusters.yaml | 18 +++++++++ .../crd/v1beta1/pingcap.com_tidbclusters.yaml | 18 +++++++++ manifests/crd_v1beta1.yaml | 18 +++++++++ pkg/apis/pingcap/v1alpha1/types.go | 5 ++- .../pingcap/v1alpha1/zz_generated.deepcopy.go | 5 +++ pkg/manager/member/tikv_member_manager.go | 4 ++ pkg/manager/member/tikv_upgrader.go | 40 +++++++++---------- pkg/manager/member/utils.go | 27 ++++++++----- pkg/manager/suspender/suspender.go | 2 +- 11 files changed, 132 insertions(+), 34 deletions(-) diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 2cf24324de..9a978fda2a 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -21348,6 +21348,7 @@ map[string]github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiKVStore +

key: store id

@@ -21736,6 +21737,16 @@ Kubernetes meta/v1.Time TODO: remove nullable, https://github.com/kubernetes/kubernetes/issues/86811

+ + +lastLeaderCountBeforeUpgrade
+ +int32 + + + + +

TiKVTitanCfConfig

diff --git a/manifests/crd.yaml b/manifests/crd.yaml index 137ecd7324..a97ee29ebf 100644 --- a/manifests/crd.yaml +++ b/manifests/crd.yaml @@ -33779,6 +33779,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -33853,6 +33856,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -33881,6 +33887,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -34026,6 +34035,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -34100,6 +34112,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -34128,6 +34143,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true diff --git a/manifests/crd/v1/pingcap.com_tidbclusters.yaml b/manifests/crd/v1/pingcap.com_tidbclusters.yaml index d85126be53..4d101a4335 100644 --- a/manifests/crd/v1/pingcap.com_tidbclusters.yaml +++ b/manifests/crd/v1/pingcap.com_tidbclusters.yaml @@ -20524,6 +20524,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20598,6 +20601,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20626,6 +20632,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20771,6 +20780,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20845,6 +20857,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20873,6 +20888,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true diff --git a/manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml b/manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml index 7d99237db2..db6e97cd41 100644 --- a/manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml +++ b/manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml @@ -20494,6 +20494,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20568,6 +20571,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20596,6 +20602,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20741,6 +20750,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20815,6 +20827,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -20843,6 +20858,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true diff --git a/manifests/crd_v1beta1.yaml b/manifests/crd_v1beta1.yaml index 80e5d0b232..387365ad67 100644 --- a/manifests/crd_v1beta1.yaml +++ b/manifests/crd_v1beta1.yaml @@ -33744,6 +33744,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -33818,6 +33821,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -33846,6 +33852,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -33991,6 +34000,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -34065,6 +34077,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true @@ -34093,6 +34108,9 @@ spec: type: string ip: type: string + lastLeaderCountBeforeUpgrade: + format: int32 + type: integer lastTransitionTime: format: date-time nullable: true diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go index 495de6b45a..82624efe46 100644 --- a/pkg/apis/pingcap/v1alpha1/types.go +++ b/pkg/apis/pingcap/v1alpha1/types.go @@ -1402,7 +1402,7 @@ type TiKVStatus struct { Phase MemberPhase `json:"phase,omitempty"` BootStrapped bool `json:"bootStrapped,omitempty"` StatefulSet *apps.StatefulSetStatus `json:"statefulSet,omitempty"` - Stores map[string]TiKVStore `json:"stores,omitempty"` + Stores map[string]TiKVStore `json:"stores,omitempty"` // key: store id PeerStores map[string]TiKVStore `json:"peerStores,omitempty"` TombstoneStores map[string]TiKVStore `json:"tombstoneStores,omitempty"` FailureStores map[string]TiKVFailureStore `json:"failureStores,omitempty"` @@ -1497,6 +1497,9 @@ type TiKVStore struct { // TODO: remove nullable, https://github.com/kubernetes/kubernetes/issues/86811 // +nullable LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + // LastLeaderCountBeforeUpgrade records the leader count before upgrade + // It is set when evicting leader and used to wait for most leaders to transfer back after upgrade + LastLeaderCountBeforeUpgrade *int32 `json:"lastLeaderCountBeforeUpgrade,omitempty"` } // TiKVFailureStore is the tikv failure store information diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go index e157eaa813..0f9b7998f1 100644 --- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go @@ -8280,6 +8280,11 @@ func (in *TiKVStorageReadPoolConfig) DeepCopy() *TiKVStorageReadPoolConfig { func (in *TiKVStore) DeepCopyInto(out *TiKVStore) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + if in.LastLeaderCountBeforeUpgrade != nil { + in, out := &in.LastLeaderCountBeforeUpgrade, &out.LastLeaderCountBeforeUpgrade + *out = new(int32) + **out = **in + } return } diff --git a/pkg/manager/member/tikv_member_manager.go b/pkg/manager/member/tikv_member_manager.go index 0eb5463c91..96231212f0 100644 --- a/pkg/manager/member/tikv_member_manager.go +++ b/pkg/manager/member/tikv_member_manager.go @@ -861,6 +861,10 @@ func (m *tikvMemberManager) syncTiKVClusterStatus(tc *v1alpha1.TidbCluster, set status.LastTransitionTime = oldStore.LastTransitionTime } + if oldStore.LastLeaderCountBeforeUpgrade != nil { + status.LastLeaderCountBeforeUpgrade = oldStore.LastLeaderCountBeforeUpgrade + } + // In theory, the external tikv can join the cluster, and the operator would only manage the internal tikv. // So we check the store owner to make sure it. if store.Store != nil { diff --git a/pkg/manager/member/tikv_upgrader.go b/pkg/manager/member/tikv_upgrader.go index 7d13039ee1..c5cfeab6f2 100644 --- a/pkg/manager/member/tikv_upgrader.go +++ b/pkg/manager/member/tikv_upgrader.go @@ -32,6 +32,7 @@ import ( errorutils "k8s.io/apimachinery/pkg/util/errors" "k8s.io/klog/v2" podutil "k8s.io/kubernetes/pkg/api/v1/pod" + "k8s.io/utils/pointer" ) const ( @@ -39,8 +40,6 @@ const ( annoKeyEvictLeaderBeginTime = "evictLeaderBeginTime" // annoKeyEvictLeaderEndTime is the annotation key in a pod to record the time to end leader eviction annoKeyEvictLeaderEndTime = "tidb.pingcap.com/tikv-evict-leader-end-at" - // EvictLeaderTimeout is the annotation key in a pod to record the leader count before upgrade - annoKeyTiKVLeaderCountBeforeUpgrade = "tidb.pingcap.com/tikv-leader-count-before-upgrade" // TODO: change to use minReadySeconds in sts spec // See https://kubernetes.io/blog/2021/08/27/minreadyseconds-statefulsets/ annoKeyTiKVMinReadySeconds = "tidb.pingcap.com/tikv-min-ready-seconds" @@ -277,7 +276,11 @@ func (u *tikvUpgrader) modifyVolumesBeforeUpgrade(tc *v1alpha1.TidbCluster, upgr func (u *tikvUpgrader) endEvictLeaderAfterUpgrade(tc *v1alpha1.TidbCluster, pod *corev1.Pod) (bool /*done*/, error) { logPrefix := fmt.Sprintf("endEvictLeaderAfterUpgrade: for tikv pod %s/%s", pod.Namespace, pod.Name) - storeID, err := TiKVStoreIDFromStatus(tc, pod.Name) + store, err := TiKVStoreFromStatus(tc, pod.Name) + if err != nil { + return false, err + } + storeID, err := strconv.ParseUint(store.ID, 10, 64) if err != nil { return false, err } @@ -316,16 +319,11 @@ func (u *tikvUpgrader) endEvictLeaderAfterUpgrade(tc *v1alpha1.TidbCluster, pod // // 3. Time out waiting for leaders to transfer back - timeout := tc.TiKVWaitLeaderTransferBackTimeout() - leaderCountBeforeStr, exist := pod.Annotations[annoKeyTiKVLeaderCountBeforeUpgrade] - if !exist { - return true, nil - } - leaderCountBefore, err := strconv.Atoi(leaderCountBeforeStr) - if err != nil { - klog.Errorf("%s: parse annotation %q to int failed", logPrefix, annoKeyTiKVLeaderCountBeforeUpgrade) + if store.LastLeaderCountBeforeUpgrade == nil { + klog.Infof("%s: miss leader count before upgrade, so skip waiting leaders for transfer back", logPrefix) return true, nil } + leaderCountBefore := int(*store.LastLeaderCountBeforeUpgrade) evictLeaderEndTime, err := time.Parse(time.RFC3339, evictLeaderEndTimeStr) if err != nil { klog.Errorf("%s: parse annotation %q to time failed", logPrefix, annoKeyEvictLeaderBeginTime) @@ -333,21 +331,19 @@ func (u *tikvUpgrader) endEvictLeaderAfterUpgrade(tc *v1alpha1.TidbCluster, pod } if leaderCountBefore < 200 { + klog.V(4).Infof("%s: leader count is %d and less than 200, so skip waiting leaders for transfer back", logPrefix, leaderCountBefore) return true, nil } + timeout := tc.TiKVWaitLeaderTransferBackTimeout() if time.Now().After(evictLeaderEndTime.Add(timeout)) { - klog.Infof("%s: time out for leaders transfer back threshold %v, so skip waiting", logPrefix, timeout) + klog.V(4).Infof("%s: time out with threshold %v, so skip waiting leaders for transfer back", logPrefix, timeout) return true, nil } - leaderCountNow, err := u.deps.TiKVControl.GetTiKVPodClient(tc.Namespace, tc.Name, pod.Name, tc.IsTLSClusterEnabled()).GetLeaderCount() - if err != nil { - klog.Warningf("%s: failed to get leader count, error: %v", logPrefix, err) - return false, nil - } + leaderCountNow := int(store.LeaderCount) if leaderCountNow >= leaderCountBefore*2/3 { - klog.Infof("%s: leader count is %d and greater than 2/3 of original count %d, so ready to upgrade next store", + klog.V(4).Infof("%s: leader count is %d and greater than 2/3 of original count %d, so ready to upgrade next store", logPrefix, leaderCountNow, leaderCountBefore) return true, nil } @@ -362,12 +358,12 @@ func (u *tikvUpgrader) beginEvictLeader(tc *v1alpha1.TidbCluster, storeID uint64 podName := pod.GetName() annosToRecordInfo := map[string]string{} - leaderCount, err := u.deps.TiKVControl.GetTiKVPodClient(tc.Namespace, tc.Name, pod.Name, tc.IsTLSClusterEnabled()).GetLeaderCount() - if err == nil { - annosToRecordInfo[annoKeyTiKVLeaderCountBeforeUpgrade] = strconv.Itoa(leaderCount) + if status, exist := tc.Status.TiKV.Stores[strconv.Itoa(int(storeID))]; exist { + status.LastLeaderCountBeforeUpgrade = pointer.Int32Ptr(int32(status.LeaderCount)) + tc.Status.TiKV.Stores[strconv.Itoa(int(storeID))] = status } - err = controller.GetPDClient(u.deps.PDControl, tc).BeginEvictLeader(storeID) + err := controller.GetPDClient(u.deps.PDControl, tc).BeginEvictLeader(storeID) if err != nil { klog.Errorf("beginEvictLeader: failed to begin evict leader: %d, %s/%s, %v", storeID, ns, podName, err) diff --git a/pkg/manager/member/utils.go b/pkg/manager/member/utils.go index c9a5fb1552..64fbe3ff24 100644 --- a/pkg/manager/member/utils.go +++ b/pkg/manager/member/utils.go @@ -483,20 +483,27 @@ func parseImage(image string) (string, string) { return name, tag } -var ErrNotFoundStoreID = fmt.Errorf("not found") - -func TiKVStoreIDFromStatus(tc *v1alpha1.TidbCluster, podName string) (uint64, error) { +func TiKVStoreFromStatus(tc *v1alpha1.TidbCluster, podName string) (v1alpha1.TiKVStore, error) { for _, store := range tc.Status.TiKV.Stores { if store.PodName == podName { - storeID, err := strconv.ParseUint(store.ID, 10, 64) - if err != nil { - return 0, err - } - - return storeID, nil + return store, nil } } - return 0, ErrNotFoundStoreID + return v1alpha1.TiKVStore{}, fmt.Errorf("store is not found in tikv status") +} + +func TiKVStoreIDFromStatus(tc *v1alpha1.TidbCluster, podName string) (uint64, error) { + store, err := TiKVStoreFromStatus(tc, podName) + if err != nil { + return 0, err + } + + storeID, err := strconv.ParseUint(store.ID, 10, 64) + if err != nil { + return 0, err + } + + return storeID, nil } // MergePatchContainers adds patches to base using a strategic merge patch and diff --git a/pkg/manager/suspender/suspender.go b/pkg/manager/suspender/suspender.go index 0194bfe2d5..c3af54d428 100644 --- a/pkg/manager/suspender/suspender.go +++ b/pkg/manager/suspender/suspender.go @@ -95,7 +95,7 @@ func (s *suspender) SuspendComponent(cluster v1alpha1.Cluster, comp v1alpha1.Mem return true, err } - klog.V(4).Infof("component %s is not needed to be suspended", ctx.ComponentID()) + klog.V(10).Infof("component %s is not needed to be suspended", ctx.ComponentID()) return false, nil } From f130cda7b5bc91230a19a048ebfecd8913c02f5f Mon Sep 17 00:00:00 2001 From: Shiori Date: Thu, 9 Feb 2023 10:57:44 +0800 Subject: [PATCH 05/10] optimize --- docs/api-references/docs.md | 3 + pkg/apis/pingcap/v1alpha1/types.go | 8 +- .../pingcap/v1alpha1/zz_generated.deepcopy.go | 4 +- pkg/manager/member/tikv_member_manager.go | 4 +- pkg/manager/member/tikv_upgrader.go | 94 ++++++++----------- 5 files changed, 53 insertions(+), 60 deletions(-) diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 9a978fda2a..1c9fbb3c77 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -21745,6 +21745,9 @@ int32 +

LeaderCountBeforeUpgrade records the leader count before upgrade.

+

It is set when evicting leader and used to wait for most leaders to transfer back after upgrade. +It is unset after leader transfer is completed.

diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go index 82624efe46..eb3bc15891 100644 --- a/pkg/apis/pingcap/v1alpha1/types.go +++ b/pkg/apis/pingcap/v1alpha1/types.go @@ -1497,9 +1497,11 @@ type TiKVStore struct { // TODO: remove nullable, https://github.com/kubernetes/kubernetes/issues/86811 // +nullable LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - // LastLeaderCountBeforeUpgrade records the leader count before upgrade - // It is set when evicting leader and used to wait for most leaders to transfer back after upgrade - LastLeaderCountBeforeUpgrade *int32 `json:"lastLeaderCountBeforeUpgrade,omitempty"` + // LeaderCountBeforeUpgrade records the leader count before upgrade. + // + // It is set when evicting leader and used to wait for most leaders to transfer back after upgrade. + // It is unset after leader transfer is completed. + LeaderCountBeforeUpgrade *int32 `json:"lastLeaderCountBeforeUpgrade,omitempty"` } // TiKVFailureStore is the tikv failure store information diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go index 0f9b7998f1..065f60a49e 100644 --- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go @@ -8280,8 +8280,8 @@ func (in *TiKVStorageReadPoolConfig) DeepCopy() *TiKVStorageReadPoolConfig { func (in *TiKVStore) DeepCopyInto(out *TiKVStore) { *out = *in in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - if in.LastLeaderCountBeforeUpgrade != nil { - in, out := &in.LastLeaderCountBeforeUpgrade, &out.LastLeaderCountBeforeUpgrade + if in.LeaderCountBeforeUpgrade != nil { + in, out := &in.LeaderCountBeforeUpgrade, &out.LeaderCountBeforeUpgrade *out = new(int32) **out = **in } diff --git a/pkg/manager/member/tikv_member_manager.go b/pkg/manager/member/tikv_member_manager.go index bb4f203a61..af0d628599 100644 --- a/pkg/manager/member/tikv_member_manager.go +++ b/pkg/manager/member/tikv_member_manager.go @@ -861,8 +861,8 @@ func (m *tikvMemberManager) syncTiKVClusterStatus(tc *v1alpha1.TidbCluster, set status.LastTransitionTime = oldStore.LastTransitionTime } - if oldStore.LastLeaderCountBeforeUpgrade != nil { - status.LastLeaderCountBeforeUpgrade = oldStore.LastLeaderCountBeforeUpgrade + if oldStore.LeaderCountBeforeUpgrade != nil { + status.LeaderCountBeforeUpgrade = oldStore.LeaderCountBeforeUpgrade } // In theory, the external tikv can join the cluster, and the operator would only manage the internal tikv. diff --git a/pkg/manager/member/tikv_upgrader.go b/pkg/manager/member/tikv_upgrader.go index c5cfeab6f2..b7b61d60d1 100644 --- a/pkg/manager/member/tikv_upgrader.go +++ b/pkg/manager/member/tikv_upgrader.go @@ -293,64 +293,52 @@ func (u *tikvUpgrader) endEvictLeaderAfterUpgrade(tc *v1alpha1.TidbCluster, pod } // wait for leaders to transfer back or timeout - // - // 1. 2/3 of leaders are already transferred back. - // - // 2. Original leader count is less than 200. - // Though the accurate threshold is 57, it can be set to a larger value, for example 200. - // Moreover, clusters which have small number of leaders are supposed to has low pressure, - // and this recovering strategy may be unnecessary for them. Clusters in production env - // usually has thousands of leaders. - // - // Since PD considers it as balance when the leader count delta is less than 10, so - // these two conditions should be taken into consideration - // - // - When the original leader count is less than 20, there is possibility that - // no leader will transfer back. - // For example: The target store's leader count is 19. Other stores' leader count are 9. - // There are 20 stores in total. In this case, there may be no leader to transfer back. - // - // - When the leader count is less than 57, there is possibility that only less than 2/3 - // leaders are transfered back. `(N-10-9 >= 2/3*N) -> (N>=57)`. - // For example: The target store's leader count is 56. Other stores' leader count are 46. - // There are 57 stores in total. In this case, there may be only 37 leaders to transfer back, - // and 37/56 < 2/3. Accordingly, if the target store's leader count is 57, then there may be - // 38 leaders to transfer back, and 38/57 == 2/3. - // - // 3. Time out waiting for leaders to transfer back - - if store.LastLeaderCountBeforeUpgrade == nil { - klog.Infof("%s: miss leader count before upgrade, so skip waiting leaders for transfer back", logPrefix) - return true, nil - } - leaderCountBefore := int(*store.LastLeaderCountBeforeUpgrade) - evictLeaderEndTime, err := time.Parse(time.RFC3339, evictLeaderEndTimeStr) - if err != nil { - klog.Errorf("%s: parse annotation %q to time failed", logPrefix, annoKeyEvictLeaderBeginTime) - return true, nil - } + // refer to https://github.com/pingcap/tiup/pull/2051 - if leaderCountBefore < 200 { - klog.V(4).Infof("%s: leader count is %d and less than 200, so skip waiting leaders for transfer back", logPrefix, leaderCountBefore) - return true, nil - } + isLeaderTransferBackOrTimeout := func() bool { + leaderCountBefore := int(*store.LeaderCountBeforeUpgrade) + evictLeaderEndTime, err := time.Parse(time.RFC3339, evictLeaderEndTimeStr) + if err != nil { + klog.Errorf("%s: parse annotation %q to time failed", logPrefix, annoKeyEvictLeaderBeginTime) + return true + } - timeout := tc.TiKVWaitLeaderTransferBackTimeout() - if time.Now().After(evictLeaderEndTime.Add(timeout)) { - klog.V(4).Infof("%s: time out with threshold %v, so skip waiting leaders for transfer back", logPrefix, timeout) - return true, nil - } + if leaderCountBefore < 200 { + klog.V(4).Infof("%s: leader count is %d and less than 200, so skip waiting leaders for transfer back", logPrefix, leaderCountBefore) + return true + } + + timeout := tc.TiKVWaitLeaderTransferBackTimeout() + if time.Now().After(evictLeaderEndTime.Add(timeout)) { + klog.Infof("%s: time out with threshold %v, so skip waiting leaders for transfer back", logPrefix, timeout) + return true + } - leaderCountNow := int(store.LeaderCount) - if leaderCountNow >= leaderCountBefore*2/3 { - klog.V(4).Infof("%s: leader count is %d and greater than 2/3 of original count %d, so ready to upgrade next store", + leaderCountNow := int(store.LeaderCount) + if leaderCountNow >= leaderCountBefore*2/3 { + klog.Infof("%s: leader count is %d and greater than 2/3 of original count %d, so ready to upgrade next store", + logPrefix, leaderCountNow, leaderCountBefore) + return true + } + + klog.Infof("%s: leader count is %d and less than 2/3 of original count %d, and wait for leaders to transfer back", logPrefix, leaderCountNow, leaderCountBefore) - return true, nil + return false } - klog.Infof("%s: leader count is %d and less than 2/3 of original count %d, and wait for leaders to transfer back", - logPrefix, leaderCountNow, leaderCountBefore) - return false, nil + if store.LeaderCountBeforeUpgrade != nil { + done := isLeaderTransferBackOrTimeout() + if done { + store.LeaderCountBeforeUpgrade = nil + tc.Status.TiKV.Stores[store.ID] = store + } + return done, nil + } else { + klog.V(4).Infof("%s: miss leader count before upgrade, so skip waiting leaders for transfer back", logPrefix) + } + + return true, nil + } func (u *tikvUpgrader) beginEvictLeader(tc *v1alpha1.TidbCluster, storeID uint64, pod *corev1.Pod) error { @@ -359,7 +347,7 @@ func (u *tikvUpgrader) beginEvictLeader(tc *v1alpha1.TidbCluster, storeID uint64 annosToRecordInfo := map[string]string{} if status, exist := tc.Status.TiKV.Stores[strconv.Itoa(int(storeID))]; exist { - status.LastLeaderCountBeforeUpgrade = pointer.Int32Ptr(int32(status.LeaderCount)) + status.LeaderCountBeforeUpgrade = pointer.Int32Ptr(int32(status.LeaderCount)) tc.Status.TiKV.Stores[strconv.Itoa(int(storeID))] = status } From c76806ac8747ffcd8de6a169852f710fa1ddcb33 Mon Sep 17 00:00:00 2001 From: Shiori Date: Thu, 9 Feb 2023 11:00:28 +0800 Subject: [PATCH 06/10] fix timeout --- pkg/apis/pingcap/v1alpha1/tidbcluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/apis/pingcap/v1alpha1/tidbcluster.go b/pkg/apis/pingcap/v1alpha1/tidbcluster.go index e6669f442f..2f2000348b 100644 --- a/pkg/apis/pingcap/v1alpha1/tidbcluster.go +++ b/pkg/apis/pingcap/v1alpha1/tidbcluster.go @@ -39,7 +39,7 @@ const ( defaultEnablePVReclaim = false // defaultEvictLeaderTimeout is the timeout limit of evict leader defaultEvictLeaderTimeout = 1500 * time.Minute - defaultWaitLeaderTransferBackTimeout = 4 * time.Minute + defaultWaitLeaderTransferBackTimeout = 400 * time.Second // defaultTiCDCGracefulShutdownTimeout is the timeout limit of graceful // shutdown a TiCDC pod. defaultTiCDCGracefulShutdownTimeout = 10 * time.Minute @@ -152,7 +152,7 @@ func (tc *TidbCluster) TiKVWaitLeaderTransferBackTimeout() time.Duration { if tc.Spec.TiKV != nil && tc.Spec.TiKV.WaitLeaderTransferBackTimeout != nil { return tc.Spec.TiKV.WaitLeaderTransferBackTimeout.Duration } - return defaultEvictLeaderTimeout + return defaultWaitLeaderTransferBackTimeout } // TiFlashImage return the image used by TiFlash. From fc413c08206e588f8104e2e70801365bdd038a56 Mon Sep 17 00:00:00 2001 From: Shiori Date: Thu, 9 Feb 2023 15:24:46 +0800 Subject: [PATCH 07/10] optimize and fix ci --- pkg/manager/member/tikv_upgrader.go | 49 +++---- pkg/manager/member/tikv_upgrader_test.go | 170 ++++++++++++++++++++++- 2 files changed, 194 insertions(+), 25 deletions(-) diff --git a/pkg/manager/member/tikv_upgrader.go b/pkg/manager/member/tikv_upgrader.go index b7b61d60d1..58c1772b42 100644 --- a/pkg/manager/member/tikv_upgrader.go +++ b/pkg/manager/member/tikv_upgrader.go @@ -285,26 +285,31 @@ func (u *tikvUpgrader) endEvictLeaderAfterUpgrade(tc *v1alpha1.TidbCluster, pod return false, err } - // evict leader if needed - - evictLeaderEndTimeStr, ended := pod.Annotations[annoKeyEvictLeaderEndTime] - if !ended { - return false, u.endEvictLeader(tc, storeID, pod) + // evict leader + err = u.endEvictLeader(tc, storeID, pod) + if err != nil { + return false, err } // wait for leaders to transfer back or timeout // refer to https://github.com/pingcap/tiup/pull/2051 isLeaderTransferBackOrTimeout := func() bool { - leaderCountBefore := int(*store.LeaderCountBeforeUpgrade) + evictLeaderEndTimeStr, exist := pod.Annotations[annoKeyEvictLeaderEndTime] + if !exist { + klog.Errorf("%s: miss annotation %q, so skip waiting leaders for transfer back", logPrefix, annoKeyEvictLeaderEndTime) + return true + } + evictLeaderEndTime, err := time.Parse(time.RFC3339, evictLeaderEndTimeStr) if err != nil { - klog.Errorf("%s: parse annotation %q to time failed", logPrefix, annoKeyEvictLeaderBeginTime) + klog.Errorf("%s: parse annotation %q to time failed, so skip waiting leaders for transfer back", logPrefix, annoKeyEvictLeaderEndTime) return true } + leaderCountBefore := int(*store.LeaderCountBeforeUpgrade) if leaderCountBefore < 200 { - klog.V(4).Infof("%s: leader count is %d and less than 200, so skip waiting leaders for transfer back", logPrefix, leaderCountBefore) + klog.Infof("%s: leader count is %d and less than 200, so skip waiting leaders for transfer back", logPrefix, leaderCountBefore) return true } @@ -381,32 +386,28 @@ func (u *tikvUpgrader) beginEvictLeader(tc *v1alpha1.TidbCluster, storeID uint64 func (u *tikvUpgrader) endEvictLeader(tc *v1alpha1.TidbCluster, storeID uint64, pod *corev1.Pod) error { ns := tc.GetNamespace() podName := pod.GetName() - annosToRecordInfo := map[string]string{} // call pd to end evict leader if err := endEvictLeaderbyStoreID(u.deps, tc, storeID); err != nil { return fmt.Errorf("end evict leader for store %d failed: %v", storeID, err) } klog.Infof("endEvictLeader: end evict leader: %d, %s/%s successfully", storeID, ns, podName) - annosToRecordInfo[annoKeyEvictLeaderEndTime] = time.Now().Format(time.RFC3339) - if pod.Annotations == nil { - pod.Annotations = map[string]string{} - } - for k, v := range annosToRecordInfo { - pod.Annotations[k] = v - } - _, err := u.deps.PodControl.UpdatePod(tc, pod) - if err != nil { - klog.Errorf("endEvictLeader: failed to set pod %s/%s annotation to record info, annos:%v err:%v", - ns, podName, annosToRecordInfo, err) - return fmt.Errorf("end evict leader for store %d failed: %v", storeID, err) + // record evict leader end time which is used to wait for leaders to transfer back + if _, exist := pod.Annotations[annoKeyEvictLeaderEndTime]; !exist { + if pod.Annotations == nil { + pod.Annotations = map[string]string{} + } + pod.Annotations[annoKeyEvictLeaderEndTime] = time.Now().Format(time.RFC3339) + _, err := u.deps.PodControl.UpdatePod(tc, pod) + if err != nil { + klog.Errorf("endEvictLeader: failed to set pod %s/%s annotation %s, err:%v", + ns, podName, annoKeyEvictLeaderEndTime, err) + return fmt.Errorf("end evict leader for store %d failed: %v", storeID, err) + } } - klog.Infof("endEvictLeader: set pod %s/%s annotation to record info successfully, annos:%v", - ns, podName, annosToRecordInfo) return nil - } // endEvictLeaderForAllStore end evict leader for all stores of a tc diff --git a/pkg/manager/member/tikv_upgrader_test.go b/pkg/manager/member/tikv_upgrader_test.go index 10fb378c86..9edf42ebe4 100644 --- a/pkg/manager/member/tikv_upgrader_test.go +++ b/pkg/manager/member/tikv_upgrader_test.go @@ -62,7 +62,7 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { } testFn := func(test *testcase, t *testing.T) { - t.Log(test.name) + t.Log("test case:", test.name) upgrader, pdControl, podControl, podInformer, tikvControl, volumeModifier := newTiKVUpgrader() tc := newTidbClusterForTiKVUpgrader() @@ -832,6 +832,174 @@ func TestTiKVUpgraderUpgrade(t *testing.T) { g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(2))) }, }, + { + name: "wait for leaders of pod 2 to transfer back before upgading pod 1", + changeFn: func(tc *v1alpha1.TidbCluster) { + tc.Status.PD.Phase = v1alpha1.NormalPhase + tc.Status.TiKV.Phase = v1alpha1.UpgradePhase + tc.Status.TiKV.Synced = true + tc.Status.TiKV.StatefulSet.CurrentReplicas = 2 + tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 + store := tc.Status.TiKV.Stores["3"] + store.LeaderCount = 1000 + store.LeaderCountBeforeUpgrade = pointer.Int32Ptr(2000) // set `LeaderCountBeforeUpgrade` so that operator will check if the leaders transfer back + tc.Status.TiKV.Stores["3"] = store + }, + changeOldSet: func(oldSet *apps.StatefulSet) { + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) + oldSet.Status.CurrentReplicas = 2 + oldSet.Status.UpdatedReplicas = 1 + oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) + }, + changePods: func(pods []*corev1.Pod) { + }, + beginEvictLeaderErr: false, + endEvictLeaderErr: false, + updatePodErr: false, + podName: "upgrader-tikv-1", + errExpectFn: func(g *GomegaWithT, err error) { + g.Expect(err).To(HaveOccurred()) + g.Expect(err.Error()).To(ContainSubstring("waiting to end evict leader of pod upgrader-tikv-2")) + }, + expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet, pods map[string]*corev1.Pod) { + g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(2))) // should not upgrade pod 1 cause leaders of pod 2 is not transferred back + }, + }, + { + name: "timeout waiting for leaders of pod 2 to transfer back and upgrade pod 1", + changeFn: func(tc *v1alpha1.TidbCluster) { + tc.Status.PD.Phase = v1alpha1.NormalPhase + tc.Status.TiKV.Phase = v1alpha1.UpgradePhase + tc.Status.TiKV.Synced = true + tc.Status.TiKV.StatefulSet.CurrentReplicas = 2 + tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 + // leaders of pod 2 is transferred back + store := tc.Status.TiKV.Stores["3"] + store.LeaderCount = 1000 + store.LeaderCountBeforeUpgrade = pointer.Int32Ptr(2000) + tc.Status.TiKV.Stores["3"] = store + // leaders of pod 1 evicted leaders + store = tc.Status.TiKV.Stores["2"] + store.LeaderCount = 0 + tc.Status.TiKV.Stores["2"] = store + }, + changeOldSet: func(oldSet *apps.StatefulSet) { + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) + oldSet.Status.CurrentReplicas = 2 + oldSet.Status.UpdatedReplicas = 1 + oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) + }, + changePods: func(pods []*corev1.Pod) { + for _, pod := range pods { + if pod.GetName() == TikvPodName(upgradeTcName, 1) { + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Add(-1 * time.Minute).Format(time.RFC3339)} + } + if pod.GetName() == TikvPodName(upgradeTcName, 2) { + pod.Annotations = map[string]string{annoKeyEvictLeaderEndTime: time.Time{}.Format(time.RFC3339)} + } + } + }, + beginEvictLeaderErr: false, + endEvictLeaderErr: false, + updatePodErr: false, + podName: "upgrader-tikv-1", + errExpectFn: func(g *GomegaWithT, err error) { + g.Expect(err).NotTo(HaveOccurred()) + }, + expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet, pods map[string]*corev1.Pod) { + g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(1))) // should upgrade pod 1 + }, + }, + { + name: "complete for leaders of pod 2 to transfer back and upgrade pod 1", + changeFn: func(tc *v1alpha1.TidbCluster) { + tc.Status.PD.Phase = v1alpha1.NormalPhase + tc.Status.TiKV.Phase = v1alpha1.UpgradePhase + tc.Status.TiKV.Synced = true + tc.Status.TiKV.StatefulSet.CurrentReplicas = 2 + tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 + // leaders of pod 2 is transferred back + store := tc.Status.TiKV.Stores["3"] + store.LeaderCount = 1500 + store.LeaderCountBeforeUpgrade = pointer.Int32Ptr(2000) + tc.Status.TiKV.Stores["3"] = store + // leaders of pod 1 evicted leaders + store = tc.Status.TiKV.Stores["2"] + store.LeaderCount = 0 + tc.Status.TiKV.Stores["2"] = store + }, + changeOldSet: func(oldSet *apps.StatefulSet) { + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) + oldSet.Status.CurrentReplicas = 2 + oldSet.Status.UpdatedReplicas = 1 + oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) + }, + changePods: func(pods []*corev1.Pod) { + for _, pod := range pods { + if pod.GetName() == TikvPodName(upgradeTcName, 1) { + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Add(-1 * time.Minute).Format(time.RFC3339)} + } + if pod.GetName() == TikvPodName(upgradeTcName, 2) { + pod.Annotations = map[string]string{annoKeyEvictLeaderEndTime: time.Now().Format(time.RFC3339)} + } + } + }, + beginEvictLeaderErr: false, + endEvictLeaderErr: false, + updatePodErr: false, + podName: "upgrader-tikv-1", + errExpectFn: func(g *GomegaWithT, err error) { + g.Expect(err).NotTo(HaveOccurred()) + }, + expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet, pods map[string]*corev1.Pod) { + g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(1))) // should upgrade pod 1 + }, + }, + { + name: "skip waiting for leaders of pod 2 to transfer back and upgrade pod 1", + changeFn: func(tc *v1alpha1.TidbCluster) { + tc.Status.PD.Phase = v1alpha1.NormalPhase + tc.Status.TiKV.Phase = v1alpha1.UpgradePhase + tc.Status.TiKV.Synced = true + tc.Status.TiKV.StatefulSet.CurrentReplicas = 2 + tc.Status.TiKV.StatefulSet.UpdatedReplicas = 1 + // leaders of pod 2 is transferred back but count is less than 200 + store := tc.Status.TiKV.Stores["3"] + store.LeaderCount = 10 + store.LeaderCountBeforeUpgrade = pointer.Int32Ptr(100) + tc.Status.TiKV.Stores["3"] = store + // leaders of pod 1 evicted leaders + store = tc.Status.TiKV.Stores["2"] + store.LeaderCount = 0 + tc.Status.TiKV.Stores["2"] = store + }, + changeOldSet: func(oldSet *apps.StatefulSet) { + mngerutils.SetStatefulSetLastAppliedConfigAnnotation(oldSet) + oldSet.Status.CurrentReplicas = 2 + oldSet.Status.UpdatedReplicas = 1 + oldSet.Spec.UpdateStrategy.RollingUpdate.Partition = pointer.Int32Ptr(2) + }, + changePods: func(pods []*corev1.Pod) { + for _, pod := range pods { + if pod.GetName() == TikvPodName(upgradeTcName, 1) { + pod.Annotations = map[string]string{annoKeyEvictLeaderBeginTime: time.Now().Add(-1 * time.Minute).Format(time.RFC3339)} + } + if pod.GetName() == TikvPodName(upgradeTcName, 2) { + pod.Annotations = map[string]string{annoKeyEvictLeaderEndTime: time.Now().Format(time.RFC3339)} + } + } + }, + beginEvictLeaderErr: false, + endEvictLeaderErr: false, + updatePodErr: false, + podName: "upgrader-tikv-1", + errExpectFn: func(g *GomegaWithT, err error) { + g.Expect(err).NotTo(HaveOccurred()) + }, + expectFn: func(g *GomegaWithT, tc *v1alpha1.TidbCluster, newSet *apps.StatefulSet, pods map[string]*corev1.Pod) { + g.Expect(*newSet.Spec.UpdateStrategy.RollingUpdate.Partition).To(Equal(int32(1))) // should upgrade pod 1 + }, + }, } for _, test := range tests { From 9f598530b1327d6211e86938f8653d46915b98c7 Mon Sep 17 00:00:00 2001 From: Shiori Date: Thu, 9 Feb 2023 16:25:25 +0800 Subject: [PATCH 08/10] fix ci --- docs/api-references/docs.md | 4 ++-- pkg/apis/pingcap/v1alpha1/openapi_generated.go | 2 +- pkg/apis/pingcap/v1alpha1/types.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 1c9fbb3c77..9624b8ef82 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -21207,8 +21207,8 @@ Kubernetes meta/v1.Duration (Optional) -

WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back after -upgarde for a tikv.

+

WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back before +the next tikv upgrade.

Defaults to 400s

diff --git a/pkg/apis/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/pingcap/v1alpha1/openapi_generated.go index 1f374af9fc..a611c4c5f8 100644 --- a/pkg/apis/pingcap/v1alpha1/openapi_generated.go +++ b/pkg/apis/pingcap/v1alpha1/openapi_generated.go @@ -11522,7 +11522,7 @@ func schema_pkg_apis_pingcap_v1alpha1_TiKVSpec(ref common.ReferenceCallback) com }, "waitLeaderTransferBackTimeout": { SchemaProps: spec.SchemaProps{ - Description: "WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back after upgarde for a tikv.\n\nDefaults to 400s", + Description: "WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back before the next tikv upgrade.\n\nDefaults to 400s", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), }, }, diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go index eb3bc15891..c765beaa7d 100644 --- a/pkg/apis/pingcap/v1alpha1/types.go +++ b/pkg/apis/pingcap/v1alpha1/types.go @@ -607,8 +607,8 @@ type TiKVSpec struct { // +optional EvictLeaderTimeout *string `json:"evictLeaderTimeout,omitempty"` - // WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back after - // upgarde for a tikv. + // WaitLeaderTransferBackTimeout indicates the timeout to wait for leader transfer back before + // the next tikv upgrade. // // Defaults to 400s // +optional From d1a445fb3557880bf3286bc3a97d0650df24296e Mon Sep 17 00:00:00 2001 From: Shiori Date: Fri, 10 Feb 2023 15:35:55 +0800 Subject: [PATCH 09/10] update field name --- docs/api-references/docs.md | 2 +- manifests/crd.yaml | 36 +++++++++---------- .../crd/v1/pingcap.com_tidbclusters.yaml | 36 +++++++++---------- .../crd/v1beta1/pingcap.com_tidbclusters.yaml | 36 +++++++++---------- manifests/crd_v1beta1.yaml | 36 +++++++++---------- pkg/apis/pingcap/v1alpha1/types.go | 2 +- 6 files changed, 74 insertions(+), 74 deletions(-) diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 9624b8ef82..efb3767c54 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -21739,7 +21739,7 @@ TODO: remove nullable, Date: Fri, 10 Feb 2023 17:02:50 +0800 Subject: [PATCH 10/10] optimize --- pkg/manager/member/tikv_upgrader.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/manager/member/tikv_upgrader.go b/pkg/manager/member/tikv_upgrader.go index 58c1772b42..441aff233c 100644 --- a/pkg/manager/member/tikv_upgrader.go +++ b/pkg/manager/member/tikv_upgrader.go @@ -295,24 +295,23 @@ func (u *tikvUpgrader) endEvictLeaderAfterUpgrade(tc *v1alpha1.TidbCluster, pod // refer to https://github.com/pingcap/tiup/pull/2051 isLeaderTransferBackOrTimeout := func() bool { + leaderCountBefore := int(*store.LeaderCountBeforeUpgrade) + if leaderCountBefore < 200 { + klog.Infof("%s: leader count is %d and less than 200, so skip waiting leaders for transfer back", logPrefix, leaderCountBefore) + return true + } + evictLeaderEndTimeStr, exist := pod.Annotations[annoKeyEvictLeaderEndTime] if !exist { klog.Errorf("%s: miss annotation %q, so skip waiting leaders for transfer back", logPrefix, annoKeyEvictLeaderEndTime) return true } - evictLeaderEndTime, err := time.Parse(time.RFC3339, evictLeaderEndTimeStr) if err != nil { klog.Errorf("%s: parse annotation %q to time failed, so skip waiting leaders for transfer back", logPrefix, annoKeyEvictLeaderEndTime) return true } - leaderCountBefore := int(*store.LeaderCountBeforeUpgrade) - if leaderCountBefore < 200 { - klog.Infof("%s: leader count is %d and less than 200, so skip waiting leaders for transfer back", logPrefix, leaderCountBefore) - return true - } - timeout := tc.TiKVWaitLeaderTransferBackTimeout() if time.Now().After(evictLeaderEndTime.Add(timeout)) { klog.Infof("%s: time out with threshold %v, so skip waiting leaders for transfer back", logPrefix, timeout)