Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

pkg/components: add Headlamp component #981

Merged
merged 9 commits into from
Oct 13, 2020
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
23 changes: 23 additions & 0 deletions assets/charts/components/headlamp/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
7 changes: 7 additions & 0 deletions assets/charts/components/headlamp/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: headlamp
description: An easy-to-use and versatile dashboard for Kubernetes brought to you by Kinvolk.
type: application

version: 0.1.0
appVersion: 0.0.0
iaguis marked this conversation as resolved.
Show resolved Hide resolved
62 changes: 62 additions & 0 deletions assets/charts/components/headlamp/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
iaguis marked this conversation as resolved.
Show resolved Hide resolved
Expand the name of the chart.
*/}}
{{- define "headlamp.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 "headlamp.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 }}

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

{{/*
Common labels
*/}}
{{- define "headlamp.labels" -}}
helm.sh/chart: {{ include "headlamp.chart" . }}
{{ include "headlamp.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "headlamp.selectorLabels" -}}
app.kubernetes.io/name: {{ include "headlamp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "headlamp.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "headlamp.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
60 changes: 60 additions & 0 deletions assets/charts/components/headlamp/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "headlamp.fullname" . }}
labels:
{{- include "headlamp.labels" . | nindent 4 }}
iaguis marked this conversation as resolved.
Show resolved Hide resolved
spec:
selector:
matchLabels:
{{- include "headlamp.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "headlamp.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- -in-cluster
- -plugins-dir=/headlamp/plugins/
ports:
- name: http
containerPort: {{ .Values.service.targetPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: {{ .Values.service.targetPort }}
readinessProbe:
httpGet:
path: /
port: {{ .Values.service.targetPort }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
41 changes: 41 additions & 0 deletions assets/charts/components/headlamp/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "headlamp.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "headlamp.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions assets/charts/components/headlamp/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "headlamp.fullname" . }}
labels:
{{- include "headlamp.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: TCP
name: http
selector:
{{- include "headlamp.selectorLabels" . | nindent 4 }}
64 changes: 64 additions & 0 deletions assets/charts/components/headlamp/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Default values for headlamp.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: quay.io/kinvolk/headlamp
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: l8e

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
type: ClusterIP
port: 80
targetPort: 4466

ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
tls: []
# - 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

nodeSelector: {}

tolerations: []

affinity: {}
7 changes: 7 additions & 0 deletions ci/aks/aks-cluster.lokocfg.envsubst
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,10 @@ component "httpbin" {
component "experimental-istio-operator" {
enable_monitoring = true
}

component "headlamp" {
ingress {
host = "headlamp.${var.cluster_name}.${var.aws_dns_zone}"
certmanager_cluster_issuer = "letsencrypt-staging"
}
}
7 changes: 7 additions & 0 deletions ci/aws/aws-cluster.lokocfg.envsubst
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,10 @@ component "aws-ebs-csi-driver" {}
component "experimental-istio-operator" {
enable_monitoring = true
}

component "headlamp" {
ingress {
host = "headlamp.$CLUSTER_ID.$AWS_DNS_ZONE"
certmanager_cluster_issuer = "letsencrypt-staging"
}
}
7 changes: 7 additions & 0 deletions ci/packet/packet-cluster.lokocfg.envsubst
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,10 @@ component "httpbin" {
component "experimental-istio-operator" {
enable_monitoring = true
}

component "headlamp" {
ingress {
host = "headlamp.$CLUSTER_ID.$AWS_DNS_ZONE"
certmanager_cluster_issuer = "letsencrypt-staging"
}
}
1 change: 1 addition & 0 deletions cli/cmd/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
_ "github.com/kinvolk/lokomotive/pkg/components/external-dns"
_ "github.com/kinvolk/lokomotive/pkg/components/flatcar-linux-update-operator"
_ "github.com/kinvolk/lokomotive/pkg/components/gangway"
_ "github.com/kinvolk/lokomotive/pkg/components/headlamp"
_ "github.com/kinvolk/lokomotive/pkg/components/httpbin"
_ "github.com/kinvolk/lokomotive/pkg/components/istio-operator"
_ "github.com/kinvolk/lokomotive/pkg/components/linkerd"
Expand Down
4 changes: 4 additions & 0 deletions docs/concepts/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,17 @@ Sample output:

```
Available components:
aws-ebs-csi-driver
cert-manager
cluster-autoscaler
contour
dex
experimental-istio-operator
experimental-linkerd
external-dns
flatcar-linux-update-operator
gangway
headlamp
httpbin
metallb
metrics-server
Expand Down
Loading