Skip to content

Commit

Permalink
feat: Aks upgrade to 1.26 (#68)
Browse files Browse the repository at this point in the history
* add updated scripts

* update aks version and transform ingress values

* add new nginx-controller v.1.8.1

* add ingressClassResource to nginx

* vnet peering

* update kubernetes version

---------

Co-authored-by: fmlisco <{ID}+{username}@users.noreply.github.com>
  • Loading branch information
diegolagospagopa and fmlisco authored Jul 16, 2023
1 parent e56759d commit 3130ae3
Show file tree
Hide file tree
Showing 8 changed files with 283 additions and 229 deletions.
4 changes: 4 additions & 0 deletions src/aks-platform/05_ingress.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ module "nginx_ingress" {
name = "controller.replicaCount"
value = var.ingress_replica_count
},
{
name = "controller.service.annotations.service\\.beta\\.kubernetes\\.io/azure-load-balancer-health-probe-request-path"
value = "/healthz"
},
{
name = "controller.nodeSelector.beta\\.kubernetes\\.io/os"
value = "linux"
Expand Down
4 changes: 2 additions & 2 deletions src/aks-platform/env/dev01/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public_ip_aksoutbound_name = "dvopla-d-dev01-aksoutbound-pip-1"
aks_enabled = true
aks_private_cluster_enabled = false
aks_alerts_enabled = false
aks_kubernetes_version = "1.23.8"
aks_kubernetes_version = "1.26.3"
aks_system_node_pool = {
name = "dvldev01sys",
vm_size = "Standard_B2ms",
vm_size = "Standard_B4ms",
os_disk_type = "Managed",
os_disk_size_gb = 75,
node_count_min = 1,
Expand Down
172 changes: 0 additions & 172 deletions src/aks-platform/k8setup.sh

This file was deleted.

1 change: 1 addition & 0 deletions src/aks-platform/k8setup.sh
29 changes: 15 additions & 14 deletions src/aks-platform/scripts/k8setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set -e
############################################################

# Global variables
VERS="1.1"
VERS="1.2"
# Gestisce le diverse posizioni di "ENV"
THISENV=$(ls -d ./env 2>/dev/null || ls -d ../env 2>/dev/null)

Expand All @@ -23,12 +23,10 @@ function print_usage() {
echo "-------------------------------------------------------------------------"
echo "Usage: cd <scripts folder>"
echo " ./k8setup.sh <ENV>"
cd ../env
for thisenv in *
for thisenv in ${THISENV}
do
echo " Example: ./k8setup.sh ${thisenv}"
done
cd ../scripts
echo
echo "Syntax: setup.sh [-l|h|k|s]"
echo " options:"
Expand Down Expand Up @@ -74,13 +72,13 @@ function check_env() {
ENV=$1

# Check if env has been properly entered
if [ ! -d "../env/$ENV" ]; then
if [ ! -d "${THISENV}/$ENV" ]; then
echo "[ERROR] ENV should be one of:"
ls "../env"
ls -1 ${THISENV}
exit 1
fi

env_file_path="../env/${ENV}/backend.ini"
env_file_path="${THISENV}/${ENV}/backend.ini"

# Check if backend.ini exists
if [ -f "$env_file_path" ]; then
Expand Down Expand Up @@ -169,23 +167,23 @@ function setup() {
exit 1
fi


az aks get-credentials -g "${aks_resource_group_name}" -n "${aks_name}" --subscription "${subscription}" --file "${HOME_DIR}/.kube/config-${aks_name}"
# convert configuration format
kubelogin convert-kubeconfig -l azurecli --kubeconfig "${HOME_DIR}/.kube/config-${aks_name}"
# verify connection with k8s cluster
echo "Checking connection to AKS cluster ${aks_name}"
kubectl --kubeconfig="${HOME_DIR}/.kube/config-${aks_name}" get namespaces

# merge cluster configuration into global configuration
az aks get-credentials -g "${aks_resource_group_name}" -n "${aks_name}" --subscription "${subscription}" --overwrite-existing
# convert global configuration format
kubelogin convert-kubeconfig -l azurecli

# with AAD auth enabled we need to authenticate the machine on the first setup
echo "Follow Microsoft sign in steps. kubectl get namespaces command may fail but it's the expected behavior"
kubectl config use-context "${aks_name}"
kubectl get namespaces

# convert configuration format
for confg in /Users/"$(whoami)"/.kube/config*; do
kubelogin convert-kubeconfig -l azurecli --kubeconfig "$confg"
done
}

# Main program
Expand All @@ -197,7 +195,10 @@ while getopts ":hlks-:" option; do
k) # kubelogin convert kubeconfig
echo "converting kubeconfig to use azurecli login mode."
installpkg "kubelogin"
kubelogin convert-kubeconfig -l azurecli
for confg in /Users/"$(whoami)"/.kube/config*; do
kubelogin convert-kubeconfig -l azurecli --kubeconfig "$confg"
echo "${confg} converted!"
done
exit;;
l) # list available environments
echo "Available environment(-s):"
Expand All @@ -213,7 +214,7 @@ while getopts ":hlks-:" option; do
kubelogin convert-kubeconfig -l azurecli --kubeconfig "$confg"
echo "${confg} converted!"
done
exit;;
exit;;
*) # Invalid option
echo "Error: Invalid option"
echo ""
Expand Down
Loading

0 comments on commit 3130ae3

Please sign in to comment.