chore: initial commit

This commit is contained in:
devthejo 2023-12-16 11:25:39 +01:00
commit 359cd5a0c4
Signed by: devthejo
GPG key ID: C04215C627711F5C
24 changed files with 14771 additions and 0 deletions

View file

@ -0,0 +1,31 @@
name: 🎁 Release Charts
on:
push:
tags:
- "*"
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref_name }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "forgejo-actions"
git config user.email "bot@devthefuture.org"
- name: Publish Helm charts
uses: https://git.devthefuture.org/devthefuture/helm-gh-pages.git@v1.7.0
with:
charts_dir: charts
linting: off
token: ${{ secrets.M8A_ORG_BOT_REPO_TOKEN }}

View file

@ -0,0 +1,35 @@
name: 🎉 Release Commit
on:
workflow_dispatch:
pull_request:
types: [closed]
concurrency:
cancel-in-progress: true
group: "${{ github.workflow }}-${{ github.ref_name }}-${{ startsWith(github.event.head_commit.message, 'chore(release): ') && 'release' || 'commit' }}"
jobs:
yarn-release:
if: "${{ !startsWith(github.event.head_commit.message, 'chore(release): ') }}"
runs-on: ubuntu-latest
name: create release using commit-and-tag-version
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.M8A_ORG_BOT_REPO_TOKEN }}
- run: yarn
- name: Run release
env:
GIT_AUTHOR_EMAIL: bot@devthefuture.org
GIT_AUTHOR_NAME: forgejo-actions
GIT_COMMITTER_EMAIL: bot@devthefuture.org
GIT_COMMITTER_NAME: forgejo-actions
run: yarn release
- name: Push release
shell: bash
run: |
git push --follow-tags origin main

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
/.yarn/releases/** binary
/.yarn/plugins/** binary

10
.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
yarn-error.log
node_modules
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

9359
.pnp.cjs generated Executable file

File diff suppressed because one or more lines are too long

2090
.pnp.loader.mjs generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
const yaml = require("js-yaml")
module.exports = {
readVersion: (contents) => {
let chart
try {
chart = yaml.load(contents)
} catch (e) {
console.error(e)
throw e
}
return chart.version
},
writeVersion: (contents, version) => {
const chart = yaml.load(contents)
chart.version = version
const { dependencies } = chart
if (dependencies) {
for (const dependency of dependencies) {
if (
dependency.repository.startsWith("file://./charts/") ||
dependency.repository.startsWith("file://../")
) {
dependency.version = version
}
}
}
return yaml.dump(chart, { indent: 2 })
},
}

44
.versionrc.js Normal file
View file

@ -0,0 +1,44 @@
/* eslint-disable node/no-unpublished-require */
const fs = require("fs-extra")
// package.json
const getDirectoriesSync = (source) =>
fs
.readdirSync(source, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory() || dirent.isSymbolicLink())
.map((dirent) => dirent.name)
const bumpFiles = []
// charts
const getChartsRecursive = (dir, list = []) => {
const chartList = getDirectoriesSync(dir)
list.push(
...chartList.map((c) =>
fs.realpathSync(`${dir}/${c}`).slice(__dirname.length + 1)
)
)
for (const chartName of chartList) {
const childDir = `${dir}/${chartName}/charts`
if (fs.pathExistsSync(childDir)) {
list.push(...getChartsRecursive(childDir))
}
}
return list
}
const chartsUpdater = ".version/standard-version-chart-updater.js"
const charts = getChartsRecursive("charts")
bumpFiles.push(
...charts.map((chartDir) => ({
filename: `${chartDir}/Chart.yaml`,
updater: chartsUpdater,
}))
)
bumpFiles.push({ filename: "package.json", type: "json" })
module.exports = {
bumpFiles,
}

893
.yarn/releases/yarn-4.0.2.cjs vendored Executable file

File diff suppressed because one or more lines are too long

1
.yarnrc.yml Normal file
View file

@ -0,0 +1 @@
yarnPath: .yarn/releases/yarn-4.0.2.cjs

1
README.md Normal file
View file

@ -0,0 +1 @@
# DevTheFuture Helm Charts Registry

View file

@ -0,0 +1,3 @@
apiVersion: v2
name: modjo-microservice
version: 0.0.0

View file

