From d0b78953840adef506b413920016aa4b7731a373 Mon Sep 17 00:00:00 2001 From: samarth3112 Date: Thu, 14 Apr 2022 18:30:34 +0530 Subject: [PATCH 1/4] tsst --- .github/workflows/deploytoAKS.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploytoAKS.yml b/.github/workflows/deploytoAKS.yml index 12bf4c7..f268945 100644 --- a/.github/workflows/deploytoAKS.yml +++ b/.github/workflows/deploytoAKS.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup .NET Core SDK - uses: actions/setup-dotnet@v1.5.0 + uses: actions/setup-dotnet@v2 with: # SDK version to use. Examples: 2.2.104, 3.1, 3.1.x dotnet-version: 3.1.x From c8a2357f166c6b8a17bb86c9964dc5654dd28fa7 Mon Sep 17 00:00:00 2001 From: samarth3112 Date: Thu, 14 Apr 2022 18:53:02 +0530 Subject: [PATCH 2/4] added azure login --- .github/workflows/deploytoAKS.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/deploytoAKS.yml b/.github/workflows/deploytoAKS.yml index f268945..2c182c8 100644 --- a/.github/workflows/deploytoAKS.yml +++ b/.github/workflows/deploytoAKS.yml @@ -43,6 +43,18 @@ jobs: - name: push docker image run: docker push '${{secrets.DOCKER_LOGIN}}'/githubactions-aks-demo:'${{github.sha}}' + - name: 'Az CLI login' + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - name: 'Run Azure CLI commands' + run: | + az account show + az group list + pwd # - name: Azure Kubernetes set context # uses: Azure/aks-set-context@v1 # with: From d54e72e015f5f6c0c4af1f24b500c66401fb131d Mon Sep 17 00:00:00 2001 From: samarth3112 Date: Thu, 14 Apr 2022 18:57:55 +0530 Subject: [PATCH 3/4] commit to testk8 --- .github/workflows/deploytoAKS.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploytoAKS.yml b/.github/workflows/deploytoAKS.yml index 2c182c8..9560efb 100644 --- a/.github/workflows/deploytoAKS.yml +++ b/.github/workflows/deploytoAKS.yml @@ -54,7 +54,14 @@ jobs: run: | az account show az group list - pwd + pwd + - name: set cotext + uses: azure/aks-set-context@v2.0 + with: + resource-group: "samarth-resources-msdn" + cluster-name: "test-ingress" + + # - name: Azure Kubernetes set context # uses: Azure/aks-set-context@v1 # with: From 99eb0ee80f3cf3c76ec9496bb5c4a02b81cfaf06 Mon Sep 17 00:00:00 2001 From: samarth3112 Date: Thu, 14 Apr 2022 19:10:44 +0530 Subject: [PATCH 4/4] deploy --- .github/workflows/deploytoAKS.yml | 92 +++++++++++++------------------ 1 file changed, 38 insertions(+), 54 deletions(-) diff --git a/.github/workflows/deploytoAKS.yml b/.github/workflows/deploytoAKS.yml index 9560efb..dcea905 100644 --- a/.github/workflows/deploytoAKS.yml +++ b/.github/workflows/deploytoAKS.yml @@ -43,62 +43,46 @@ jobs: - name: push docker image run: docker push '${{secrets.DOCKER_LOGIN}}'/githubactions-aks-demo:'${{github.sha}}' - - name: 'Az CLI login' - uses: azure/login@v1 + - name: Azure Kubernetes set context + uses: Azure/aks-set-context@v1 with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + # Azure credentials i.e. output of `az ad sp create-for-rbac --sdk-auth` + creds: '${{secrets.AZURE_CREDENTIALS}}' + # Resource Group Name + resource-group: samarth-resources-msdn + # AKS Cluster Name + cluster-name: test-ingress - - name: 'Run Azure CLI commands' - run: | - az account show - az group list - pwd - - name: set cotext - uses: azure/aks-set-context@v2.0 + # Create K8s secrets to pull images + - name: Create secret in Kubernetes cluster + uses: Azure/k8s-create-secret@v1.1 with: - resource-group: "samarth-resources-msdn" - cluster-name: "test-ingress" - - - # - name: Azure Kubernetes set context - # uses: Azure/aks-set-context@v1 - # with: - # # Azure credentials i.e. output of `az ad sp create-for-rbac --sdk-auth` - # creds: '${{secrets.AZURE_CREDENTIALS}}' - # # Resource Group Name - # resource-group: aks-demo-rg - # # AKS Cluster Name - # cluster-name: ga-aks-demo-cluster - - # # Create K8s secrets to pull images - # - name: Create secret in Kubernetes cluster - # uses: Azure/k8s-create-secret@v1.1 - # with: - # # Container registry url - # container-registry-url: https://index.docker.io/v1/ - # # Container registry username - # container-registry-username: '${{secrets.DOCKER_LOGIN}}' - # # Container registry password - # container-registry-password: '${{secrets.DOCKER_PASSWORD}}' - # # Type of Kubernetes secret. For example, docker-registry or generic - # secret-type: docker-registry - # # Name of the secret. You can use this secret name in the Kubernetes YAML configuration file. - # secret-name: docker-image-pull-secret + # Container registry url + container-registry-url: https://index.docker.io/v1/ + # Container registry username + container-registry-username: '${{secrets.DOCKER_LOGIN}}' + # Container registry password + container-registry-password: '${{secrets.DOCKER_PASSWORD}}' + # Type of Kubernetes secret. For example, docker-registry or generic + secret-type: docker-registry + # Name of the secret. You can use this secret name in the Kubernetes YAML configuration file. + secret-name: docker-image-pull-secret + + # Deploy to k8s cluster + - name: Deploy to Kubernetes cluster + uses: Azure/k8s-deploy@v1 + with: + # Path to the manifest files which will be used for deployment. + manifests: | + k8s/deployment.yml + k8s/service.yml + # Fully qualified resource URL of the image(s) to be used for substitutions on the manifest files Example: contosodemo.azurecr.io/helloworld:test + images: '${{secrets.DOCKER_LOGIN}}/githubactions-aks-demo:${{github.sha}}' + # Name of a docker-registry secret that has already been set up within the cluster. Each of these secret names are added under imagePullSecrets field for the workloads found in the input manifest files + imagepullsecrets: docker-image-pull-secret + # deploy/promote/reject + action: deploy - # # Deploy to k8s cluster - # - name: Deploy to Kubernetes cluster - # uses: Azure/k8s-deploy@v1 - # with: - # # Path to the manifest files which will be used for deployment. - # manifests: | - # k8s/deployment.yml - # k8s/service.yml - # # Fully qualified resource URL of the image(s) to be used for substitutions on the manifest files Example: contosodemo.azurecr.io/helloworld:test - # images: '${{secrets.DOCKER_LOGIN}}/githubactions-aks-demo:${{github.sha}}' - # # Name of a docker-registry secret that has already been set up within the cluster. Each of these secret names are added under imagePullSecrets field for the workloads found in the input manifest files - # imagepullsecrets: docker-image-pull-secret - # # deploy/promote/reject - # action: deploy + + \ No newline at end of file