Skip to content

Commit

Permalink
Merge pull request #461 from mojaloop/feature/env-migrate
Browse files Browse the repository at this point in the history
Feature/env migrate
  • Loading branch information
sijo5722-2021 authored Jan 29, 2025
2 parents e187822 + 1e99314 commit 535a2e2
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ helmCharts:
releaseName: aws-ebs-csi-driver
repo: https://kubernetes-sigs.github.io/aws-ebs-csi-driver
namespace: kube-system
valuesFile: aws-ebs-csi-driver-values.yaml
valuesFile: aws-ebs-csi-driver-values.yaml
version: ${ARGOCD_ENV_aws_ebs_csi_driver_helm_version}
3 changes: 3 additions & 0 deletions gitops/argo-apps/base/rook-ceph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ spec:

- name: cluster_domain
value: "${ARGOCD_ENV_utils_rook_ceph_cluster_domain}"

- name: aws_ebs_csi_driver_helm_version
value: "${ARGOCD_ENV_utils_rook_ceph_aws_ebs_csi_driver_helm_version}"
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ argocd_override:
volumes_provider: "${rook_ceph_volumes_provider}"
volumes_storage_region: "${cloud_region}"
cluster_domain: "${cluster_domain}"
aws_ebs_csi_driver_helm_version: "${rook_ceph_aws_ebs_csi_driver_helm_version}"
reflector:
helm_version: "${reflector_helm_version}"
reloader:
Expand Down
3 changes: 2 additions & 1 deletion terraform/ccnew/default-config/common-vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,5 @@ rook_ceph_csi_driver_replicas: "'2'"
rook_ceph_objects_replica_count: "'3'"
rook_ceph_osd_count: "'3'"
rook_ceph_volume_size_per_osd: "500Gi"
rook_ceph_volumes_provider: "pvc" # host, pvc
rook_ceph_volumes_provider: "pvc" # host, pvc
rook_ceph_aws_ebs_csi_driver_helm_version: "2.39.0"
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,4 @@ resource "gitlab_repository_file" "vault_token_update" {
content = base64encode("vault-token-${sha256(vault_token.env_token[each.value].client_token)}")
author_name = "Terraform"
commit_message = "tf_trigger: vault_token_update"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ path "${vault_mount.transit.path}/encrypt/${vault_transit_secret_backend_key.uns
path "${vault_mount.transit.path}/decrypt/${vault_transit_secret_backend_key.unseal_key[each.value].name}" {
capabilities = [ "update" ]
}
path "${vault_mount.transit.path}/encrypt/unseal-key-${each.value}-migrated" {
capabilities = [ "update" ]
}
path "${vault_mount.transit.path}/decrypt/unseal-key-${each.value}-migrated" {
capabilities = [ "update" ]
}
EOT
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,4 @@ resource "gitlab_project_variable" "ceph_percona_bucket" {
value = "${var.env_name}-percona"
protected = false
masked = false
}
}
1 change: 1 addition & 0 deletions terraform/gitlab/ci-templates/k8s-cluster/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ cache:
- yq eval '.' $CONFIG_PATH/addons-vars.yaml -o=json > addons-vars.yaml
- for var in $(jq -r 'to_entries[] | "\(.key)=\(.value)\n"' ./cluster-config.json); do export $var; done
- for var in $(jq -r 'to_entries[] | "\(.key)=\(.value)\n"' ./addons-vars.yaml); do export $var; done
- if [ $migrate == "true" ]; then sh .gitlab/scripts/get-artifacts.sh; fi
- export ENV_VAULT_TOKEN="$(vault kv get -field=value ${KV_SECRET_PATH}/${CI_PROJECT_NAME}/env_token)"
- export $cloud_platform_client_secret_name="$(vault kv get -field=value ${KV_SECRET_PATH}/${CI_PROJECT_NAME}/cloud_platform_client_secret)"
- export GITLAB_CI_PAT="$(vault kv get -field=value ${KV_SECRET_PATH}/gitlab/gitlab_ci_pat)"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export SOURCE_GITLAB_TOKEN="$(vault kv get -field=token ${KV_SECRET_PATH}/mig-source-gitlab)"
curl --location --output artifacts.zip --header "Authorization: Bearer $SOURCE_GITLAB_TOKEN" $MIG_SOURCE_GITLAB/api/v4/projects/$MIG_SOURCE_PROJECT_ID/jobs/$MIG_SOURCE_JOB_ID/artifacts
unzip -o artifacts.zip -d $TF_ROOT
3 changes: 3 additions & 0 deletions terraform/k8s/ansible-k8s-deploy/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,21 @@ locals {
netbird_version = get_env("NETBIRD_VERSION")
netbird_api_host = get_env("NETBIRD_API_HOST")
netbird_setup_key = get_env("NETBIRD_K8S_SETUP_KEY")
migrate = get_env("migrate")
coredns_localcache_version = local.common_vars.coredns_localcache_version
}
master_hosts_var_maps = {
netbird_version = get_env("NETBIRD_VERSION")
netbird_api_host = get_env("NETBIRD_API_HOST")
netbird_setup_key = get_env("NETBIRD_K8S_SETUP_KEY")
migrate = get_env("migrate")
coredns_localcache_version = local.common_vars.coredns_localcache_version
}
bastion_hosts_var_maps = {
netbird_version = get_env("NETBIRD_VERSION")
netbird_api_host = get_env("NETBIRD_API_HOST")
netbird_setup_key = get_env("NETBIRD_GW_SETUP_KEY")
migrate = get_env("migrate")
nexus_fqdn = get_env("NEXUS_FQDN")
ceph_fqdn = get_env("CEPH_OBJECTSTORE_FQDN")
vault_fqdn = get_env("VAULT_FQDN")
Expand Down
1 change: 1 addition & 0 deletions terraform/k8s/default-config/cluster-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ gitlab_admin_rbac_group: tenant-admins
gitlab_readonly_rbac_group: tenant-viewers
coredns_bind_address: "169.254.20.10"
single_nat_gateway: true
migrate: false
4 changes: 3 additions & 1 deletion terraform/k8s/gitops-build/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ inputs = {
letsencrypt_email = local.LETSENCRYPT_EMAIL
enable_grafana_oidc = local.ENABLE_GRAFANA_OIDC
kv_path = local.KV_SECRET_PATH
transit_vault_key_name = local.TRANSIT_VAULT_UNSEAL_KEY_NAME
transit_vault_key_name = local.migrate ? local.mig_transit_vault_unseal_key_name : local.TRANSIT_VAULT_UNSEAL_KEY_NAME
transit_vault_url = local.VAULT_SERVER_URL
ceph_api_url = local.ceph_fqdn
central_observability_endpoint = local.central_observability_endpoint
Expand Down Expand Up @@ -154,10 +154,12 @@ locals {
KV_SECRET_PATH = get_env("KV_SECRET_PATH")
VAULT_GITLAB_ROOT_TOKEN = get_env("ENV_VAULT_TOKEN")
TRANSIT_VAULT_UNSEAL_KEY_NAME = get_env("TRANSIT_VAULT_UNSEAL_KEY_NAME")
mig_transit_vault_unseal_key_name = "${get_env("TRANSIT_VAULT_UNSEAL_KEY_NAME")}-migrated"
VAULT_SERVER_URL = get_env("VAULT_SERVER_URL")
VAULT_ADDR = get_env("VAULT_ADDR")
ceph_fqdn = get_env("CEPH_OBJECTSTORE_FQDN")
central_observability_endpoint = get_env("MIMIR_GW_FQDN")
migrate = get_env("migrate")
argocd_ingress_internal_lb = true
grafana_ingress_internal_lb = true
vault_ingress_internal_lb = true
Expand Down

0 comments on commit 535a2e2

Please sign in to comment.