-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInitDeploy.ps1
36 lines (28 loc) · 965 Bytes
/
InitDeploy.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
33
34
35
36
param (
[string]$target = "local"
)
$name = "buildversionsapi"
$namespace = "buildversions"
$registryHost = "registry:5000"
$kubeseal = "c:\apps\kubeseal\kubeseal.exe"
if($target -eq "local")
{
$kubeconfig = $env:KUBECONFIG
}
else
{
$kubeconfig = $env:KUBECONFIGX
}
$semanticVersion = "0.0.0.dev-9"
"Current deploy: ${registryHost}/${name}:${semanticVersion}"
kubectl apply -f ./deploy/${target}/namespace.yaml --kubeconfig $kubeconfig
cd ./deploy/${target}/${name}
kustomize edit set image "${registryHost}/${name}:${semanticVersion}"
if(Test-Path -Path ./secrets/*)
{
"Creating secrets"
kubectl create secret generic ${name}-secret --output json --dry-run=client --from-file=./secrets --validate=false --kubeconfig $kubeconfig |
&${kubeseal} -n $namespace --controller-namespace kube-system --format yaml --validate=false --kubeconfig $kubeconfig > "secret.yaml"
}
cd ../../..
kubectl apply -k ./deploy/${target}/${name} --kubeconfig $kubeconfig