Skip to content

Commit

Permalink
Refactor Velero in infrastructure (#1541)
Browse files Browse the repository at this point in the history
* Refactor Velero in infrastructure

* updates

* Suspend velero ks while restore

* Fix path for terraform in nginx

---------

Co-authored-by: Automatic Update <[email protected]>
  • Loading branch information
sveinpj and Automatic Update authored Dec 16, 2024
1 parent 5bbfcab commit 6e5e95c
Show file tree
Hide file tree
Showing 19 changed files with 216 additions and 431 deletions.
2 changes: 1 addition & 1 deletion scripts/ingress-nginx/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ verify_cluster_access
### Create secret required by ingress-nginx
###

SELECTED_INGRESS_IP_RAW_ADDRESS=$(terraform -chdir="../../terraform/subscriptions/$AZ_SUBSCRIPTION_NAME/$RADIX_ZONE/pre-clusters" output -json clusters | jq -r '.[] | select(.cluster==env.CLUSTER_NAME).ingressIp')
SELECTED_INGRESS_IP_RAW_ADDRESS=$(terraform -chdir="../terraform/subscriptions/$AZ_SUBSCRIPTION_NAME/$RADIX_ZONE/pre-clusters" output -json clusters | jq -r '.[] | select(.cluster==env.CLUSTER_NAME).ingressIp')
create-a-record "*.${CLUSTER_NAME}" "$SELECTED_INGRESS_IP_RAW_ADDRESS" "$AZ_RESOURCE_GROUP_IPPRE" "$AZ_RESOURCE_DNS" "60" || {
echo "ERROR: failed to create A record *.${CLUSTER_NAME}" >&2
}
Expand Down
21 changes: 0 additions & 21 deletions scripts/install_base_components.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,27 +250,6 @@ wait
### For network security policy applied by operator to work, the namespace hosting prometheus and nginx-ingress-controller need to be labeled
kubectl label ns default purpose=radix-base-ns --overwrite

#######################################################################################
### Install prerequisites for Velero
###

echo ""
printf "%s► Execute %s%s\n" "${grn}" "$WORKDIR_PATH/scripts/velero/install_prerequisites_in_cluster.sh" "${normal}"
(USER_PROMPT="$USER_PROMPT" ./velero/install_prerequisites_in_cluster.sh)
wait

#######################################################################################
### Patching kube-dns metrics
###

# TODO: Even with this, kube-dns is not discovered in prometheus. Needs to be debugged.
#
# echo "Patching kube-dns metrics"
# kubectl patch deployment -n kube-system kube-dns-v20 \
# --patch "$(cat ./manifests/kube-dns-metrics-patch.yaml)"

#

#######################################################################################
### Install Flux

Expand Down
248 changes: 0 additions & 248 deletions scripts/velero/install_prerequisites_in_cluster.sh

This file was deleted.

3 changes: 3 additions & 0 deletions scripts/velero/restore/restore_apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ start_radix_operator() {
printf " Done.\n"
}

flux suspend ks -n flux-system velero
wait_for_velero "BackupStorageLocation default"
kubectl patch BackupStorageLocation default --namespace velero --type merge --patch "$(echo $PATCH_JSON)"

Expand Down Expand Up @@ -570,8 +571,10 @@ PATCH_JSON="$(
}
END
)"

# Set velero in read/write mode
kubectl patch BackupStorageLocation default --namespace velero --type merge --patch "$(echo $PATCH_JSON)"
flux resume ks -n flux-system velero

#######################################################################################
### Done!
Expand Down
41 changes: 21 additions & 20 deletions terraform/subscriptions/s940/c2/common/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,27 @@ data "azurerm_subnet" "this" {
}

module "storageaccount" {
source = "../../../modules/storageaccount"
for_each = var.storageaccounts
name = "radix${each.key}${module.config.environment}"
tier = each.value.account_tier
account_replication_type = each.value.account_replication_type
resource_group_name = each.value.resource_group_name
location = each.value.location
environment = module.config.environment
kind = each.value.kind
change_feed_enabled = each.value.change_feed_enabled
versioning_enabled = each.value.versioning_enabled
backup = each.value.backup
principal_id = module.backupvault.data.backupvault.identity[0].principal_id
vault_id = module.backupvault.data.backupvault.id
policyblobstorage_id = module.backupvault.data.policyblobstorage.id
subnet_id = data.azurerm_subnet.this.id
vnet_resource_group = module.config.vnet_resource_group
lifecyclepolicy = each.value.lifecyclepolicy
ip_rule = data.azurerm_key_vault_secret.this.value
log_analytics_id = module.loganalytics.workspace_id
source = "../../../modules/storageaccount"
for_each = var.storageaccounts
name = "radix${each.key}${module.config.environment}"
tier = each.value.account_tier
account_replication_type = each.value.account_replication_type
resource_group_name = each.value.resource_group_name
location = each.value.location
environment = module.config.environment
kind = each.value.kind
change_feed_enabled = each.value.change_feed_enabled
versioning_enabled = each.value.versioning_enabled
backup = each.value.backup
principal_id = module.backupvault.data.backupvault.identity[0].principal_id
vault_id = module.backupvault.data.backupvault.id
policyblobstorage_id = module.backupvault.data.policyblobstorage.id
subnet_id = data.azurerm_subnet.this.id
vnet_resource_group = module.config.vnet_resource_group
lifecyclepolicy = each.value.lifecyclepolicy
ip_rule = data.azurerm_key_vault_secret.this.value
log_analytics_id = module.loganalytics.workspace_id
shared_access_key_enabled = each.value.shared_access_key_enabled #Needed in module create container when running apply
}

module "acr" {
Expand Down
Loading

0 comments on commit 6e5e95c

Please sign in to comment.