Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable backup of database and secrets associated with Pulp custom res…
…ource * Create new CRD and update CSV bundler * Create new role to capture secrets and db data to PVC * Update backup CR with backup PVC and directory information fixes #8473 https://pulp.plan.io/issues/8473
- Loading branch information
1 parent
27a19db
commit 615f9db
Showing
32 changed files
with
771 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Enable backup of database and secrets associated with Pulp custom resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
apiVersion: pulp.pulpproject.org/v1beta1 | ||
kind: PulpBackup | ||
metadata: | ||
name: example-pulpbackup | ||
spec: | ||
pulp_name: example-pulp |
11 changes: 11 additions & 0 deletions
11
deploy/crds/pulpproject_v1beta1_pulpbackup_cr.default.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
apiVersion: pulp.pulpproject.org/v1beta | ||
kind: PulpBackup | ||
metadata: | ||
name: example-pulpbackup | ||
spec: | ||
pulp_name: '' | ||
pulp_backup_pvc: '' | ||
pulp_backup_size: '' | ||
pulp_backup_storage_class: '' | ||
postgres_label_selector: '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: pulpbackups.pulp.pulpproject.org | ||
spec: | ||
group: pulp.pulpproject.org | ||
names: | ||
kind: PulpBackup | ||
listKind: PulpBackupList | ||
plural: pulpbackups | ||
singular: pulpbackup | ||
scope: Namespaced | ||
versions: | ||
- name: v1beta1 | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
x-kubernetes-preserve-unknown-fields: true | ||
description: Schema validation for the PulpBackup CRD | ||
properties: | ||
spec: | ||
type: object | ||
properties: | ||
pulp_name: | ||
description: Name of the deployment to be backed up | ||
type: string | ||
pulp_backup_pvc: | ||
description: Name of the PVC to be used for storing the backup | ||
type: string | ||
pulp_backup_size: | ||
description: Size of PVC | ||
type: string | ||
pulp_backup_storage_class: | ||
description: Storage class to use when creating PVC for backup | ||
type: string | ||
postgres_label_selector: | ||
description: Label selector used to identify postgres pod for executing migration | ||
type: string | ||
oneOf: | ||
- required: ["pulp_name"] | ||
status: | ||
properties: | ||
pulpBackupClaim: | ||
description: The PVC name used for the backup | ||
type: string | ||
pulpBackupDirectory: | ||
description: The directory data is backed up to on the PVC | ||
type: string | ||
conditions: | ||
description: The resulting conditions when a Service Telemetry is instantiated | ||
items: | ||
properties: | ||
status: | ||
type: string | ||
type: | ||
type: string | ||
reason: | ||
type: string | ||
lastTransitionTime: | ||
type: string | ||
type: object | ||
type: array | ||
type: object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
deploy/olm-catalog/pulp-operator/manifests/pulp.pulpproject.org_pulpbackups_crd.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: pulpbackups.pulp.pulpproject.org | ||
spec: | ||
group: pulp.pulpproject.org | ||
names: | ||
kind: PulpBackup | ||
listKind: PulpBackupList | ||
plural: pulpbackups | ||
singular: pulpbackup | ||
scope: Namespaced | ||
versions: | ||
- name: v1beta1 | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
x-kubernetes-preserve-unknown-fields: true | ||
description: Schema validation for the PulpBackup CRD | ||
properties: | ||
spec: | ||
type: object | ||
properties: | ||
pulp_name: | ||
description: Name of the deployment to be backed up | ||
type: string | ||
pulp_backup_pvc: | ||
description: Name of the PVC to be used for storing the backup | ||
type: string | ||
pulp_backup_size: | ||
description: Size of PVC | ||
type: string | ||
pulp_backup_storage_class: | ||
description: Storage class to use when creating PVC for backup | ||
type: string | ||
postgres_label_selector: | ||
description: Label selector used to identify postgres pod for executing migration | ||
type: string | ||
oneOf: | ||
- required: ["pulp_name"] | ||
status: | ||
properties: | ||
pulpBackupClaim: | ||
description: The PVC name used for the backup | ||
type: string | ||
pulpBackupDirectory: | ||
description: The directory data is backed up to on the PVC | ||
type: string | ||
conditions: | ||
description: The resulting conditions when a Service Telemetry is instantiated | ||
items: | ||
properties: | ||
status: | ||
type: string | ||
type: | ||
type: string | ||
reason: | ||
type: string | ||
lastTransitionTime: | ||
type: string | ||
type: object | ||
type: array | ||
type: object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../roles/backup/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Backup | ||
======== | ||
|
||
The purpose of this role is to create a backup of your Pulp deployment. This includes: | ||
- backup of the PostgreSQL database | ||
- custom user config file | ||
|
||
Requirements | ||
------------ | ||
|
||
Requires the `openshift` Python library to interact with Kubernetes: `pip install openshift`. | ||
|
||
Role Variables | ||
-------------- | ||
|
||
* `pulp_name`: The name of the pulp custom resource to backup | ||
* `pulp_backup_pvc`: The name of the PVC to uses for backup | ||
* `pulp_backup_size`: The size of storage for the PVC created by operator if one is not supplied | ||
* `pulp_backup_storage_class`: The storage class to be used for the backup PVC | ||
* `postgres_configuration_secret`: The postgres_configuration_secret | ||
|
||
|
||
Dependencies | ||
------------ | ||
|
||
collections: | ||
|
||
- community.kubernetes | ||
- operator_sdk.util | ||
|
||
License | ||
------- | ||
|
||
GPLv2+ | ||
|
||
Author Information | ||
------------------ | ||
|
||
[Pulp Team](https://pulpproject.org/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
# Required: specify name of pulp deployment to backup from | ||
pulp_name: '' | ||
|
||
# Specify a pre-created PVC (name) to backup to | ||
pulp_backup_pvc: '' | ||
|
||
# Size of backup PVC if created dynamically | ||
pulp_backup_size: '' | ||
|
||
# Specify storage class to determine how to dynamically create PVC's with | ||
pulp_backup_storage_class: '' | ||
|
||
# Secret Names | ||
pulp_admin_password_secret: "{{ pulp_name }}-admin-password" | ||
postgres_configuration_secret: "{{ pulp_name }}-postgres-configuration" | ||
|
||
custom_resource_key: '_pulp_pulpproject_org_pulpbackup' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
galaxy_info: | ||
author: Pulp Team | ||
description: A role to backup a Pulp deployment | ||
issue_tracker_url: https://pulp.plan.io/projects/pulp/issues/new | ||
license: GPL-2.0-or-later | ||
company: Red Hat | ||
min_ansible_version: 2.9 | ||
platforms: | ||
- name: Debian | ||
versions: | ||
- buster | ||
- name: Fedora | ||
versions: | ||
- 30 | ||
- 31 | ||
- 32 | ||
- 33 | ||
- name: EL | ||
versions: | ||
- 7 | ||
- 8 | ||
galaxy_tags: | ||
- pulp | ||
- pulpcore | ||
dependencies: [] | ||
# List your role dependencies here, one per line. Be sure to remove the '[]' above, | ||
# if you add dependencies to this list. | ||
collections: | ||
- operator_sdk.util | ||
- community.kubernetes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
|
||
# After copying secret files to the PVC, delete the local tmp copies | ||
- name: Clean up _secrets directory | ||
ansible.builtin.file: | ||
path: "{{ playbook_dir }}/_secrets" | ||
state: absent | ||
|
||
- name: Delete any existing management pod | ||
community.kubernetes.k8s: | ||
name: "{{ meta.name }}-db-management" | ||
kind: Pod | ||
namespace: "{{ meta.namespace }}" | ||
state: absent | ||
force: true |
Oops, something went wrong.