kubepack / chartify

📈 Generate Helm Charts from Kubernetes objects
Apache License 2.0
227 stars 25 forks source link

Value conversion error for fields #17

Closed yadavnikhil closed 7 years ago

yadavnikhil commented 7 years ago

Hi

I am evaluating your code to convert my kubernetes yml to helm. Working good, but few issues:

  1. When converting, for Deployment Template spec, in ImagePullSecrets, in the output file, the "name" is converted to "Name". "n" to uppercase: for which helm fails. imagePullSecrets:
    • Name: my-pull-secret

I've few more issues, which i was able to fix in my local fork.

Is this repo still active? i will open a PR for few changes.

tamalsaha commented 7 years ago

Yes, this repo is active. Please file your pr.

yadavnikhil commented 7 years ago

Ok great, Thanks. Can you please answer for the issue: "name" is converted to "Name". "n" to uppercase: for which helm fails.

tamalsaha commented 7 years ago

Can you be more specific? Can you point to code or YAML sample?

yadavnikhil commented 7 years ago

This is my deployment.yml, secret.yml:

apiVersion: extensions/v1beta1 
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: myregistry:5000/nginx:1.7.9
        ports:
        - containerPort: 80
      imagePullSecrets:
      - name: my-pull-secret

apiVersion: v1
kind: Secret
metadata:
  name: my-pull-secret
data:
  .dockerconfigjson: <token>
type: kubernetes.io/dockerconfigjson

Below is my output: nginx-deployment.deployment.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    chart: '{{.Chart.Name}}-{{.Chart.Version}}'
    heritage: '{{.Release.Service}}'
    release: '{{.Release.Name}}'
  name: '{{ template "fullname" . }}-nginx-deployment'
spec:
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: '{{.Values.nginxdeployment.nginx.image}}:{{.Values.nginxdeployment.nginx.imageTag}}'
        name: nginx
        ports:
        - containerPort: 80
      imagePullSecrets:
      - Name: my-pull-secret

As you see above, for imagePullSecrets, the field "Name" --> "N" is in uppercase.

tamalsaha commented 7 years ago

@yadavnikhil , the issue here is Chartify is using the kubernetes client from their server package. Now that the client-go package exists and generally works, we need to switch to that one. The client-go package uses type definitions that has proper tags for things like ImagePullSecrets.

yadavnikhil commented 7 years ago

@TamalSaha Ok. Is it a major refactor for existing code?

tamalsaha commented 7 years ago

No. I am going to do that after I merge your pr. Looking into that now.

tamalsaha commented 7 years ago

I have migrated Chartify to use Client-go. The capital 'N' issue should be fixed now.

yadavnikhil commented 7 years ago

Cool. Thanks. I'll check it.

yadavnikhil commented 7 years ago

The changes to use Client-go working for me now. Thanks.