Skip to content

Commit

Permalink
Update YAML for label-driven recurring job
Browse files Browse the repository at this point in the history
Longhorn-467

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang authored and innobead committed Aug 20, 2021
1 parent 8dca776 commit 64d53d5
Showing 1 changed file with 84 additions and 4 deletions.
88 changes: 84 additions & 4 deletions deploy/longhorn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,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"]
verbs: ["*"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
Expand Down Expand Up @@ -745,6 +746,86 @@ spec:
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
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -874,9 +955,8 @@ data:
# backingImageURL: "https://backing-image-example.s3-region.amazonaws.com/test-backing-image"
# diskSelector: "ssd,fast"
# nodeSelector: "storage,fast"
# recurringJobs: '[{"name":"snap", "task":"snapshot", "cron":"*/1 * * * *", "retain":1},
# {"name":"backup", "task":"backup", "cron":"*/2 * * * *", "retain":1,
# "labels": {"interval":"2m"}}]'
# recurringJobSelector: '[{"name":"snap-group", "isGroup":true},
# {"name":"backup", "isGroup":false}]'
---
apiVersion: apps/v1
kind: DaemonSet
Expand Down

0 comments on commit 64d53d5

Please sign in to comment.