Skip to content

Commit

Permalink
feat(etcd-backup): add custom CA support
Browse files Browse the repository at this point in the history
Signed-off-by: Valentin Maillot <[email protected]>
  • Loading branch information
vmaillot committed Mar 26, 2024
1 parent 4c9ac3b commit 8e18f07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ The following options are used:
- `OCP_BACKUP_S3`: Use S3 to store etcd-backup snapshots
- `OCP_BACKUP_S3_NAME`: MinIO client host alias name
- `OCP_BACKUP_S3_HOST`: S3 host endpoint (with scheme)
- `OCP_BACKUP-S3_CA`: S3 host CA (if needed)
- `OCP_BACKUP_S3_BUCKET`: S3 bucket name
- `OCP_BACKUP_S3_ACCESS_KEY`: access key to access S3 bucket
- `OCP_BACKUP_S3_SECRET_KEY`: secret key to access S3 bucket
Expand Down
4 changes: 4 additions & 0 deletions backup-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ data:
OCP_BACKUP_S3: "false"
OCP_BACKUP_S3_NAME: "minio"
OCP_BACKUP_S3_HOST: "http://minio.local:9000"
OCP_BACKUP_S3_CA: |
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
OCP_BACKUP_S3_BUCKET: "etcd-backup"
OCP_BACKUP_S3_ACCESS_KEY: "randomaccesskey"
OCP_BACKUP_S3_SECRET_KEY: "secretkey"
Expand Down
7 changes: 5 additions & 2 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ set -xeuo pipefail
if [ "${OCP_BACKUP_S3}" = "true" ]; then
# prepare & push backup to S3

# update CA trust
update-ca-trust
# add custom CA if any and update CA trust
if [ "${OCP_BACKUP_S3_CA}" ]; then
echo -n "${OCP_BACKUP_S3_CA}" > /etc/pki/ca-trust/source/anchors/ca.crt
update-ca-trust
fi

# configure mcli assuming the bucket already exists
bash +o history
Expand Down

0 comments on commit 8e18f07

Please sign in to comment.