-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add kubernetes-create-acr-secret template
- Loading branch information
1 parent
5dabf45
commit ba5e9e2
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
AzureDevOpsTemplates/Deploy/StepTemplates/kubernetes-create-acr-secret.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,54 @@ | ||
parameters: | ||
AzureSubscription: | ||
ContainerRegistryAdminUser: | ||
ContainerRegistryName: | ||
ContainerRegistryPassword: | ||
ClusterName: | ||
Namespace: | ||
ResourceGroup: | ||
Condition: true | ||
|
||
steps: | ||
- task: Kubernetes@1 | ||
condition: and(${{ parameters.Condition }}, succeeded()) | ||
displayName: kubectl login | ||
inputs: | ||
connectionType: Azure Resource Manager | ||
azureSubscriptionEndpoint: ${{ parameters.AzureSubscription }} | ||
azureResourceGroup: ${{ parameters.ResourceGroup }} | ||
kubernetesCluster: ${{ parameters.ClusterName }} | ||
useClusterAdmin: true | ||
command: login | ||
- task: Kubernetes@1 | ||
condition: and(${{ parameters.Condition }}, succeeded()) | ||
continueOnError: true | ||
displayName: kubectl delete ACR secret ${{ parameters.Namespace }} | ||
inputs: | ||
connectionType: Azure Resource Manager | ||
azureSubscriptionEndpoint: ${{ parameters.AzureSubscription }} | ||
azureResourceGroup: ${{ parameters.ResourceGroup }} | ||
kubernetesCluster: ${{ parameters.ClusterName }} | ||
useClusterAdmin: true | ||
namespace: ${{ parameters.Namespace }} | ||
command: delete | ||
arguments: secret gandtsharedcr-cred | ||
- task: Kubernetes@1 | ||
condition: and(${{ parameters.Condition }}, succeeded()) | ||
displayName: kubectl create ACR secret ${{ parameters.Namespace }} | ||
inputs: | ||
connectionType: Azure Resource Manager | ||
azureSubscriptionEndpoint: ${{ parameters.AzureSubscription }} | ||
azureResourceGroup: ${{ parameters.ResourceGroup }} | ||
kubernetesCluster: ${{ parameters.ClusterName }} | ||
useClusterAdmin: true | ||
namespace: ${{ parameters.Namespace }} | ||
command: create | ||
arguments: secret docker-registry gandtsharedcr-cred --docker-server=${{ parameters.ContainerRegistryName }}.azurecr.io --docker-username=${{ parameters.ContainerRegistryAdminUser}} --docker-password=${{ parameters.ContainerRegistryPassword }} | ||
- task: PowerShell@2 | ||
condition: and(${{ parameters.Condition }}, succeeded()) | ||
displayName: kubectl patch serviceaccount ${{ parameters.Namespace }} | ||
inputs: | ||
targetType: inline | ||
script: > | ||
kubectl patch serviceaccount default -n ${{ parameters.Namespace }} -p '{\"imagePullSecrets\": [{\"name\": \"gandtsharedcr-cred\"}]}' | ||
pwsh: true |