Skip to content

Commit

Permalink
DASD-8236 Add Create Namespace Step (#157)
Browse files Browse the repository at this point in the history
* 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
smneal and NickGraham101 authored Dec 7, 2020
1 parent 6858b71 commit 0627e06
Showing 1 changed file with 41 additions and 0 deletions.
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 }}'

0 comments on commit 0627e06

Please sign in to comment.