Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add etcd v3.5.0 addon to Stash #195

Merged
merged 2 commits into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions apis/installer/v1alpha1/stash_catalog_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type StashCatalogSpec struct {
Postgres StashPostgresSpec `json:"postgres"`
Redis StashRedisSpec `json:"redis"`
NATS StashNATSSpec `json:"nats"`
ETCD StashETCDSpec `json:"etcd"`
}

// StashElasticsearchSpec is the schema for Stash Elasticsearch values file
Expand Down Expand Up @@ -204,6 +205,33 @@ type NATSRestore struct {
Overwrite bool `json:"overwrite"`
}

// StashETCDSpec is the schema for Stash ETCD values file
type StashETCDSpec struct {
Enabled bool `json:"enabled"`
Backup ETCDBackup `json:"backup"`
Restore ETCDRestore `json:"restore"`
}

type ETCDBackup struct {
// +optional
Args string `json:"args"`
}

type ETCDRestore struct {
// +optional
Args string `json:"args"`
// +optional
InitialCluster string `json:"initialCluster"`
// +optional
InitialClusterToken string `json:"initialClusterToken"`
// +optional
DataDir string `json:"dataDir"`
// +optional
WorkloadKind string `json:"workloadKind"`
// +optional
WorkloadName string `json:"workloadName"`
}

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

// StashCatalogList is a list of StashCatalogs
Expand Down
51 changes: 51 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.

