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

Add integration testing and example for skipBuildDependencies option #1368

Merged
merged 27 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d8c7447
Added skipDependencyBuild option to Helm deployment
pscarey Dec 6, 2018
21147f1
Added example of using helm with skipBuildDependencies
pscarey Dec 6, 2018
542dcb7
Updated annotated-skaffold.yaml
pscarey Dec 6, 2018
b6f4a34
Example + docs fixes
pscarey Dec 6, 2018
8a7816e
Move example + annotated-skaffold.yaml to integration folder
pscarey Dec 8, 2018
f0730f7
Corrected README in examples, updated integration examples README
pscarey Dec 8, 2018
25d9e31
Update apiVersion to v1beta2 in integration/examples/helm-deployment-…
balopat Dec 9, 2018
68aa15f
Added skipDependencyBuild option to Helm deployment
pscarey Dec 6, 2018
d210c26
Updated annotated-skaffold.yaml
pscarey Dec 6, 2018
53a9865
Move example + annotated-skaffold.yaml to integration folder
pscarey Dec 8, 2018
7ea92d8
Update apiVersion to v1beta2 in integration/examples/helm-deployment-…
balopat Dec 9, 2018
2a0cae1
Merge deleted README.adoc
pscarey Jan 14, 2019
1d8732d
Remove extraneous files
pscarey Jan 14, 2019
17a3871
Merge branch 'master' into pscarey-opt-skip-helm-dep-build
pscarey Jan 15, 2019
0cb43e2
update to v1beta4
balopat Jan 29, 2019
7596048
revert rushed change
balopat Jan 29, 2019
8876a51
upgrade to v1beta4
balopat Jan 29, 2019
831515f
remove unnecessary header from example doc
balopat Jan 29, 2019
2acb227
Merge upstream into branch
pscarey Feb 22, 2019
4e23a49
Fix naming errors - change option to SkipDependencyBuild
pscarey Feb 22, 2019
010dabb
Update schemas
pscarey Feb 22, 2019
ffd87ae
Merge master
pscarey Mar 9, 2019
0c3202b
Remove v1beta4 change
pscarey Mar 9, 2019
de81c9f
Update schemas
pscarey Mar 9, 2019
14d24f0
Revent rename
pscarey Mar 20, 2019
7c1e72e
Merge upstream
pscarey Mar 20, 2019
b2089a2
Schema, docs, examples updates
pscarey Mar 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions integration/examples/annotated-skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ deploy:
# version: ""
# recreatePods: false
#
# # Skip the helm dep build, required for charts with local dependencies
# skipDependencyBuild: false
#
# # setValues get appended to the helm deploy with --set.
# setValues:
# key: "value"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM nginx:stable
29 changes: 29 additions & 0 deletions integration/examples/helm-deployment-dependencies/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
=== Example: helm-dependencies
:icons: font

ifndef::env-github[]
link:{github-repo-tree}/examples/helm-deployment-dependencies[see on Github icon:github[]]
endif::[]

==== Deploy helm charts with local dependencies

This example follows the link:{github-repo-tree}/examples/helm-deployment-dependencies[helm] example, but with a local chart as a depenency.

The `skipDependencyBuild` option is used to skip the `helm dep build` command. This must be disabled for charts with local dependencies.

The image can be passed to the subchart using the standard Helm format of `subchart-name.value`.

```
deploy:
helm:
releases:
- name: skaffold-helm
chartPath: skaffold-helm
namespace: skaffold
skipDependencyBuild: true # Skip helm dep build
values:
image: skaffold-helm
"subchart.image": gcr.io/k8s-skaffold/skaffold-helm # Set image for subchart
valuesFiles:
- helm-values-file.yaml
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for Kubernetes
name: skaffold-helm
version: 0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for Kubernetes
name: subchart
version: 0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "subchart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "subchart.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "subchart.name" . }}
labels:
app: {{ template "subchart.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "subchart.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.image }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/bin/bash", "-c", "--" ]
args: ["while true; do sleep 30; done;"]
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "subchart.fullname" . -}}
{{- $servicePort := .Values.service.externalPort -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "subchart.fullname" . }}
labels:
app: {{ template "subchart.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host }}
http:
paths:
- path: /
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "subchart.fullname" . }}
labels:
app: {{ template "subchart.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.service.internalPort }}
protocol: TCP
name: {{ .Values.service.name }}
selector:
app: {{ template "subchart.name" . }}
release: {{ .Release.Name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Default values for skaffold-helm.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
nameOverride: "subchart"
replicaCount: 1
image: nginx:stable
# This is the helm convention on declaring images
# image:
# repository: nginx
# tag: stable
# pullPolicy: IfNotPresent
service:
name: nginx
type: ClusterIP
externalPort: 80
internalPort: 80
ingress:
enabled: false
# Used to create an Ingress record.
hosts:
- chart-example.local
annotations:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
tls:
# Secrets must be manually created in the namespace.
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies:
- name: subchart
condition: subchart.enabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "skaffold-helm.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "skaffold-helm.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "skaffold-helm.name" . }}
labels:
app: {{ template "skaffold-helm.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "skaffold-helm.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.image }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/bin/bash", "-c", "--" ]
args: ["while true; do sleep 30; done;"]
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "skaffold-helm.fullname" . -}}
{{- $servicePort := .Values.service.externalPort -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "skaffold-helm.fullname" . }}
labels:
app: {{ template "skaffold-helm.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host }}
http:
paths:
- path: /
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "skaffold-helm.fullname" . }}
labels:
app: {{ template "skaffold-helm.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.service.internalPort }}
protocol: TCP
name: {{ .Values.service.name }}
selector:
app: {{ template "skaffold-helm.name" . }}
release: {{ .Release.Name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Default values for skaffold-helm.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image: nginx:stable
# This is the helm convention on declaring images
# image:
# repository: nginx
# tag: stable
# pullPolicy: IfNotPresent
service:
name: nginx
type: ClusterIP
externalPort: 80
internalPort: 80
ingress:
enabled: false
# Used to create an Ingress record.
hosts:
- chart-example.local
annotations:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
tls:
# Secrets must be manually created in the namespace.
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

subchart:
enabled: true
Loading