@ -0,0 +1,38 @@
{{- define "common.names.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "common.names.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "common.names.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 "common.names.suffixedName" -}}
{{- $base := trunc 54 (include "common.names.fullname" .root) -}}
{{- $suffix := .suffix -}}
{{- printf "%s-%s" $base $suffix | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "common.labels.standard" -}}
app.kubernetes.io/name: {{ include "common.names.name" . }}
helm.sh/chart: {{ include "common.names.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{- define "common.labels.matchLabels" -}}
app.kubernetes.io/name: {{ include "common.names.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

View file

@ -0,0 +1,31 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
name: {{ include "common.names.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
type: Utilization
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
type: Utilization
{{- end }}
{{- end }}

View file

@ -0,0 +1,29 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
annotations:
{{- if .Values.ingress.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingress.annotations "context" $) | nindent 4 }}
{{- end }}
spec:
tls:
{{- if .Values.ingress.tls }}
- hosts:
- {{ .Values.ingress.hostname | quote }}
secretName: {{ .Values.ingress.tlsSecretname }}
{{- end }}
rules:
- host: {{ .Values.ingress.hostname | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "common.names.fullname" . }}
port:
name: http
{{- end }}

View file

@ -0,0 +1,15 @@
{{ if .Values.namespace.enabled }}
apiVersion: v1
kind: Namespace
metadata:
annotations:
argocd.argoproj.io/sync-wave: "-10"
{{ if .Values.namespace.annotations }}
{{- toYaml $.Values.namespace.annotations | nindent 4 }}
{{ end }}
{{ if .Values.namespace.labels }}
labels:
{{- toYaml $.Values.namespace.labels | nindent 4 }}
{{ end }}
name: {{ .Release.Namespace }}
{{ end }}

View file

@ -0,0 +1,29 @@
{{- if and (eq .Values.rollout.strategy.type "BlueGreen") .Values.preview.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "common.names.suffixedName" (dict "root" . "suffix" "preview") }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
annotations:
{{- if .Values.ingress.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingress.annotations "context" $) | nindent 4 }}
{{- end }}
spec:
tls:
{{- if .Values.ingress.tls }}
- hosts:
- {{ .Values.preview.ingress.hostname | quote }}
secretName: {{ or .Values.ingress.tlsSecretname .Values.preview.ingress.tlsSecretname }}
{{- end }}
rules:
- host: {{ .Values.preview.ingress.hostname | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "common.names.suffixedName" (dict "root" . "suffix" "preview") }}
port:
name: http
{{- end }}

View file

@ -0,0 +1,48 @@
{{- if eq .Values.rollout.strategy.type "BlueGreen" -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "common.names.suffixedName" (dict "root" . "suffix" "preview") }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if and .Values.service.clusterIP (eq .Values.service.type "ClusterIP") }}
clusterIP: {{ .Values.service.clusterIP }}
{{- end }}
{{- if .Values.service.sessionAffinity }}
sessionAffinity: {{ .Values.service.sessionAffinity }}
{{- end }}
{{- if .Values.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }}
loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.service.port }}
protocol: TCP
targetPort: http
{{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) .Values.service.nodePort) }}
nodePort: {{ .Values.service.nodePort }}
{{- else if eq .Values.service.type "ClusterIP" }}
nodePort: null
{{- end }}
selector: {{ include "common.labels.matchLabels" . | nindent 4 }}
{{- end }}

View file

@ -0,0 +1,131 @@
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
selector:
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
strategy:
{{- if eq .Values.rollout.strategy.type "BlueGreen" }}
blueGreen:
activeService: {{ default (include "common.names.fullname" .) .Values.rollout.strategy.blueGreen.activeService | quote }}
previewService: {{ default (include "common.names.suffixedName" (dict "root" . "suffix" "preview")) .Values.rollout.strategy.blueGreen.previewService | quote }}
autoPromotionEnabled: {{ .Values.rollout.strategy.blueGreen.autoPromotionEnabled }}
previewReplicaCount: {{ .Values.rollout.strategy.blueGreen.previewReplicaCount }}
antiAffinity:
{{- .Values.rollout.strategy.blueGreen.antiAffinity | toYaml | nindent 8 }}
scaleDownDelaySeconds: {{ .Values.rollout.strategy.blueGreen.scaleDownDelaySeconds }}
# Add additional Blue-Green specific configurations here as needed
{{- else if eq .Values.rollout.strategy.type "Canary" }}
canary:
{{- toYaml .Values.rollout.strategy.canary | nindent 6 }}
{{- else if eq .Values.rollout.strategy.type "RollingUpdate" }}
rollingUpdate:
{{- toYaml .Values.rollout.strategy.rollingUpdate | nindent 6 }}
{{- end }}
template:
metadata:
annotations:
{{- toYaml .Values.podAnnotations | nindent 8 }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
spec:
imagePullSecrets:
{{- toYaml .Values.image.pullSecrets | nindent 8 }}
volumes:
- name: jwt
secret:
secretName: {{ .Values.application.jwt.secretName }}
containers:
- name: {{ .Chart.Name }}
securityContext:
readOnlyRootFilesystem: true
runAsUser: 1000
runAsGroup: 1000
runAsNonRoot: true
allowPrivilegeEscalation: false
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 4000
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
{{- if .Values.application.jwt.enabled }}
- name: jwt
mountPath: /secrets/jwk.json
subPath: {{ .Values.application.jwt.jwkSecretKey }}
readOnly: true
- name: jwt
mountPath: /secrets/jwk-old.json
subPath: {{ .Values.application.jwt.jwkOldSecretKey }}
readOnly: true
{{- end }}
env:
- name: LOGLEVEL
value: {{ .Values.application.logLevel }}
- name: LOG_REQUESTS
{{- if .Values.application.jwt.enabled }}
value: {{ .Values.application.logRequests | quote }}
- name: JWK_FILE
value: /secrets/jwk.json
- name: OLDJWK_FILE
value: /secrets/jwk-old.json
{{- end }}
{{- if .Values.application.pg.enabled }}
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: {{ .Values.application.pg.dsnSecretName }}
key: {{ .Values.application.pg.dsnSecretKey }}
{{- end }}
{{- if .Values.application.hasura.enabled }}
- name: HASURA_GRAPHQL_URL
value: {{ .Values.application.hasura.graphqlUrl }}
- name: HASURA_WEB_HOOK_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.application.hasura.webhookSecretName }}
key: {{ .Values.application.hasura.webhookSecretKey }}
- name: HASURA_GRAPHQL_ADMIN_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.application.hasura.adminSecretName }}
key: {{ .Values.application.hasura.adminSecretKey }}
{{- end }}
{{- if .Values.application.amqp.enabled }}
- name: AMQP_URL
valueFrom:
secretKeyRef:
name: {{ .Values.application.amqp.dsnSecretName }}
key: {{ .Values.application.amqp.dsnSecretKey }}
{{- end }}
{{- if .Values.extraEnv }}
{{ .Values.extraEnv | toYaml | nindent 12 }}
{{- end }}
nodeSelector:
{{- toYaml .Values.nodeSelector | nindent 8 }}
affinity:
{{- toYaml .Values.affinity | nindent 8 }}
tolerations:
{{- toYaml .Values.tolerations | nindent 8 }}