6 changes: 6 additions & 0 deletions catalog/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
"5.0.13",
"6.2.5"
]
},
{
"name": "etcd",
"versions": [
"3.5.0"
]
}
]
}
37 changes: 37 additions & 0 deletions catalog/raw/etcd/3.5.0/etcd-backup-function.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: etcd-backup-3.5.0
spec:
args:
- backup-etcd
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --secret-dir=/etc/repository/secret
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --wait-timeout=${waitTimeout:=300}
- --hostname=${HOSTNAME:=}
- --namespace=${NAMESPACE:=default}
- --appbinding=${TARGET_NAME:=}
- --backupsession=${BACKUP_SESSION:=}
- --etcd-args=${args:=}
- --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-etcd:3.5.0
volumeMounts:
- mountPath: /etc/repository/secret
name: ${secretVolume}
22 changes: 22 additions & 0 deletions catalog/raw/etcd/3.5.0/etcd-backup-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: stash.appscode.com/v1beta1
kind: Task
metadata:
name: etcd-backup-3.5.0
spec:
steps:
- name: etcd-backup-3.5.0
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
- name: update-status
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
volumes:
- name: secret-volume
secret:
secretName: ${REPOSITORY_SECRET_NAME}
38 changes: 38 additions & 0 deletions catalog/raw/etcd/3.5.0/etcd-restore-function.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: etcd-restore-3.5.0
spec:
args:
- restore-etcd
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --secret-dir=/etc/repository/secret
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --wait-timeout=${waitTimeout:=300}
- --hostname=${HOSTNAME:=}
- --source-hostname=${SOURCE_HOSTNAME:=}
- --namespace=${NAMESPACE:=default}
- --appbinding=${TARGET_NAME:=}
- --etcd-args=${args:=}
- --initial-cluster=${initialCluster:=}
- --initial-cluster-token=${initialClusterToken:=}
- --data-dir=${dataDir:=}
- --workload-kind=${workloadKind:=}
- --workload-name=${workloadName:=}
- --output-dir=${outputDir:=}
- --license-apiservice=${LICENSE_APISERVICE:=}
- --invoker-kind=${INVOKER_KIND:=}
- --invoker-name=${INVOKER_NAME:=}
- --image=${ADDON_IMAGE:=}
- --secret-name=${REPOSITORY_SECRET_NAME:=}
- --snapshots=${RESTORE_SNAPSHOTS:=}
image: stashed/stash-etcd:3.5.0
volumeMounts:
- mountPath: /etc/repository/secret
name: ${secretVolume}
22 changes: 22 additions & 0 deletions catalog/raw/etcd/3.5.0/etcd-restore-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: stash.appscode.com/v1beta1
kind: Task
metadata:
name: etcd-restore-3.5.0
spec:
steps:
- name: etcd-restore-3.5.0
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
- name: update-status
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
volumes:
- name: secret-volume
secret:
secretName: ${REPOSITORY_SECRET_NAME}
8 changes: 8 additions & 0 deletions charts/stash-catalog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ The following table lists the configurable parameters of the `stash-catalog` cha
| nats.restore.args | Arguments to pass to `nats str restore` command during restore process | `""` |
| nats.restore.streams | List of streams to restore. Don't set this field if you want to restore all the backed up streams. | `""` |
| nats.restore.overwrite | Specify whether to delete the old stream before restoring from backup. | `false` |
| etcd.enabled | If true, deploys ETCD addon | `true` |
| etcd.backup.args | Arguments to pass to `etcdctl save` command during backup process | `""` |
| etcd.restore.args | Arguments to pass to `etcdctl restore` command during restore process | `""` |
| etcd.restore.initialCluster | List of the peers used to bootstrap the ETCD cluster | `""` |
| etcd.restore.initialClusterToken | Initial token used for the ETCD cluster | `""` |
| etcd.restore.dataDir | Directory where the ETCD stores its data for persistence | `""` |
| etcd.restore.workloadKind | Kind of the workload used to deploy the ETCD cluster (i.e. StatefulSet) | `""` |
| etcd.restore.workloadName | Name of the workload used to deploy the ETCD cluster | `""` |


Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{ if .Values.etcd.enabled }}
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: 'etcd-backup-3.5.0'
labels:
{{- include "stash-catalog.labels" . | nindent 4 }}
spec:
args:
- backup-etcd
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --secret-dir=/etc/repository/secret
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --wait-timeout=${waitTimeout:={{ .Values.waitTimeout}}}
- --hostname=${HOSTNAME:=}
- --namespace=${NAMESPACE:=default}
- --appbinding=${TARGET_NAME:=}
- --backupsession=${BACKUP_SESSION:=}
- --etcd-args=${args:=}
- --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-etcd:3.5.0'
volumeMounts:
- mountPath: /etc/repository/secret
name: ${secretVolume}
{{ end }}
26 changes: 26 additions & 0 deletions charts/stash-catalog/templates/etcd/3.5.0/etcd-backup-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{ if .Values.etcd.enabled }}
apiVersion: stash.appscode.com/v1beta1
kind: Task
metadata:
name: 'etcd-backup-3.5.0'
labels:
{{- include "stash-catalog.labels" . | nindent 4 }}
spec:
steps:
- name: etcd-backup-3.5.0
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
- name: update-status
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
volumes:
- name: secret-volume
secret:
secretName: ${REPOSITORY_SECRET_NAME}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{ if .Values.etcd.enabled }}
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: 'etcd-restore-3.5.0'
labels:
{{- include "stash-catalog.labels" . | nindent 4 }}
spec:
args:
- restore-etcd
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --secret-dir=/etc/repository/secret
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --wait-timeout=${waitTimeout:={{ .Values.waitTimeout}}}
- --hostname=${HOSTNAME:=}
- --source-hostname=${SOURCE_HOSTNAME:=}
- --namespace=${NAMESPACE:=default}
- --appbinding=${TARGET_NAME:=}
- --etcd-args=${args:=}
- --initial-cluster=${initialCluster:=}
- --initial-cluster-token=${initialClusterToken:=}
- --data-dir=${dataDir:=}
- --workload-kind=${workloadKind:=}
- --workload-name=${workloadName:=}
- --output-dir=${outputDir:=}
- --license-apiservice=${LICENSE_APISERVICE:=}
- --invoker-kind=${INVOKER_KIND:=}
- --invoker-name=${INVOKER_NAME:=}
- --image=${ADDON_IMAGE:=}
- --secret-name=${REPOSITORY_SECRET_NAME:=}
- --snapshots=${RESTORE_SNAPSHOTS:=}
image: '{{ include "catalog.registry" . }}/stash-etcd:3.5.0'
volumeMounts:
- mountPath: /etc/repository/secret
name: ${secretVolume}
{{ end }}
Loading