Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta #3

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ba4ac55
Primer Commit PL - Validacion de TF Manifest
LuchoN83 May 12, 2023
569733c
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
b9b62b0
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
3126714
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
e5f6061
Segundo Commit - Provision AKS DEV por Terraform
LuchoN83 May 12, 2023
83e52b7
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
de692ec
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
613f966
Update 02-variables.tf
LuchoN83 May 12, 2023
11d1790
Update 02-variables.tf
LuchoN83 May 12, 2023
1d5ec26
Cambio de Region
May 12, 2023
3e56c87
update 01
May 12, 2023
a5a781c
update 02
May 12, 2023
8523426
Update 05-log-analytics-workspace.tf
LuchoN83 May 12, 2023
fa6e31e
Update 07-aks-cluster.tf
LuchoN83 May 12, 2023
87eb7fb
Update 02-variables.tf
LuchoN83 May 12, 2023
0ccfeb0
BETA A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipelines
LuchoN83 May 12, 2023
cc6ab7e
Beta A-Provision-por-Terraform-de-AKS-Cluster-PL.yml
LuchoN83 May 12, 2023
a4c467e
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml
LuchoN83 May 12, 2023
6f4c401
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml
LuchoN83 May 12, 2023
e9e04a1
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml
LuchoN83 May 12, 2023
dc19911
Nuevo Node Pool Linux
May 12, 2023
c9acdef
Update README.md
LuchoN83 May 12, 2023
c3f440b
Set up CI with Azure Pipelines
LuchoN83 May 17, 2023
2dc5e98
Update 01-terraform-provision-aks-cluster-pipeline-QA.yml for Azure P…
LuchoN83 May 17, 2023
8e27ba9
Update 01-main.tf
LuchoN83 May 18, 2023
22acc4e
Create 12 - azurecosmos.tf
LuchoN83 May 19, 2023
a8b0271
Update 02-variables.tf
LuchoN83 May 19, 2023
bad4686
Update 07-aks-cluster.tf
LuchoN83 May 19, 2023
0d44e8e
Create backend-deploy.yaml
LuchoN83 May 19, 2023
d9051f3
Create backend-network.yaml
LuchoN83 May 19, 2023
76ddb46
Update backend-deploy.yaml
LuchoN83 May 19, 2023
e28e056
Create frontend-deploy.yaml
LuchoN83 May 19, 2023
5e789c0
Create frontend-network.yaml
LuchoN83 May 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions 01-terraform-provision-aks-cluster-pipeline-QA.yml
Original file line number Diff line number Diff line change
@@ -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/$(QA_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
154 changes: 154 additions & 0 deletions A-Provision-por-Terraform-de-AKS-Cluster-PL.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
trigger:
- beta

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)
## 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: 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
# 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)

- 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/$(QA_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
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
RETO GLOBANT BETA
32 changes: 32 additions & 0 deletions backend/backend-deploy.yaml
Original file line number Diff line number Diff line change
@@ -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: "{}"
- name: DATABASE_DBNAME
value: DemoDB-beta
30 changes: 30 additions & 0 deletions backend/backend-network.yaml
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions frontend/frontend-deploy.yaml
Original file line number Diff line number Diff line change
@@ -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',
}
})()
Loading