Skip to content

Commit

Permalink
Add catalogs for manifest-backup addon (#248)
Browse files Browse the repository at this point in the history
* Add catalogs for manifest-backup addon

Signed-off-by: Emruz Hossain <[email protected]>

* Generate charts

Signed-off-by: Emruz Hossain <[email protected]>

* Set default value for include-dependants flag

Signed-off-by: Emruz Hossain <[email protected]>

* Rename manifest addon to kubedump

Signed-off-by: Emruz Hossain <[email protected]>

* Fix command for kbuedump addon

Signed-off-by: Emruz Hossain <[email protected]>
  • Loading branch information
Emruz Hossain authored Apr 28, 2022
1 parent e07115b commit 55b9a5d
Show file tree
Hide file tree
Showing 12 changed files with 232 additions and 5 deletions.
12 changes: 12 additions & 0 deletions apis/installer/v1alpha1/stash_catalog_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type StashCatalogSpec struct {
Redis StashRedisSpec `json:"redis"`
NATS StashNATSSpec `json:"nats"`
ETCD StashETCDSpec `json:"etcd"`
KubeDump KubeDumpSpec `json:"kubedump"`
}

// StashElasticsearchSpec is the schema for Stash Elasticsearch values file
Expand Down Expand Up @@ -232,6 +233,17 @@ type ETCDRestore struct {
WorkloadName string `json:"workloadName"`
}

type KubeDumpSpec struct {
Enabled bool `json:"enabled"`
Backup KubeDumpBackup `json:"backup"`
}

type KubeDumpBackup struct {
Sanitize bool `json:"sanitize"`
LabelSelector string `json:"labelSelector"`
IncludeDependants bool `json:"includeDependants"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// StashCatalogList is a list of StashCatalogs
Expand Down
34 changes: 34 additions & 0 deletions apis/installer/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion catalog/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
"5.0.13-v4",
"6.2.5-v4"
]
},
{
"name": "kubedump",
"versions": [
"0.1.0"
]
}
]
}
}
40 changes: 40 additions & 0 deletions catalog/raw/kubedump/0.1.0/kubedump-backup-function.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: kubedump-backup-0.1.0
spec:
args:
- backup
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --storage-secret-name=${REPOSITORY_SECRET_NAME:=}
- --storage-secret-namespace=${REPOSITORY_SECRET_NAMESPACE:=}
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --hostname=${HOSTNAME:=}
- --namespace=${NAMESPACE:=default}
- --backupsession=${BACKUP_SESSION:=}
- --invoker-kind=${INVOKER_KIND:=}
- --invoker-name=${INVOKER_NAME:=}
- --target-kind=${TARGET_KIND:=}
- --target-name=${TARGET_NAME:=}
- --target-namespace=${TARGET_NAMESPACE:=}
- --sanitize=${sanitize:=true}
- --label-selector=${labelSelector:=}
- --include-dependants=${includeDependants:=false}
- --retention-keep-last=${RETENTION_KEEP_LAST:=0}
- --retention-keep-hourly=${RETENTION_KEEP_HOURLY:=0}
- --retention-keep-daily=${RETENTION_KEEP_DAILY:=0}
- --retention-keep-weekly=${RETENTION_KEEP_WEEKLY:=0}
- --retention-keep-monthly=${RETENTION_KEEP_MONTHLY:=0}
- --retention-keep-yearly=${RETENTION_KEEP_YEARLY:=0}
- --retention-keep-tags=${RETENTION_KEEP_TAGS:=}
- --retention-prune=${RETENTION_PRUNE:=false}
- --retention-dry-run=${RETENTION_DRY_RUN:=false}
- --output-dir=${outputDir:=}
- --license-apiservice=${LICENSE_APISERVICE:=}
image: stashed/stash-kubedump:0.1.0
14 changes: 14 additions & 0 deletions catalog/raw/kubedump/0.1.0/kubedump-backup-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: stash.appscode.com/v1beta1
kind: Task
metadata:
name: kubedump-backup-0.1.0
spec:
steps:
- name: kubedump-backup-0.1.0
params:
- name: outputDir
value: /tmp/output
- name: update-status
params:
- name: outputDir
value: /tmp/output
4 changes: 4 additions & 0 deletions charts/stash-catalog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ The following table lists the configurable parameters of the `stash-catalog` cha
| etcd.restore.dataDir | Directory where the ETCD stores its data for persistence | <code>""</code> |
| etcd.restore.workloadKind | Kind of the workload used to deploy the ETCD cluster (i.e. StatefulSet) | <code>""</code> |
| etcd.restore.workloadName | Name of the workload used to deploy the ETCD cluster | <code>""</code> |
| kubedump.enabled | If true, deploy kubedump addon | <code>true</code> |
| kubedump.backup.sanitize | Specify whether to remove the decorator | <code>true</code> |
| kubedump.backup.labelSelector | Specify label selector to filter resources | <code>""</code> |
| kubedump.backup.includeDependants | Specify whether to include the dependants resources along with it's parent | <code>false</code> |


Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{ if .Values.kubedump.enabled }}
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: 'kubedump-backup-0.1.0'
labels:
{{- include "stash-catalog.labels" . | nindent 4 }}
spec:
args:
- backup
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --storage-secret-name=${REPOSITORY_SECRET_NAME:=}
- --storage-secret-namespace=${REPOSITORY_SECRET_NAMESPACE:=}
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --hostname=${HOSTNAME:=}
- --namespace=${NAMESPACE:=default}
- --backupsession=${BACKUP_SESSION:=}
- --invoker-kind=${INVOKER_KIND:=}
- --invoker-name=${INVOKER_NAME:=}
- --target-kind=${TARGET_KIND:=}
- --target-name=${TARGET_NAME:=}
- --target-namespace=${TARGET_NAMESPACE:=}
- --sanitize=${sanitize:=true}
- --label-selector=${labelSelector:=}
- --include-dependants=${includeDependants:=false}
- --retention-keep-last=${RETENTION_KEEP_LAST:=0}
- --retention-keep-hourly=${RETENTION_KEEP_HOURLY:=0}
- --retention-keep-daily=${RETENTION_KEEP_DAILY:=0}
- --retention-keep-weekly=${RETENTION_KEEP_WEEKLY:=0}
- --retention-keep-monthly=${RETENTION_KEEP_MONTHLY:=0}
- --retention-keep-yearly=${RETENTION_KEEP_YEARLY:=0}
- --retention-keep-tags=${RETENTION_KEEP_TAGS:=}
- --retention-prune=${RETENTION_PRUNE:=false}
- --retention-dry-run=${RETENTION_DRY_RUN:=false}
- --output-dir=${outputDir:=}
- --license-apiservice=${LICENSE_APISERVICE:=}
image: '{{ include "catalog.registry" . }}/stash-kubedump:0.1.0'
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{ if .Values.kubedump.enabled }}
apiVersion: stash.appscode.com/v1beta1
kind: Task
metadata:
name: 'kubedump-backup-0.1.0'
labels:
{{- include "stash-catalog.labels" . | nindent 4 }}
spec:
steps:
- name: kubedump-backup-0.1.0
params:
- name: outputDir
value: /tmp/output
- name: update-status
params:
- name: outputDir
value: /tmp/output
{{ end }}
22 changes: 22 additions & 0 deletions charts/stash-catalog/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ properties:
required:
- registry
type: object
kubedump:
properties:
backup:
properties:
includeDependants:
type: boolean
labelSelector:
type: string
sanitize:
type: boolean
required:
- includeDependants
- labelSelector
- sanitize
type: object
enabled:
type: boolean
required:
- backup
- enabled
type: object
mariadb:
description: StashMariadbSpec is the schema for Stash MariaDB values file
properties:
Expand Down Expand Up @@ -227,6 +248,7 @@ required:
- elasticsearch
- etcd
- image
- kubedump
- mariadb
- mongodb
- mysql
Expand Down
11 changes: 11 additions & 0 deletions charts/stash-catalog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,14 @@ etcd:
workloadKind: ""
# Name of the workload used to deploy the ETCD cluster
workloadName: ""
kubedump:
# If true, deploy kubedump addon
enabled: true
# Optional arguments to pass to the backup process
backup:
# Specify whether to remove the decorator
sanitize: true
# Specify label selector to filter resources
labelSelector: ""
# Specify whether to include the dependants resources along with it's parent
includeDependants: false
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ spec:
style.
properties:
field:
description: Field defines the metric value path of the manifest
description: Field defines the metric value path of the cluster
file and the type of that value
properties:
path:
Expand Down Expand Up @@ -209,7 +209,7 @@ spec:
type: string
valueFromPath:
description: "ValueFromPath contains the field path of the
manifest file of a object. ValueFromPath is used when
cluster file of a object. ValueFromPath is used when
the metric value is coming from any specific json path
of the object. \n Example: For metrics \"kube_deployment_spec_replicas\",
the metricValue is coming from a specific path .spec.replicas
Expand Down Expand Up @@ -241,7 +241,7 @@ spec:
description: Value defines user defined parameter's value.
type: string
valuePath:
description: 'ValuePath defines the manifest field path
description: 'ValuePath defines the cluster field path
for the parameter''s value. Example: To add deployment''s
spec replica count as parameter, params: - key: replica valuePath:
.spec.replicas'
Expand Down Expand Up @@ -334,7 +334,7 @@ spec:
type: string
valueFromPath:
description: "ValueFromPath contains the field
path of the manifest file of a object. ValueFromPath
path of the cluster file of a object. ValueFromPath
is used when the metric value is coming from
any specific json path of the object. \n Example:
For metrics \"kube_deployment_spec_replicas\",
Expand Down
22 changes: 22 additions & 0 deletions charts/stash/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,27 @@ properties:
required:
- registry
type: object
kubedump:
properties:
backup:
properties:
includeDependants:
type: boolean
labelSelector:
type: string
sanitize:
type: boolean
required:
- includeDependants
- labelSelector
- sanitize
type: object
enabled:
type: boolean
required:
- backup
- enabled
type: object
mariadb:
description: StashMariadbSpec is the schema for Stash MariaDB values file
properties:
Expand Down Expand Up @@ -266,6 +287,7 @@ properties:
- elasticsearch
- etcd
- image
- kubedump
- mariadb
- mongodb
- mysql
Expand Down

0 comments on commit 55b9a5d

Please sign in to comment.