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 Helm chart for installing Kubeapps #349

Merged
merged 22 commits into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions chart/kubeapps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
charts/*.tgz
21 changes: 21 additions & 0 deletions chart/kubeapps/.helmignore
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
19 changes: 19 additions & 0 deletions chart/kubeapps/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you also add the maintainers and other metadata like home, sources and icon?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I'll do that, thanks!

name: kubeapps
version: 0.1.0
appVersion: 1.0.0.alpha.4
description: Kubeapps is a dashboard for your Kubernetes cluster that makes it easy to deploy and manage applications in your cluster using Helm
icon: https://raw.githubusercontent.com/kubeapps/kubeapps/master/docs/img/logo.png
keywords:
- helm
- dashboard
- service catalog
- deployment
home: https://kubeapps.com
sources:
- https://github.com/kubeapps/kubeapps
maintainers:
- name: bitnami-bot
email: containers@bitnami.com
- name: prydonius
email: adnan@bitnami.com
6 changes: 6 additions & 0 deletions chart/kubeapps/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: mongodb
repository: https://kubernetes-charts.storage.googleapis.com
version: 4.0.4
digest: sha256:415440e73af7d4b02a10a15f28bb2fc095cbdffdc2e1676d76e0f0eaa1632d50
generated: 2018-08-01T11:50:24.777058724-07:00
4 changes: 4 additions & 0 deletions chart/kubeapps/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
- name: mongodb
version: ">= 0"
repository: https://kubernetes-charts.storage.googleapis.com
19 changes: 19 additions & 0 deletions chart/kubeapps/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
echo http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.frontend.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "kubeapps.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.frontend.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl get svc -w {{ template "kubeapps.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "kubeapps.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.frontend.service.port }}
{{- else if contains "ClusterIP" .Values.frontend.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "kubeapps.fullname" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME 8080:8080
{{- end }}
97 changes: 97 additions & 0 deletions chart/kubeapps/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "kubeapps.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kubeapps.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Render image reference
*/}}
{{- define "kubeapps.image" -}}
{{ .registry }}/{{ .repository }}:{{ .tag }}
{{- end -}}

{{/*
Create a default fully qualified app name for MongoDB dependency.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "kubeapps.mongodb.fullname" -}}
{{- $name := default "mongodb" .Values.mongodb.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "kubeapps.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create name for the apprepository-controller based on the fullname
*/}}
{{- define "kubeapps.apprepository.fullname" -}}
{{ template "kubeapps.fullname" . }}-apprepository-controller
{{- end -}}

{{/*
Create name for the apprepository bootstrap job
*/}}
{{- define "kubeapps.apprepository-jobs-bootstrap.fullname" -}}
{{ template "kubeapps.fullname" . }}-apprepository-jobs-bootstrap
{{- end -}}

{{/*
Create name for the chartsvc based on the fullname
*/}}
{{- define "kubeapps.chartsvc.fullname" -}}
{{ template "kubeapps.fullname" . }}-chartsvc
{{- end -}}

{{/*
Create name for the dashboard based on the fullname
*/}}
{{- define "kubeapps.dashboard.fullname" -}}
{{ template "kubeapps.fullname" . }}-dashboard
{{- end -}}

{{/*
Create name for the dashboard config based on the fullname
*/}}
{{- define "kubeapps.dashboard-config.fullname" -}}
{{ template "kubeapps.fullname" . }}-dashboard-config
{{- end -}}

{{/*
Create name for the frontend config based on the fullname
*/}}
{{- define "kubeapps.frontend-config.fullname" -}}
{{ template "kubeapps.fullname" . }}-frontend-config
{{- end -}}

