Cant install chart with CronJob

Hi,
I try to install a chart with a CronJob:
helm install -f.\custom-values.yaml .\chart\ad-sync-service
And get the message:
Error: validation failed: unable to recognize “”: no matches for kind “CronJob” in version “”

The CronJob file works.
I start it before successfully, just situated outside of the chart folder with
kubectl apply -f cronjob.yaml
But now I moved the file into the chart folder to set a helm build.
The chart path is fine.

What could cause the error message?
Thanks for your help!
Frank

image

The long exception:
C:\workspace\BE-ad-sync-service\AdSyncService\AdSyncService> helm install -f.\custom-values.yaml .\chart\ad-sync-service\ --debug
[debug] Created tunnel using local port: ‘57259’

[debug] SERVER: “127.0.0.1:57259”

[debug] Original chart version: “”
[debug] CHART PATH: C:\workspace\BE-ad-sync-service\AdSyncService\AdSyncService\chart\ad-sync-service

Error: validation failed: unable to recognize “”: no matches for kind “CronJob” in version “”

Here the cronjob.yaml:

apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: ad-sync
creationTimestamp: 2019-02-15T09:10:20Z
namespace: default
selfLink: /apis/batch/v1beta1/namespaces/default/cronjobs/ad-sync
spec:
concurrencyPolicy: Allow
failedJobsHistoryLimit: 1
successfulJobsHistoryLimit: 3
suspend: false
schedule: “*/5 * * * *”
jobTemplate:
metadata:
labels:
job: ad-sync
spec:
template:
spec:
containers:
- name: ad-sync
image: foo.azurecr.io/foobar/ad-sync
envFrom:
- configMapRef:
name: ad-sync-service-configmap
command: [“dotnet”, “AdSyncService.dll”]
args:
restartPolicy: OnFailure

Can you share templated cronjob.yaml too, looking by the error my guess is apiVersion field is interpreted as “” by helm.

The cronjob.yaml you see above.

The crone job is working now.
The problem may be was that I wrote this and the other yaml files in visual studio.
Visual Studio creates an each line end a carriage return and a linefeed.
It should be only a linefeed, because the cron job is running on linux.
Frank

@frankmehlhop if you get ride of those carriage returns in the deployment file does it start working too?

@macintoshprime Yes.

Awesome! Glad to hear it works now :grinning:

Maybe I am having a same issue. Although mine does not have any error message.
I am installing it but cronjob is not there.