-
Notifications
You must be signed in to change notification settings - Fork 3
/
Initialize-Cluster.ps1
32 lines (22 loc) · 1.11 KB
/
Initialize-Cluster.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#Requires -Version 3.0
Param(
[Parameter(Mandatory=$True)]
[string]
$EnvironmentTag
)
# stop the script on first error
$ErrorActionPreference = 'Stop'
#******************************************************************************
# Script body
#******************************************************************************
Write-Host "Initializing cluster... Using kubectl context: "
kubectl config current-context
Write-Host "Initializing helm..."
helm init
Write-Host "Initializing registry secret..."
$imagePullSecreteName = "devicecache-registry"
$registryUrl = ("cadevcache" + $EnvironmentTag + "registry.azurecr.io")
$keyVaultName = "ca-devcache-$EnvironmentTag"
$registryUsername = (Get-AzureKeyVaultSecret -VaultName $keyVaultName -SecretName registryAdminUsername).SecretValueText
$registryPassword = (Get-AzureKeyVaultSecret -VaultName $keyVaultName -SecretName registryAdminPassword).SecretValueText
kubectl create secret docker-registry $imagePullSecreteName --docker-server=$registryUrl --docker-username=$registryUsername --docker-password=$registryPassword --docker-email=reallynotimportant@contoso.com