From 33a8333226e66935b5e724b78bbc7753d68279a2 Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Mon, 3 Mar 2025 23:21:11 +0100 Subject: [PATCH 01/10] terraform reconfigure and upgrade --- build/templates/terraform-apply-stages.yml | 2 +- build/templates/terraform-plan-destroy-stages.yml | 2 +- build/templates/terraform-plan-stages.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/templates/terraform-apply-stages.yml b/build/templates/terraform-apply-stages.yml index 5f20ead..91330f1 100644 --- a/build/templates/terraform-apply-stages.yml +++ b/build/templates/terraform-apply-stages.yml @@ -102,7 +102,7 @@ stages: -backend-config="storage_account_name=$env:TF_STATE_BLOB_ACCOUNT_NAME" ` -backend-config="container_name=$env:TF_STATE_BLOB_CONTAINER_NAME" ` -backend-config="key=$env:TF_STATE_BLOB_FILE" ` - -backend-config="sas_token=$env:TF_STATE_BLOB_SAS_TOKEN" + -backend-config="sas_token=$env:TF_STATE_BLOB_SAS_TOKEN" -reconfigure -upgrade displayName: 'Terraform Init' workingDirectory: ${{ parameters.workingDirectory }} env: diff --git a/build/templates/terraform-plan-destroy-stages.yml b/build/templates/terraform-plan-destroy-stages.yml index 9b12abe..0c852b7 100644 --- a/build/templates/terraform-plan-destroy-stages.yml +++ b/build/templates/terraform-plan-destroy-stages.yml @@ -93,7 +93,7 @@ stages: -backend-config="storage_account_name=$env:TF_STATE_BLOB_ACCOUNT_NAME" ` -backend-config="container_name=$env:TF_STATE_BLOB_CONTAINER_NAME" ` -backend-config="key=$env:TF_STATE_BLOB_FILE" ` - -backend-config="sas_token=$env:TF_STATE_BLOB_SAS_TOKEN" + -backend-config="sas_token=$env:TF_STATE_BLOB_SAS_TOKEN" -reconfigure -upgrade displayName: 'Terraform Init' workingDirectory: ${{ parameters.workingDirectory }} env: diff --git a/build/templates/terraform-plan-stages.yml b/build/templates/terraform-plan-stages.yml index c4c55e6..7a74cf4 100644 --- a/build/templates/terraform-plan-stages.yml +++ b/build/templates/terraform-plan-stages.yml @@ -93,7 +93,7 @@ stages: -backend-config="storage_account_name=$env:TF_STATE_BLOB_ACCOUNT_NAME" ` -backend-config="container_name=$env:TF_STATE_BLOB_CONTAINER_NAME" ` -backend-config="key=$env:TF_STATE_BLOB_FILE" ` - -backend-config="sas_token=$env:TF_STATE_BLOB_SAS_TOKEN" + -backend-config="sas_token=$env:TF_STATE_BLOB_SAS_TOKEN" -reconfigure -upgrade displayName: 'Terraform Init' workingDirectory: ${{ parameters.workingDirectory }} env: From 58678269ad56af5804bbe3ed700dc49166352365 Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Mon, 3 Mar 2025 23:32:21 +0100 Subject: [PATCH 02/10] merge tf templates --- .../terraform-plan-destroy-stages.yml | 125 ------------------ build/templates/terraform-plan-stages.yml | 34 +++-- build/terraform-create-aks-cluster.yml | 1 + build/terraform-destroy-aks-cluster.yml | 3 +- 4 files changed, 28 insertions(+), 135 deletions(-) delete mode 100644 build/templates/terraform-plan-destroy-stages.yml diff --git a/build/templates/terraform-plan-destroy-stages.yml b/build/templates/terraform-plan-destroy-stages.yml deleted file mode 100644 index 0c852b7..0000000 --- a/build/templates/terraform-plan-destroy-stages.yml +++ /dev/null @@ -1,125 +0,0 @@ -parameters: - - name: stageName - displayName: 'Stage name display name' - type: string - - - name: vmImage - displayName: 'Vm Image' - default: 'windows-latest' - type: string - - - name: terraformVersion - displayName: 'Terraform Version' - type: string - default: 'latest' - - - name: workingDirectory - displayName: 'Working Directory for Terraform' - type: string - - - name: storageAccount - displayName: 'Storage Account' - type: string - - - name: storageContainer - displayName: 'Storage Container' - type: string - - - name: stateFile - displayName: 'State File' - type: string - - - name: sasToken - displayName: 'Sas Token' - type: string - - - name: prefix - displayName: 'Prefix' - default: 'd01' - type: string - - - name: subscriptionId - displayName: 'Azure Subscription Id' - type: string - - - name: clientId - displayName: 'Azure Client Id' - type: string - - - name: clientSecret - displayName: 'Azure Client Secret' - type: string - - - name: tenantId - displayName: 'Azure Tenant Id' - type: string - -stages: - - stage: ${{ parameters.stageName }} - displayName: ${{ parameters.stageName }} - jobs: - - job: ${{ parameters.stageName }} - displayName: ${{ parameters.stageName }} - pool: - vmImage: ${{ parameters.VmImage }} - variables: - - name: 'TF_LOG' - value: 'INFO' - steps: - - checkout: self - fetchDepth: 0 - - - task: TerraformInstaller@1 - displayName: 'Install Terraform ${{ parameters.terraformVersion }}' - inputs: - terraformVersion: '${{ parameters.terraformVersion }}' - - - task: FileTransform@2 - displayName: 'Transform terraform.auto.tfvars.json' - inputs: - folderPath: '$(System.DefaultWorkingDirectory)' - xmlTransformationRules: '' - jsonTargetFiles: 'terraform/terraform.auto.tfvars.json' - - - powershell: | - terraform init -backend=false - terraform validate - terraform fmt -check - displayName: "Run tf validate" - workingDirectory: '${{ parameters.workingDirectory }}' - - - powershell: | - terraform init ` - -backend-config="storage_account_name=$env:TF_STATE_BLOB_ACCOUNT_NAME" ` - -backend-config="container_name=$env:TF_STATE_BLOB_CONTAINER_NAME" ` - -backend-config="key=$env:TF_STATE_BLOB_FILE" ` - -backend-config="sas_token=$env:TF_STATE_BLOB_SAS_TOKEN" -reconfigure -upgrade - displayName: 'Terraform Init' - workingDirectory: ${{ parameters.workingDirectory }} - env: - TF_STATE_BLOB_ACCOUNT_NAME: ${{ parameters.storageAccount }} - TF_STATE_BLOB_CONTAINER_NAME: ${{ parameters.storageContainer }} - TF_STATE_BLOB_FILE: ${{ parameters.stateFile }} - TF_STATE_BLOB_SAS_TOKEN: ${{ parameters.sasToken }} - - - powershell: | - terraform plan -destroy -var "prefix=${{ parameters.prefix }}" -out main.tfplan - displayName: 'Terraform Plan' - workingDirectory: ${{ parameters.workingDirectory }} - env: - ARM_SUBSCRIPTION_ID: ${{ parameters.subscriptionId }} - ARM_CLIENT_ID: ${{ parameters.clientId }} - ARM_CLIENT_SECRET: ${{ parameters.clientSecret }} - ARM_TENANT_ID: ${{ parameters.tenantId }} - - - powershell: | - cp main.tfplan $(Build.ArtifactStagingDirectory) - displayName: 'Copy Plan' - workingDirectory: ${{ parameters.workingDirectory }} - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifacts' - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - ArtifactName: 'drop' - publishLocation: 'Container' diff --git a/build/templates/terraform-plan-stages.yml b/build/templates/terraform-plan-stages.yml index 7a74cf4..d7e9ad4 100644 --- a/build/templates/terraform-plan-stages.yml +++ b/build/templates/terraform-plan-stages.yml @@ -54,6 +54,10 @@ parameters: displayName: 'Azure Tenant Id' type: string + - name: destroy + displayName: 'Should destroy infrastructure' + type: boolean + stages: - stage: ${{ parameters.stageName }} displayName: ${{ parameters.stageName }} @@ -102,15 +106,27 @@ stages: TF_STATE_BLOB_FILE: ${{ parameters.stateFile }} TF_STATE_BLOB_SAS_TOKEN: ${{ parameters.sasToken }} - - powershell: | - terraform plan -var "prefix=${{ parameters.prefix }}" -out main.tfplan - displayName: 'Terraform Plan' - workingDirectory: ${{ parameters.workingDirectory }} - env: - ARM_SUBSCRIPTION_ID: ${{ parameters.subscriptionId }} - ARM_CLIENT_ID: ${{ parameters.clientId }} - ARM_CLIENT_SECRET: ${{ parameters.clientSecret }} - ARM_TENANT_ID: ${{ parameters.tenantId }} + - ${{ if eq(parameters.destroy, false) }}: + - powershell: | + terraform plan -var "prefix=${{ parameters.prefix }}" -out main.tfplan + displayName: 'Terraform Plan' + workingDirectory: ${{ parameters.workingDirectory }} + env: + ARM_SUBSCRIPTION_ID: ${{ parameters.subscriptionId }} + ARM_CLIENT_ID: ${{ parameters.clientId }} + ARM_CLIENT_SECRET: ${{ parameters.clientSecret }} + ARM_TENANT_ID: ${{ parameters.tenantId }} + + - ${{ if eq(parameters.destroy, true) }}: + - powershell: | + terraform plan -destroy -var "prefix=${{ parameters.prefix }}" -out main.tfplan + displayName: 'Terraform Plan' + workingDirectory: ${{ parameters.workingDirectory }} + env: + ARM_SUBSCRIPTION_ID: ${{ parameters.subscriptionId }} + ARM_CLIENT_ID: ${{ parameters.clientId }} + ARM_CLIENT_SECRET: ${{ parameters.clientSecret }} + ARM_TENANT_ID: ${{ parameters.tenantId }} - powershell: | cp main.tfplan $(Build.ArtifactStagingDirectory) diff --git a/build/terraform-create-aks-cluster.yml b/build/terraform-create-aks-cluster.yml index ebb282d..89318b5 100644 --- a/build/terraform-create-aks-cluster.yml +++ b/build/terraform-create-aks-cluster.yml @@ -44,6 +44,7 @@ stages: clientId: $(library-client-id) clientSecret: $(library-client-secret) tenantId: $(library-tenant-id) + destroy: false - template: templates/terraform-apply-stages.yml parameters: diff --git a/build/terraform-destroy-aks-cluster.yml b/build/terraform-destroy-aks-cluster.yml index bd8b09d..5df94bf 100644 --- a/build/terraform-destroy-aks-cluster.yml +++ b/build/terraform-destroy-aks-cluster.yml @@ -24,7 +24,7 @@ variables: value: "Terraform_Apply_Destroy_AKS_Cluster" stages: - - template: templates/terraform-plan-destroy-stages.yml + - template: templates/terraform-plan-stages.yml parameters: stageName: ${{ variables.planStageName }} VmImage: windows-latest @@ -39,6 +39,7 @@ stages: clientId: $(library-client-id) clientSecret: $(library-client-secret) tenantId: $(library-tenant-id) + destroy: true - template: templates/terraform-apply-stages.yml parameters: From b27cb3046531086527e6ef4e8a62d2f7543c7ff9 Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Mon, 3 Mar 2025 23:34:56 +0100 Subject: [PATCH 03/10] encoding script --- scripts/verify-encoding.ps1 | 83 +++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 scripts/verify-encoding.ps1 diff --git a/scripts/verify-encoding.ps1 b/scripts/verify-encoding.ps1 new file mode 100644 index 0000000..8cc5a54 --- /dev/null +++ b/scripts/verify-encoding.ps1 @@ -0,0 +1,83 @@ +<# +.SYNOPSIS + This script will verify that there's no UTF-8 BOM or CRLF line endings in the files inside of the project. +#> +param ( + # Path to the repository root. All text files under the root will be checked for UTF-8 BOM and CRLF. + $SourceRoot = "$PSScriptRoot/..", + + # Makes the script to perform file modifications to bring them to the standard. + [switch] $Autofix +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +# For PowerShell to properly process the UTF-8 output from git ls-tree we need to set up the output encoding: +[Console]::OutputEncoding = [Text.Encoding]::UTF8 + +$allFiles = git -c core.quotepath=off ls-tree -r HEAD --name-only +Write-Output "Total files in the repository: $($allFiles.Length)" + +# https://stackoverflow.com/questions/6119956/how-to-determine-if-git-handles-a-file-as-binary-or-as-text#comment15281840_6134127 +$nullHash = '4b825dc642cb6eb9a060e54bf8d69288fbee4904' +$textFiles = git -c core.quotepath=off diff --numstat $nullHash HEAD -- @allFiles | + Where-Object { -not $_.StartsWith('-') } | + ForEach-Object { [Regex]::Unescape($_.Split("`t", 3)[2]) } +Write-Output "Text files in the repository: $($textFiles.Length)" + +$bom = @(0xEF, 0xBB, 0xBF) +$bomErrors = @() +$lineEndingErrors = @() + +try { + Push-Location $SourceRoot + foreach ($file in $textFiles) { + if ([IO.Path]::GetExtension($file) -eq '.DotSettings' -or $file.EndsWith('.verified.cs')) { + continue + } + + $fullPath = Resolve-Path -LiteralPath $file + + if (-Not (Test-Path -LiteralPath $fullPath -PathType Leaf)) { + Write-Warning "Skipping missing file: $file" + continue + } + + $bytes = [IO.File]::ReadAllBytes($fullPath) | Select-Object -First $bom.Length + + if ($null -eq $bytes -or $bytes.Length -eq 0) { + Write-Warning "Skipping empty or unreadable file: $file" + continue + } + + $bytesEqualsBom = @(Compare-Object $bytes $bom -SyncWindow 0).Length -eq 0 + if ($bytesEqualsBom -and $Autofix) { + $fullContent = [IO.File]::ReadAllBytes($fullPath) + $newContent = $fullContent | Select-Object -Skip $bom.Length + [IO.File]::WriteAllBytes($fullPath, $newContent) + Write-Output "Removed UTF-8 BOM from file $file" + } elseif ($bytesEqualsBom) { + $bomErrors += @($file) + } + + $text = [IO.File]::ReadAllText($fullPath) + $hasWrongLineEndings = $text.Contains("`r`n") + if ($hasWrongLineEndings -and $Autofix) { + $newText = $text -replace "`r`n", "`n" + [IO.File]::WriteAllText($fullPath, $newText) + Write-Output "Fixed the line endings for file $file" + } elseif ($hasWrongLineEndings) { + $lineEndingErrors += @($file) + } + } + + if ($bomErrors.Length) { + throw "The following $($bomErrors.Length) files have UTF-8 BOM:`n" + ($bomErrors -join "`n") + } + if ($lineEndingErrors.Length) { + throw "The following $($lineEndingErrors.Length) files have CRLF instead of LF:`n" + ($lineEndingErrors -join "`n") + } +} finally { + Pop-Location +} From ce579ce5b0d5a69eb66e9b15c38f81f4021fd555 Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Mon, 3 Mar 2025 23:42:44 +0100 Subject: [PATCH 04/10] fix encoding --- EventTriangleAPI.sln | 2 +- build/templates/helm-deploy-jobs.yml | 2 +- cloudflare/Get-CloudflareDnsRecords.ps1 | 2 +- cloudflare/Get-CloudflareZoneId.ps1 | 2 +- cloudflare/Get-NewDnsEntries.ps1 | 2 +- cloudflare/Main.ps1 | 2 +- cloudflare/Update-CloudflareDnsRecord.ps1 | 2 +- docs/AcrConnectionSetting.md | 2 +- docs/AksResourceDeployment.md | 2 +- helm/README.md | 2 +- .../certificate-issuer-letsencrypt.yaml | 2 +- kubernetes/certificate/certificate.yaml | 2 +- .../deploy-cert-manager-helm.ps1 | 2 +- kubernetes/namespace/namespace.yaml | 2 +- scripts/Build-Docker.ps1 | 2 +- scripts/Build-Docker.sh | 2 +- scripts/Deploy-Helm-Chart.ps1 | 2 +- scripts/verify-encoding.ps1 | 86 ++++++++++++------- .../20230804064756_Initialize.Designer.cs | 2 +- .../Migrations/20230804064756_Initialize.cs | 2 +- .../DatabaseContextModelSnapshot.cs | 2 +- .../Properties/launchSettings.json | 2 +- .../20230823153056_Initialize.Designer.cs | 2 +- .../Migrations/20230823153056_Initialize.cs | 2 +- .../DatabaseContextModelSnapshot.cs | 2 +- .../Properties/launchSettings.json | 2 +- .../20230823153137_Initialize.Designer.cs | 2 +- .../Migrations/20230823153137_Initialize.cs | 2 +- .../DatabaseContextModelSnapshot.cs | 2 +- .../Properties/launchSettings.json | 2 +- terraform/README.md | 2 +- 31 files changed, 87 insertions(+), 59 deletions(-) diff --git a/EventTriangleAPI.sln b/EventTriangleAPI.sln index bc66fe5..a61d51e 100644 --- a/EventTriangleAPI.sln +++ b/EventTriangleAPI.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 diff --git a/build/templates/helm-deploy-jobs.yml b/build/templates/helm-deploy-jobs.yml index ff978f9..7da3c2e 100644 --- a/build/templates/helm-deploy-jobs.yml +++ b/build/templates/helm-deploy-jobs.yml @@ -1,4 +1,4 @@ -parameters: +parameters: - name: chartName type: string diff --git a/cloudflare/Get-CloudflareDnsRecords.ps1 b/cloudflare/Get-CloudflareDnsRecords.ps1 index 041efed..060db7e 100644 --- a/cloudflare/Get-CloudflareDnsRecords.ps1 +++ b/cloudflare/Get-CloudflareDnsRecords.ps1 @@ -1,4 +1,4 @@ -param ( +param ( [Parameter(Mandatory = $true)] [string]$ApiToken, diff --git a/cloudflare/Get-CloudflareZoneId.ps1 b/cloudflare/Get-CloudflareZoneId.ps1 index 4f56026..e1042eb 100644 --- a/cloudflare/Get-CloudflareZoneId.ps1 +++ b/cloudflare/Get-CloudflareZoneId.ps1 @@ -1,4 +1,4 @@ -param ( +param ( [Parameter(Mandatory = $true)] [string]$ApiToken, diff --git a/cloudflare/Get-NewDnsEntries.ps1 b/cloudflare/Get-NewDnsEntries.ps1 index 9fb805e..c2431cf 100644 --- a/cloudflare/Get-NewDnsEntries.ps1 +++ b/cloudflare/Get-NewDnsEntries.ps1 @@ -1,4 +1,4 @@ -$postgresService = $( kubectl get service "postgres-service" -n "event-triangle" -o json ) | ConvertFrom-Json +$postgresService = $( kubectl get service "postgres-service" -n "event-triangle" -o json ) | ConvertFrom-Json $postgresPublicIp = $postgresService.status.loadBalancer.ingress[0].ip $rabbitService = $( kubectl get service "event-rabbitmq" -n "event-triangle" -o json ) | ConvertFrom-Json diff --git a/cloudflare/Main.ps1 b/cloudflare/Main.ps1 index bb63b71..38f9f70 100644 --- a/cloudflare/Main.ps1 +++ b/cloudflare/Main.ps1 @@ -1,4 +1,4 @@ -param ( +param ( [Parameter(Mandatory = $true)] [string]$ApiToken, diff --git a/cloudflare/Update-CloudflareDnsRecord.ps1 b/cloudflare/Update-CloudflareDnsRecord.ps1 index 14a2c05..6475554 100644 --- a/cloudflare/Update-CloudflareDnsRecord.ps1 +++ b/cloudflare/Update-CloudflareDnsRecord.ps1 @@ -1,4 +1,4 @@ -param ( +param ( [Parameter(Mandatory = $true)] [string]$ApiToken, diff --git a/docs/AcrConnectionSetting.md b/docs/AcrConnectionSetting.md index 945e979..5683316 100644 --- a/docs/AcrConnectionSetting.md +++ b/docs/AcrConnectionSetting.md @@ -1,4 +1,4 @@ -# Setup ACR to push images from Pipelines +# Setup ACR to push images from Pipelines - Enable admin for ACR in Azure Portal - Update Service connection with admin username and password diff --git a/docs/AksResourceDeployment.md b/docs/AksResourceDeployment.md index 1808938..66a07cd 100644 --- a/docs/AksResourceDeployment.md +++ b/docs/AksResourceDeployment.md @@ -1,4 +1,4 @@ -# K8s Deployment notes +# K8s Deployment notes ## Deployment order diff --git a/helm/README.md b/helm/README.md index 8d660ba..43007d2 100644 --- a/helm/README.md +++ b/helm/README.md @@ -1,4 +1,4 @@ -# Commands +# Commands ## HELM Create diff --git a/kubernetes/certificate-issuer-letsencrypt/certificate-issuer-letsencrypt.yaml b/kubernetes/certificate-issuer-letsencrypt/certificate-issuer-letsencrypt.yaml index 0f30861..ba0b776 100644 --- a/kubernetes/certificate-issuer-letsencrypt/certificate-issuer-letsencrypt.yaml +++ b/kubernetes/certificate-issuer-letsencrypt/certificate-issuer-letsencrypt.yaml @@ -1,4 +1,4 @@ -apiVersion: cert-manager.io/v1 +apiVersion: cert-manager.io/v1 kind: ClusterIssuer metadata: name: letsencrypt-prod diff --git a/kubernetes/certificate/certificate.yaml b/kubernetes/certificate/certificate.yaml index 1f9daff..c7aaedb 100644 --- a/kubernetes/certificate/certificate.yaml +++ b/kubernetes/certificate/certificate.yaml @@ -1,4 +1,4 @@ -apiVersion: cert-manager.io/v1 +apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: razumovsky-me-tls diff --git a/kubernetes/helm-install-cert-manager/deploy-cert-manager-helm.ps1 b/kubernetes/helm-install-cert-manager/deploy-cert-manager-helm.ps1 index fc8a6ce..3b9fc4b 100644 --- a/kubernetes/helm-install-cert-manager/deploy-cert-manager-helm.ps1 +++ b/kubernetes/helm-install-cert-manager/deploy-cert-manager-helm.ps1 @@ -1,4 +1,4 @@ -param( +param( [Parameter(Position = 0, Mandatory = $true)] [string] $HelmReleaseName, [Parameter(Position = 1, Mandatory = $true)] diff --git a/kubernetes/namespace/namespace.yaml b/kubernetes/namespace/namespace.yaml index 253e2a1..60a94e6 100644 --- a/kubernetes/namespace/namespace.yaml +++ b/kubernetes/namespace/namespace.yaml @@ -1,4 +1,4 @@ -apiVersion: v1 +apiVersion: v1 kind: Namespace metadata: name: event-triangle \ No newline at end of file diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index d131154..b68baad 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -1,4 +1,4 @@ -param ( +param ( [Parameter(Mandatory = $true)] [string]$DockerRegistryUrl, diff --git a/scripts/Build-Docker.sh b/scripts/Build-Docker.sh index 0f723a5..005a555 100644 --- a/scripts/Build-Docker.sh +++ b/scripts/Build-Docker.sh @@ -1,4 +1,4 @@ -GIT_VERSION_IMAGE="${{ parameters.dockerRegistryUrl }}/${{ parameters.imageRepository }}:$(GitVersion.SemVer)" +GIT_VERSION_IMAGE="${{ parameters.dockerRegistryUrl }}/${{ parameters.imageRepository }}:$(GitVersion.SemVer)" LATEST_VERSION_IMAGE="${{ parameters.dockerRegistryUrl }}/${{ parameters.imageRepository }}:latest" echo "GIT_VERSION_IMAGE: $GIT_VERSION_IMAGE" echo "LATEST_VERSION_IMAGE: $LATEST_VERSION_IMAGE" diff --git a/scripts/Deploy-Helm-Chart.ps1 b/scripts/Deploy-Helm-Chart.ps1 index 68ba8f2..b35d9ff 100644 --- a/scripts/Deploy-Helm-Chart.ps1 +++ b/scripts/Deploy-Helm-Chart.ps1 @@ -1,4 +1,4 @@ -param ( +param ( [string]$HelmChartsFolder = "E:\RiderProjects\02_DOTNET_PROJECTS\EventTriangleAPI\helm", [string]$ChartName = "auth-service-chart", [string]$Version, diff --git a/scripts/verify-encoding.ps1 b/scripts/verify-encoding.ps1 index 8cc5a54..4169150 100644 --- a/scripts/verify-encoding.ps1 +++ b/scripts/verify-encoding.ps1 @@ -1,56 +1,84 @@ +# SPDX-FileCopyrightText: 2020-2025 Friedrich von Never +# +# SPDX-License-Identifier: MIT + <# .SYNOPSIS + encoding-verifier v2.0.1. + This script will verify that there's no UTF-8 BOM or CRLF line endings in the files inside of the project. + + https://github.com/ForNeVeR/encoding-verifier #> param ( - # Path to the repository root. All text files under the root will be checked for UTF-8 BOM and CRLF. - $SourceRoot = "$PSScriptRoot/..", +# Path to the repository root. All text files under the root will be checked for UTF-8 BOM and CRLF. +# +# By default (if nothing's passed), the script will try auto-detecting the nearest Git root. + [string] $SourceRoot, - # Makes the script to perform file modifications to bring them to the standard. - [switch] $Autofix +# Makes the script to perform file modifications to bring them to the standard. + [switch] $Autofix, + +# List of file extensions (with leading dots) to ignore. Case-insensitive. + [string[]] $ExcludeExtensions = @( + '.dotsettings' +) ) Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' +if (!$SourceRoot) { + $SourceRoot = git rev-parse --show-toplevel + if (!$?) { + throw "Cannot call `"git rev-parse`": exit code $LASTEXITCODE." + } +} + # For PowerShell to properly process the UTF-8 output from git ls-tree we need to set up the output encoding: [Console]::OutputEncoding = [Text.Encoding]::UTF8 -$allFiles = git -c core.quotepath=off ls-tree -r HEAD --name-only -Write-Output "Total files in the repository: $($allFiles.Length)" +try { + Push-Location $SourceRoot + [array] $allFiles = git -c core.quotepath=off ls-tree -r HEAD --name-only + if (!$?) { + throw "Cannot call `"git ls-tree`": exit code $LASTEXITCODE." + } + Write-Output "Total files in the repository: $($allFiles.Length)" + + $counter = [pscustomobject] @{ Value = 0 } + $groupSize = 50 + [array] $chunks = $allFiles | Group-Object -Property { [math]::Floor($counter.Value++ / $groupSize) } + Write-Output "Split into $($chunks.Count) chunks." + + # https://stackoverflow.com/questions/6119956/how-to-determine-if-git-handles-a-file-as-binary-or-as-text#comment15281840_6134127 + $nullHash = '4b825dc642cb6eb9a060e54bf8d69288fbee4904' + $textFiles = $chunks | ForEach-Object { + $chunk = $_.Group + $filePaths = git -c core.quotepath=off diff --numstat $nullHash HEAD -- @chunk + if (!$?) { + throw "Cannot call `"git diff`": exit code $LASTEXITCODE." + } + $filePaths | + Where-Object { -not $_.StartsWith('-') } | + ForEach-Object { [Regex]::Unescape($_.Split("`t", 3)[2]) } + } -# https://stackoverflow.com/questions/6119956/how-to-determine-if-git-handles-a-file-as-binary-or-as-text#comment15281840_6134127 -$nullHash = '4b825dc642cb6eb9a060e54bf8d69288fbee4904' -$textFiles = git -c core.quotepath=off diff --numstat $nullHash HEAD -- @allFiles | - Where-Object { -not $_.StartsWith('-') } | - ForEach-Object { [Regex]::Unescape($_.Split("`t", 3)[2]) } -Write-Output "Text files in the repository: $($textFiles.Length)" + Write-Output "Text files in the repository: $($textFiles.Length)" -$bom = @(0xEF, 0xBB, 0xBF) -$bomErrors = @() -$lineEndingErrors = @() + $bom = @(0xEF, 0xBB, 0xBF) + $bomErrors = @() + $lineEndingErrors = @() -try { - Push-Location $SourceRoot foreach ($file in $textFiles) { - if ([IO.Path]::GetExtension($file) -eq '.DotSettings' -or $file.EndsWith('.verified.cs')) { + if ($ExcludeExtensions -contains [IO.Path]::GetExtension($file).ToLowerInvariant()) { continue } $fullPath = Resolve-Path -LiteralPath $file - - if (-Not (Test-Path -LiteralPath $fullPath -PathType Leaf)) { - Write-Warning "Skipping missing file: $file" - continue - } - $bytes = [IO.File]::ReadAllBytes($fullPath) | Select-Object -First $bom.Length + if (!$bytes) { continue } # filter empty files - if ($null -eq $bytes -or $bytes.Length -eq 0) { - Write-Warning "Skipping empty or unreadable file: $file" - continue - } - $bytesEqualsBom = @(Compare-Object $bytes $bom -SyncWindow 0).Length -eq 0 if ($bytesEqualsBom -and $Autofix) { $fullContent = [IO.File]::ReadAllBytes($fullPath) diff --git a/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/20230804064756_Initialize.Designer.cs b/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/20230804064756_Initialize.Designer.cs index 129bd74..a5b3ec4 100644 --- a/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/20230804064756_Initialize.Designer.cs +++ b/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/20230804064756_Initialize.Designer.cs @@ -1,4 +1,4 @@ -// +// using System; using EventTriangleAPI.Authorization.Persistence; using Microsoft.EntityFrameworkCore; diff --git a/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/20230804064756_Initialize.cs b/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/20230804064756_Initialize.cs index 124dc06..af23d29 100644 --- a/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/20230804064756_Initialize.cs +++ b/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/20230804064756_Initialize.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/DatabaseContextModelSnapshot.cs b/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/DatabaseContextModelSnapshot.cs index 2a7a2c6..426132b 100644 --- a/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/DatabaseContextModelSnapshot.cs +++ b/src/authorization/EventTriangleAPI.Authorization.Persistence/Migrations/DatabaseContextModelSnapshot.cs @@ -1,4 +1,4 @@ -// +// using System; using EventTriangleAPI.Authorization.Persistence; using Microsoft.EntityFrameworkCore; diff --git a/src/authorization/EventTriangleAPI.Authorization.Presentation/Properties/launchSettings.json b/src/authorization/EventTriangleAPI.Authorization.Presentation/Properties/launchSettings.json index 8ad1b52..e13e1ec 100644 --- a/src/authorization/EventTriangleAPI.Authorization.Presentation/Properties/launchSettings.json +++ b/src/authorization/EventTriangleAPI.Authorization.Presentation/Properties/launchSettings.json @@ -1,4 +1,4 @@ -{ +{ "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, diff --git a/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/20230823153056_Initialize.Designer.cs b/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/20230823153056_Initialize.Designer.cs index 0a065f5..4eb5448 100644 --- a/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/20230823153056_Initialize.Designer.cs +++ b/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/20230823153056_Initialize.Designer.cs @@ -1,4 +1,4 @@ -// +// using System; using EventTriangleAPI.Consumer.Persistence; using Microsoft.EntityFrameworkCore; diff --git a/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/20230823153056_Initialize.cs b/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/20230823153056_Initialize.cs index 6ae7b3c..588c0a0 100644 --- a/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/20230823153056_Initialize.cs +++ b/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/20230823153056_Initialize.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/DatabaseContextModelSnapshot.cs b/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/DatabaseContextModelSnapshot.cs index c1cd6ed..f4707f4 100644 --- a/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/DatabaseContextModelSnapshot.cs +++ b/src/consumer/EventTriangleAPI.Consumer.Persistence/Migrations/DatabaseContextModelSnapshot.cs @@ -1,4 +1,4 @@ -// +// using System; using EventTriangleAPI.Consumer.Persistence; using Microsoft.EntityFrameworkCore; diff --git a/src/consumer/EventTriangleAPI.Consumer.Presentation/Properties/launchSettings.json b/src/consumer/EventTriangleAPI.Consumer.Presentation/Properties/launchSettings.json index d368c95..76e264c 100644 --- a/src/consumer/EventTriangleAPI.Consumer.Presentation/Properties/launchSettings.json +++ b/src/consumer/EventTriangleAPI.Consumer.Presentation/Properties/launchSettings.json @@ -1,4 +1,4 @@ -{ +{ "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, diff --git a/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/20230823153137_Initialize.Designer.cs b/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/20230823153137_Initialize.Designer.cs index 739555d..4fd70fb 100644 --- a/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/20230823153137_Initialize.Designer.cs +++ b/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/20230823153137_Initialize.Designer.cs @@ -1,4 +1,4 @@ -// +// using System; using EventTriangleAPI.Sender.Persistence; using Microsoft.EntityFrameworkCore; diff --git a/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/20230823153137_Initialize.cs b/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/20230823153137_Initialize.cs index 072b133..ced410f 100644 --- a/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/20230823153137_Initialize.cs +++ b/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/20230823153137_Initialize.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/DatabaseContextModelSnapshot.cs b/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/DatabaseContextModelSnapshot.cs index 7e81207..311d2a6 100644 --- a/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/DatabaseContextModelSnapshot.cs +++ b/src/sender/EventTriangleAPI.Sender.Persistence/Migrations/DatabaseContextModelSnapshot.cs @@ -1,4 +1,4 @@ -// +// using System; using EventTriangleAPI.Sender.Persistence; using Microsoft.EntityFrameworkCore; diff --git a/src/sender/EventTriangleAPI.Sender.Presentation/Properties/launchSettings.json b/src/sender/EventTriangleAPI.Sender.Presentation/Properties/launchSettings.json index bba1897..bf53da6 100644 --- a/src/sender/EventTriangleAPI.Sender.Presentation/Properties/launchSettings.json +++ b/src/sender/EventTriangleAPI.Sender.Presentation/Properties/launchSettings.json @@ -1,4 +1,4 @@ -{ +{ "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, diff --git a/terraform/README.md b/terraform/README.md index 3d0a6b0..41b8dfd 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -1,4 +1,4 @@ -# Commands +# Commands ## Connect to AKS From 7f8a8d99e2809d14fc90ec2d75f38be9b3721447 Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Tue, 4 Mar 2025 01:45:02 +0100 Subject: [PATCH 05/10] infrastructure update --- .../Example.ps1 | 6 +++++ terraform/.terraform.lock.hcl | 26 +++++++++---------- terraform/modules/aks/main.tf | 4 +-- terraform/output.tf | 4 +++ terraform/terraform.auto.tfvars.json | 6 ++--- 5 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 kubernetes/helm-install-grafana-prometheus/Example.ps1 diff --git a/kubernetes/helm-install-grafana-prometheus/Example.ps1 b/kubernetes/helm-install-grafana-prometheus/Example.ps1 new file mode 100644 index 0000000..a970265 --- /dev/null +++ b/kubernetes/helm-install-grafana-prometheus/Example.ps1 @@ -0,0 +1,6 @@ +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +helm repo update +kubectl create namespace monitoring +helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring --set grafana.service.type=ClusterIP --set prometheus.service.type=ClusterIP +kubectl get svc -n monitoring + diff --git a/terraform/.terraform.lock.hcl b/terraform/.terraform.lock.hcl index 3c99d54..03ed0f1 100644 --- a/terraform/.terraform.lock.hcl +++ b/terraform/.terraform.lock.hcl @@ -42,22 +42,22 @@ provider "registry.terraform.io/hashicorp/azuread" { } provider "registry.terraform.io/hashicorp/azurerm" { - version = "4.16.0" + version = "4.21.1" constraints = ">= 3.71.0" hashes = [ - "h1:HZdmFPnC/+x6si15pq4rGYv/1TrCcyQXLnDMqq1SONw=", - "zh:2035e461a94bd4180557a06f8e56f228a8a035608d0dac4d08e5870cf9265276", - "zh:3f15778a22ef1b9d0fa28670e5ea6ef1094b0be2533f43f350a2ef15d471b353", - "zh:4f1a4d03b008dd958bcd6bf82cf088fbaa9c121be2fd35e10e6b06c6e8f6aaa1", - "zh:5859f31c342364e849b4f8c437a46f33e927fa820244d0732b8d2ec74a95712d", - "zh:693d0f15512ca8c6b5e999b3a7551503feb06b408b3836bc6a6403e518b9ddab", - "zh:7f4912bec5b04f5156935292377c12484c13582151eb3c2555df409a7e5fb6e0", - "zh:bb9a509497f3a131c52fac32348919bf1b9e06c69a65f24607b03f7b56fb47b6", - "zh:c1b0c64e49ac591fd038ad71e71403ff71c07476e27e8da718c29f0028ea6d0d", - "zh:dd4ca432ee14eb0bb0cdc0bb463c8675b8ef02497be870a20d8dfee3e7fe52b3", - "zh:df58bb7fea984d2b11709567842ca4d55b3f24e187aa6be99e3677f55cbbe7da", + "h1:K4QidQiHvsJfLhTb7gwQuvGZuGZnXSD3ccQXWIV6cvE=", + "zh:0ba8a63b1b2572a8b04c122fd76fdca9a529b4ca3364cc1c8883341300285bf8", + "zh:1ba2e24a88aa54a87bde2c0519e3bf39a245c6ec1759fd671e96342b0bedc6c7", + "zh:22664d3bcad2c9ebecfb1165b076d2733c8a369a0f6d2b7f8f8ad2ee7eb64f03", + "zh:32128a565a615386e9020694d8ae9741ae6159ae46eaf0bfbd91b4fa45791af0", + "zh:33e7afa34ff2b0936abcad831e0971de58f9ac0debc024033dedcd9d01b5a1db", + "zh:540b27a9860d8a027dd1bc88bbf7a7b296e9476ff9f837fc0e48ff7e8a05d110", + "zh:6f8462409ab025182844b88b0c3c3b5368e06677a7e44f4edbcc473cd3cd873e", + "zh:7ab962e4d8401f0016199e97f7ca48cb9e9ee9e74a548579175ac1e6cd5c6189", + "zh:7b8f98dc6e26c9e5395ac1246c3876c1327d8e47b9894b3c8650a0f7b67bbc06", + "zh:8c40a9ec1b1f43cd60e6758316b7d2cb08bd2fa87260a37031de1156aa9c2a83", + "zh:c4908c33c404050528e0c0bd4d0567d139ddeb0f6f37f61a3c9c8c4e1af2fe2a", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - "zh:f7fb37704da50c096f9c7c25e8a95fe73ce1d3c5aab0d616d506f07bc5cfcdd8", ] } diff --git a/terraform/modules/aks/main.tf b/terraform/modules/aks/main.tf index b6a6717..0548e03 100644 --- a/terraform/modules/aks/main.tf +++ b/terraform/modules/aks/main.tf @@ -24,8 +24,8 @@ resource "azurerm_kubernetes_cluster" "aks" { } network_profile { - load_balancer_sku = "standard" - network_plugin = "kubenet" # CNI + network_plugin = "azure" + network_policy = "azure" } dynamic "oms_agent" { diff --git a/terraform/output.tf b/terraform/output.tf index ad450f9..b71f337 100644 --- a/terraform/output.tf +++ b/terraform/output.tf @@ -10,6 +10,10 @@ output "subscription" { value = data.azurerm_client_config.current.subscription_id } +output "cluster_connect_command" { + value = "az aks get-credentials --resource-group ${azurerm_resource_group.public.name} --name ${module.aks.name} --subscription ${var.subscription_id}" +} + output "grafana_endpoint" { value = length(module.grafana) > 0 ? module.grafana[0].grafana_endpoint : null } diff --git a/terraform/terraform.auto.tfvars.json b/terraform/terraform.auto.tfvars.json index 35fef16..e642697 100644 --- a/terraform/terraform.auto.tfvars.json +++ b/terraform/terraform.auto.tfvars.json @@ -8,9 +8,9 @@ "default_node_pool_type": "VirtualMachineScaleSets", "system_node_count": 3, "log_analytics_sku": "PerGB2018", - "should_deploy_acr": true, - "should_deploy_log_analytics": true, - "should_deploy_prometheus": true, + "should_deploy_acr": false, + "should_deploy_log_analytics": false, + "should_deploy_prometheus": false, "acr_name": "azuredevopsacrd01", "subscription_id": "f32f6566-8fa0-4198-9c91-a3b8ac69e89a", "tenant_id": "b40a105f-0643-4922-8e60-10fc1abf9c4b", From cd7da750d5f22052c56bb1be45a6bec48c5f590e Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Tue, 4 Mar 2025 02:02:29 +0100 Subject: [PATCH 06/10] command for monitoring --- .../helm-install-grafana-prometheus/Example.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kubernetes/helm-install-grafana-prometheus/Example.ps1 b/kubernetes/helm-install-grafana-prometheus/Example.ps1 index a970265..366b135 100644 --- a/kubernetes/helm-install-grafana-prometheus/Example.ps1 +++ b/kubernetes/helm-install-grafana-prometheus/Example.ps1 @@ -3,4 +3,15 @@ helm repo update kubectl create namespace monitoring helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring --set grafana.service.type=ClusterIP --set prometheus.service.type=ClusterIP kubectl get svc -n monitoring +kubectl --namespace monitoring get secret prometheus-grafana -o jsonpath="{.data.admin-password}" | ForEach-Object { [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($_)) } + +# Port mapping for grafana +$POD_NAME = kubectl --namespace monitoring get pod -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=prometheus" -o name +kubectl --namespace monitoring port-forward $POD_NAME 3000 + +# Port mapping for prometheus master +kubectl --namespace monitoring port-forward svc/prometheus-kube-prometheus-prometheus 9090:9090 + +# Port mapping for k8s metrics endpoint +kubectl --namespace monitoring port-forward svc/prometheus-kube-state-metrics 8080:8080 From 0d05d36bc42fd9841ea16a6c9e6afb9b4132c305 Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Tue, 4 Mar 2025 22:58:03 +0100 Subject: [PATCH 07/10] configure monitoring --- .../Example.ps1 | 3 +- .../monitoring-http-nginx-ingress.yaml | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 kubernetes/helm-install-grafana-prometheus/monitoring-http-nginx-ingress.yaml diff --git a/kubernetes/helm-install-grafana-prometheus/Example.ps1 b/kubernetes/helm-install-grafana-prometheus/Example.ps1 index 366b135..6469631 100644 --- a/kubernetes/helm-install-grafana-prometheus/Example.ps1 +++ b/kubernetes/helm-install-grafana-prometheus/Example.ps1 @@ -6,8 +6,7 @@ kubectl get svc -n monitoring kubectl --namespace monitoring get secret prometheus-grafana -o jsonpath="{.data.admin-password}" | ForEach-Object { [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($_)) } # Port mapping for grafana -$POD_NAME = kubectl --namespace monitoring get pod -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=prometheus" -o name -kubectl --namespace monitoring port-forward $POD_NAME 3000 +kubectl --namespace monitoring port-forward svc/prometheus-grafana 3000:80 # Port mapping for prometheus master kubectl --namespace monitoring port-forward svc/prometheus-kube-prometheus-prometheus 9090:9090 diff --git a/kubernetes/helm-install-grafana-prometheus/monitoring-http-nginx-ingress.yaml b/kubernetes/helm-install-grafana-prometheus/monitoring-http-nginx-ingress.yaml new file mode 100644 index 0000000..2441508 --- /dev/null +++ b/kubernetes/helm-install-grafana-prometheus/monitoring-http-nginx-ingress.yaml @@ -0,0 +1,47 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: ing-monitoring + namespace: monitoring + annotations: + nginx.ingress.kubernetes.io/enable-cors: 'true' + nginx.ingress.kubernetes.io/cors-allow-headers: 'Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,Accept-Language' + nginx.ingress.kubernetes.io/cors-max-age: '600' + nginx.ingress.kubernetes.io/proxy-body-size: '12m' + nginx.ingress.kubernetes.io/rewrite-target: '/' + nginx.ingress.kubernetes.io/use-regex: 'true' +spec: + ingressClassName: nginx + rules: + - host: prometheus-et.razumovsky.me + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: prometheus-kube-prometheus-prometheus + port: + number: 9090 + + - host: grafana-et.razumovsky.me + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: prometheus-grafana + port: + number: 80 + + - host: metrics-et.razumovsky.me + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: prometheus-kube-state-metrics + port: + number: 8080 From a21b28da098acd10c5048ce619943d287da8eec2 Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Wed, 5 Mar 2025 18:45:31 +0100 Subject: [PATCH 08/10] merge git attributes --- .gitattributes | 3 ++- terraform/.gitattributes | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 terraform/.gitattributes diff --git a/.gitattributes b/.gitattributes index 0f04fc1..ccf37d7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ * text=auto eol=lf *.html linguist-detectable=false *.cshtml linguist-detectable=false -*.htm linguist-detectable=false \ No newline at end of file +*.htm linguist-detectable=false +*.razor linguist-detectable=false diff --git a/terraform/.gitattributes b/terraform/.gitattributes deleted file mode 100644 index ccf37d7..0000000 --- a/terraform/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -* text=auto eol=lf -*.html linguist-detectable=false -*.cshtml linguist-detectable=false -*.htm linguist-detectable=false -*.razor linguist-detectable=false From 76100a8b94e4595ed0bdc7593fd05d5d9ad023d4 Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Wed, 5 Mar 2025 18:46:16 +0100 Subject: [PATCH 09/10] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4135572..3356937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,3 +26,6 @@ and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec - Configure CD with AKS and HELM - Helm deploy powershell script - Move ingress and certificates to HELM chart +- Install Prometheus Grafana Alert manager using HELM +- Configure ingress for Prometheus Grafana Alert manager +- Fix encoding From 6fc2a30a0341633a18bdab428cda6f4a7f834aef Mon Sep 17 00:00:00 2001 From: kolosovpetro Date: Wed, 5 Mar 2025 18:46:56 +0100 Subject: [PATCH 10/10] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3356937..bd30129 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,3 +29,4 @@ and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec - Install Prometheus Grafana Alert manager using HELM - Configure ingress for Prometheus Grafana Alert manager - Fix encoding +- Merge plan and plan-destroy terraform pipelines