diff --git a/class/defaults.yml b/class/defaults.yml index 9376849..cd7f5e1 100644 --- a/class/defaults.yml +++ b/class/defaults.yml @@ -3,13 +3,13 @@ parameters: charts: k8up: source: https://k8up-io.github.io/k8up - version: 3.0.2 + version: 4.3.0 images: k8up: registry: ghcr.io repository: k8up-io/k8up - tag: v2.5.2 + tag: v2.7.1 pullPolicy: IfNotPresent helmReleaseName: k8up diff --git a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/cleanup-hook.yaml b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/cleanup-hook.yaml new file mode 100644 index 0000000..daf97e7 --- /dev/null +++ b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/cleanup-hook.yaml @@ -0,0 +1,106 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + annotations: + helm.sh/hook: post-install,post-upgrade,post-delete + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + helm.sh/hook-weight: '1' + labels: + app.kubernetes.io/instance: k8up + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: k8up + helm.sh/chart: k8up-4.3.0 + name: cleanup-service-account +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + annotations: + helm.sh/hook: post-install,post-upgrade,post-delete + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + helm.sh/hook-weight: '2' + labels: + app.kubernetes.io/instance: k8up + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: k8up + helm.sh/chart: k8up-4.3.0 + name: k8up-cleanup-roles + namespace: syn-backup-k8up +rules: + - apiGroups: + - '' + resources: + - namespaces + verbs: + - get + - list + - apiGroups: + - rbac.authorization.k8s.io + resources: + - rolebindings + - roles + verbs: + - delete +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + annotations: + helm.sh/hook: post-install,post-upgrade,post-delete + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + helm.sh/hook-weight: '3' + labels: + app.kubernetes.io/instance: k8up + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: k8up + helm.sh/chart: k8up-4.3.0 + name: cleanup-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: k8up-cleanup-roles +subjects: + - kind: ServiceAccount + name: cleanup-service-account + namespace: syn-backup-k8up +--- +apiVersion: batch/v1 +kind: Job +metadata: + annotations: + helm.sh/hook: post-install,post-upgrade,post-delete + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + helm.sh/hook-weight: '4' + labels: + app.kubernetes.io/instance: k8up + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: k8up + helm.sh/chart: k8up-4.3.0 + name: k8up-cleanup +spec: + template: + metadata: + labels: + app.kubernetes.io/instance: k8up + app.kubernetes.io/name: k8up + name: k8up + spec: + containers: + - args: + - | + #!/bin/bash + + NAMESPACES=$(kubectl get namespace -ojson | jq -r '.items[].metadata.name') + + for ns in $NAMESPACES + do + kubectl -n "$ns" delete rolebinding pod-executor-namespaced --ignore-not-found=true + kubectl -n "$ns" delete role pod-executor --ignore-not-found=true + done + command: + - sh + - -c + image: bitnami/kubectl:latest + name: k8up-cleanup + restartPolicy: Never + serviceAccountName: cleanup-service-account diff --git a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/clusterrolebinding.yaml b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/clusterrolebinding.yaml index 90d2293..88c562d 100644 --- a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/clusterrolebinding.yaml +++ b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/clusterrolebinding.yaml @@ -5,7 +5,7 @@ metadata: app.kubernetes.io/instance: k8up app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: k8up - helm.sh/chart: k8up-3.0.2 + helm.sh/chart: k8up-4.3.0 name: k8up roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/deployment.yaml b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/deployment.yaml index 2528568..be74f06 100644 --- a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/deployment.yaml +++ b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/deployment.yaml @@ -5,7 +5,7 @@ metadata: app.kubernetes.io/instance: k8up app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: k8up - helm.sh/chart: k8up-3.0.2 + helm.sh/chart: k8up-4.3.0 name: k8up spec: replicas: 1 @@ -24,7 +24,7 @@ spec: - operator env: - name: BACKUP_IMAGE - value: ghcr.io/k8up-io/k8up:v2.5.2 + value: ghcr.io/k8up-io/k8up:v2.7.1 - name: TZ value: Etc/UTC - name: BACKUP_ENABLE_LEADER_ELECTION @@ -41,7 +41,7 @@ spec: value: k8up.io/backupcommand - name: BACKUP_BACKOFFLIMIT value: '2' - image: ghcr.io/k8up-io/k8up:v2.5.2 + image: ghcr.io/k8up-io/k8up:v2.7.1 imagePullPolicy: IfNotPresent livenessProbe: httpGet: diff --git a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/executor-clusterrole.yaml b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/executor-clusterrole.yaml new file mode 100644 index 0000000..a7f164a --- /dev/null +++ b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/executor-clusterrole.yaml @@ -0,0 +1,35 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/instance: k8up + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: k8up + helm.sh/chart: k8up-4.3.0 + name: k8up-executor +rules: + - apiGroups: + - '' + resources: + - pods + verbs: + - get + - list + - apiGroups: + - '' + resources: + - pods/exec + verbs: + - create + - apiGroups: + - k8up.io + resources: + - snapshots + verbs: + - create + - delete + - get + - list + - patch + - update + - watch diff --git a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/operator-clusterrole.yaml b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/operator-clusterrole.yaml index 25fdd9c..4e3b2d2 100644 --- a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/operator-clusterrole.yaml +++ b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/operator-clusterrole.yaml @@ -5,7 +5,7 @@ metadata: app.kubernetes.io/instance: k8up app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: k8up - helm.sh/chart: k8up-3.0.2 + helm.sh/chart: k8up-4.3.0 name: k8up-manager rules: - apiGroups: @@ -32,15 +32,6 @@ rules: - patch - update - watch - - apiGroups: - - batch - resources: - - jobs/finalizers - - jobs/status - verbs: - - get - - patch - - update - apiGroups: - coordination.k8s.io resources: @@ -68,15 +59,19 @@ rules: - apiGroups: - '' resources: - - pods + - persistentvolumes verbs: - - '*' + - get + - list + - watch - apiGroups: - '' resources: - - pods/exec + - pods verbs: - - '*' + - get + - list + - watch - apiGroups: - '' resources: @@ -86,6 +81,7 @@ rules: - delete - get - list + - watch - apiGroups: - k8up.io resources: @@ -251,13 +247,43 @@ rules: - get - patch - update + - apiGroups: + - k8up.io + resources: + - snapshots + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - k8up.io + resources: + - snapshots/finalizers + - snapshots/status + verbs: + - get + - patch + - update + - apiGroups: + - rbac.authorization.k8s.io + resourceNames: + - k8up-executor + resources: + - clusterroles + verbs: + - bind - apiGroups: - rbac.authorization.k8s.io resources: - rolebindings - - roles verbs: - create - delete - get - list + - update + - watch diff --git a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/service.yaml b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/service.yaml index baaf6c0..aa1857f 100644 --- a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/service.yaml +++ b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/service.yaml @@ -5,7 +5,7 @@ metadata: app.kubernetes.io/instance: k8up app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: k8up - helm.sh/chart: k8up-3.0.2 + helm.sh/chart: k8up-4.3.0 name: k8up-metrics spec: ports: diff --git a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/serviceaccount.yaml b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/serviceaccount.yaml index 59c4ad0..92dbdc0 100644 --- a/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/serviceaccount.yaml +++ b/tests/golden/defaults/backup-k8up/backup-k8up/01_k8up_helmchart/k8up/templates/serviceaccount.yaml @@ -5,5 +5,5 @@ metadata: app.kubernetes.io/instance: k8up app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: k8up - helm.sh/chart: k8up-3.0.2 + helm.sh/chart: k8up-4.3.0 name: k8up diff --git a/tests/golden/defaults/backup-k8up/backup-k8up/02_k8up_crds.yaml b/tests/golden/defaults/backup-k8up/backup-k8up/02_k8up_crds.yaml index 2113fa0..ed2f35c 100644 --- a/tests/golden/defaults/backup-k8up/backup-k8up/02_k8up_crds.yaml +++ b/tests/golden/defaults/backup-k8up/backup-k8up/02_k8up_crds.yaml @@ -1525,84 +1525,6 @@ spec: --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.10.0 - creationTimestamp: null - name: effectiveschedules.k8up.io -spec: - group: k8up.io - names: - kind: EffectiveSchedule - listKind: EffectiveScheduleList - plural: effectiveschedules - singular: effectiveschedule - scope: Namespaced - versions: - - additionalPrinterColumns: - - description: Schedule Namespace - jsonPath: .spec.scheduleRefs[0].namespace - name: Schedule Namespace - type: string - - description: Schedule Name - jsonPath: .spec.scheduleRefs[0].name - name: Schedule Name - type: string - - description: Generated Schedule - jsonPath: .spec.generatedSchedule - name: Generated Schedule - type: string - - description: Job Type - jsonPath: .spec.jobType - name: Job Type - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: EffectiveSchedule is the Schema to persist schedules generated from Randomized schedules. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: EffectiveScheduleSpec defines the desired state of EffectiveSchedule - properties: - generatedSchedule: - description: GeneratedSchedule is the effective schedule that is added to Cron - type: string - jobType: - description: JobType defines to which job type this schedule applies - type: string - originalSchedule: - description: OriginalSchedule is the original user-defined schedule definition in the Schedule object. - type: string - scheduleRefs: - description: ScheduleRefs holds a list of schedules for which the generated schedule applies to. The list may omit entries that aren't generated from smart schedules. - items: - description: ScheduleRef represents a reference to a Schedule resource - properties: - name: - type: string - namespace: - type: string - type: object - type: array - type: object - type: object - served: true - storage: true - subresources: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 @@ -9367,6 +9289,18 @@ spec: - type type: object type: array + effectiveSchedules: + description: EffectiveSchedules contains a list of schedules generated from randomizing schedules. + items: + properties: + generatedSchedule: + description: ScheduleDefinition is the actual cron-type expression that defines the interval of the actions. + type: string + jobType: + description: JobType defines what job type this is. + type: string + type: object + type: array type: object type: object served: true @@ -9390,7 +9324,20 @@ spec: singular: snapshot scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Date when snapshot was taken + jsonPath: .spec.date + name: Date taken + type: string + - description: Snapshot's paths + jsonPath: .spec.paths[*] + name: Paths + type: string + - description: Repository Url + jsonPath: .spec.repository + name: Repository + type: string + name: v1 schema: openAPIV3Schema: description: Snapshot is the Schema for the snapshots API @@ -9415,6 +9362,8 @@ spec: items: type: string type: array + repository: + type: string type: object status: description: SnapshotStatus defines the observed state of Snapshot