View file

@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: default
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}

View file

@ -0,0 +1,48 @@
{{- if .Values.service.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if and .Values.service.clusterIP (eq .Values.service.type "ClusterIP") }}
clusterIP: {{ .Values.service.clusterIP }}
{{- end }}
{{- if .Values.service.sessionAffinity }}
sessionAffinity: {{ .Values.service.sessionAffinity }}
{{- end }}
{{- if .Values.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }}
loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
ports:
- name: http
port: {{ .Values.service.port }}
protocol: TCP
targetPort: http
{{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) .Values.service.nodePort) }}
nodePort: {{ .Values.service.nodePort }}
{{- else if eq .Values.service.type "ClusterIP" }}
nodePort: null
{{- end }}
selector: {{ include "common.labels.matchLabels" . | nindent 4 }}
{{- end }}

View file

@ -0,0 +1,111 @@
fullnameOverride: ""
nameOverride: ""
image:
repository:
tag:
pullPolicy: IfNotPresent
pullSecrets: []
application:
logLevel: debug
logRequests: false
pg:
enabled: false
dsnSecretName: pg
dsnSecretKey: dsn
amqp:
enabled: false
dsnSecretName: amqp
dsnSecretKey: dsn
hasura:
enabled: false
graphqlUrl: http://hasura:8080/v1/graphql
webhookSecretName: hasura
webhookSecretKey: webhook-secret
adminSecretName: hasura
adminSecretKey: admin
jwt:
enabled: false
secretName: jwks
jwkSecretKey: jwk.json
jwkOldSecretKey: jwk-old.json
extraEnv:
commonAnnotations: {}
commonLabels: {}
podAnnotations: {}
service:
enabled: true
type: ClusterIP
port: 80
nodePort:
clusterIP: ""
loadBalancerIP: ""
externalTrafficPolicy: Cluster
loadBalancerSourceRanges: []
extraPorts: []
annotations: {}
sessionAffinity: None
sessionAffinityConfig: {}
ingress:
enabled: false
annotations: {}
hostname: api.local
tlsSecretname: alerte-secours-tls
resources: {}
# requests:
# cpu: "2"
# memory: 2Gi
# limits:
# cpu: "2"
# memory: 2Gi
revisionHistoryLimit: 2
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage:
targetMemoryUtilizationPercentage:
replicaCount: 1
nodeSelector: {}
tolerations: []
affinity: {}
namespace:
enabled: true
labels:
alerte-secours-tls: wildcard
rollout:
strategy:
type: "BlueGreen"
blueGreen:
autoPromotionEnabled: false
previewReplicaCount: 1
antiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
weight: 1
scaleDownDelaySeconds: 30
canary:
# Canary strategy configurations
rollingUpdate:
# RollingUpdate strategy configurations
preview:
ingress:
enabled: false
hostname:
automountServiceAccountToken: false

15
package.json Normal file
View file

@ -0,0 +1,15 @@
{
"version": "0.0.0",
"repository": "git@codeberg.org:devthefuture/helm-charts.git",
"license": "MIT",
"private": true,
"devDependencies": {
"commit-and-tag-version": "^11.1.0",
"fs-extra": "^11.1.0",
"js-yaml": "^4.1.0"
},
"scripts": {
"release": "commit-and-tag-version"
},
"packageManager": "yarn@4.0.2"
}

1772
yarn.lock Normal file

File diff suppressed because it is too large Load diff