Skip to content

Commit

Permalink
Kubeapps chart - Lint chart (#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Ariza Toledano authored and Andres Martinez Gotor committed Nov 20, 2019
1 parent 3cc0bac commit f480eca
Show file tree
Hide file tree
Showing 30 changed files with 787 additions and 601 deletions.
18 changes: 9 additions & 9 deletions chart/kubeapps/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ appVersion: DEVEL
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
- helm
- dashboard
- service catalog
- deployment
home: https://kubeapps.com
sources:
- https://github.com/kubeapps/kubeapps
- https://github.com/kubeapps/kubeapps
maintainers:
- name: Bitnami
email: containers@bitnami.com
- name: prydonius
email: adnan@bitnami.com
- name: Bitnami
email: containers@bitnami.com
- name: prydonius
email: adnan@bitnami.com
# 2.10+ required because we need the install-crd hook type
tillerVersion: ">=2.10.0"
2 changes: 1 addition & 1 deletion chart/kubeapps/crds/apprepository-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ spec:
kind: AppRepository
plural: apprepositories
shortNames:
- apprepos
- apprepos
version: v1alpha1
6 changes: 3 additions & 3 deletions chart/kubeapps/requirements.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: mongodb
repository: https://kubernetes-charts.storage.googleapis.com
version: 7.2.9
- name: mongodb
repository: https://kubernetes-charts.storage.googleapis.com
version: 7.2.9
digest: sha256:415440e73af7d4b02a10a15f28bb2fc095cbdffdc2e1676d76e0f0eaa1632d50
generated: 2019-09-24T07:04:11.615576228Z
6 changes: 3 additions & 3 deletions chart/kubeapps/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies:
- name: mongodb
version: ">= 0"
repository: https://kubernetes-charts.storage.googleapis.com
- name: mongodb
version: ">= 0"
repository: https://kubernetes-charts.storage.googleapis.com
45 changes: 38 additions & 7 deletions chart/kubeapps/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,31 @@ If release name contains chart name it will be used as a full name.
{{- end -}}
{{- 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 -}}

{{/*
Common labels
*/}}
{{- define "kubeapps.labels" -}}
app: {{ include "kubeapps.name" . }}
chart: {{ include "kubeapps.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- end -}}

{{/*
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "kubeapps.matchLabels" -}}
app: {{ include "kubeapps.name" . }}
release: {{ .Release.Name }}
{{- end -}}

{{/*
Render image reference
*/}}
Expand Down Expand Up @@ -55,13 +80,6 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- 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
*/}}
Expand Down Expand Up @@ -177,3 +195,16 @@ imagePullSecrets:
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Renders a value that contains template.
Usage:
{{ include "kubeapps.tplValue" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "kubeapps.tplValue" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
13 changes: 6 additions & 7 deletions chart/kubeapps/templates/apprepositories-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ metadata:
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
data:
{{- if .caCert }}
{{- if .caCert }}
ca.crt: |-
{{ .caCert | b64enc }}
{{- end }}
{{- if .authorizationHeader }}
{{- .caCert | b64enc }}
{{- end }}
{{- if .authorizationHeader }}
authorizationHeader: |-
{{ .authorizationHeader | b64enc }}
{{- .authorizationHeader | b64enc }}
{{- end }}
{{- end }}
---
{{- end }}
{{ end -}}
29 changes: 14 additions & 15 deletions chart/kubeapps/templates/apprepositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@ spec:
{{- if or $.Values.securityContext.enabled $.Values.apprepository.initialReposProxy.enabled .nodeSelector }}
syncJobPodTemplate:
spec:
{{- if $.Values.apprepository.initialReposProxy.enabled }}
{{- if $.Values.apprepository.initialReposProxy.enabled }}
containers:
- env:
- name: https_proxy
value: {{ $.Values.apprepository.initialReposProxy.https_proxy }}
- name: http_proxy
value: {{ $.Values.apprepository.initialReposProxy.http_proxy }}
- name: no_proxy
value: {{ $.Values.apprepository.initialReposProxy.no_proxy }}
{{- end }}
{{- if $.Values.securityContext.enabled }}
- env:
- name: https_proxy
value: {{ $.Values.apprepository.initialReposProxy.https_proxy }}
- name: http_proxy
value: {{ $.Values.apprepository.initialReposProxy.http_proxy }}
- name: no_proxy
value: {{ $.Values.apprepository.initialReposProxy.no_proxy }}
{{- end }}
{{- if $.Values.securityContext.enabled }}
securityContext:
runAsUser: {{ $.Values.securityContext.runAsUser }}
{{- end }}
{{- if .nodeSelector }}
nodeSelector:
{{ toYaml .nodeSelector | indent 8 }}
{{- end }}
{{- end }}
{{- if .nodeSelector }}
nodeSelector: {{- toYaml .nodeSelector | nindent 8 }}
{{- end }}
{{- end }}
{{- if or .caCert .authorizationHeader }}
auth:
Expand Down
4 changes: 2 additions & 2 deletions chart/kubeapps/templates/apprepository-crd.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if not (.Capabilities.APIVersions.Has "kubeapps.com/v1alpha1") -}}
# The condition above will be true if another instance of Kubeapps is
# already installed
# already installed
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
Expand All @@ -19,6 +19,6 @@ spec:
kind: AppRepository
plural: apprepositories
shortNames:
- apprepos
- apprepos
version: v1alpha1
{{- end -}}
56 changes: 27 additions & 29 deletions chart/kubeapps/templates/apprepository-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,35 @@ spec:
spec:
serviceAccountName: {{ template "kubeapps.apprepository.fullname" . }}
{{- include "kubeapps.imagePullSecrets" . | indent 6 }}
containers:
- name: controller
image: {{ template "kubeapps.image" (list .Values.apprepository.image .Values.global) }}
command:
- /apprepository-controller
args:
- --logtostderr
- --user-agent-comment=kubeapps/{{ .Chart.AppVersion }}
- --repo-sync-image={{ template "kubeapps.image" (list .Values.apprepository.syncImage .Values.global) }}
- --namespace={{ .Release.Namespace }}
- --mongo-url={{ template "kubeapps.mongodb.fullname" . }}
- --mongo-secret-name={{ .Values.mongodb.existingSecret }}
{{- if .Values.apprepository.crontab }}
- --crontab={{ .Values.apprepository.crontab }}
{{- end }}
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 }}
{{- if .Values.apprepository.affinity }}
affinity: {{- include "kubeapps.tplValue" (dict "value" .Values.apprepository.affinity "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.apprepository.nodeSelector }}
nodeSelector: {{- include "kubeapps.tplValue" (dict "value" .Values.apprepository.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.apprepository.tolerations }}
tolerations: {{- include "kubeapps.tplValue" (dict "value" .Values.apprepository.tolerations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
{{- with .Values.apprepository.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
containers:
- name: controller
image: {{ template "kubeapps.image" (list .Values.apprepository.image .Values.global) }}
command:
- /apprepository-controller
args:
- --logtostderr
- --user-agent-comment=kubeapps/{{ .Chart.AppVersion }}
- --repo-sync-image={{ template "kubeapps.image" (list .Values.apprepository.syncImage .Values.global) }}
- --namespace={{ .Release.Namespace }}
- --mongo-url={{ template "kubeapps.mongodb.fullname" . }}
- --mongo-secret-name={{ .Values.mongodb.existingSecret }}
{{- if .Values.apprepository.crontab }}
- --crontab={{ .Values.apprepository.crontab }}
{{- end }}
{{- if .Values.apprepository.resources }}
resources: {{- toYaml .Values.apprepository.resources | nindent 12 }}
{{- end }}
34 changes: 17 additions & 17 deletions chart/kubeapps/templates/apprepository-jobs-cleanup-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
- apiGroups:
- kubeapps.com
resources:
- apprepositories
verbs:
- list
- delete
- apiGroups:
- ""
resources:
- secrets
verbs:
- list
- delete
- apiGroups:
- kubeapps.com
resources:
- apprepositories
verbs:
- list
- delete
- apiGroups:
- ""
resources:
- secrets
verbs:
- list
- delete
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
Expand All @@ -46,7 +46,7 @@ roleRef:
kind: Role
name: {{ template "kubeapps.apprepository-jobs-cleanup.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "kubeapps.apprepository-jobs-cleanup.fullname" . }}
namespace: {{ .Release.Namespace }}
- kind: ServiceAccount
name: {{ template "kubeapps.apprepository-jobs-cleanup.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
45 changes: 21 additions & 24 deletions chart/kubeapps/templates/apprepository-jobs-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,29 @@ spec:
release: {{ .Release.Name }}
spec:
{{- include "kubeapps.imagePullSecrets" . | indent 6 }}
containers:
- name: kubectl
image: {{ template "kubeapps.image" (list .Values.hooks.image .Values.global) }}
command:
- /bin/sh
args:
- -ec
- |
kubectl delete apprepositories.kubeapps.com -n {{ .Release.Namespace }} --all
kubectl delete secrets -n {{ .Release.Namespace }} -l app={{ template "kubeapps.name" $ }},release={{ $.Release.Name }}
restartPolicy: OnFailure
serviceAccountName: {{ template "kubeapps.apprepository-jobs-cleanup.fullname" . }}
{{- with .Values.hooks.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if .Values.hooks.affinity }}
affinity: {{- include "kubeapps.tplValue" (dict "value" .Values.hooks.affinity "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.hooks.nodeSelector }}
nodeSelector: {{- include "kubeapps.tplValue" (dict "value" .Values.hooks.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.hooks.tolerations }}
tolerations: {{- include "kubeapps.tplValue" (dict "value" .Values.hooks.tolerations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
{{- with .Values.hooks.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.hooks.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
restartPolicy: OnFailure
serviceAccountName: {{ template "kubeapps.apprepository-jobs-cleanup.fullname" . }}
containers:
- name: kubectl
image: {{ template "kubeapps.image" (list .Values.hooks.image .Values.global) }}
command:
- /bin/sh
args:
- -ec
- |
kubectl delete apprepositories.kubeapps.com -n {{ .Release.Namespace }} --all
kubectl delete secrets -n {{ .Release.Namespace }} -l app={{ template "kubeapps.name" $ }},release={{ $.Release.Name }}
Loading

0 comments on commit f480eca

Please sign in to comment.