Update chart for label-driven recurring job

Longhorn-467

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
This commit is contained in:
Chin-Ya Huang 2021-08-17 11:11:42 +08:00 committed by David Ko
parent 13dc719ebb
commit 8dca77621d
5 changed files with 92 additions and 11 deletions

View File

@ -504,17 +504,17 @@ Warning: This option works only when there is a failed replica in the volume. An
min: 1
max: 10
default: 3
- variable: persistence.recurringJobs.enable
description: "Enable recurring job for Longhorn StorageClass"
- variable: persistence.recurringJobSelector.enable
description: "Enable recurring job selector for Longhorn StorageClass"
group: "Longhorn Storage Class Settings"
label: Enable Storage Class Recurring Job
label: Enable Storage Class Recurring Job Selector
type: boolean
default: false
show_subquestion_if: true
subquestions:
- variable: persistence.recurringJobs.jobList
description: 'Recurring job list for Longhorn StorageClass. Please be careful of quotes of input. e.g., [{"name":"backup", "task":"backup", "cron":"*/2 * * * *", "retain":1,"labels": {"interval":"2m"}}]'
label: Storage Class Recurring Job List
- variable: persistence.recurringJobSelector.jobList
description: 'Recurring job selector list for Longhorn StorageClass. Please be careful of quotes of input. e.g., [{"name":"backup", "isGroup":true}]'
label: Storage Class Recurring Job Selector List
group: "Longhorn Storage Class Settings"
type: string
default:

View File

@ -39,7 +39,8 @@ rules:
"engineimages", "engineimages/status", "nodes", "nodes/status", "instancemanagers", "instancemanagers/status",
"sharemanagers", "sharemanagers/status", "backingimages", "backingimages/status",
"backingimagemanagers", "backingimagemanagers/status", "backingimagedatasources", "backingimagedatasources/status",
"backuptargets", "backuptargets/status", "backupvolumes", "backupvolumes/status", "backups", "backups/status"]
"backuptargets", "backuptargets/status", "backupvolumes", "backupvolumes/status", "backups", "backups/status",
"recurringjobs", "recurringjobs/status"]
verbs: ["*"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]

View File

@ -671,4 +671,84 @@ spec:
type: string
description: The backup last synced time
jsonPath: .status.lastSyncedAt
---
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
labels:
longhorn-manager: RecurringJob
name: recurringjobs.longhorn.io
spec:
group: longhorn.io
names:
kind: RecurringJob
listKind: RecurringJobList
plural: recurringjobs
shortNames:
- lhrj
singular: recurringjob
scope: Namespaced
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
metadata:
type: object
properties:
name:
type: string
spec:
type: object
properties:
groups:
type: array
items:
type: string
task:
type: string
pattern: "^snapshot|backup$"
cron:
type: string
retain:
type: integer
concurrency:
type: integer
labels:
x-kubernetes-preserve-unknown-fields: true
status:
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}
additionalPrinterColumns:
- name: Groups
type: string
description: Sets groupings to the jobs. When set to "default" group will be added to the volume label when no other job label exist in volume.
jsonPath: .spec.groups
- name: Task
type: string
description: Should be one of "backup" or "snapshot".
jsonPath: .spec.task
- name: Cron
type: string
description: The cron expression represents recurring job scheduling.
jsonPath: .spec.cron
- name: Retain
type: integer
description: The number of snapshots/backups to keep for the volume.
jsonPath: .spec.retain
- name: Concurrency
type: integer
description: The concurrent job to run by each cron job.
jsonPath: .spec.concurrency
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
- name: Labels
type: string
description: Specify the labels
jsonPath: .spec.labels
---

View File

@ -21,6 +21,6 @@ data:
staleReplicaTimeout: "30"
fromBackup: ""
backingImage: ""
{{- if .Values.persistence.recurringJobs.enable }}
recurringJobs: '{{ .Values.persistence.recurringJobs.jobList }}'
{{- if .Values.persistence.recurringJobSelector.enable }}
recurringJobSelector: '{{ .Values.persistence.recurringJobSelector.jobList }}'
{{- end }}

View File

@ -55,7 +55,7 @@ persistence:
defaultClass: true
defaultClassReplicaCount: 3
reclaimPolicy: Delete
recurringJobs:
recurringJobSelector:
enable: false
jobList: []