Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using skaffold render with Helm support for GitOps #7461

Open
piomin opened this issue May 30, 2022 · 2 comments
Open

Using skaffold render with Helm support for GitOps #7461

piomin opened this issue May 30, 2022 · 2 comments

Comments

@piomin
Copy link

piomin commented May 30, 2022

The skaffold render command with helm support should render not only manifests but also the values.yaml file. Maybe with with additional option such as --render-helm-values=true.

Actual behavior

Assuming I have the following Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Chart.Name }}
spec:
  selector:
    matchLabels:
      app: {{ .Chart.Name }}
  template:
    metadata:
      labels:
        app: {{ .Chart.Name }}
    spec:
      containers:
      - name: {{ .Chart.Name }}
        image: "{{.Values.image.repository }}:{{.Values.image.tag}}"
        ports:
        - containerPort: {{ .Values.image.containerPort }}
        imagePullPolicy: {{ .Values.image.pullPolicy }}

And values.yaml:

image:
  repository: piomin/sample-spring-kotlin-microservice
  tag: 1.4.0
  containerPort: 8080
  pullPolicy: IfNotPresent

The output for skaffold render is:

# Source: sample-spring-kotlin-microservice/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sample-spring-kotlin-microservice
spec:
  selector:
    matchLabels:
      app: sample-spring-kotlin-microservice
  template:
    metadata:
      labels:
        app: sample-spring-kotlin-microservice
    spec:
      containers:
      - name: sample-spring-kotlin-microservice
        image: "piomin/sample-spring-kotlin-microservice:e91a4325999093bac11084408ed5df6a76a7fadfba16947d3a6358bc7789eb14@sha256:5c336af21c28c829a5f7d6e847d33546efb5b1816f5937f15d282ddba676b003"
        ports:
        - containerPort: 8080
        imagePullPolicy: IfNotPresent

Information

Assuming I have a GitOps process and want to use skaffold render to generate content for CI/CD I would like to have values.yaml generated and then commit it to the repository.

$ skaffold build --file-output='abcd.json'
$ skaffold render -a abcd.json
@tejal29
Copy link
Member

tejal29 commented Dec 19, 2022

@piomin I think the rendered yaml is correct.
Skaffold should replace the image with the build sha.

# Source: sample-spring-kotlin-microservice/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sample-spring-kotlin-microservice
spec:
  selector:
    matchLabels:
      app: sample-spring-kotlin-microservice
  template:
    metadata:
      labels:
        app: sample-spring-kotlin-microservice
    spec:
      containers:
      - name: sample-spring-kotlin-microservice
        image: "piomin/sample-spring-kotlin-microservice:e91a4325999093bac11084408ed5df6a76a7fadfba16947d3a6358bc7789eb14@sha256:5c336af21c28c829a5f7d6e847d33546efb5b1816f5937f15d282ddba676b003"
        ports:
        - containerPort: 8080
        imagePullPolicy: IfNotPresent

Can you please point to what is incorrect? What is the expected rendered yaml?

side note: Skaffold does include values.yaml while templating. Are you suggesting the flag should override the image tag?

@tejal29 tejal29 added the triage/needs-information Information requested label Dec 19, 2022
@Luke-Mason
Copy link

I really would like this feature. Currently skaffold allows for templating here
but it would be nice to know the values that are produced within the values.yaml when you use the setValuesTemplate field as that edits the values.yaml. That combined with the addition of profiles can really change the values.yaml in the final step from helm. helm has helm template command, and we want that to be replicated through skaffold templating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants