From ba4ac5533fcaf3c1cb080f6aeb8c817fb1bdba69 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Thu, 11 May 2023 21:04:08 -0500 Subject: [PATCH 01/32] Primer Commit PL - Validacion de TF Manifest [skip ci] --- ...vision-por-Terraform-de-AKS-Cluster-PL.yml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 A-Provision-por-Terraform-de-AKS-Cluster-PL.yml diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml new file mode 100644 index 0000000..d6527bc --- /dev/null +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -0,0 +1,39 @@ +# Stage-1: Terraform Validate Stage +## Step-1: Publish Artifacts to Pipeline (Pipeline artifacts provide a way to share files between stages in a pipeline or between different pipelines. ) +## Step-2: Install Latest Terraform (0.13.5) (Ideally not needed if we use default Ubuntu Agents) +## Step-3: Validate Terraform Manifests (terraform init, terraform validate) + +stages: +- stage: TerraformValidate + jobs: + - job: TerraformValidateJob + continueOnError: false + steps: + - task: PublishPipelineArtifact@1 + displayName: Publish Artifacts + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/terraform-manifests' + artifact: 'terraform-manifests-out' + publishLocation: 'pipeline' + - task: TerraformInstaller@0 + displayName: Terraform Install + inputs: + terraformVersion: 'latest' + - task: TerraformCLI@0 + displayName: Terraform Init + inputs: + command: 'init' + workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests' + backendType: 'azurerm' + backendServiceArm: 'terraform-aks-azurerm-svc-con' + backendAzureRmResourceGroupName: 'terraform-storage-rg' + backendAzureRmStorageAccountName: 'terraformstatexlrwdrzs' + backendAzureRmContainerName: 'tfstatefiles' + backendAzureRmKey: 'aks-base.tfstate' + allowTelemetryCollection: false + - task: TerraformCLI@0 + displayName: Terraform Validate + inputs: + command: 'validate' + workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests' + allowTelemetryCollection: false \ No newline at end of file From 569733ca77ddeff1d37d2451401856ef7317cd96 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Thu, 11 May 2023 21:08:31 -0500 Subject: [PATCH 02/32] Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipelines --- A-Provision-por-Terraform-de-AKS-Cluster-PL.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index d6527bc..09ca90e 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -25,7 +25,7 @@ stages: command: 'init' workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests' backendType: 'azurerm' - backendServiceArm: 'terraform-aks-azurerm-svc-con' + backendServiceArm: 'SVC-Terraform-Azure-Connection' backendAzureRmResourceGroupName: 'terraform-storage-rg' backendAzureRmStorageAccountName: 'terraformstatexlrwdrzs' backendAzureRmContainerName: 'tfstatefiles' From b9b62b0da7ba2d462d99cbd5c336a6d41ebaf476 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Thu, 11 May 2023 21:10:50 -0500 Subject: [PATCH 03/32] Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipelines --- A-Provision-por-Terraform-de-AKS-Cluster-PL.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index 09ca90e..fcf4b97 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -26,7 +26,9 @@ stages: workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests' backendType: 'azurerm' backendServiceArm: 'SVC-Terraform-Azure-Connection' + ensureBackend: true backendAzureRmResourceGroupName: 'terraform-storage-rg' + backendAzureRmResourceGroupLocation: 'eastus' backendAzureRmStorageAccountName: 'terraformstatexlrwdrzs' backendAzureRmContainerName: 'tfstatefiles' backendAzureRmKey: 'aks-base.tfstate' From 31267148e5397f3d3929927b1db881349dbad27e Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Thu, 11 May 2023 21:18:22 -0500 Subject: [PATCH 04/32] Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipelines --- A-Provision-por-Terraform-de-AKS-Cluster-PL.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index fcf4b97..854f1ce 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -29,7 +29,7 @@ stages: ensureBackend: true backendAzureRmResourceGroupName: 'terraform-storage-rg' backendAzureRmResourceGroupLocation: 'eastus' - backendAzureRmStorageAccountName: 'terraformstatexlrwdrzs' + backendAzureRmStorageAccountName: 'terraformstatechallenge' backendAzureRmContainerName: 'tfstatefiles' backendAzureRmKey: 'aks-base.tfstate' allowTelemetryCollection: false From e5f6061c9fda04cf8af1bab414090687ec73607a Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Thu, 11 May 2023 21:45:29 -0500 Subject: [PATCH 05/32] Segundo Commit - Provision AKS DEV por Terraform --- ...vision-por-Terraform-de-AKS-Cluster-PL.yml | 66 ++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index 854f1ce..df10fa5 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -1,3 +1,14 @@ +trigger: +- main + +pool: + vmImage: 'ubuntu-latest' +# Definicion de Variales para Ambientes +variables: +- name: DEV_ENVIRONMENT + value: dev +- name: QA_ENVIRONMENT + value: qa # Stage-1: Terraform Validate Stage ## Step-1: Publish Artifacts to Pipeline (Pipeline artifacts provide a way to share files between stages in a pipeline or between different pipelines. ) ## Step-2: Install Latest Terraform (0.13.5) (Ideally not needed if we use default Ubuntu Agents) @@ -38,4 +49,57 @@ stages: inputs: command: 'validate' workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests' - allowTelemetryCollection: false \ No newline at end of file + allowTelemetryCollection: false + +# Stage-2: Despliegues de Stages para Dev & QA +# Deployment-1: Despliegue de Dev AKS Cluster +## Step-1: DEfinir Variables para los ambientes +## Step-2: Descarga de SSH Secure File +## Step-3: Terraform Initialize (State Storage to store in Azure Storage Account for Dev AKS Cluster) +## Step-4: Terraform Plan (Creacion del Plan) +## Step-5: Terraform Apply (Uso del plan en el paso anterior) + +- stage: DeployAKSClusters + jobs: + - deployment: DeployDevAKSCluster + displayName: DeployDevAKSCluster + pool: + vmImage: 'ubuntu-latest' + environment: $(DEV_ENVIRONMENT) + strategy: + runOnce: + deploy: + steps: + - task: DownloadSecureFile@1 + displayName: Download SSH Key + name: sshkey + inputs: + secureFile: 'id_rsa.pub' + - task: TerraformCLI@0 + displayName: Terraform Init + inputs: + command: 'init' + workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' + backendType: 'azurerm' + backendServiceArm: 'SVC-Terraform-Azure-Connection' + backendAzureRmResourceGroupName: 'terraform-storage-rg' + backendAzureRmStorageAccountName: 'terraformstatechallenge' + backendAzureRmContainerName: 'tfstatefiles' + backendAzureRmKey: 'aks-$(DEV_ENVIRONMENT).tfstate' + allowTelemetryCollection: false + - task: TerraformCLI@0 + displayName: Terraform Plan + inputs: + command: 'plan' + workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' + environmentServiceName: 'SVC-Terraform-Azure-Connection' + commandOptions: '-var ssh_public_key=$(sshkey.secureFilePath) -var environment=$(DEV_ENVIRONMENT) -out $(Pipeline.Workspace)/terraform-manifests-out/$(DEV_ENVIRONMENT)-$(Build.BuildId).out' + allowTelemetryCollection: false + - task: TerraformCLI@0 + displayName: Terraform Apply + inputs: + command: 'apply' + workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' + environmentServiceName: 'SVC-Terraform-Azure-Connection' + commandOptions: '$(Pipeline.Workspace)/terraform-manifests-out/$(DEV_ENVIRONMENT)-$(Build.BuildId).out' + allowTelemetryCollection: false \ No newline at end of file From 83e52b78f686d389cfbb5ccf1ca01c1d4e9be481 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Thu, 11 May 2023 22:54:42 -0500 Subject: [PATCH 06/32] Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipelines --- A-Provision-por-Terraform-de-AKS-Cluster-PL.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index df10fa5..43720e3 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -39,7 +39,7 @@ stages: backendServiceArm: 'SVC-Terraform-Azure-Connection' ensureBackend: true backendAzureRmResourceGroupName: 'terraform-storage-rg' - backendAzureRmResourceGroupLocation: 'eastus' + backendAzureRmResourceGroupLocation: 'centralus' backendAzureRmStorageAccountName: 'terraformstatechallenge' backendAzureRmContainerName: 'tfstatefiles' backendAzureRmKey: 'aks-base.tfstate' From de692ecf8b087fcaaab44c68803cc733ba56594d Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Thu, 11 May 2023 23:13:48 -0500 Subject: [PATCH 07/32] Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipelines --- A-Provision-por-Terraform-de-AKS-Cluster-PL.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index 43720e3..9f18c11 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -39,7 +39,6 @@ stages: backendServiceArm: 'SVC-Terraform-Azure-Connection' ensureBackend: true backendAzureRmResourceGroupName: 'terraform-storage-rg' - backendAzureRmResourceGroupLocation: 'centralus' backendAzureRmStorageAccountName: 'terraformstatechallenge' backendAzureRmContainerName: 'tfstatefiles' backendAzureRmKey: 'aks-base.tfstate' From 613f96664f2a4481269d9d2e7203d6a14d588e19 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Thu, 11 May 2023 23:18:00 -0500 Subject: [PATCH 08/32] Update 02-variables.tf --- terraform-manifests/02-variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-manifests/02-variables.tf b/terraform-manifests/02-variables.tf index 9c4abb0..b2d7619 100644 --- a/terraform-manifests/02-variables.tf +++ b/terraform-manifests/02-variables.tf @@ -7,7 +7,7 @@ variable "location" { type = string description = "Azure Region where all these resources will be provisioned" - default = "Central US" + default = "East US" } # Azure Resource Group Name From 11d1790d54bf5fce7a14fdc6d47c764b023d2f2b Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 00:11:54 -0500 Subject: [PATCH 09/32] Update 02-variables.tf --- terraform-manifests/02-variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-manifests/02-variables.tf b/terraform-manifests/02-variables.tf index b2d7619..379d1ea 100644 --- a/terraform-manifests/02-variables.tf +++ b/terraform-manifests/02-variables.tf @@ -7,7 +7,7 @@ variable "location" { type = string description = "Azure Region where all these resources will be provisioned" - default = "East US" + default = "eastus" } # Azure Resource Group Name From 1d5ec26fa245d03a5450db0507642ab7cbe5e629 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 12 May 2023 00:41:36 -0500 Subject: [PATCH 10/32] Cambio de Region --- terraform-manifests/02-variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform-manifests/02-variables.tf b/terraform-manifests/02-variables.tf index 9c4abb0..c287bf7 100644 --- a/terraform-manifests/02-variables.tf +++ b/terraform-manifests/02-variables.tf @@ -1,5 +1,5 @@ # Define Input Variables -# 1. Azure Location (CentralUS) +# 1. Azure Location (EastUS) # 2. Azure Resource Group Name # 3. Azure AKS Environment Name (Dev, QA, Prod) @@ -7,7 +7,7 @@ variable "location" { type = string description = "Azure Region where all these resources will be provisioned" - default = "Central US" + default = "East US" } # Azure Resource Group Name From a5a781c8cba82f79b7f343db6c2f1ea5b33262ad Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 12 May 2023 00:45:52 -0500 Subject: [PATCH 11/32] update 02 --- terraform-manifests/02-variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-manifests/02-variables.tf b/terraform-manifests/02-variables.tf index 0554df9..c287bf7 100644 --- a/terraform-manifests/02-variables.tf +++ b/terraform-manifests/02-variables.tf @@ -7,7 +7,7 @@ variable "location" { type = string description = "Azure Region where all these resources will be provisioned" - default = "Central US" + default = "East US" } # Azure Resource Group Name From 852342621b3cd32f6ea83da2632ff1242765a3fc Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 01:14:32 -0500 Subject: [PATCH 12/32] Update 05-log-analytics-workspace.tf --- terraform-manifests/05-log-analytics-workspace.tf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/terraform-manifests/05-log-analytics-workspace.tf b/terraform-manifests/05-log-analytics-workspace.tf index d989ed2..8b814b2 100644 --- a/terraform-manifests/05-log-analytics-workspace.tf +++ b/terraform-manifests/05-log-analytics-workspace.tf @@ -1,7 +1,7 @@ # Create Log Analytics Workspace -resource "azurerm_log_analytics_workspace" "insights" { - name = "${var.environment}-logs-${random_pet.aksrandom.id}" - location = azurerm_resource_group.aks_rg.location - resource_group_name = azurerm_resource_group.aks_rg.name - retention_in_days = 30 -} \ No newline at end of file +#resource "azurerm_log_analytics_workspace" "insights" { +# name = "${var.environment}-logs-${random_pet.aksrandom.id}" +# location = azurerm_resource_group.aks_rg.location +# resource_group_name = azurerm_resource_group.aks_rg.name +# retention_in_days = 30 +#} From fa6e31e20a72e8d17c32dd5e49942f46cfd8ab16 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 01:49:29 -0500 Subject: [PATCH 13/32] Update 07-aks-cluster.tf --- terraform-manifests/07-aks-cluster.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/terraform-manifests/07-aks-cluster.tf b/terraform-manifests/07-aks-cluster.tf index 5507179..a362f81 100644 --- a/terraform-manifests/07-aks-cluster.tf +++ b/terraform-manifests/07-aks-cluster.tf @@ -37,10 +37,10 @@ resource "azurerm_kubernetes_cluster" "aks_cluster" { # Add On Profiles addon_profile { azure_policy { enabled = true } - oms_agent { - enabled = true - log_analytics_workspace_id = azurerm_log_analytics_workspace.insights.id - } +# oms_agent { +# enabled = true +# log_analytics_workspace_id = azurerm_log_analytics_workspace.insights.id +# } } # RBAC and Azure AD Integration Block @@ -78,4 +78,4 @@ tags = { } -} \ No newline at end of file +} From 87eb7fbc2ca2fcf6c1b062a2e2edfe27b4be6b5b Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 01:53:02 -0500 Subject: [PATCH 14/32] Update 02-variables.tf --- terraform-manifests/02-variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-manifests/02-variables.tf b/terraform-manifests/02-variables.tf index c287bf7..1a90a90 100644 --- a/terraform-manifests/02-variables.tf +++ b/terraform-manifests/02-variables.tf @@ -43,7 +43,7 @@ variable "windows_admin_username" { # Windows Admin Password for k8s worker nodes variable "windows_admin_password" { type = string - default = "P@ssw0rd1234" + default = "P@ssw0rd123456" description = "This variable defines the Windows admin password k8s Worker nodes" } From 0ccfeb020685ea8c5011ece480eca7aabbb02517 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 01:54:11 -0500 Subject: [PATCH 15/32] BETA A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipelines --- A-Provision-por-Terraform-de-AKS-Cluster-PL.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index 9f18c11..3d3f732 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -1,5 +1,5 @@ trigger: -- main +- beta pool: vmImage: 'ubuntu-latest' From cc6ab7e10fd5d2bbe1aec116e648b26910e1cdb0 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 02:01:04 -0500 Subject: [PATCH 16/32] Beta A-Provision-por-Terraform-de-AKS-Cluster-PL.yml --- ...vision-por-Terraform-de-AKS-Cluster-PL.yml | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index 3d3f732..bfaf691 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -101,4 +101,57 @@ stages: workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' environmentServiceName: 'SVC-Terraform-Azure-Connection' commandOptions: '$(Pipeline.Workspace)/terraform-manifests-out/$(DEV_ENVIRONMENT)-$(Build.BuildId).out' - allowTelemetryCollection: false \ No newline at end of file + allowTelemetryCollection: false +# Stage-3: Despliegues de Stages para Dev & QA +# Deployment-1: Despliegue de Dev AKS Cluster +## Step-1: DEfinir Variables para los ambientes +## Step-2: Descarga de SSH Secure File +## Step-3: Terraform Initialize (State Storage to store in Azure Storage Account for Dev AKS Cluster) +## Step-4: Terraform Plan (Creacion del Plan) +## Step-5: Terraform Apply (Uso del plan en el paso anterior) + +- stage: DeployAKSClusters + jobs: + - deployment: DeployQAAKSCluster + dependsOn: DeployDevAKSCluster + displayName: DeployQAAKSCluster + pool: + vmImage: 'ubuntu-latest' + environment: $(QA_ENVIRONMENT) + strategy: + runOnce: + deploy: + steps: + - task: DownloadSecureFile@1 + displayName: Download SSH Key + name: sshkey + inputs: + secureFile: 'id_rsa.pub' + - task: TerraformCLI@0 + displayName: Terraform Init + inputs: + command: 'init' + workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' + backendType: 'azurerm' + backendServiceArm: 'SVC-Terraform-Azure-Connection' + backendAzureRmResourceGroupName: 'terraform-storage-rg' + backendAzureRmStorageAccountName: 'terraformstatechallenge' + backendAzureRmContainerName: 'tfstatefiles' + backendAzureRmKey: 'aks-$(QA_ENVIRONMENT).tfstate' + allowTelemetryCollection: false + - task: TerraformCLI@0 + displayName: Terraform Plan + inputs: + command: 'plan' + workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' + environmentServiceName: 'SVC-Terraform-Azure-Connection' + commandOptions: '-var ssh_public_key=$(sshkey.secureFilePath) -var environment=$(QA_ENVIRONMENT) -out $(Pipeline.Workspace)/terraform-manifests-out/$(DEV_ENVIRONMENT)-$(Build.BuildId).out' + allowTelemetryCollection: false + - task: TerraformCLI@0 + displayName: Terraform Apply + inputs: + command: 'apply' + workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' + environmentServiceName: 'SVC-Terraform-Azure-Connection' + commandOptions: '$(Pipeline.Workspace)/terraform-manifests-out/$(QA_ENVIRONMENT)-$(Build.BuildId).out' + allowTelemetryCollection: false From a4c467e4c67e4bca756cde290661b6997b28d9f3 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 02:02:36 -0500 Subject: [PATCH 17/32] Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml --- A-Provision-por-Terraform-de-AKS-Cluster-PL.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index bfaf691..3500a4a 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -58,7 +58,7 @@ stages: ## Step-4: Terraform Plan (Creacion del Plan) ## Step-5: Terraform Apply (Uso del plan en el paso anterior) -- stage: DeployAKSClusters +- stage: DeployDEVAKSClusters jobs: - deployment: DeployDevAKSCluster displayName: DeployDevAKSCluster @@ -110,7 +110,7 @@ stages: ## Step-4: Terraform Plan (Creacion del Plan) ## Step-5: Terraform Apply (Uso del plan en el paso anterior) -- stage: DeployAKSClusters +- stage: DeployQAAKSClusters jobs: - deployment: DeployQAAKSCluster dependsOn: DeployDevAKSCluster From 6f4c401e08493c6f30d14b0607a9bc2519c59455 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 02:03:54 -0500 Subject: [PATCH 18/32] Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml --- A-Provision-por-Terraform-de-AKS-Cluster-PL.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index 3500a4a..95065e0 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -113,7 +113,6 @@ stages: - stage: DeployQAAKSClusters jobs: - deployment: DeployQAAKSCluster - dependsOn: DeployDevAKSCluster displayName: DeployQAAKSCluster pool: vmImage: 'ubuntu-latest' From e9e04a1841038e18a376a514c194c9ea944ead10 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 02:10:55 -0500 Subject: [PATCH 19/32] Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml --- A-Provision-por-Terraform-de-AKS-Cluster-PL.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml index 95065e0..3d0402e 100644 --- a/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml +++ b/A-Provision-por-Terraform-de-AKS-Cluster-PL.yml @@ -58,7 +58,7 @@ stages: ## Step-4: Terraform Plan (Creacion del Plan) ## Step-5: Terraform Apply (Uso del plan en el paso anterior) -- stage: DeployDEVAKSClusters +- stage: DeployAKSClusters jobs: - deployment: DeployDevAKSCluster displayName: DeployDevAKSCluster @@ -110,8 +110,6 @@ stages: ## Step-4: Terraform Plan (Creacion del Plan) ## Step-5: Terraform Apply (Uso del plan en el paso anterior) -- stage: DeployQAAKSClusters - jobs: - deployment: DeployQAAKSCluster displayName: DeployQAAKSCluster pool: @@ -144,7 +142,7 @@ stages: command: 'plan' workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' environmentServiceName: 'SVC-Terraform-Azure-Connection' - commandOptions: '-var ssh_public_key=$(sshkey.secureFilePath) -var environment=$(QA_ENVIRONMENT) -out $(Pipeline.Workspace)/terraform-manifests-out/$(DEV_ENVIRONMENT)-$(Build.BuildId).out' + commandOptions: '-var ssh_public_key=$(sshkey.secureFilePath) -var environment=$(QA_ENVIRONMENT) -out $(Pipeline.Workspace)/terraform-manifests-out/$(QA_ENVIRONMENT)-$(Build.BuildId).out' allowTelemetryCollection: false - task: TerraformCLI@0 displayName: Terraform Apply From dc19911071ca8e0b7f5b7cf7a8fb79d0e2457962 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 12 May 2023 02:33:02 -0500 Subject: [PATCH 20/32] Nuevo Node Pool Linux --- terraform-manifests/09-aks-cluster-linux-user-nodepools.tf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/terraform-manifests/09-aks-cluster-linux-user-nodepools.tf b/terraform-manifests/09-aks-cluster-linux-user-nodepools.tf index b816693..fa4832c 100644 --- a/terraform-manifests/09-aks-cluster-linux-user-nodepools.tf +++ b/terraform-manifests/09-aks-cluster-linux-user-nodepools.tf @@ -1,5 +1,4 @@ # Create Linux Azure AKS Node Pool -/* resource "azurerm_kubernetes_cluster_node_pool" "linux101" { availability_zones = [1, 2, 3] enable_auto_scaling = true @@ -25,5 +24,4 @@ resource "azurerm_kubernetes_cluster_node_pool" "linux101" { "nodepoolos" = "linux" "app" = "java-apps" } -} -*/ +} \ No newline at end of file From c9acdef81c03e554a654ab9f9e52c85e7eb00f5d Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 12 May 2023 07:53:53 -0500 Subject: [PATCH 21/32] Update README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 6a89acf..3634516 100644 --- a/README.md +++ b/README.md @@ -1,4 +1 @@ -# Provision Azure AKS Cluster using Terraform and Azure DevOps - -## For Step by Step Instructions -- [Step by Step Instructions](https://github.com/stacksimplify/azure-aks-kubernetes-masterclass/tree/master/25-Azure-DevOps-Terraform-Azure-AKS) \ No newline at end of file +RETO GLOBANT BETA From c3f440b89e037da5b7a081170a8990a67ca6deea Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Wed, 17 May 2023 16:33:06 -0500 Subject: [PATCH 22/32] Set up CI with Azure Pipelines [skip ci] --- ...form-provision-aks-cluster-pipeline-QA.yml | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 01-terraform-provision-aks-cluster-pipeline-QA.yml diff --git a/01-terraform-provision-aks-cluster-pipeline-QA.yml b/01-terraform-provision-aks-cluster-pipeline-QA.yml new file mode 100644 index 0000000..37a226f --- /dev/null +++ b/01-terraform-provision-aks-cluster-pipeline-QA.yml @@ -0,0 +1,102 @@ +trigger: +- beta + +pool: + vmImage: 'ubuntu-latest' +# Definicion de Variales para Ambientes +variables: +- name: QA_ENVIRONMENT + value: qa +# Stage-1: Terraform Validate Stage +## Step-1: Publish Artifacts to Pipeline (Pipeline artifacts provide a way to share files between stages in a pipeline or between different pipelines. ) +## Step-2: Install Latest Terraform (0.13.5) (Ideally not needed if we use default Ubuntu Agents) +## Step-3: Validate Terraform Manifests (terraform init, terraform validate) + +stages: +- stage: TerraformValidate + jobs: + - job: TerraformValidateJob + continueOnError: false + steps: + - task: PublishPipelineArtifact@1 + displayName: Publish Artifacts + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/terraform-manifests' + artifact: 'terraform-manifests-out' + publishLocation: 'pipeline' + - task: TerraformInstaller@0 + displayName: Terraform Install + inputs: + terraformVersion: 'latest' + - task: TerraformCLI@0 + displayName: Terraform Init + inputs: + command: 'init' + workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests' + backendType: 'azurerm' + backendServiceArm: 'SVC-Terraform-Azure-Connection' + ensureBackend: true + backendAzureRmResourceGroupName: 'terraform-storage-rg' + backendAzureRmStorageAccountName: 'terraformstatechallenge' + backendAzureRmContainerName: 'tfstatefiles' + backendAzureRmKey: 'aks-base.tfstate' + allowTelemetryCollection: false + - task: TerraformCLI@0 + displayName: Terraform Validate + inputs: + command: 'validate' + workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests' + allowTelemetryCollection: false + +# Stage-2: Despliegues de Stages para Dev & QA +# Deployment-1: Despliegue de Dev AKS Cluster +## Step-1: DEfinir Variables para los ambientes +## Step-2: Descarga de SSH Secure File +## Step-3: Terraform Initialize (State Storage to store in Azure Storage Account for Dev AKS Cluster) +## Step-4: Terraform Plan (Creacion del Plan) +## Step-5: Terraform Apply (Uso del plan en el paso anterior) + +- stage: DeployAKSClusters + jobs: + - deployment: DeployQAAKSCluster + displayName: DeployQAAKSCluster + pool: + vmImage: 'ubuntu-latest' + environment: $(QA_ENVIRONMENT) + strategy: + runOnce: + deploy: + steps: + - task: DownloadSecureFile@1 + displayName: Download SSH Key + name: sshkey + inputs: + secureFile: 'id_rsa.pub' + - task: TerraformCLI@0 + displayName: Terraform Init + inputs: + command: 'init' + workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' + backendType: 'azurerm' + backendServiceArm: 'SVC-Terraform-Azure-Connection' + backendAzureRmResourceGroupName: 'terraform-storage-rg' + backendAzureRmStorageAccountName: 'terraformstatechallenge' + backendAzureRmContainerName: 'tfstatefiles' + backendAzureRmKey: 'aks-$(QA_ENVIRONMENT).tfstate' + allowTelemetryCollection: false + - task: TerraformCLI@0 + displayName: Terraform Plan + inputs: + command: 'plan' + workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' + environmentServiceName: 'SVC-Terraform-Azure-Connection' + commandOptions: '-var ssh_public_key=$(sshkey.secureFilePath) -var environment=$(QA_ENVIRONMENT) -out $(Pipeline.Workspace)/terraform-manifests-out/$(DEV_ENVIRONMENT)-$(Build.BuildId).out' + allowTelemetryCollection: false + - task: TerraformCLI@0 + displayName: Terraform Apply + inputs: + command: 'apply' + workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' + environmentServiceName: 'SVC-Terraform-Azure-Connection' + commandOptions: '$(Pipeline.Workspace)/terraform-manifests-out/$(QA_ENVIRONMENT)-$(Build.BuildId).out' + allowTelemetryCollection: false \ No newline at end of file From 2dc5e98a79d7c86b072d43b4799063eacdb3fabc Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Wed, 17 May 2023 16:37:27 -0500 Subject: [PATCH 23/32] Update 01-terraform-provision-aks-cluster-pipeline-QA.yml for Azure Pipelines --- 01-terraform-provision-aks-cluster-pipeline-QA.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01-terraform-provision-aks-cluster-pipeline-QA.yml b/01-terraform-provision-aks-cluster-pipeline-QA.yml index 37a226f..4227b13 100644 --- a/01-terraform-provision-aks-cluster-pipeline-QA.yml +++ b/01-terraform-provision-aks-cluster-pipeline-QA.yml @@ -90,7 +90,7 @@ stages: command: 'plan' workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out' environmentServiceName: 'SVC-Terraform-Azure-Connection' - commandOptions: '-var ssh_public_key=$(sshkey.secureFilePath) -var environment=$(QA_ENVIRONMENT) -out $(Pipeline.Workspace)/terraform-manifests-out/$(DEV_ENVIRONMENT)-$(Build.BuildId).out' + commandOptions: '-var ssh_public_key=$(sshkey.secureFilePath) -var environment=$(QA_ENVIRONMENT) -out $(Pipeline.Workspace)/terraform-manifests-out/$(QA_ENVIRONMENT)-$(Build.BuildId).out' allowTelemetryCollection: false - task: TerraformCLI@0 displayName: Terraform Apply From 8e27ba9fcd7ddf12416a44bd0c551c8506c4b2c8 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Thu, 18 May 2023 12:22:17 -0500 Subject: [PATCH 24/32] Update 01-main.tf actualizacion proveedor helm --- terraform-manifests/01-main.tf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/terraform-manifests/01-main.tf b/terraform-manifests/01-main.tf index 95834e0..dc788e0 100644 --- a/terraform-manifests/01-main.tf +++ b/terraform-manifests/01-main.tf @@ -24,6 +24,10 @@ terraform { source = "hashicorp/random" version = "~> 3.0" } + helm = { + source = "hashicorp/helm" + version = "~> 2.0" + } } # Terraform State Storage to Azure Storage Container @@ -49,3 +53,8 @@ resource "random_pet" "aksrandom" { } +provider "helm" { + kubernetes { + config_path = "~/.kube/config" # Path to your kubeconfig file + } +} From 22acc4ea7dd18c9562d8ff11ef360e97fda23dd0 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 19 May 2023 15:43:00 -0500 Subject: [PATCH 25/32] Create 12 - azurecosmos.tf --- terraform-manifests/12 - azurecosmos.tf | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 terraform-manifests/12 - azurecosmos.tf diff --git a/terraform-manifests/12 - azurecosmos.tf b/terraform-manifests/12 - azurecosmos.tf new file mode 100644 index 0000000..3c533be --- /dev/null +++ b/terraform-manifests/12 - azurecosmos.tf @@ -0,0 +1,37 @@ +resource "azurerm_cosmosdb_account" "db" { + name = "retocosmosdb-beta" + location = azurerm_resource_group.aks_rg.location + resource_group_name = azurerm_resource_group.aks_rg.name + offer_type = "Standard" + kind = "MongoDB" + + consistency_policy { + consistency_level = "Session" + } + + geo_location { + location = azurerm_resource_group.aks_rg.location + failover_priority = 0 + } +} + +resource "azurerm_cosmosdb_mongo_database" "db" { + name = var.cosmosdbname + resource_group_name = azurerm_resource_group.aks_rg.name + account_name = azurerm_cosmosdb_account.db.name + throughput = 400 +} + +resource "azurerm_cosmosdb_mongo_collection" "collection" { + name = var.cosmosdbcollection + resource_group_name = azurerm_resource_group.aks_rg.name + account_name = azurerm_cosmosdb_account.db.name + database_name = azurerm_cosmosdb_mongo_database.db.name + default_ttl_seconds = "777" + shard_key = "uniqueKey" + throughput = 400 + index { + keys = ["_id"] + unique = true + } +} From a8b0271f1aa547b073b23c2c335b81dbc44685b4 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 19 May 2023 15:44:55 -0500 Subject: [PATCH 26/32] Update 02-variables.tf --- terraform-manifests/02-variables.tf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/terraform-manifests/02-variables.tf b/terraform-manifests/02-variables.tf index 1a90a90..31e0707 100644 --- a/terraform-manifests/02-variables.tf +++ b/terraform-manifests/02-variables.tf @@ -46,4 +46,17 @@ variable "windows_admin_password" { default = "P@ssw0rd123456" description = "This variable defines the Windows admin password k8s Worker nodes" } +variable "cosmosdbaccountname" { + type = string + default = "retocosmosdb-beta" +} +variable "cosmosdbname" { + type = string + default = "DemoDB-beta" +} + +variable "cosmosdbcollection" { + type = string + default = "DemoCollection-beta" +} From bad46865bae78b8ab2a5e12d25ce58d6866b00d5 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 19 May 2023 15:45:56 -0500 Subject: [PATCH 27/32] Update 07-aks-cluster.tf --- terraform-manifests/07-aks-cluster.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform-manifests/07-aks-cluster.tf b/terraform-manifests/07-aks-cluster.tf index a362f81..a20786c 100644 --- a/terraform-manifests/07-aks-cluster.tf +++ b/terraform-manifests/07-aks-cluster.tf @@ -15,8 +15,8 @@ resource "azurerm_kubernetes_cluster" "aks_cluster" { enable_auto_scaling = true max_count = 3 min_count = 1 - os_disk_size_gb = 30 - type = "VirtualMachineScaleSets" + os_disk_size_gb = 35 +# type = "VirtualMachineScaleSets" node_labels = { "nodepool-type" = "system" "environment" = var.environment From 0d44e8ec4eda8f2544d08c48feb7b6222907d375 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 19 May 2023 15:48:46 -0500 Subject: [PATCH 28/32] Create backend-deploy.yaml --- backend/backend-deploy.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 backend/backend-deploy.yaml diff --git a/backend/backend-deploy.yaml b/backend/backend-deploy.yaml new file mode 100644 index 0000000..b0423c9 --- /dev/null +++ b/backend/backend-deploy.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: reto-backend +spec: + replicas: 1 + selector: + matchLabels: + app: reto-backend + template: + metadata: + labels: + app: reto-backend + spec: + containers: + - image: mongo:latest + name: reto-backend + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 250m + memory: 256Mi + ports: + - containerPort: 3000 + name: http + env: + - name: DATABASE_URI + value: "mongodb://retocosmosdb-alpha:8IRPyPR5UzvvAwgx2PiBEaP6jDqgfv06GIKpwylyxx5YvnEpMhpa8W0PX8p8c67f2cJ30Cf3ZvDyACDbkbKg5Q==@retocosmosdb-alpha.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@retocosmosdb-alpha@" + - name: DATABASE_DBNAME + value: DemoDB-alpha From d9051f37bb956ccae0af0782e7daaa1b67567075 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 19 May 2023 15:51:41 -0500 Subject: [PATCH 29/32] Create backend-network.yaml --- backend/backend-network.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 backend/backend-network.yaml diff --git a/backend/backend-network.yaml b/backend/backend-network.yaml new file mode 100644 index 0000000..b8ff1d0 --- /dev/null +++ b/backend/backend-network.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: Service +metadata: + name: reto-backend +spec: + selector: + app: reto-backend + ports: + - name: http + port: 80 + targetPort: 3000 +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: reto-backend + annotations: + kubernetes.io/ingress.class: addon-http-application-routing +spec: + rules: + - host: reto-backend.{DNS} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: reto-backend + port: + number: 80 From 76ddb46166f2650a0448656033c012e6e53bc98b Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 19 May 2023 15:56:10 -0500 Subject: [PATCH 30/32] Update backend-deploy.yaml --- backend/backend-deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/backend-deploy.yaml b/backend/backend-deploy.yaml index b0423c9..b75dcdd 100644 --- a/backend/backend-deploy.yaml +++ b/backend/backend-deploy.yaml @@ -27,6 +27,6 @@ spec: name: http env: - name: DATABASE_URI - value: "mongodb://retocosmosdb-alpha:8IRPyPR5UzvvAwgx2PiBEaP6jDqgfv06GIKpwylyxx5YvnEpMhpa8W0PX8p8c67f2cJ30Cf3ZvDyACDbkbKg5Q==@retocosmosdb-alpha.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@retocosmosdb-alpha@" + value: "{}" - name: DATABASE_DBNAME - value: DemoDB-alpha + value: DemoDB-beta From e28e056bf91e257f76bda75fea382f164488ff38 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 19 May 2023 15:59:25 -0500 Subject: [PATCH 31/32] Create frontend-deploy.yaml --- frontend/frontend-deploy.yaml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 frontend/frontend-deploy.yaml diff --git a/frontend/frontend-deploy.yaml b/frontend/frontend-deploy.yaml new file mode 100644 index 0000000..c6a0e42 --- /dev/null +++ b/frontend/frontend-deploy.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: reto-frontend +spec: + replicas: 1 + selector: + matchLabels: + app: reto-frontend + template: + metadata: + labels: + app: reto-frontend + spec: + containers: + - image: mcr.microsoft.com/mslearn/samples/contoso-ship-manager:frontend + name: ship-manager-frontend + imagePullPolicy: Always + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 250m + memory: 256Mi + ports: + - containerPort: 80 + name: http + volumeMounts: + - name: config + mountPath: /usr/src/app/dist/config.js + subPath: config.js + volumes: + - name: config + configMap: + name: frontend-config +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: frontend-config +data: + config.js: | + const config = (() => { + return { + 'VUE_APP_BACKEND_BASE_URL': 'http://reto-backend.5200834be53f4b05b214.eastus.aksapp.io', + } + })() From 5e789c033ef0e69a77cbd43a429680fe654e6941 Mon Sep 17 00:00:00 2001 From: LuchoN83 <39603304+LuchoN83@users.noreply.github.com> Date: Fri, 19 May 2023 16:00:14 -0500 Subject: [PATCH 32/32] Create frontend-network.yaml --- frontend/frontend-network.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 frontend/frontend-network.yaml diff --git a/frontend/frontend-network.yaml b/frontend/frontend-network.yaml new file mode 100644 index 0000000..005ab6b --- /dev/null +++ b/frontend/frontend-network.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: Service +metadata: + name: reto-frontend +spec: + selector: + app: reto-frontend + ports: + - name: http + port: 80 + targetPort: 80 +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: reto-frontend + annotations: + kubernetes.io/ingress.class: addon-http-application-routing +spec: + rules: + - host: reto.5200834be53f4b05b214.eastus.aksapp.io + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: reto-frontend + port: + number: 80