Using `skaffold render` with Helm support for GitOps
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
@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?
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