Ross
Ross

Reputation: 2417

Azure Pipelines Kubernetes Manifest - must be a directory to be a root

I have a pipeline I am trying to implement the Kubernetes Manifest bake action using a Kustomize render. However when I run this I get the following error:

##[error]Error: got file 'kustomization.yaml', but '/home/administrator/BA-L01/_work/80/s/Infrastructure/STARS.API.Web/overlays/devtest/kustomization.yaml' must be a directory to be a root

pipeline.yaml:

- task: KubernetesManifest@0
  displayName: Create Manifest Files
  name: bake
  inputs:
    action: 'bake'
    namespace: ''
    renderType: 'kustomize'
    kustomizationPath: 'Infrastructure/STARS.API.Web/overlays/devtest/kustomization.yaml'

Folder Structure:

STARS.API.Web
└── base
│   │   kustomization.yaml
│   │   service.yaml
│   │   deployment.yaml
│   
└── overlays
    └── devtest
        │   kustomization.yaml
        │   devtest-custom-values.yaml

../base/kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- service.yaml
- deployment.yaml

../devtest/kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - ../../base

patchesStrategicMerge:
  - devtest-custom-values.yaml

Upvotes: 1

Views: 1417

Answers (1)

chresse
chresse

Reputation: 5805

As the error message says, your kustomizationPath must point to the directory where your kustomization.yaml is located - not to the kustomization.yaml file.

So your pipeline.yaml has to be:

- task: KubernetesManifest@0
  displayName: Create Manifest Files
  name: bake
  inputs:
    action: 'bake'
    namespace: ''
    renderType: 'kustomize'
    kustomizationPath: 'Infrastructure/STARS.API.Web/overlays/devtest/'

Upvotes: 1

Related Questions