'Django kubernetes error error converting YAML to JSON: yaml: line 11: mapping values are not allowed in this context

im using Django and kubernetes to create a website and when i run

 helm upgrade --install --dry-run --debug django-test ./helm/django-website

there seems to be a problem with deploypment.yaml but i cant seem to find the issue ive tried multiple methods from forms and used yaml checkers but i cannot fix it i dont know why it has a problem to begin with because the program generated it all i added was

command: ["make", "start-server"] on line 36

here is the code for deployment.yaml


apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "django-website.fullname" . }}
  labels:
    {{ include "django-website.labels" . | nindent 4 }}
spec:
  {{ if not .Values.autoscaling.enabled }}
    replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "django-website.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      {{- with .Values.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "django-website.selectorLabels" . | nindent 8 }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "django-website.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          command: ["make", "start-server"]
          env:
          {{- include "django-website.db.env" . | nindent 10 -}}
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}

here is the error code when running helm upgrade


helm upgrade --install --dry-run --debug django-test ./helm/django-website
history.go:56: [debug] getting history for release django-test
load.go:120: Warning: Dependencies are handled in Chart.yaml since apiVersion "v2". We recommend migrating dependencies to Chart.yaml.
upgrade.go:142: [debug] preparing upgrade for django-test
Error: UPGRADE FAILED: YAML parse error on django-website/templates/deployment.yaml: error converting YAML to JSON: yaml: line 11: mapping values are not allowed in this context
helm.go:84: [debug] error converting YAML to JSON: yaml: line 11: mapping values are not allowed in this context
YAML parse error on django-website/templates/deployment.yaml
helm.sh/helm/v3/pkg/releaseutil.(*manifestFile).sort
    helm.sh/helm/v3/pkg/releaseutil/manifest_sorter.go:146
helm.sh/helm/v3/pkg/releaseutil.SortManifests
    helm.sh/helm/v3/pkg/releaseutil/manifest_sorter.go:106
helm.sh/helm/v3/pkg/action.(*Configuration).renderResources
    helm.sh/helm/v3/pkg/action/action.go:165
helm.sh/helm/v3/pkg/action.(*Upgrade).prepareUpgrade
    helm.sh/helm/v3/pkg/action/upgrade.go:234
helm.sh/helm/v3/pkg/action.(*Upgrade).RunWithContext
    helm.sh/helm/v3/pkg/action/upgrade.go:143
main.newUpgradeCmd.func2
    helm.sh/helm/v3/cmd/helm/upgrade.go:197
github.com/spf13/cobra.(*Command).execute
    github.com/spf13/[email protected]/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
    github.com/spf13/[email protected]/command.go:974
github.com/spf13/cobra.(*Command).Execute
    github.com/spf13/[email protected]/command.go:902
main.main
    helm.sh/helm/v3/cmd/helm/helm.go:83
runtime.main
    runtime/proc.go:255
runtime.goexit
    runtime/asm_arm64.s:1133
UPGRADE FAILED
main.newUpgradeCmd.func2
    helm.sh/helm/v3/cmd/helm/upgrade.go:199
github.com/spf13/cobra.(*Command).execute
    github.com/spf13/[email protected]/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
    github.com/spf13/[email protected]/command.go:974
github.com/spf13/cobra.(*Command).Execute
    github.com/spf13/[email protected]/command.go:902
main.main
    helm.sh/helm/v3/cmd/helm/helm.go:83
runtime.main
    runtime/proc.go:255
runtime.goexit
    runtime/asm_arm64.s:1133 

the checker seems to think its a problem with line 7 to 11 but when i do fix that it causes more issue

does anyone know how to fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source