Skip to content

Commit

Permalink
added 230
Browse files Browse the repository at this point in the history
  • Loading branch information
Houssem Dellai committed Jul 15, 2024
1 parent e4ad49c commit 9f0683e
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 333 deletions.
308 changes: 81 additions & 227 deletions 230_ingress_apim/README.md

Large diffs are not rendered by default.

Binary file modified 230_ingress_apim/images/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 230_ingress_apim/images/resources.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 0 additions & 17 deletions 230_ingress_apim/kubernetes/2-ingress.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions 230_ingress_apim/kubernetes/5-nginx-internal-controller.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions 230_ingress_apim/kubernetes/6-ingress-internal.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,22 @@ spec:
- port: 80
targetPort: 3500
selector:
app: webapi
app: webapi
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: webapi
namespace: webapi
spec:
ingressClassName: nginx
rules:
- http:
paths:
- backend:
service:
name: webapi
port:
number: 80
path: /
pathType: Prefix
18 changes: 18 additions & 0 deletions 230_ingress_apim/kubernetes/install-nginx-ingress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use Helm to deploy an NGINX ingress controller

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update

helm install ingress-nginx ingress-nginx/ingress-nginx \
--version 4.11.0 \
--namespace ingress-nginx \
--set controller.replicaCount=2 \
--set controller.nodeSelector."kubernetes\.io/os"=linux \
--set controller.admissionWebhooks.patch.nodeSelector."kubernetes\.io/os"=linux \
--set controller.service.loadBalancerIP=10.10.0.10 \
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-internal"=true \
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path"=/healthz

kubectl get pods,deployments,services --namespace ingress-nginx

kubectl get services ingress-nginx-controller -n ingress-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
4 changes: 2 additions & 2 deletions 230_ingress_apim/terraform/aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "azurerm_kubernetes_cluster" "aks" {
}

web_app_routing {
dns_zone_id = null # azurerm_dns_zone.dns_zone.id
dns_zone_ids = null
}

lifecycle {
Expand All @@ -35,7 +35,7 @@ resource "azurerm_kubernetes_cluster" "aks" {
}
}

# Required to create internal Load Balancer
# Required to create internal Load Balancer for Nginx Ingress Controller
resource "azurerm_role_assignment" "network-contributor" {
scope = azurerm_subnet.snet-aks.id
role_definition_name = "Network Contributor"
Expand Down
4 changes: 2 additions & 2 deletions 230_ingress_apim/terraform/apim-ingress.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "azurerm_api_management_api" "api-albums" {
path = "albums"
api_type = "http" # graphql, http, soap, and websocket
protocols = ["http", "https"]
service_url = "http://10.10.0.7/albums"
service_url = "http://10.10.0.7/albums" # Private IP of the Ingress Controller
subscription_required = false
}

Expand All @@ -20,4 +20,4 @@ resource "azurerm_api_management_api_operation" "operation-get-albums" {
method = "GET"
url_template = "/"
description = "GET returns sample JSON file."
}
}
4 changes: 2 additions & 2 deletions 230_ingress_apim/terraform/apim.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ resource "azurerm_public_ip" "pip-apim" {
allocation_method = "Static"
sku = "Standard"
zones = ["1"]
domain_name_label = "apim-external-${var.prefix}"
domain_name_label = "apim-ext-${var.prefix}"
}

resource "azurerm_api_management" "apim" {
name = "apim-external-${var.prefix}"
name = "apim-external-aks-${var.prefix}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
publisher_name = "My Company"
Expand Down
3 changes: 3 additions & 0 deletions 230_ingress_apim/terraform/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "api_url" {
value = "${azurerm_api_management.apim.gateway_url}/${azurerm_api_management_api.api-albums.path}"
}
5 changes: 0 additions & 5 deletions 230_ingress_apim/terraform/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ terraform {
source = "hashicorp/azurerm"
version = "= 3.112.0"
}

azapi = {
source = "Azure/azapi"
version = ">= 1.12.1"
}
}
}

Expand Down
51 changes: 0 additions & 51 deletions 230_ingress_apim/terraform/testplan.jmx

This file was deleted.

0 comments on commit 9f0683e

Please sign in to comment.