Skip to content

#321 - move sill folder from codegouvfr/helm-charts in monorepo #324

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
30 changes: 30 additions & 0 deletions .github/workflows/helm-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
branches:
- main

jobs:
publish-helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
git config user.name "actions"
git config user.email "[email protected]"
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

icons:
runs-on: ubuntu-latest
needs: publish-helm
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
node-version: '20'
- run: git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${{github.repository}}.git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npx -y -p [email protected] gh-pages -d ./icons --dest icons --add -u "github-actions-bot <[email protected]>"
23 changes: 23 additions & 0 deletions charts/sill/.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/
21 changes: 21 additions & 0 deletions charts/sill/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: sill
description: Application behind https://sill.code.gouv.fr
icon: https://codegouvfr.github.io/helm-charts/icons/marianne.png
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 1.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 1.0.0
1 change: 1 addition & 0 deletions charts/sill/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enjoy sill :)
124 changes: 124 additions & 0 deletions charts/sill/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "sill.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "sill.web.name" -}}
{{- printf "%s-%s" (include "sill.name" .) .Values.web.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}


{{- define "sill.api.name" -}}
{{- printf "%s-%s" (include "sill.name" .) .Values.api.name | 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 "sill.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 -}}

{{- define "sill.web.fullname" -}}
{{- printf "%s-%s" (include "sill.fullname" .) .Values.web.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}


{{- define "sill.api.fullname" -}}
{{- printf "%s-%s" (include "sill.fullname" .) .Values.api.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "sill.chart" -}}
{{- printf "sill" -}}
{{- end -}}

{{- define "sill.api.chart" -}}
{{- printf "sill-api" -}}
{{- end -}}

{{- define "sill.web.chart" -}}
{{- printf "sill-web" -}}
{{- end -}}


{{/*Common labels*/}}

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

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

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

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


{{- define "sill.api.selectorLabels" -}}
app.kubernetes.io/name: {{ include "sill.api.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{- define "sill.web.selectorLabels" -}}
app.kubernetes.io/name: {{ include "sill.web.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*Create the name of the service account to use*/}}

{{- define "sill.api.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "sill.api.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{- define "sill.web.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "sill.web.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
18 changes: 18 additions & 0 deletions charts/sill/templates/cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.serviceAccount.create -}}
{{- if .Values.serviceAccount.clusterAdmin -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "sill.fullname" . }}
labels:
{{- include "sill.api.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: {{ include "sill.api.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- end -}}
73 changes: 73 additions & 0 deletions charts/sill/templates/deployment-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "sill.api.fullname" . }}
labels:
{{- include "sill.api.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.api.replicaCount }}
{{- if .Values.api.updateStrategy }}
strategy: {{- toYaml .Values.api.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "sill.api.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
labels:
{{- include "sill.api.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.api.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "sill.api.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.api.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.api.securityContext | nindent 12 }}
image: "{{ .Values.api.image.name }}:{{ .Values.api.image.version }}"
envFrom:
- secretRef:
{{- if .Values.existingSecret }}
name: {{ .Values.existingSecret }}
{{- else }}
name: {{ template "sill.fullname" . }}
{{- end }}
imagePullPolicy: {{ .Values.api.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.api.containerPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /public/healthcheck
port: http
readinessProbe:
httpGet:
path: /public/healthcheck
port: http
resources:
{{- toYaml .Values.api.resources | nindent 12 }}
volumeMounts:
- name: cache
mountPath: /node_modules/.cache/
volumes:
- name: cache
emptyDir: {}
{{- with .Values.api.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.api.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.api.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
65 changes: 65 additions & 0 deletions charts/sill/templates/deployment-ui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "sill.web.fullname" . }}
labels:
{{- include "sill.web.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.web.replicaCount }}
{{- if .Values.web.updateStrategy }}
strategy: {{- toYaml .Values.web.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "sill.web.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "sill.web.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "sill.web.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.web.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.web.securityContext | nindent 12 }}
image: "{{ .Values.web.image.name }}:{{ .Values.web.image.version }}"
imagePullPolicy: {{ .Values.web.image.pullPolicy }}
env:
{{- if .Values.web.env }}
{{- range $key, $value := .Values.web.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end -}}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.web.containerPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.web.resources | nindent 12 }}
{{- with .Values.web.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.web.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.web.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Loading