ps/Modules/Alkami.DevOps.Minikube/Public/Reset-MinikubeServices.ps1

47 lines
1.8 KiB
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Reset-MinikubeServices {
<#
.SYNOPSIS
Resets Minikube services to match those defined in the service version and configuration files
.DESCRIPTION
Use this function to reset your cluster to match your service(s) configuration files.
.PARAMETER Force
[switch] Will force a complete reinstallation and sync up between the services config file and the Minikube cluster. Use this when removing or excluding a service from the configuration.
.EXAMPLE
Refresh-Services -Force
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[switch]$Force
)
$ErrorActionPreference = "Stop"
$logLead = (Get-LogLeadName)
$config = Get-MinikubeConfigurationInformation
if ($Force.IsPresent)
{
Write-Host "$loglead : Forcing refresh of services..."
Write-Host "$loglead : Deleting localhost namespace..."
kubectl delete ns localhost
Write-Host "$loglead : Creating localhost namespace..."
kubectl create ns localhost
Write-Host "$loglead : Refreshing Minikube secrets..."
Reset-MinikubeSecrets
Write-Host "$loglead : Installing alkami-local-dev services..."
helm install alkami-local-dev --repo https://packagerepo.orb.alkamitech.com/helm/helm-charts $config.helmChartName -n localhost --create-namespace --dependency-update -f $config.localServiceVersionsFilePath -f $config.localServiceCustomizationsFilePath
}
else
{
Write-Host "$loglead : Upgrading alkami-local-dev services..."
helm upgrade alkami-local-dev --repo https://packagerepo.orb.alkamitech.com/helm/helm-charts $config.helmChartName -n localhost --create-namespace --dependency-update -f $config.localServiceVersionsFilePath -f $config.localServiceCustomizationsFilePath
}
}