{{/*
Create name for the tiller-proxy based on the fullname
*/}}
{{- define "kubeapps.tiller-proxy.fullname" -}}
{{ template "kubeapps.fullname" . }}-tiller-proxy
{{- end -}}
17 changes: 17 additions & 0 deletions chart/kubeapps/templates/apprepository-crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: apprepositories.kubeapps.com
labels:
app: {{ template "kubeapps.apprepository.fullname" . }}
chart: {{ template "kubeapps.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
group: kubeapps.com
names:
kind: AppRepository
plural: apprepositories
shortNames:
- apprepos
version: v1alpha1
47 changes: 47 additions & 0 deletions chart/kubeapps/templates/apprepository-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "kubeapps.apprepository.fullname" . }}
labels:
app: {{ template "kubeapps.apprepository.fullname" . }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that when there is an issue deploying a chart from kubeapps the following message is show:

Check the health of Kubeapps components 'kubectl get po --all-namespaces -l created-by=kubeapps'.

However, it seems any pod created by the chart has the label created-by=kubeapps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you seeing that? I thought that was from the kubeapps CLI, it's not in the NOTES.txt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, it's actually shown in the UI, will fix that thanks. Note you'll need to build images for the apprepository-controller and dashboard to make this actually work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I saw that Ara already built the images so I used the same ones

chart: {{ template "kubeapps.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ template "kubeapps.apprepository.fullname" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "kubeapps.apprepository.fullname" . }}
release: {{ .Release.Name }}
spec:
serviceAccountName: {{ template "kubeapps.apprepository.fullname" . }}
containers:
- name: controller
image: {{ template "kubeapps.image" .Values.apprepository.image }}
command:
- /apprepository-controller
args:
- --logtostderr
- --repo-sync-image={{ template "kubeapps.image" .Values.apprepository.syncImage }}
- --namespace={{ .Release.Namespace }}
- --mongo-url={{ template "kubeapps.mongodb.fullname" . }}
- --mongo-secret-name={{ template "kubeapps.mongodb.fullname" . }}
resources:
{{ toYaml .Values.apprepository.resources | indent 12 }}
{{- with .Values.apprepository.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.apprepository.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.apprepository.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
30 changes: 30 additions & 0 deletions chart/kubeapps/templates/apprepository-jobs-bootstrap-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
annotations:
helm.sh/hook: post-install
helm.sh/hook-delete-policy: hook-succeeded
helm.sh/hook-weight: "-10"
labels:
app: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
chart: {{ template "kubeapps.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
apprepositories.yaml: |-
{{- range .Values.apprepository.initialRepos }}
apiVersion: kubeapps.com/v1alpha1
kind: AppRepository
metadata:
name: {{ .name }}
labels:
app: {{ template "kubeapps.apprepository.fullname" $ }}
chart: {{ template "kubeapps.chart" $ }}
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
spec:
type: helm
url: {{ .url }}
---
{{ end -}}
44 changes: 44 additions & 0 deletions chart/kubeapps/templates/apprepository-jobs-bootstrap-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
annotations:
helm.sh/hook: post-install
helm.sh/hook-delete-policy: hook-succeeded
helm.sh/hook-weight: "-10"
labels:
app: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
chart: {{ template "kubeapps.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
- apiGroups:
- kubeapps.com
resources:
- apprepositories
verbs:
- get
- create
- delete
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add hook annotations.

metadata:
name: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
annotations:
helm.sh/hook: post-install
helm.sh/hook-delete-policy: hook-succeeded
helm.sh/hook-weight: "-10"
labels:
app: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
chart: {{ template "kubeapps.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
namespace: {{ .Release.Namespace }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
annotations:
helm.sh/hook: post-install
helm.sh/hook-delete-policy: hook-succeeded
helm.sh/hook-weight: "-10"
labels:
app: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
chart: {{ template "kubeapps.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
50 changes: 50 additions & 0 deletions chart/kubeapps/templates/apprepository-jobs-bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
annotations:
helm.sh/hook: post-install
helm.sh/hook-delete-policy: hook-succeeded
labels:
app: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
chart: {{ template "kubeapps.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
template:
metadata:
labels:
app: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: kubectl
image: {{ template "kubeapps.image" .Values.apprepository.jobsImage }}
command:
- kubectl
- apply
- -f
- /tmp/apprepositories/apprepositories.yaml
volumeMounts:
- mountPath: /tmp/apprepositories
name: apprepositories-config
resources:
{{ toYaml .Values.apprepository.resources | indent 12 }}
volumes:
- name: apprepositories-config
configMap:
name: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
restartPolicy: OnFailure
serviceAccountName: {{ template "kubeapps.apprepository-jobs-bootstrap.fullname" . }}
{{- with .Values.apprepository.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.apprepository.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.apprepository.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
Loading