microclimate-dev2ops / microclimate-dev2ops.github.io

The Microclimate website
https://microclimate-dev2ops.github.io
13 stars 19 forks source link

Helm install command failing for same deployment yaml #64

Open arjunsbabu opened 5 years ago

arjunsbabu commented 5 years ago

Issue type: Question Reported in: 1.10 Description of issue: I am trying deploying deployment in two git branches. One is successful and other is failing. The chart folder is same in both and all files..

Workaround (if possible): Recreating the branch by clonning working one will solve the issue. But like to know the reason

Error in devops pod

``

time="2019-05-09T13:50:15Z" level=info msg="Helm certificates detected"
time="2019-05-09T13:50:15Z" level=info msg="Issuing Helm command with arguments `[upgrade --install --wait --namespace myhealthcoach --values chart-845131195/pipeline.yaml dohmhc-98462966-adc0-4701-9dd5-e6401b6c3f9a chart-845131195/chart/dohnodemhc --tls --tls-ca-cert=/msb_helm_sec/ca.pem --tls-cert=/msb_helm_sec/cert.pem --tls-key=/msb_helm_sec/key.pem]`"
time="2019-05-09T13:50:15Z" level=info msg="Release "dohmhc-98462966-adc0-4701-9dd5-e6401b6c3f9a" does not exist. Installing it now.
Error: YAML parse error on dohmhc/templates/deployment.yaml: error converting YAML to JSON: yaml: invalid map key: map[interface {}]interface {}{".Values.replicaCount":interface {}(nil)}
"
time="2019-05-09T13:50:15Z" level=error msg="Error executing `upgrade --install --wait --namespace myhealthcoach --values chart-845131195/pipeline.yaml dohmhc-98462966-adc0-4701-9dd5-e6401b6c3f9a chart-845131195/chart/dohnodemhc`: exit status 1"
time="2019-05-09T13:50:27Z" level=debug msg="In status interval"
sishida commented 5 years ago

Thank you for bringing this issue to our attention. The Microclimate team has been notified.

arjunsbabu commented 5 years ago

the same deployment.yaml is working for another branch . I can fix the error above . But like to know why the same error is not happening for a different branch issue deployment.yaml is as follows

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: "{{  .Chart.Name }}-deployment"
  labels:
    chart: '{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}'
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    metadata:
      labels:
        app: "{{ .Chart.Name }}-selector"
        version: "current"
    spec:
      containers:
      - name: "{{ .Chart.Name }}"
        image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
        imagePullPolicy: {{ .Values.image.pullPolicy }}
        ports:
        - containerPort: {{ .Values.service.servicePort }}

values.yaml

# Default values for templateExample.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
  repository: sample
  tag: v0.1.0
  pullPolicy: Always

service:
  name: http
  type: ClusterIP
  servicePort: 80
  targetPort: 3000

resources:
  cpu: 100m
  memory: 128Mi
  requests:
    cpu: 100m
    memory: 128Mi

I have tryed manual helm install command using the above files and it worked. The fix for the above is to add an "" in values.replicacount. After i have done it another error is coming in the microclimate deploy

ie

Error: release dohmhc-1eae8af9-978d-466a-9d67-3880463f6dcd failed: Deployment in version "v1beta1" cannot be handled as a Deployment: v1beta1.Deployment.Spec: v1beta1.DeploymentSpec.Replicas: readUint32: unexpected character: �, error found in #10 byte of ...|eplicas":"{ { .Value|..., bigger context ...|mespace":"dev-myhealthcoach"},"spec":{"replicas":"{ { .Values.replicaCount } }","template":{"metadat|...

I have used the same deployment.yaml , values.yaml in another branch and its working. Infact what we have done is while we seen one branch working we merged the changes to another branch. ..But not working in new branch. Please help me find the route cause of tiller behaving differently in same situation. I have kept the issue branch for any testing @jagraj

arjunsbabu commented 5 years ago

i believe the reason is some other values provided by the microclimate to tiller..

sishida commented 5 years ago

I am following up with the team again today to see if I can obtain more info for this question.

jagraj commented 5 years ago

Arjun seems to be sick, I just had slack conversation with Arjun and requested test case so that we can reproduce in our environment. This will help to capture logs and debug this problem. He is going to share more information tomorrow.

rajivnathan commented 5 years ago

I think there are 2 things related to naming that we should clarify:

  1. The helm chart folder name and the name in the Chart.yaml. I think those need to match because of helm limitations as I noted.
  2. The second is project name and the chart name. That's the one that I believe Arjun is talking about and those shouldn't need to match. It should work with Microcimate today.

Steps to reproduce would help clarify whether that covers what Arjun is asking for and we can help verify it is working as expected.

jagraj commented 5 years ago

I verified issue "2" above and this has been resolved in 18.06 release and the fix should be in your MC version 1.10 as well. I opened issue against our docs to take out the limitation that we currently documented in the current release of the docs.

sishida commented 5 years ago

Thanks for opening the issue, Jag! I have merged a pull request that removes the limitation in our docs. The changes should appear with the next Microclimate release.