Removed Log Analytics resources from sample as not used in article

This commit is contained in:
Tom Archer 2023-05-26 11:37:59 -07:00
parent d0a579d375
commit fe231e8d91
4 changed files with 85 additions and 49 deletions

View File

@ -0,0 +1,85 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: azure-vote-back
spec:
replicas: 1
selector:
matchLabels:
app: azure-vote-back
template:
metadata:
labels:
app: azure-vote-back
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: azure-vote-back
image: mcr.microsoft.com/oss/bitnami/redis:6.0.8
env:
- name: ALLOW_EMPTY_PASSWORD
value: "yes"
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 6379
name: redis
---
apiVersion: v1
kind: Service
metadata:
name: azure-vote-back
spec:
ports:
- port: 6379
selector:
app: azure-vote-back
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: azure-vote-front
spec:
replicas: 1
selector:
matchLabels:
app: azure-vote-front
template:
metadata:
labels:
app: azure-vote-front
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: azure-vote-front
image: mcr.microsoft.com/azuredocs/azure-vote-front:v1
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
env:
- name: REDIS
value: "azure-vote-back"
---
apiVersion: v1
kind: Service
metadata:
name: azure-vote-front
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: azure-vote-front

View File

@ -14,30 +14,6 @@ locals {
current_user_id = coalesce(var.msi_id, data.azurerm_client_config.current.object_id)
}
resource "random_pet" "azurerm_log_analytics_workspace_name" {
prefix = "ws"
}
resource "azurerm_log_analytics_workspace" "test" {
location = var.log_analytics_workspace_location
name = random_pet.azurerm_log_analytics_workspace_name.id
resource_group_name = azurerm_resource_group.rg.name
sku = var.log_analytics_workspace_sku
}
resource "azurerm_log_analytics_solution" "test" {
location = azurerm_log_analytics_workspace.test.location
resource_group_name = azurerm_resource_group.rg.name
solution_name = "ContainerInsights"
workspace_name = azurerm_log_analytics_workspace.test.name
workspace_resource_id = azurerm_log_analytics_workspace.test.id
plan {
product = "OMSGallery/ContainerInsights"
publisher = "Microsoft"
}
}
resource "random_pet" "azurerm_kubernetes_cluster_name" {
prefix = "cluster"
}

View File

@ -6,10 +6,6 @@ output "kubernetes_cluster_name" {
value = azurerm_kubernetes_cluster.k8s.name
}
output "log_analytics_workspace_name" {
value = azurerm_log_analytics_workspace.test.name
}
output "client_certificate" {
value = azurerm_kubernetes_cluster.k8s.kube_config[0].client_certificate
sensitive = true

View File

@ -16,27 +16,6 @@ variable "node_count" {
default = 3
}
# For available Log Analytics regions, refer to:
# https://azure.microsoft.com/global-infrastructure/services/?products=monitor
variable "log_analytics_workspace_location" {
type = string
default = "eastus"
description = "Location of the Log Analytics workspace."
}
# For Log Analytics pricing, refer to:
# https://azure.microsoft.com/pricing/details/monitor
variable "log_analytics_workspace_sku" {
type = string
description = "The SKU of the Log Analytics workspace. Choose from: Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, PerGB2018"
default = "PerGB2018"
validation {
condition = contains(["Free", "PerNode", "Premium", "Standard", "Standalone", "Unlimited", "CapacityReservation", "PerGB2018"], var.log_analytics_workspace_sku)
error_message = "The Log Analytics workspace SKU must be one of the following: Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, PerGB2018"
}
}
variable "msi_id" {
type = string
description = "The Managed Service Identity ID used to create the service principal. If this value is null (the default), the AzureRM provider configuration Object ID is used.."