generated from onedr0p/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
152 additions
and
82 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
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 was deleted.
Oops, something went wrong.
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,40 @@ | ||
# Volsync | ||
|
||
Comes with PVC, which it backs up. | ||
|
||
## Usage | ||
|
||
1. In kustomization.yaml import with: | ||
|
||
```yaml | ||
components: | ||
- ../../../path/to/templates/volsync | ||
``` | ||
2. In fluxtomization `ks.yaml` add this: | ||
|
||
```yaml | ||
spec: | ||
postBuild: | ||
substitute: | ||
APP: *app | ||
``` | ||
|
||
3. Inside substitute these variables are supported: | ||
|
||
- `APP` (required) | ||
|
||
- `PVC_CAPACITY` (required) | ||
- `PVC_STORAGECLASS` (optional, default `"truenas-nfs-main"`) | ||
- `PVC_ACCESSMODE` (optional, default `"ReadWriteOnce"`) | ||
- `PVC_NAME_PREFIX` (optional, default `""`) | ||
- `PVC_NAME_SUFFIX` (optional, default `""`) | ||
|
||
- `VOLSYNC_COPYMETHOD` (optional, default `"Snapshot"`) | ||
- `VOLSYNC_SNAPSHOTCLASS` (optional, default `"truenas-nfs-main"`) | ||
- `VOLSYNC_CACHE_SNAPSHOTCLASS` (optional, default `"openebs-hostpath"`) | ||
- `VOLSYNC_CACHE_ACCESSMODE` (optional, default `"ReadWriteOnce"`) | ||
- `VOLSYNC_CACHE_CAPACITY` (optional, default `"4Gi"`) | ||
- `VOLSYNC_REPO_EXTRA_SUBPATH` (optional, default `""`) - should not start | ||
with `/`. Adds extra subpath to backup location in minio. Allows to have | ||
multiple volsync backups to go into the same bucket. |
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: kustomize.config.k8s.io/v1alpha1 | ||
kind: Component | ||
|
||
resources: | ||
- ./pvc.yaml | ||
- ./minio.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,81 @@ | ||
--- | ||
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/external-secrets.io/externalsecret_v1beta1.json | ||
apiVersion: external-secrets.io/v1beta1 | ||
kind: ExternalSecret | ||
metadata: | ||
name: "${APP}-volsync" | ||
spec: | ||
secretStoreRef: | ||
kind: ClusterSecretStore | ||
name: store-k8s | ||
target: | ||
name: "${APP}-volsync-secret" | ||
template: | ||
engineVersion: v2 | ||
data: | ||
RESTIC_REPOSITORY: "s3:{{ .MINIO_URL }}/{{ .${APP//-/_}_restic_minio_user }}/${VOLSYNC_REPO_EXTRA_SUBPATH:-}" | ||
RESTIC_PASSWORD: "{{ .${APP//-/_}_restic_pass }}" | ||
AWS_ACCESS_KEY_ID: "{{ .${APP//-/_}_restic_minio_user }}" | ||
AWS_SECRET_ACCESS_KEY: "{{ .${APP//-/_}_restic_minio_pass }}" | ||
dataFrom: | ||
- extract: | ||
key: everything | ||
- extract: | ||
key: service-hosts | ||
--- | ||
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/volsync.backube/replicationsource_v1alpha1.json | ||
apiVersion: volsync.backube/v1alpha1 | ||
kind: ReplicationSource | ||
metadata: | ||
name: "${APP}" | ||
spec: | ||
sourcePVC: "${PVC_NAME_PREFIX:-}${APP}${PVC_NAME_SUFFIX:-}" | ||
trigger: | ||
schedule: "0 * * * *" | ||
restic: | ||
repository: "${APP}-volsync-secret" | ||
copyMethod: "${VOLSYNC_COPYMETHOD:-Snapshot}" | ||
|
||
volumeSnapshotClassName: "${VOLSYNC_SNAPSHOTCLASS:-truenas-nfs-main}" | ||
storageClassName: "${PVC_STORAGECLASS:-truenas-nfs-main}" | ||
accessModes: ["${PVC_ACCESSMODE:-ReadWriteOnce}"] | ||
|
||
cacheStorageClassName: "${VOLSYNC_CACHE_SNAPSHOTCLASS:-openebs-hostpath}" | ||
cacheAccessModes: ["${VOLSYNC_CACHE_ACCESSMODE:-ReadWriteOnce}"] | ||
cacheCapacity: "${VOLSYNC_CACHE_CAPACITY:-4Gi}" | ||
|
||
pruneIntervalDays: 7 | ||
retain: | ||
hourly: 24 | ||
daily: 7 | ||
weekly: 5 | ||
moverSecurityContext: | ||
runAsUser: 568 | ||
runAsGroup: 568 | ||
fsGroup: 568 | ||
--- | ||
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/volsync.backube/replicationdestination_v1alpha1.json | ||
apiVersion: volsync.backube/v1alpha1 | ||
kind: ReplicationDestination | ||
metadata: | ||
name: "${APP}-dst" | ||
spec: | ||
trigger: | ||
manual: restore-once | ||
restic: | ||
repository: "${APP}-volsync-secret" | ||
copyMethod: Snapshot # must be Snapshot | ||
|
||
volumeSnapshotClassName: "${VOLSYNC_SNAPSHOTCLASS:-truenas-nfs-main}" | ||
storageClassName: "${PVC_STORAGECLASS:-truenas-nfs-main}" | ||
accessModes: ["${PVC_ACCESSMODE:-ReadWriteOnce}"] | ||
capacity: "${PVC_CAPACITY}" | ||
|
||
cacheStorageClassName: "${VOLSYNC_CACHE_SNAPSHOTCLASS:-openebs-hostpath}" | ||
cacheAccessModes: ["${VOLSYNC_CACHE_ACCESSMODE:-ReadWriteOnce}"] | ||
cacheCapacity: "${VOLSYNC_CACHE_CAPACITY:-4Gi}" | ||
|
||
moverSecurityContext: | ||
runAsUser: 568 | ||
runAsGroup: 568 | ||
fsGroup: 568 |
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 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: "${PVC_NAME_PREFIX:-}${APP}${PVC_NAME_SUFFIX:-}" | ||
spec: | ||
accessModes: ["${PVC_ACCESSMODE:-ReadWriteOnce}"] | ||
dataSourceRef: | ||
kind: ReplicationDestination | ||
apiGroup: volsync.backube | ||
name: "${APP}-dst" | ||
resources: | ||
requests: | ||
storage: "${PVC_CAPACITY}" | ||
storageClassName: "${PVC_STORAGECLASS:-truenas-nfs-main}" |