Skip to content

Commit

Permalink
Adding sentry data synchronization (#1115)
Browse files Browse the repository at this point in the history
See more details below
  • Loading branch information
rfuelsh authored Apr 17, 2023
1 parent 0fcce6d commit ab60ed5
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 1 deletion.
21 changes: 21 additions & 0 deletions deployment/charts/templates/fuel-core-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
port: http
{{- end }}
---
{{- if .Values.app.volume.pvc_clone_enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -28,6 +29,26 @@ spec:
requests:
storage: {{ .Values.app.volume.storagerequests }}
storageClassName: {{ .Values.app.volume.storageclass }}
dataSource:
name: {{ .Values.app.volume.pvc_clone_snapshot_id }}
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
{{ else }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.app.volume.claimname }}
labels:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
accessModes:
- {{ .Values.app.volume.accessmodes }}
resources:
requests:
storage: {{ .Values.app.volume.storagerequests }}
storageClassName: {{ .Values.app.volume.storageclass }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
Expand Down
4 changes: 3 additions & 1 deletion deployment/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ app:
pvname: ${fuel_core_pv_name}
mountPath: /mnt/db/
claimname: ${fuel_core_pvc_name}
pvc_clone_enabled: ${fuel_core_pvc_clone_enabled}
pvc_clone_snapshot_id: ${fuel_core_pvc_snapshot_id}
storageclass: ${pvc_storage_class}
storagerequests: ${pvc_storage_requests}
accessmodes: ReadWriteOnce
Expand All @@ -55,4 +57,4 @@ app:
memory_limits: ${fuel_core_memory_limits}
prometheus:
enabled: ${fuel_core_prometheus_enabled}
helm_release_name: ${fuel_core_prometheus_helm_release_name}
helm_release_name: ${fuel_core_prometheus_helm_release_name}
3 changes: 3 additions & 0 deletions deployment/scripts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fuel_core_min_gas_price=0
fuel_core_pv_name="db-pv"
fuel_core_pvc_name="db-pv-claim"
fuel_core_sentry_enabled=false
fuel_core_pvc_clone_enabled=false
fuel_core_pvc_snapshot_ref="snap-06fb1faafc1409cc5"
fuel_core_pvc_snapshot_id="imported-aws-snapshot"

fuel_core_cpu_requests="1m"
fuel_core_memory_requests="50Mi"
Expand Down
19 changes: 19 additions & 0 deletions deployment/scripts/fuel-core-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ set -o allexport && source .env && set +o allexport
if [ "${k8s_provider}" == "eks" ]; then
echo "Updating your kube context locally ...."
aws eks update-kubeconfig --name ${TF_VAR_eks_cluster_name}

echo "Copying chainspec into deployment context ...."
cp chainspec/${chain_spec_file} ../charts/chainspec.json
export fuel_core_consensus_key_secret_base64_encoded=$(echo -n $fuel_core_consensus_key_secret | base64 -w 0)

cd ../secrets/
echo "Creating the fuel-core k8s secret ...."
mv fuel-core-secret.yaml fuel-core-secret.template
Expand All @@ -19,13 +21,30 @@ if [ "${k8s_provider}" == "eks" ]; then
kubectl create ns ${k8s_namespace} || true
kubectl delete -f fuel-core-secret.yaml || true
kubectl apply -f fuel-core-secret.yaml

if [ "${fuel_core_pvc_clone_enabled}" == "true" ]; then
cd ../volume_snapshots/
kubectl apply -f VolumeSnapshotClass.yaml || true
mv VolumeSnapshotContent.yaml VolumeSnapshotContent.template
envsubst < VolumeSnapshotContent.template > VolumeSnapshotContent.yaml
rm VolumeSnapshotContent.template
kubectl apply -f VolumeSnapshotContent.yaml
mv VolumeSnapshot.yaml VolumeSnapshot.template
envsubst < VolumeSnapshot.template > VolumeSnapshot.yaml
rm VolumeSnapshot.template
kubectl apply -f VolumeSnapshot.yaml
else
echo "Volume Snapshots will not be created ...."
fi

cd ../charts
mv Chart.yaml Chart.template
envsubst < Chart.template > Chart.yaml
rm Chart.template
mv values.yaml values.template
envsubst < values.template > values.yaml
rm values.template

echo "Deploying ${fuel_core_service_name} helm chart to ${TF_VAR_eks_cluster_name} ...."
helm upgrade ${fuel_core_service_name} . \
--values values.yaml \
Expand Down
9 changes: 9 additions & 0 deletions deployment/volume_snapshots/VolumeSnapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: ${fuel_core_pvc_snapshot_id}
namespace: ${k8s_namespace}
spec:
volumeSnapshotClassName: ebs-csi-aws
source:
volumeSnapshotContentName: ${fuel_core_pvc_snapshot_id}
6 changes: 6 additions & 0 deletions deployment/volume_snapshots/VolumeSnapshotClass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: ebs-csi-aws
driver: ebs.csi.aws.com
deletionPolicy: Delete
14 changes: 14 additions & 0 deletions deployment/volume_snapshots/VolumeSnapshotContent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotContent
metadata:
name: ${fuel_core_pvc_snapshot_id}
spec:
volumeSnapshotRef:
kind: VolumeSnapshot
name: ${fuel_core_pvc_snapshot_id}
namespace: ${k8s_namespace}
source:
snapshotHandle: ${fuel_core_pvc_snapshot_ref}
driver: ebs.csi.aws.com
deletionPolicy: Delete
volumeSnapshotClassName: ebs-csi-aws

0 comments on commit ab60ed5

Please sign in to comment.