diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 0b47c517f1a..4167d783883 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -189,7 +189,9 @@ StorageProvider
(Members of StorageProvider
are embedded into this type.)
StorageProvider configures where and how backups should be stored.
+StorageProvider configures where and how backups should be stored. +*** Note: This field should generally not be left empty, unless you are certain the storage provider +*** can be obtained from another source, such as a schedule CR.
BRConfig is the configs for BR
+BRConfig is the configs for BR +*** Note: This field should generally not be left empty, unless you are certain the BR config +*** can be obtained from another source, such as a schedule CR.
compactSpan
+
+string
+
+CompactSpan is to specify how long backups we want to compact.
+backupTemplate
@@ -674,6 +689,20 @@ BackupSpec
compactBackupTemplate
+
+
+CompactSpec
+
+
+CompactBackupTemplate is the specification of the compact backup structure to get scheduled.
+storageClassName
string
@@ -710,6 +739,37 @@ string
ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.
br
+
+
+BRConfig
+
+
+BRConfig is the configs for BR
+StorageProvider
+
+
+StorageProvider
+
+
+
+(Members of StorageProvider
are embedded into this type.)
+
StorageProvider configures where and how backups should be stored.
+(Appears on: +BackupScheduleSpec, BackupSpec, CompactSpec, RestoreSpec) @@ -3938,6 +3999,17 @@ string
compactSpan
+
+string
+
+CompactSpan is to specify how long backups we want to compact.
+backupTemplate
@@ -3965,6 +4037,20 @@ BackupSpec
compactBackupTemplate
+
+
+CompactSpec
+
+
+CompactBackupTemplate is the specification of the compact backup structure to get scheduled.
+storageClassName
string
@@ -4001,6 +4087,37 @@ string
ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.
br
+
+
+BRConfig
+
+
+BRConfig is the configs for BR
+StorageProvider
+
+
+StorageProvider
+
+
+
+(Members of StorageProvider
are embedded into this type.)
+
StorageProvider configures where and how backups should be stored.
+lastCompact
+
+string
+
+LastCompact represents the last compact
+logBackup
string
@@ -4043,6 +4171,19 @@ string
logBackupStartTs
+
+
+Kubernetes meta/v1.Time
+
+
+LogBackupStartTs represents the start time of log backup
+lastBackupTime
@@ -4056,6 +4197,32 @@ Kubernetes meta/v1.Time
lastCompactTs
+
+
+Kubernetes meta/v1.Time
+
+
+LastCompactTs represents the endTs of the last compact
+nextCompactEndTs
+
+
+Kubernetes meta/v1.Time
+
+
+NextCompactEndTs represents the scheduled endTs of next compact
+allBackupCleanTime
@@ -4193,7 +4360,9 @@ StorageProvider
(Members of StorageProvider
are embedded into this type.)
StorageProvider configures where and how backups should be stored.
+StorageProvider configures where and how backups should be stored. +*** Note: This field should generally not be left empty, unless you are certain the storage provider +*** can be obtained from another source, such as a schedule CR.
BRConfig is the configs for BR
+BRConfig is the configs for BR +*** Note: This field should generally not be left empty, unless you are certain the BR config +*** can be obtained from another source, such as a schedule CR.
(Members of StorageProvider
are embedded into this type.)
StorageProvider configures where and how backups should be stored.
+StorageProvider configures where and how backups should be stored. +*** Note: This field should generally not be left empty, unless you are certain the storage provider +*** can be obtained from another source, such as a schedule CR.
BRConfig is the configs for BR
+BRConfig is the configs for BR +*** Note: This field should generally not be left empty, unless you are certain the BR config +*** can be obtained from another source, such as a schedule CR.
(Appears on: +BackupScheduleSpec, CompactBackup)
@@ -5765,7 +5941,9 @@ StorageProvider
(Members of StorageProvider
are embedded into this type.)
StorageProvider configures where and how backups should be stored.
+StorageProvider configures where and how backups should be stored. +*** Note: This field should generally not be left empty, unless you are certain the storage provider +*** can be obtained from another source, such as a schedule CR.
BRConfig is the configs for BR
+BRConfig is the configs for BR +*** Note: This field should generally not be left empty, unless you are certain the BR config +*** can be obtained from another source, such as a schedule CR.
(Appears on: +BackupScheduleSpec, BackupSpec, CompactSpec, RestoreSpec) diff --git a/manifests/crd.yaml b/manifests/crd.yaml index 1637c9155ec..d2f9649d098 100644 --- a/manifests/crd.yaml +++ b/manifests/crd.yaml @@ -54,6 +54,23 @@ spec: type: object spec: properties: + azblob: + properties: + accessTier: + type: string + container: + type: string + path: + type: string + prefix: + type: string + sasToken: + type: string + secretName: + type: string + storageAccount: + type: string + type: object backupTemplate: properties: additionalVolumeMounts: @@ -2297,15 +2314,43 @@ spec: - message: Field `logStop` is the old version field, please use `logSubcommand` instead rule: 'has(self.logStop) ? !has(self.logSubcommand) : true' - imagePullSecrets: - items: - properties: - name: + 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: object - x-kubernetes-map-type: atomic - type: array - logBackupTemplate: + type: array + rateLimit: + type: integer + sendCredToTikv: + type: boolean + statusAddr: + type: string + table: + type: string + timeAgo: + type: string + required: + - cluster + type: object + compactBackupTemplate: properties: additionalVolumeMounts: items: @@ -3420,23 +3465,6 @@ spec: storageAccount: type: string type: object - backoffRetryPolicy: - properties: - maxRetryTimes: - default: 2 - type: integer - minRetryDuration: - default: 300s - type: string - retryTimeout: - default: 30m - type: string - type: object - backupMode: - default: snapshot - type: string - backupType: - type: string br: properties: checkRequirements: @@ -3473,51 +3501,11 @@ spec: required: - cluster type: object - calcSizeLevel: - default: all - type: string - 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 - snapshotsDeleteRatio: - default: 1 - type: number - type: object - cleanPolicy: - default: Retain - enum: - - Retain - - OnFailure - - Delete - type: string - commitTs: + concurrency: + default: 4 + type: integer + endTs: type: string - dumpling: - properties: - options: - items: - type: string - type: array - tableFilter: - items: - type: string - type: array - type: object env: items: properties: @@ -3582,25 +3570,6 @@ spec: - name type: object type: array - federalVolumeBackupPhase: - type: string - 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: @@ -4367,16 +4336,10 @@ spec: - volume - volumeMount type: object - logStop: - type: boolean - logSubcommand: - enum: - - log-start - - log-stop - - log-pause - type: string - logTruncateUntil: - type: string + maxRetryTimes: + default: 6 + format: int32 + type: integer podSecurityContext: properties: fsGroup: @@ -4474,8 +4437,6 @@ spec: x-kubernetes-int-or-string: true type: object type: object - resumeGcSchedule: - type: boolean s3: properties: acl: @@ -4507,15 +4468,7 @@ spec: type: object serviceAccount: type: string - storageClassName: - type: string - storageSize: - type: string - tableFilter: - items: - type: string - type: array - tikvGCLifeTime: + startTs: type: string tolerations: items: @@ -4537,45 +4490,3086 @@ spec: type: string useKMS: type: boolean - volumeBackupInitJobMaxActiveSeconds: - default: 600 - type: integer type: object - x-kubernetes-validations: - - message: Field `logStop` is the old version field, please use `logSubcommand` - instead - rule: 'has(self.logSubcommand) ? !has(self.logStop) : true' - - message: Field `logStop` is the old version field, please use `logSubcommand` - instead - rule: 'has(self.logStop) ? !has(self.logSubcommand) : true' - 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 + compactSpan: type: string - logBackup: + 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 + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + 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 + x-kubernetes-map-type: atomic + 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 + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + 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 + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + - 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 + x-kubernetes-map-type: atomic + 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 + logBackupTemplate: + properties: + additionalVolumeMounts: + items: + 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: array + additionalVolumes: + items: + 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 + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + 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 + x-kubernetes-map-type: atomic + 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 + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + 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 + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + - 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 + x-kubernetes-map-type: atomic + 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 + type: array + 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 + x-kubernetes-map-type: atomic + 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 + 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 + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + namespaceSelector: + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + namespaceSelector: + 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 + x-kubernetes-map-type: atomic + 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: + 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 + x-kubernetes-map-type: atomic + namespaceSelector: + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + namespaceSelector: + 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 + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + 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 + sasToken: + type: string + secretName: + type: string + storageAccount: + type: string + type: object + backoffRetryPolicy: + properties: + maxRetryTimes: + default: 2 + type: integer + minRetryDuration: + default: 300s + type: string + retryTimeout: + default: 30m + 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 + calcSizeLevel: + default: all + type: string + 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 + snapshotsDeleteRatio: + default: 1 + type: number + type: object + cleanPolicy: + default: Retain + enum: + - Retain + - OnFailure + - Delete + 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 + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + federalVolumeBackupPhase: + type: string + 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 + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + 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 + x-kubernetes-map-type: atomic + 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 + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + 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 + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + - 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 + x-kubernetes-map-type: atomic + 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 + logSubcommand: + enum: + - log-start + - log-stop + - log-pause + type: string + 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 + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + 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 + resumeGcSchedule: + type: boolean + 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 + volumeBackupInitJobMaxActiveSeconds: + default: 600 + type: integer + type: object + x-kubernetes-validations: + - message: Field `logStop` is the old version field, please use `logSubcommand` + instead + rule: 'has(self.logSubcommand) ? !has(self.logStop) : true' + - message: Field `logStop` is the old version field, please use `logSubcommand` + instead + rule: 'has(self.logStop) ? !has(self.logSubcommand) : true' + maxBackups: + format: int32 + type: integer + maxReservedTime: + type: string + pause: + type: boolean + 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 + 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 + lastCompact: + type: string + lastCompactTs: + format: date-time + type: string + logBackup: + type: string + logBackupStartTs: + format: date-time + type: string + nextCompactEndTs: + format: date-time type: string type: object required: diff --git a/manifests/crd/v1/pingcap.com_backupschedules.yaml b/manifests/crd/v1/pingcap.com_backupschedules.yaml index 34cf32e241b..3f8adc4e4bf 100644 --- a/manifests/crd/v1/pingcap.com_backupschedules.yaml +++ b/manifests/crd/v1/pingcap.com_backupschedules.yaml @@ -54,6 +54,23 @@ spec: type: object spec: properties: + azblob: + properties: + accessTier: + type: string + container: + type: string + path: + type: string + prefix: + type: string + sasToken: + type: string + secretName: + type: string + storageAccount: + type: string + type: object backupTemplate: properties: additionalVolumeMounts: @@ -2297,15 +2314,43 @@ spec: - message: Field `logStop` is the old version field, please use `logSubcommand` instead rule: 'has(self.logStop) ? !has(self.logSubcommand) : true' - imagePullSecrets: - items: - properties: - name: + 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: object - x-kubernetes-map-type: atomic - type: array - logBackupTemplate: + type: array + rateLimit: + type: integer + sendCredToTikv: + type: boolean + statusAddr: + type: string + table: + type: string + timeAgo: + type: string + required: + - cluster + type: object + compactBackupTemplate: properties: additionalVolumeMounts: items: @@ -3420,23 +3465,6 @@ spec: storageAccount: type: string type: object - backoffRetryPolicy: - properties: - maxRetryTimes: - default: 2 - type: integer - minRetryDuration: - default: 300s - type: string - retryTimeout: - default: 30m - type: string - type: object - backupMode: - default: snapshot - type: string - backupType: - type: string br: properties: checkRequirements: @@ -3473,51 +3501,11 @@ spec: required: - cluster type: object - calcSizeLevel: - default: all - type: string - 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 - snapshotsDeleteRatio: - default: 1 - type: number - type: object - cleanPolicy: - default: Retain - enum: - - Retain - - OnFailure - - Delete - type: string - commitTs: + concurrency: + default: 4 + type: integer + endTs: type: string - dumpling: - properties: - options: - items: - type: string - type: array - tableFilter: - items: - type: string - type: array - type: object env: items: properties: @@ -3582,25 +3570,6 @@ spec: - name type: object type: array - federalVolumeBackupPhase: - type: string - 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: @@ -4367,16 +4336,10 @@ spec: - volume - volumeMount type: object - logStop: - type: boolean - logSubcommand: - enum: - - log-start - - log-stop - - log-pause - type: string - logTruncateUntil: - type: string + maxRetryTimes: + default: 6 + format: int32 + type: integer podSecurityContext: properties: fsGroup: @@ -4474,8 +4437,6 @@ spec: x-kubernetes-int-or-string: true type: object type: object - resumeGcSchedule: - type: boolean s3: properties: acl: @@ -4507,15 +4468,7 @@ spec: type: object serviceAccount: type: string - storageClassName: - type: string - storageSize: - type: string - tableFilter: - items: - type: string - type: array - tikvGCLifeTime: + startTs: type: string tolerations: items: @@ -4537,45 +4490,3086 @@ spec: type: string useKMS: type: boolean - volumeBackupInitJobMaxActiveSeconds: - default: 600 - type: integer type: object - x-kubernetes-validations: - - message: Field `logStop` is the old version field, please use `logSubcommand` - instead - rule: 'has(self.logSubcommand) ? !has(self.logStop) : true' - - message: Field `logStop` is the old version field, please use `logSubcommand` - instead - rule: 'has(self.logStop) ? !has(self.logSubcommand) : true' - 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 + compactSpan: type: string - lastBackup: - type: string - lastBackupTime: - format: date-time - type: string - logBackup: + 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 + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + 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 + x-kubernetes-map-type: atomic + 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 + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + 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 + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + - 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 + x-kubernetes-map-type: atomic + 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 + logBackupTemplate: + properties: + additionalVolumeMounts: + items: + 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: array + additionalVolumes: + items: + 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 + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + 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 + x-kubernetes-map-type: atomic + 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 + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + 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 + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + - 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 + x-kubernetes-map-type: atomic + 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 + type: array + 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 + x-kubernetes-map-type: atomic + 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 + 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 + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + namespaceSelector: + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + namespaceSelector: + 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 + x-kubernetes-map-type: atomic + 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: + 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 + x-kubernetes-map-type: atomic + namespaceSelector: + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + namespaceSelector: + 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 + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + 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 + sasToken: + type: string + secretName: + type: string + storageAccount: + type: string + type: object + backoffRetryPolicy: + properties: + maxRetryTimes: + default: 2 + type: integer + minRetryDuration: + default: 300s + type: string + retryTimeout: + default: 30m + 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 + calcSizeLevel: + default: all + type: string + 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 + snapshotsDeleteRatio: + default: 1 + type: number + type: object + cleanPolicy: + default: Retain + enum: + - Retain + - OnFailure + - Delete + 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 + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + federalVolumeBackupPhase: + type: string + 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 + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + volumeClaimTemplate: + properties: + metadata: + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + 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 + x-kubernetes-map-type: atomic + 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 + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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: + name: + type: string + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + 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 + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + 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 + x-kubernetes-map-type: atomic + 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 + x-kubernetes-map-type: atomic + 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: + - 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 + x-kubernetes-map-type: atomic + 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 + logSubcommand: + enum: + - log-start + - log-stop + - log-pause + type: string + 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 + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + priorityClassName: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + 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 + resumeGcSchedule: + type: boolean + 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 + volumeBackupInitJobMaxActiveSeconds: + default: 600 + type: integer + type: object + x-kubernetes-validations: + - message: Field `logStop` is the old version field, please use `logSubcommand` + instead + rule: 'has(self.logSubcommand) ? !has(self.logStop) : true' + - message: Field `logStop` is the old version field, please use `logSubcommand` + instead + rule: 'has(self.logStop) ? !has(self.logSubcommand) : true' + maxBackups: + format: int32 + type: integer + maxReservedTime: + type: string + pause: + type: boolean + 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 + 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 + lastCompact: + type: string + lastCompactTs: + format: date-time + type: string + logBackup: + type: string + logBackupStartTs: + format: date-time + type: string + nextCompactEndTs: + format: date-time type: string type: object required: diff --git a/pkg/apis/pingcap/v1alpha1/backup_schedule.go b/pkg/apis/pingcap/v1alpha1/backup_schedule.go index ef6a66f6b97..c5895b820d1 100644 --- a/pkg/apis/pingcap/v1alpha1/backup_schedule.go +++ b/pkg/apis/pingcap/v1alpha1/backup_schedule.go @@ -25,3 +25,7 @@ func (bs *BackupSchedule) GetBackupCRDName(timestamp time.Time) string { func (bs *BackupSchedule) GetLogBackupCRDName() string { return fmt.Sprintf("%s-%s", "log", bs.GetName()) } + +func (bs *BackupSchedule) GetCompactBackupCRDName(timestamp time.Time) string { + return fmt.Sprintf("%s-%s-%s", "compact", bs.GetName(), timestamp.UTC().Format(BackupNameTimeFormat)) +} diff --git a/pkg/apis/pingcap/v1alpha1/constants.go b/pkg/apis/pingcap/v1alpha1/constants.go index 90738112627..76125486711 100644 --- a/pkg/apis/pingcap/v1alpha1/constants.go +++ b/pkg/apis/pingcap/v1alpha1/constants.go @@ -19,6 +19,8 @@ const ( // BackupNameTimeFormat is the time format for generate backup CR name BackupNameTimeFormat = "2006-01-02t15-04-05" + BackupTimestampFormat = "2006-01-02 15:04:05" + // DefaultTidbUser is the default tidb user for login tidb cluster DefaultTidbUser = "root" ) diff --git a/pkg/apis/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/pingcap/v1alpha1/openapi_generated.go index 50ddb3e2fe4..6244047ee83 100644 --- a/pkg/apis/pingcap/v1alpha1/openapi_generated.go +++ b/pkg/apis/pingcap/v1alpha1/openapi_generated.go @@ -931,6 +931,13 @@ func schema_pkg_apis_pingcap_v1alpha1_BackupScheduleSpec(ref common.ReferenceCal Format: "", }, }, + "compactSpan": { + SchemaProps: spec.SchemaProps{ + Description: "CompactSpan is to specify how long backups we want to compact.", + Type: []string{"string"}, + Format: "", + }, + }, "backupTemplate": { SchemaProps: spec.SchemaProps{ Description: "BackupTemplate is the specification of the backup structure to get scheduled.", @@ -944,6 +951,12 @@ func schema_pkg_apis_pingcap_v1alpha1_BackupScheduleSpec(ref common.ReferenceCal Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BackupSpec"), }, }, + "compactBackupTemplate": { + SchemaProps: spec.SchemaProps{ + Description: "CompactBackupTemplate is the specification of the compact backup structure to get scheduled.", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.CompactSpec"), + }, + }, "storageClassName": { SchemaProps: spec.SchemaProps{ Description: "The storageClassName of the persistent volume for Backup data storage if not storage class name set in BackupSpec. Defaults to Kubernetes default storage class.", @@ -972,12 +985,38 @@ func schema_pkg_apis_pingcap_v1alpha1_BackupScheduleSpec(ref common.ReferenceCal }, }, }, + "br": { + SchemaProps: spec.SchemaProps{ + Description: "BRConfig is the configs for BR", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BRConfig"), + }, + }, + "s3": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.S3StorageProvider"), + }, + }, + "gcs": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.GcsStorageProvider"), + }, + }, + "azblob": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.AzblobStorageProvider"), + }, + }, + "local": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.LocalStorageProvider"), + }, + }, }, Required: []string{"schedule", "backupTemplate"}, }, }, Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BackupSpec", "k8s.io/api/core/v1.LocalObjectReference"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.AzblobStorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BRConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BackupSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.CompactSpec", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.GcsStorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.LocalStorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.S3StorageProvider", "k8s.io/api/core/v1.LocalObjectReference"}, } } @@ -1071,7 +1110,7 @@ func schema_pkg_apis_pingcap_v1alpha1_BackupSpec(ref common.ReferenceCallback) c }, "br": { SchemaProps: spec.SchemaProps{ - Description: "BRConfig is the configs for BR", + Description: "BRConfig is the configs for BR *** Note: This field should generally not be left empty, unless you are certain the BR config *** can be obtained from another source, such as a schedule CR.", Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BRConfig"), }, }, @@ -1793,7 +1832,7 @@ func schema_pkg_apis_pingcap_v1alpha1_CompactSpec(ref common.ReferenceCallback) }, "br": { SchemaProps: spec.SchemaProps{ - Description: "BRConfig is the configs for BR", + Description: "BRConfig is the configs for BR *** Note: This field should generally not be left empty, unless you are certain the BR config *** can be obtained from another source, such as a schedule CR.", Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BRConfig"), }, }, diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go index 6fb32f99e5f..d1674b3a8cc 100644 --- a/pkg/apis/pingcap/v1alpha1/types.go +++ b/pkg/apis/pingcap/v1alpha1/types.go @@ -2191,6 +2191,8 @@ type BackupSpec struct { // When a GC happens, the current time minus this value is the safe point. TikvGCLifeTime *string `json:"tikvGCLifeTime,omitempty"` // StorageProvider configures where and how backups should be stored. + // *** Note: This field should generally not be left empty, unless you are certain the storage provider + // *** can be obtained from another source, such as a schedule CR. StorageProvider `json:",inline"` // The storageClassName of the persistent volume for Backup data storage. // Defaults to Kubernetes default storage class. @@ -2199,6 +2201,8 @@ type BackupSpec struct { // StorageSize is the request storage size for backup job StorageSize string `json:"storageSize,omitempty"` // BRConfig is the configs for BR + // *** Note: This field should generally not be left empty, unless you are certain the BR config + // *** can be obtained from another source, such as a schedule CR. BR *BRConfig `json:"br,omitempty"` // CommitTs is the commit ts of the backup, snapshot ts for full backup or start ts for log backup. // Format supports TSO or datetime, e.g. '400036290571534337', '2018-05-11 01:42:23'. @@ -2555,11 +2559,16 @@ type BackupScheduleSpec struct { MaxBackups *int32 `json:"maxBackups,omitempty"` // MaxReservedTime is to specify how long backups we want to keep. MaxReservedTime *string `json:"maxReservedTime,omitempty"` + // CompactSpan is to specify how long backups we want to compact. + CompactSpan *string `json:"compactSpan,omitempty"` // BackupTemplate is the specification of the backup structure to get scheduled. BackupTemplate BackupSpec `json:"backupTemplate"` // LogBackupTemplate is the specification of the log backup structure to get scheduled. // +optional LogBackupTemplate *BackupSpec `json:"logBackupTemplate"` + // CompactBackupTemplate is the specification of the compact backup structure to get scheduled. + // +optional + CompactBackupTemplate *CompactSpec `json:"compactBackupTemplate"` // The storageClassName of the persistent volume for Backup data storage if not storage class name set in BackupSpec. // Defaults to Kubernetes default storage class. // +optional @@ -2569,16 +2578,30 @@ type BackupScheduleSpec struct { // ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images. // +optional ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"` + // BRConfig is the configs for BR + // +optional + BR *BRConfig `json:"br,omitempty"` + // StorageProvider configures where and how backups should be stored. + // +optional + StorageProvider `json:",inline"` } // BackupScheduleStatus represents the current state of a BackupSchedule. type BackupScheduleStatus struct { // LastBackup represents the last backup. LastBackup string `json:"lastBackup,omitempty"` + // LastCompact represents the last compact + LastCompact string `json:"lastCompact,omitempty"` // logBackup represents the name of log backup. LogBackup *string `json:"logBackup,omitempty"` + // LogBackupStartTs represents the start time of log backup + LogBackupStartTs *metav1.Time `json:"logBackupStartTs,omitempty"` // LastBackupTime represents the last time the backup was successfully created. LastBackupTime *metav1.Time `json:"lastBackupTime,omitempty"` + // LastCompactTs represents the endTs of the last compact + LastCompactTs *metav1.Time `json:"lastCompactTs,omitempty"` + // NextCompactEndTs represents the scheduled endTs of next compact + NextCompactEndTs *metav1.Time `json:"nextCompactEndTs,omitempty"` // AllBackupCleanTime represents the time when all backup entries are cleaned up AllBackupCleanTime *metav1.Time `json:"allBackupCleanTime,omitempty"` } @@ -3499,6 +3522,8 @@ type CompactSpec struct { // +optional Env []corev1.EnvVar `json:"env,omitempty"` // StorageProvider configures where and how backups should be stored. + // *** Note: This field should generally not be left empty, unless you are certain the storage provider + // *** can be obtained from another source, such as a schedule CR. StorageProvider `json:",inline"` // StartTs is the start ts of the compact backup. // Format supports TSO or datetime, e.g. '400036290571534337', '2018-05-11 01:42:23'. @@ -3520,6 +3545,8 @@ type CompactSpec struct { // +optional ToolImage string `json:"toolImage,omitempty"` // BRConfig is the configs for BR + // *** Note: This field should generally not be left empty, unless you are certain the BR config + // *** can be obtained from another source, such as a schedule CR. BR *BRConfig `json:"br,omitempty"` // ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images. // +optional diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go index f472d006c05..1cf12838c30 100644 --- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go @@ -345,12 +345,22 @@ func (in *BackupScheduleSpec) DeepCopyInto(out *BackupScheduleSpec) { *out = new(string) **out = **in } + if in.CompactSpan != nil { + in, out := &in.CompactSpan, &out.CompactSpan + *out = new(string) + **out = **in + } in.BackupTemplate.DeepCopyInto(&out.BackupTemplate) if in.LogBackupTemplate != nil { in, out := &in.LogBackupTemplate, &out.LogBackupTemplate *out = new(BackupSpec) (*in).DeepCopyInto(*out) } + if in.CompactBackupTemplate != nil { + in, out := &in.CompactBackupTemplate, &out.CompactBackupTemplate + *out = new(CompactSpec) + (*in).DeepCopyInto(*out) + } if in.StorageClassName != nil { in, out := &in.StorageClassName, &out.StorageClassName *out = new(string) @@ -361,6 +371,12 @@ func (in *BackupScheduleSpec) DeepCopyInto(out *BackupScheduleSpec) { *out = make([]v1.LocalObjectReference, len(*in)) copy(*out, *in) } + if in.BR != nil { + in, out := &in.BR, &out.BR + *out = new(BRConfig) + (*in).DeepCopyInto(*out) + } + in.StorageProvider.DeepCopyInto(&out.StorageProvider) return } @@ -382,10 +398,22 @@ func (in *BackupScheduleStatus) DeepCopyInto(out *BackupScheduleStatus) { *out = new(string) **out = **in } + if in.LogBackupStartTs != nil { + in, out := &in.LogBackupStartTs, &out.LogBackupStartTs + *out = (*in).DeepCopy() + } if in.LastBackupTime != nil { in, out := &in.LastBackupTime, &out.LastBackupTime *out = (*in).DeepCopy() } + if in.LastCompactTs != nil { + in, out := &in.LastCompactTs, &out.LastCompactTs + *out = (*in).DeepCopy() + } + if in.NextCompactEndTs != nil { + in, out := &in.NextCompactEndTs, &out.NextCompactEndTs + *out = (*in).DeepCopy() + } if in.AllBackupCleanTime != nil { in, out := &in.AllBackupCleanTime, &out.AllBackupCleanTime *out = (*in).DeepCopy() diff --git a/pkg/apis/util/config/config.go b/pkg/apis/util/config/config.go index 7064a4a3870..73052f37451 100644 --- a/pkg/apis/util/config/config.go +++ b/pkg/apis/util/config/config.go @@ -382,6 +382,24 @@ func ParseTSString(ts string) (uint64, error) { return GoTimeToTS(t), nil } +// ParseTSStringToGoTime supports TSO or datetime, e.g. '400036290571534337', '2006-01-02 15:04:05' +func ParseTSStringToGoTime(ts string) (time.Time, error) { + if len(ts) == 0 { + return time.Time{}, nil + } + if tso, err := strconv.ParseUint(ts, 10, 64); err == nil { + return TSToGoTime(tso), nil + } + t, err := time.ParseInLocation("2006-01-02 15:04:05", ts, time.Local) + if err != nil { + t, err = time.Parse(time.RFC3339, ts) + if err != nil { + return time.Time{}, fmt.Errorf("cannot parse ts string %s, err: %v", ts, err) + } + } + return t, nil +} + // GoTimeToTS converts a Go time to uint64 timestamp. // port from tidb. func GoTimeToTS(t time.Time) uint64 { @@ -389,6 +407,13 @@ func GoTimeToTS(t time.Time) uint64 { return uint64(ts) } +func TSToGoTime(ts uint64) time.Time { + ms := int64(ts >> 18) + sec := ms / 1000 + nsec := (ms % 1000) * 1000000 + return time.Unix(sec, nsec) +} + func TSOToTS(tso uint64) int64 { return int64((tso / 1000) >> 18) } diff --git a/pkg/backup/backupschedule/backup_schedule_manager.go b/pkg/backup/backupschedule/backup_schedule_manager.go index a3ba8b43f7c..1be60e871c8 100644 --- a/pkg/backup/backupschedule/backup_schedule_manager.go +++ b/pkg/backup/backupschedule/backup_schedule_manager.go @@ -15,6 +15,7 @@ package backupschedule import ( "fmt" + "math" "path" "sort" "strings" @@ -49,31 +50,139 @@ func NewBackupScheduleManager(deps *controller.Dependencies) backup.BackupSchedu } } -func (bm *backupScheduleManager) Sync(bs *v1alpha1.BackupSchedule) error { +func (bm *backupScheduleManager) doCompact(bs *v1alpha1.BackupSchedule, startTime, endTime, now time.Time) error { + compact := buildCompactBackup(bs, startTime, endTime, now) + _, err := bm.deps.CompactControl.CreateCompactBackup(compact) + bs.Status.LastCompact = compact.Name + return err +} + +func calEndTs(bs *v1alpha1.BackupSchedule, startTs time.Time, span time.Duration, maxEndTs time.Time) time.Time { + fastCompactLimit := startTs.Add(2 * span) + + // capEndTs checks if t goes beyond fastCompactLimit: + // - if so, we set NextCompactEndTs to t and return fastCompactLimit + // - otherwise, we clear NextCompactEndTs and return t + capEndTs := func(t time.Time) time.Time { + if t.After(fastCompactLimit) { + bs.Status.NextCompactEndTs = &metav1.Time{Time: t} + return fastCompactLimit + } + bs.Status.NextCompactEndTs = nil + return t + } + + // validCandidate checks whether the passed time pointer is non-nil, strictly + // after startTs, and does not exceed maxEndTs. + validCandidate := func(t *metav1.Time) bool { + return t != nil && t.After(startTs) && !t.Time.After(maxEndTs) + } + + if validCandidate(bs.Status.NextCompactEndTs) { + return capEndTs(bs.Status.NextCompactEndTs.Time) + } + if validCandidate(bs.Status.LastBackupTime) { + return capEndTs(bs.Status.LastBackupTime.Time) + } + if maxEndTs.Before(startTs.Add(span)) { + return startTs + } + return startTs.Add(span) +} + +func (bm *backupScheduleManager) createCompact(bs *v1alpha1.BackupSchedule, maxEndTime *time.Time, nowFn nowFn) error { + if bs.Spec.CompactSpan == nil || bs.Status.LogBackup == nil || maxEndTime == nil { + return nil + } + + var startTs, endTs time.Time + switch { + case bs.Status.LogBackupStartTs == nil: + return fmt.Errorf("Compact failed: %s/%s, please start a log backup before compact it", bs.GetNamespace(), bs.GetName()) + case bs.Status.LastCompactTs == nil: + startTs = bs.Status.LogBackupStartTs.Time + default: + startTs = bs.Status.LastCompactTs.Time + } + klog.Infof("backupSchedule %s/%s startTs is %v", bs.GetNamespace(), bs.GetName(), startTs) + + span, err := time.ParseDuration(*bs.Spec.CompactSpan) + if err != nil { + return fmt.Errorf("failed to parse compact interval: %w", err) + } + + endTs = calEndTs(bs, startTs, span, *maxEndTime) + if endTs.Equal(startTs) { + klog.Infof("backupSchedule %s/%s log checkpoint is %v, less than compact span, skip", bs.GetNamespace(), bs.GetName(), maxEndTime) + return nil + } + + klog.Infof("backupSchedule %s/%s compact: from %v to %v", bs.GetNamespace(), bs.GetName(), startTs, endTs) + if err := bm.doCompact(bs, startTs, endTs, nowFn()); err != nil { + return err + } + + return nil +} + +func (bm *backupScheduleManager) Sync(bs *v1alpha1.BackupSchedule) (err error) { defer bm.backupGC(bs) if bs.Spec.Pause { return controller.IgnoreErrorf("backupSchedule %s/%s has been paused", bs.GetNamespace(), bs.GetName()) } - if err := bm.performLogBackupIfNeeded(bs); err != nil { - return err + // log backup + var checkpoint *time.Time + switch { + case bs.Spec.LogBackupTemplate == nil: + break + + case bs.Status.LogBackup == nil: + if err = bm.createLogBackup(bs); err != nil { + return err + } + + default: + checkpoint, err = bm.getLogBackupCheckpoint(bs) + if err != nil { + return err + } } + // compact + defer func() { + if bs.Spec.LogBackupTemplate == nil || bs.Spec.CompactBackupTemplate == nil { + return + } + if err := bm.canPerformNextCompact(bs); err != nil { + klog.Errorf("backupSchedule %s/%s can not perform next compact, err: %v", bs.GetNamespace(), bs.GetName(), err) + } else if err := bm.createCompact(bs, checkpoint, bm.now); err != nil { + klog.Errorf("backupSchedule %s/%s perform compact failed, err: %v", bs.GetNamespace(), bs.GetName(), err) + } + }() + + // snapshot backup if err := bm.canPerformNextBackup(bs); err != nil { return err } scheduledTime, err := getLastScheduledTime(bs, bm.now) - if scheduledTime == nil { + if err != nil { return err } - // delete the last backup job for release the backup PVC + klog.Infof("backupSchedule %s/%s next scheduled time is %v", bs.GetNamespace(), bs.GetName(), scheduledTime) - if err := bm.deleteLastBackupJob(bs); err != nil { + if scheduledTime == nil { return nil } + *scheduledTime = bm.now() + + // Delete the last backup job for releasing the backup PVC + if err := bm.deleteLastBackupJob(bs); err != nil { + return err + } backup, err := createBackup(bm.deps.BackupControl, bs, *scheduledTime) if err != nil { @@ -167,26 +276,119 @@ func (bm *backupScheduleManager) canPerformNextBackup(bs *v1alpha1.BackupSchedul return nil } -func (bm *backupScheduleManager) performLogBackupIfNeeded(bs *v1alpha1.BackupSchedule) error { +// canPerformNextCompact handles the compact backup processing logic. +// It returns a controller.RequeueError if the backup is still running, +// otherwise it updates the LastCompactTs or returns any encountered error. +func (bm *backupScheduleManager) canPerformNextCompact(bs *v1alpha1.BackupSchedule) error { + if bs.Status.LastCompact == "" { + return nil + } + + lastCompact := bs.Status.LastCompact ns := bs.GetNamespace() bsName := bs.GetName() - // no log backup or already run no need to perform log backup again + compact, err := bm.deps.CompactBackupLister.CompactBackups(ns).Get(lastCompact) + if err != nil { + if errors.IsNotFound(err) { + return nil + } + return fmt.Errorf("backup schedule %s/%s: get compact backup %s failed: %w", ns, bsName, lastCompact, err) + } + + var currentCompactTs string + switch compact.Status.State { + case string(v1alpha1.BackupComplete): + currentCompactTs = compact.Spec.EndTs + case string(v1alpha1.BackupFailed): + currentCompactTs = compact.Spec.StartTs + default: + return controller.RequeueErrorf("backup schedule %s/%s: compact backup %s is still running", ns, bsName, lastCompact) + } + + currentCompactTime, err := config.ParseTSStringToGoTime(currentCompactTs) + if err != nil { + return perrors.AddStack(err) + } + + if currentCompactTime.IsZero() || currentCompactTime.Before(bs.Status.LogBackupStartTs.Time) { + klog.Errorf("backupSchedule %s/%s last compact time can't rollback (from %v to %v)", bs.GetNamespace(), bs.GetName(), bs.Status.LogBackupStartTs, currentCompactTime) + return nil + } + if bs.Status.LastCompactTs != nil && currentCompactTime.Before(bs.Status.LastCompactTs.Time) { + klog.Errorf("backupSchedule %s/%s last compact time can't rollback (from %v to %v)", bs.GetNamespace(), bs.GetName(), bs.Status.LastCompactTs, currentCompactTime) + return nil + } + bs.Status.LastCompactTs = &metav1.Time{Time: currentCompactTime} + return nil +} + +func (bm *backupScheduleManager) createLogBackup(bs *v1alpha1.BackupSchedule) error { if bs.Spec.LogBackupTemplate == nil || bs.Status.LogBackup != nil { return nil } - // create log backup - logBackup := buildLogBackup(bs, time.Now()) - _, err := bm.deps.BackupControl.CreateBackup(logBackup) + ns := bs.GetNamespace() + bsName := bs.GetName() + startTs := bm.now() + logBackup := buildLogBackup(bs, startTs) + + // Check if the log backup already exists + _, err := bm.deps.BackupControl.GetBackup(logBackup) + if err == nil { + return fmt.Errorf("backup schedule %s/%s, log backup %s already exists", ns, bsName, logBackup.Name) + } + if !errors.IsNotFound(err) { + klog.Errorf("backup schedule %s/%s, get log backup %s failed, err: %v", ns, bsName, logBackup.Name, err) + return err + } + + _, err = bm.deps.BackupControl.CreateBackup(logBackup) if err != nil { return fmt.Errorf("backup schedule %s/%s, create log backup %s failed, err: %v", ns, bsName, logBackup.Name, err) } + klog.Infof("backup schedule %s/%s, create log backup %s successfully", ns, bsName, logBackup.Name) + bs.Status.LogBackup = &logBackup.Name + bs.Status.LogBackupStartTs = &metav1.Time{Time: startTs} return nil } +func (bm *backupScheduleManager) getLogBackupCheckpoint(bs *v1alpha1.BackupSchedule) (*time.Time, error) { + if bs.Spec.LogBackupTemplate == nil || bs.Status.LogBackup == nil { + return nil, nil + } + + ns := bs.GetNamespace() + bsName := bs.GetName() + + logBackupName := *bs.Status.LogBackup + logBackup := &v1alpha1.Backup{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: ns, + Name: logBackupName, + }, + } + + existedLog, err := bm.deps.BackupControl.GetBackup(logBackup) + if err != nil { + if errors.IsNotFound(err) { + return nil, fmt.Errorf("backup schedule %s/%s, log backup %s not found", ns, bsName, logBackupName) + } + klog.Errorf("backup schedule %s/%s, get log backup %s failed, err: %v", ns, bsName, logBackupName, err) + return nil, err + } + + checkpoint, err := config.ParseTSStringToGoTime(existedLog.Status.LogCheckpointTs) + if err != nil { + return nil, err + } + klog.Infof("backup schedule %s/%s, log backup %s checkpoint is %v", ns, bsName, logBackupName, checkpoint) + + return &checkpoint, nil +} + // getLastScheduledTime return the newest time need to be scheduled according last backup time. // the return time is not before now and return nil if there's no such time. func getLastScheduledTime(bs *v1alpha1.BackupSchedule, nowFn nowFn) (*time.Time, error) { @@ -352,6 +554,50 @@ func buildLogBackup(bs *v1alpha1.BackupSchedule, timestamp time.Time) *v1alpha1. return logBackup } +func buildCompactBackup(bs *v1alpha1.BackupSchedule, startTs, endTs, now time.Time) *v1alpha1.CompactBackup { + ns := bs.GetNamespace() + bsName := bs.GetName() + + if bs.Spec.CompactBackupTemplate == nil { + return nil + } + + compactSpec := *bs.Spec.CompactBackupTemplate.DeepCopy() + compactSpec.StartTs = startTs.UTC().Format(v1alpha1.BackupTimestampFormat) + compactSpec.EndTs = endTs.UTC().Format(v1alpha1.BackupTimestampFormat) + + logBackupPrefix := "log" + "-" + bs.Status.LogBackupStartTs.UTC().Format(v1alpha1.BackupNameTimeFormat) + if compactSpec.S3 != nil { + compactSpec.S3.Prefix = path.Join(compactSpec.S3.Prefix, logBackupPrefix) + } else if compactSpec.Gcs != nil { + compactSpec.Gcs.Prefix = path.Join(compactSpec.Gcs.Prefix, logBackupPrefix) + } else if compactSpec.Azblob != nil { + compactSpec.Azblob.Prefix = path.Join(compactSpec.Azblob.Prefix, logBackupPrefix) + } else if compactSpec.Local != nil { + compactSpec.Local.Prefix = path.Join(compactSpec.Local.Prefix, logBackupPrefix) + } + + if bs.Spec.ImagePullSecrets != nil { + compactSpec.ImagePullSecrets = bs.Spec.ImagePullSecrets + } + + bsLabel := util.CombineStringMap(label.NewBackupSchedule().Instance(bsName).BackupSchedule(bsName), bs.Labels) + compactBackup := &v1alpha1.CompactBackup{ + Spec: compactSpec, + ObjectMeta: metav1.ObjectMeta{ + Namespace: ns, + Name: bs.GetCompactBackupCRDName(now), + Labels: bsLabel, + Annotations: bs.Annotations, + OwnerReferences: []metav1.OwnerReference{ + controller.GetBackupScheduleOwnerRef(bs), + }, + }, + } + klog.Infof("build compact backup %s/%s", ns, bsName) + return compactBackup +} + func createBackup(bkController controller.BackupControlInterface, bs *v1alpha1.BackupSchedule, timestamp time.Time) (*v1alpha1.Backup, error) { bk := buildBackup(bs, timestamp) return bkController.CreateBackup(bk) @@ -364,11 +610,13 @@ func (bm *backupScheduleManager) backupGC(bs *v1alpha1.BackupSchedule) { // if MaxBackups and MaxReservedTime are set at the same time, MaxReservedTime is preferred. if bs.Spec.MaxReservedTime != nil { bm.backupGCByMaxReservedTime(bs) + bm.compactGCByMaxReservedTime(bs) return } if bs.Spec.MaxBackups != nil && *bs.Spec.MaxBackups > 0 { bm.backupGCByMaxBackups(bs) + bm.compactGCByMaxBackups(bs) return } // TODO: When the backup schedule gc policy is not set, we should set a default backup gc policy. @@ -424,6 +672,19 @@ func (bm *backupScheduleManager) backupGCByMaxReservedTime(bs *v1alpha1.BackupSc klog.Infof("backup schedule %s/%s gc backup %s success", ns, bsName, backup.GetName()) } + var compactProgress uint64 + if bs.Spec.CompactBackupTemplate == nil { + compactProgress = math.MaxUint64 + } else if bs.Status.LastCompactTs == nil { + compactProgress = 0 + } else { + compactProgress = config.GoTimeToTS(bs.Status.LastCompactTs.Time) + } + + if truncateTSO > compactProgress { + truncateTSO = compactProgress + } + if truncateTSO > 0 { // truncate the log backup if err = bm.deps.BackupControl.TruncateLogBackup(logBackup, truncateTSO); err != nil { @@ -439,6 +700,46 @@ func (bm *backupScheduleManager) backupGCByMaxReservedTime(bs *v1alpha1.BackupSc } } +func (bm *backupScheduleManager) compactGCByMaxReservedTime(bs *v1alpha1.BackupSchedule) { + ns := bs.GetNamespace() + bsName := bs.GetName() + + reservedTime, err := time.ParseDuration(*bs.Spec.MaxReservedTime) + if err != nil { + klog.Errorf("backup schedule %s/%s, invalid MaxReservedTime %s", ns, bsName, *bs.Spec.MaxReservedTime) + return + } + + compactList, err := bm.getCompactList(bs) + if err != nil { + klog.Errorf("compactGCByMaxReservedTime, err: %s", err) + return + } + + sort.Slice(compactList, func(i, j int) bool { + return compactList[i].CreationTimestamp.Unix() < compactList[j].CreationTimestamp.Unix() + }) + + expired, err := calculateExpiredCompacts(compactList, reservedTime) + if err != nil { + klog.Errorf("caculate expired compact without log backup, err: %s", err) + return + } + + for _, compact := range expired { + // delete the expired backup + if err = bm.deps.CompactControl.DeleteCompactBackup(compact); err != nil { + klog.Errorf("backup schedule %s/%s gc compact %s failed, err %v", ns, bsName, compact.GetName(), err) + return + } + klog.Infof("backup schedule %s/%s gc compact %s success", ns, bsName, compact.GetName()) + } + + if len(expired) > 0 && len(expired) == len(compactList) { + bs.Status.LastCompact = "" + } +} + // separateSnapshotBackupsAndLogBackup return snapshot backups order by create time asc and log backup func separateSnapshotBackupsAndLogBackup(backupsList []*v1alpha1.Backup) ([]*v1alpha1.Backup, *v1alpha1.Backup) { var ( @@ -551,6 +852,25 @@ func calculateExpiredBackups(backupsList []*v1alpha1.Backup, reservedTime time.D return backupsList[:i], nil } +func calculateExpiredCompacts(compactsList []*v1alpha1.CompactBackup, reservedTime time.Duration) ([]*v1alpha1.CompactBackup, error) { + expiredTS := config.TSToTSO(time.Now().Add(-1 * reservedTime).Unix()) + i := 0 + for ; i < len(compactsList); i++ { + state := compactsList[i].Status.State + if state != string(v1alpha1.BackupComplete) && state != string(v1alpha1.BackupFailed) { + break + } + endTs, err := config.ParseTSString(compactsList[i].Spec.EndTs) + if err != nil { + return nil, perrors.Annotatef(err, "parse start tso: %s", compactsList[i].Spec.EndTs) + } + if endTs >= expiredTS { + break + } + } + return compactsList[:i], nil +} + // calculateLatestTSO calculate the latest tso in auto backups and log backups func calculateLatestTSO(backupsList []*v1alpha1.Backup, logBackup *v1alpha1.Backup) (uint64, error) { var ( @@ -704,6 +1024,40 @@ func (bm *backupScheduleManager) backupGCByMaxBackups(bs *v1alpha1.BackupSchedul } } +func (bm *backupScheduleManager) compactGCByMaxBackups(bs *v1alpha1.BackupSchedule) { + ns := bs.GetNamespace() + bsName := bs.GetName() + + compactList, err := bm.getCompactList(bs) + if err != nil { + klog.Errorf("compactGCByMaxBackups failed, err: %s", err) + return + } + + // sort by creation time desc + sort.Slice(compactList, func(i, j int) bool { + return compactList[i].CreationTimestamp.Unix() > compactList[j].CreationTimestamp.Unix() + }) + + var deleteCount int + for i, compact := range compactList { + if i < int(*bs.Spec.MaxBackups) { + continue + } + // delete the backup + if err := bm.deps.CompactControl.DeleteCompactBackup(compact); err != nil { + klog.Errorf("backup schedule %s/%s gc compact %s failed, err %v", ns, bsName, compact.GetName(), err) + return + } + deleteCount += 1 + klog.Infof("backup schedule %s/%s gc compact %s success", ns, bsName, compact.GetName()) + } + + if deleteCount > 0 && deleteCount == len(compactList) { + bs.Status.LastCompact = "" + } +} + func (bm *backupScheduleManager) resetLastBackup(bs *v1alpha1.BackupSchedule) { bs.Status.LastBackupTime = nil bs.Status.LastBackup = "" @@ -727,6 +1081,23 @@ func (bm *backupScheduleManager) getBackupList(bs *v1alpha1.BackupSchedule) ([]* return backupsList, nil } +func (bm *backupScheduleManager) getCompactList(bs *v1alpha1.BackupSchedule) ([]*v1alpha1.CompactBackup, error) { + ns := bs.GetNamespace() + bsName := bs.GetName() + + backupLabels := label.NewBackupSchedule().Instance(bsName).BackupSchedule(bsName) + selector, err := backupLabels.Selector() + if err != nil { + return nil, fmt.Errorf("generate backup schedule %s/%s label selector failed, err: %v", ns, bsName, err) + } + compactList, err := bm.deps.CompactBackupLister.CompactBackups(ns).List(selector) + if err != nil { + return nil, fmt.Errorf("get backup schedule %s/%s backup list failed, selector: %s, err: %v", ns, bsName, selector, err) + } + + return compactList, nil +} + type byCreateTimeDesc []*v1alpha1.Backup func (b byCreateTimeDesc) Len() int { return len(b) } diff --git a/pkg/controller/backup_control.go b/pkg/controller/backup_control.go index 09164a9e129..f0e40a4e3f5 100644 --- a/pkg/controller/backup_control.go +++ b/pkg/controller/backup_control.go @@ -47,6 +47,7 @@ import ( // BackupControlInterface manages Backups used in BackupSchedule type BackupControlInterface interface { CreateBackup(backup *v1alpha1.Backup) (*v1alpha1.Backup, error) + GetBackup(backup *v1alpha1.Backup) (*v1alpha1.Backup, error) DeleteBackup(backup *v1alpha1.Backup) error TruncateLogBackup(logBackup *v1alpha1.Backup, truncateTSO uint64) error } @@ -82,6 +83,19 @@ func (c *realBackupControl) CreateBackup(backup *v1alpha1.Backup) (*v1alpha1.Bac return backup, err } +func (c *realBackupControl) GetBackup(backup *v1alpha1.Backup) (*v1alpha1.Backup, error) { + ns := backup.GetNamespace() + backupName := backup.GetName() + + bsName := backup.GetLabels()[label.BackupScheduleLabelKey] + backup, err := c.cli.PingcapV1alpha1().Backups(ns).Get(context.TODO(), backupName, metav1.GetOptions{}) + if err != nil { + klog.Errorf("failed to get Backup: [%s/%s] for backupSchedule/%s, err: %v", ns, backupName, bsName, err) + return nil, err + } + return backup, err +} + func (c *realBackupControl) DeleteBackup(backup *v1alpha1.Backup) error { ns := backup.GetNamespace() backupName := backup.GetName() @@ -172,6 +186,10 @@ func (fbc *FakeBackupControl) CreateBackup(backup *v1alpha1.Backup) (*v1alpha1.B return backup, fbc.backupIndexer.Add(backup) } +func (fbc *FakeBackupControl) GetBackup(backup *v1alpha1.Backup) (*v1alpha1.Backup, error) { + return fbc.backupLister.Backups(backup.GetNamespace()).Get(backup.GetName()) +} + // DeleteBackup deletes the backup from BackupIndexer func (fbc *FakeBackupControl) DeleteBackup(backup *v1alpha1.Backup) error { defer fbc.createBackupTracker.Inc() diff --git a/pkg/controller/backupschedule/backup_schedule_control.go b/pkg/controller/backupschedule/backup_schedule_control.go index 52212fe27cc..8b84ed31342 100644 --- a/pkg/controller/backupschedule/backup_schedule_control.go +++ b/pkg/controller/backupschedule/backup_schedule_control.go @@ -21,6 +21,7 @@ import ( apiequality "k8s.io/apimachinery/pkg/api/equality" errorutils "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/tools/cache" + "k8s.io/klog/v2" ) // ControlInterface implements the control logic for updating BackupSchedule @@ -56,6 +57,7 @@ func (c *defaultBackupScheduleControl) UpdateBackupSchedule(bs *v1alpha1.BackupS if apiequality.Semantic.DeepEqual(&bs.Status, oldStatus) { return errorutils.NewAggregate(errs) } + klog.Infof("backupSchedule %s/%s status updated", bs.GetNamespace(), bs.GetName()) if err := c.statusUpdater.UpdateBackupScheduleStatus(bs.DeepCopy(), &bs.Status, oldStatus); err != nil { errs = append(errs, err) } diff --git a/pkg/controller/compact_backup_control.go b/pkg/controller/compact_backup_control.go index cd28fb5e627..ee8613feaae 100644 --- a/pkg/controller/compact_backup_control.go +++ b/pkg/controller/compact_backup_control.go @@ -28,11 +28,16 @@ package controller import ( "context" + "fmt" + "strings" + "github.com/pingcap/tidb-operator/pkg/apis/label" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" "github.com/pingcap/tidb-operator/pkg/client/clientset/versioned" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" + "k8s.io/klog/v2" ) // BackupControlInterface manages Backups used in BackupSchedule @@ -53,15 +58,50 @@ func NewRealCompactControl(cli versioned.Interface, recorder record.EventRecorde } } +func (c *realCompactControl) recordCompactEvent(verb string, compact *v1alpha1.CompactBackup, err error) { + backupName := compact.GetName() + ns := compact.GetNamespace() + + bsName := compact.GetLabels()[label.BackupScheduleLabelKey] + if err == nil { + reason := fmt.Sprintf("Successful%s", strings.Title(verb)) + msg := fmt.Sprintf("%s CompactBackup %s/%s for backupSchedule/%s successful", + strings.ToLower(verb), ns, backupName, bsName) + c.recorder.Event(compact, corev1.EventTypeNormal, reason, msg) + } else { + reason := fmt.Sprintf("Failed%s", strings.Title(verb)) + msg := fmt.Sprintf("%s CompactBackup %s/%s for backupSchedule/%s failed error: %s", + strings.ToLower(verb), ns, backupName, bsName, err) + c.recorder.Event(compact, corev1.EventTypeWarning, reason, msg) + } +} + func (c *realCompactControl) CreateCompactBackup(compact *v1alpha1.CompactBackup) (*v1alpha1.CompactBackup, error) { ns := compact.GetNamespace() + compactName := compact.GetName() - return c.cli.PingcapV1alpha1().CompactBackups(ns).Create(context.TODO(), compact, metav1.CreateOptions{}) + compact, err := c.cli.PingcapV1alpha1().CompactBackups(ns).Create(context.TODO(), compact, metav1.CreateOptions{}) + bsName := compact.GetLabels()[label.BackupScheduleLabelKey] + if err != nil { + klog.Errorf("failed to create CompactBackup: [%s/%s] for backupSchedule/%s, err: %v", ns, compactName, bsName, err) + } else { + klog.V(4).Infof("create CompactBackup: [%s/%s] for backupSchedule/%s successfully", ns, compactName, bsName) + } + c.recordCompactEvent("create", compact, err) + return compact, err } func (c *realCompactControl) DeleteCompactBackup(compact *v1alpha1.CompactBackup) error { ns := compact.GetNamespace() compactName := compact.GetName() - return c.cli.PingcapV1alpha1().CompactBackups(ns).Delete(context.TODO(), compactName, metav1.DeleteOptions{}) + err := c.cli.PingcapV1alpha1().CompactBackups(ns).Delete(context.TODO(), compactName, metav1.DeleteOptions{}) + bsName := compact.GetLabels()[label.BackupScheduleLabelKey] + if err != nil { + klog.Errorf("failed to delete CompactBackup: [%s/%s] for backupSchedule/%s, err: %v", ns, compactName, bsName, err) + } else { + klog.V(4).Infof("delete CompactBackup: [%s/%s] for backupSchedule/%s successfully", ns, compactName, bsName) + } + c.recordCompactEvent("delete", compact, err) + return err } diff --git a/pkg/controller/dependences.go b/pkg/controller/dependences.go index 52f8d50ce29..58baa591149 100644 --- a/pkg/controller/dependences.go +++ b/pkg/controller/dependences.go @@ -298,6 +298,7 @@ func newRealControls( ProxyControl: NewDefaultTiProxyControl(), TiDBControl: NewDefaultTiDBControl(secretLister), BackupControl: NewRealBackupControl(clientset, recorder), + CompactControl: NewRealCompactControl(clientset, recorder), RestoreControl: NewRealRestoreControl(clientset, restoreLister, recorder), SecretControl: NewRealSecretControl(kubeClientset, secretLister, recorder), }