MicrosoftDocs / mslearn-aks-deployment-pipeline-github-actions

Sample code for the MS Learn module for AKS with GitHub Actions
Creative Commons Attribution 4.0 International
17 stars 667 forks source link

Helm deployment failed with error "unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "Ingress" in version "v1"" #10

Open erezbatish opened 2 years ago

erezbatish commented 2 years ago

Hi In step unit 10 Create the deployment pipeline

When running the workflow build-latest.yaml

I'm getting the following error on Run Helm Deploy step:

Error: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "Ingress" in version "v1" Error: Process completed with exit code 1.

This is how my workflow looks like:

__name: Build and push the latest build to staging

on: push: branches: [ main ]

jobs: build_push_image: runs-on: ubuntu-latest

steps:
  - uses: actions/checkout@v2

  - name: Build and push staging image
    uses: docker/build-push-action@v1.1.1
    with:
      username: ${{ secrets.ACR_LOGIN }}
      password: ${{ secrets.ACR_PASSWORD }}
      registry: ${{ secrets.ACR_NAME }}
      repository: contoso-website
      tags: latest

_deploy: runs-on: ubuntu-latest needs: build_push_image

steps:
  - uses: actions/checkout@v2

  - name: Install Helm
    uses: Azure/setup-helm@v1
    with:
      version: v3.3.1

  - name: Get AKS Credentials
    uses: Azure/aks-set-context@v1
    with:
      creds: ${{ secrets.AZURE_CREDENTIALS }}
      resource-group: mslearn-gh-pipelines-8235
      cluster-name: contoso-video
  - name: Run Helm Deploy
    run: |
      helm upgrade \
        --install \
        --create-namespace \
        --atomic \
        --wait \
        --namespace staging \
        contoso-website \
        ./kubernetes/contoso-website \
        --set image.repository=${{ secrets.ACR_NAME }} \
        --set dns.name=${{ secrets.DNS_NAME }}__

Please advise_

erezbatish commented 2 years ago

It seems like the Ingress.yaml manifest is in old version format and need to be updated to the current Ingress version. This is the current ingress.yaml manifest:

apiVersion: v1
kind: Ingress
metadata:
  name: contoso-website
  namespace: {{ default "staging" .Release.Namespace }}
  annotations:
    kubernetes.io/ingress.class: addon-http-application-routing
spec:
  rules:
    - host: contoso.!DNS!
      http:
        paths:
          - backend:
              serviceName: contoso-website
              servicePort: http
            path: /

Any advise on how to re-write it and update it to recent versions?