-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DASD-8236 Add Create Namespace Step (#157)
* Added create-kubernetes-namespace step template * Add validate to create namespace template * Update namespace, add exception template * Fix script ref * Update displayName * Updated script reference * Remove exception template Co-authored-by: NickGraham101 <[email protected]>
- Loading branch information
1 parent
6858b71
commit 0627e06
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
azure-pipelines-templates/deploy/step/create-kubernetes-namespace.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
parameters: | ||
AksResourceGroupName: | ||
AzureSubscription: | ||
AksClusterName: | ||
Namespace: | ||
Validate: false | ||
IsMultiRepoCheckout: true | ||
|
||
steps: | ||
- checkout: das-platform-automation | ||
- task: Kubernetes@1 | ||
displayName: kubectl get namespaces | ||
name: GetNamespaces | ||
inputs: | ||
connectionType: Azure Resource Manager | ||
azureSubscriptionEndpoint: ${{ parameters.AzureSubscription }} | ||
azureResourceGroup: ${{ parameters.AksResourceGroupName }} | ||
kubernetesCluster: ${{ parameters.AksClusterName }} | ||
useClusterAdmin: true | ||
command: 'get' | ||
arguments: 'namespace' | ||
- task: PowerShell@2 | ||
displayName: 'PowerShell: Test-KubernetesNamespaceExists.ps1' | ||
inputs: | ||
targetType: 'filePath' | ||
${{ if eq(parameters.IsMultiRepoCheckout, true) }}: | ||
filePath: das-platform-automation/Infrastructure-Scripts/Test-KubernetesNamespaceExists.ps1 | ||
${{ if eq(parameters.IsMultiRepoCheckout, false) }}: | ||
filePath: Infrastructure-Scripts/Test-KubernetesNamespaceExists.ps1 | ||
arguments: -KubectlOutput '$(GetNamespaces.KubectlOutput)' -Namespace ${{ parameters.Namespace }} -Verbose | ||
- task: Kubernetes@1 | ||
displayName: kubectl create ${{ parameters.Namespace }} namespace | ||
condition: and(succeeded(), eq(variables.NamespaceExists, 'false'), eq('${{ parameters.Validate }}', false)) | ||
inputs: | ||
connectionType: Azure Resource Manager | ||
azureSubscriptionEndpoint: ${{ parameters.AzureSubscription }} | ||
azureResourceGroup: ${{ parameters.AksResourceGroupName }} | ||
kubernetesCluster: ${{ parameters.AksClusterName }} | ||
useClusterAdmin: true | ||
command: 'create' | ||
arguments: 'namespace ${{ parameters.Namespace }}' |