Skip to content

Commit d9617b8

Browse files
committed
fix: update backup checks in post_tests.yml and related markdown files
1 parent 3bf6ea3 commit d9617b8

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

.github/workflows/post_tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- 2022-11-27-cheapest-amazon-eks
1313
- 2022-12-24-amazon-eks-karpenter-tests 2022-11-27-cheapest-amazon-eks
1414
# - 2023-03-08-trivy-operator-grafana 2022-11-27-cheapest-amazon-eks
15-
# - 2023-03-20-velero-and-cert-manager 2022-11-27-cheapest-amazon-eks
15+
- 2023-03-20-velero-and-cert-manager 2022-11-27-cheapest-amazon-eks
1616
# - 2023-04-01-secrets-store-csi-driver-reloader 2023-03-20-velero-and-cert-manager 2022-11-27-cheapest-amazon-eks
1717
- 2023-04-01-secrets-store-csi-driver-reloader 2022-11-27-cheapest-amazon-eks
1818
- 2023-06-06-my-favourite-krew-plugins-kubectl 2022-11-27-cheapest-amazon-eks

_posts/2023/2023-03-20-velero-and-cert-manager.md

+17-11
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ kubectl wait --namespace cert-manager --timeout=15m --for=condition=Ready cluste
8585

8686
Create new certificate and let it sign by Let's Encrypt to validate it:
8787

88-
```shell
89-
tee "${TMP_DIR}/${CLUSTER_FQDN}/k8s-cert-manager-certificate-production.yml" << EOF | kubectl apply -f -
88+
```bash
89+
if ! aws s3 ls "s3://${CLUSTER_FQDN}/velero/backups" | grep -q velero-weekly-backup-cert-manager; then
90+
tee "${TMP_DIR}/${CLUSTER_FQDN}/k8s-cert-manager-certificate-production.yml" << EOF | kubectl apply -f -
9091
apiVersion: cert-manager.io/v1
9192
kind: Certificate
9293
metadata:
@@ -107,7 +108,8 @@ spec:
107108
- "*.${CLUSTER_FQDN}"
108109
- "${CLUSTER_FQDN}"
109110
EOF
110-
kubectl wait --namespace cert-manager --for=condition=Ready --timeout=10m certificate ingress-cert-production
111+
kubectl wait --namespace cert-manager --for=condition=Ready --timeout=10m certificate ingress-cert-production
112+
fi
111113
```
112114

113115
### Create S3 bucket
@@ -120,8 +122,9 @@ kubectl wait --namespace cert-manager --for=condition=Ready --timeout=10m certif
120122
Use CloudFormation to create S3 bucket which will be used to store backups from
121123
Velero.
122124

123-
```shell
124-
cat > "${TMP_DIR}/${CLUSTER_FQDN}/aws-s3.yml" << \EOF
125+
```bash
126+
if ! aws s3 ls "s3://${CLUSTER_FQDN}"; then
127+
cat > "${TMP_DIR}/${CLUSTER_FQDN}/aws-s3.yml" << \EOF
125128
AWSTemplateFormatVersion: 2010-09-09
126129
127130
Parameters:
@@ -256,9 +259,10 @@ Outputs:
256259
Value: !Ref S3ChangeNotificationTopic
257260
EOF
258261

259-
aws cloudformation deploy --capabilities CAPABILITY_NAMED_IAM \
260-
--parameter-overrides S3BucketName="${CLUSTER_FQDN}" EmailToSubscribe="${MY_EMAIL}" \
261-
--stack-name "${CLUSTER_NAME}-s3" --template-file "${TMP_DIR}/${CLUSTER_FQDN}/aws-s3.yml"
262+
aws cloudformation deploy --capabilities CAPABILITY_NAMED_IAM \
263+
--parameter-overrides S3BucketName="${CLUSTER_FQDN}" EmailToSubscribe="${MY_EMAIL}" \
264+
--stack-name "${CLUSTER_NAME}-s3" --template-file "${TMP_DIR}/${CLUSTER_FQDN}/aws-s3.yml"
265+
fi
262266
```
263267

264268
## Install Velero
@@ -413,8 +417,10 @@ default aws k01.k8s.mylabs.dev/velero Available 2023-03-23 20:16:20
413417

414418
Initiate backup process and save the necessary cert-manager object to S3:
415419

416-
```shell
417-
velero backup create --labels letsencrypt=production --ttl 2160h0m0s --from-schedule velero-weekly-backup-cert-manager
420+
```bash
421+
if ! aws s3 ls "s3://${CLUSTER_FQDN}/velero/backups" | grep -q velero-weekly-backup-cert-manager; then
422+
velero backup create --labels letsencrypt=production --ttl 2160h0m0s --from-schedule velero-weekly-backup-cert-manager
423+
fi
418424
```
419425

420426
Check the backup details:
@@ -670,7 +676,7 @@ Few commands showing the details after cert-manager renewed the certificate.
670676

671677
Examine the certificate:
672678

673-
```shell
679+
```bash
674680
kubectl describe certificates -n cert-manager ingress-cert-production
675681
```
676682

_posts/2025/2025-02-01-eks-auto-cert-manager-velero.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ kubectl label secret --namespace cert-manager letsencrypt-production-dns letsenc
104104
Create a new certificate and have it signed by Let's Encrypt for validation:
105105

106106
```bash
107-
if ! aws s3 ls "s3://${CLUSTER_FQDN}/velero/backups" | grep -q .; then
107+
if ! aws s3 ls "s3://${CLUSTER_FQDN}/velero/backups" | grep -q velero-monthly-backup-cert-manager-production; then
108108
tee "${TMP_DIR}/${CLUSTER_FQDN}/k8s-cert-manager-certificate-production.yml" << EOF | kubectl apply -f -
109109
apiVersion: cert-manager.io/v1
110110
kind: Certificate
@@ -539,7 +539,7 @@ default aws k01.k8s.mylabs.dev/velero Available 2025-02-06 06:21:59
539539
Initiate the backup process and store the required cert-manager objects in S3.
540540

541541
```bash
542-
if ! aws s3 ls "s3://${CLUSTER_FQDN}/velero/backups" | grep -q .; then
542+
if ! aws s3 ls "s3://${CLUSTER_FQDN}/velero/backups" | grep -q velero-monthly-backup-cert-manager-production; then
543543
velero backup create --labels letsencrypt=production --ttl 2160h --from-schedule velero-monthly-backup-cert-manager-production --wait
544544
fi
545545
```

0 commit comments

Comments
 (0)