Skip to content
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
15 changes: 15 additions & 0 deletions charts/dco2/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: dco2
description: DCO2 GitHub App server
type: application
version: 0.1.0
appVersion: 0.1.0
kubeVersion: ">= 1.25.0-0"
keywords:
- dco
- dco2
maintainers:
- name: Sergio
email: tegioz@icloud.com
- name: Cintia
email: cynthiasg@icloud.com
74 changes: 74 additions & 0 deletions charts/dco2/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "dco2.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a fully qualified app name.
*/}}
{{- define "dco2.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := include "dco2.name" . -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Kubernetes resource name prefix
Using the prefix allows deploying multiple instances of the chart in a single namespace.
If the dynamic prefix is disabled, the helper returns an empty string.
Resource names are capped at 63 characters.
We truncate the prefix to leave space for the longest suffix ("server-config" = 12 chars).
*/}}
{{- define "dco2.resourceNamePrefix" -}}
{{- if .Values.dynamicResourceNamePrefixEnabled -}}
{{- include "dco2.fullname" . | trunc 43 | trimSuffix "-" | printf "%s-" -}}
{{- else -}}
{{- "" -}}
{{- end -}}
{{- end -}}

{{/*
Compose a resource name using the optional prefix.
*/}}
{{- define "dco2.resourceName" -}}
{{- $root := index . 0 -}}
{{- $name := index . 1 -}}
{{- printf "%s%s" (include "dco2.resourceNamePrefix" $root) $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create chart name and version.
*/}}
{{- define "dco2.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

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

{{/*
Selector labels.
*/}}
{{- define "dco2.selectorLabels" -}}
app.kubernetes.io/name: {{ include "dco2.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
62 changes: 62 additions & 0 deletions charts/dco2/templates/server_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: server
{{- include "dco2.labels" . | nindent 4 }}
name: {{ include "dco2.resourceName" (list . "server") }}
spec:
replicas: {{ .Values.server.deploy.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/component: server
{{- include "dco2.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app.kubernetes.io/component: server
{{- include "dco2.selectorLabels" . | nindent 8 }}
{{- with .Values.server.deploy.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.server.deploy.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- command:
- dco2-server
args:
- --config-file
- {{ printf "%s/%s" .Values.configDir .Values.configFileName | quote }}
image: {{ printf "%s:%s" .Values.server.deploy.image.repository (default "latest" .Values.imageTag) }}
imagePullPolicy: {{ .Values.pullPolicy }}
name: server
{{- with .Values.server.deploy.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- containerPort: 9000
name: http
protocol: TCP
{{- with .Values.server.deploy.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.server.deploy.resources | nindent 12 }}
volumeMounts:
- mountPath: {{ .Values.configDir | quote }}
name: server-config
readOnly: true
volumes:
- name: server-config
secret:
secretName: {{ include "dco2.resourceName" (list . "server-config") }}
30 changes: 30 additions & 0 deletions charts/dco2/templates/server_ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if .Values.server.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
labels:
app.kubernetes.io/component: server
{{- include "dco2.labels" . | nindent 4 }}
name: {{ include "dco2.resourceName" (list . "server") }}
{{- with .Values.server.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.server.ingress.className }}
ingressClassName: {{ .Values.server.ingress.className }}
{{- end }}
defaultBackend:
service:
name: {{ include "dco2.resourceName" (list . "server") }}
port:
number: {{ .Values.server.ingress.backendServicePort }}
{{- with .Values.server.ingress.hosts }}
rules:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.server.ingress.tls }}
tls:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/dco2/templates/server_secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "dco2.resourceName" (list . "server-config") }}
type: Opaque
stringData:
{{ .Values.configFileName }}: |-
github_app:
{{- if .Values.server.config.githubApp.apiHost }}
api_host: {{ .Values.server.config.githubApp.apiHost }}
{{- end }}
app_id: {{ .Values.server.config.githubApp.appId }}
private_key: |-
{{ .Values.server.config.githubApp.privateKey | default "" | nindent 8 }}
webhook_secret: {{ .Values.server.config.githubApp.webhookSecret | quote }}
log_format: {{ .Values.server.config.logFormat }}
server_addr: {{ .Values.server.config.addr }}
19 changes: 19 additions & 0 deletions charts/dco2/templates/server_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: server
{{- include "dco2.labels" . | nindent 4 }}
name: {{ include "dco2.resourceName" (list . "server") }}
{{- with .Values.server.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
allocateLoadBalancerNodePorts: {{ .Values.server.service.allocateLoadBalancerNodePorts }}
ports:
{{- toYaml .Values.server.service.ports | nindent 4 }}
selector:
app.kubernetes.io/component: server
{{- include "dco2.selectorLabels" . | nindent 4 }}
type: {{ default "ClusterIP" .Values.server.service.type }}
83 changes: 83 additions & 0 deletions charts/dco2/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# DCO2 chart default configuration values

# Image pull secrets (if needed)
imagePullSecrets: []

# Image tag to deploy. Defaults to "latest" when empty.
imageTag: ""

# Name overrides
nameOverride: ""

# Image pull policy
pullPolicy: IfNotPresent

# Overwrite the installation's fullname generation (used for resource naming)
fullnameOverride: ""

# Enable dynamic resource name prefix
#
# When enabled, resources include the Helm installation name as a prefix so multiple
# installations can share a namespace. Override the prefix with `fullnameOverride`.
dynamicResourceNamePrefixEnabled: false

# Directory path where the configuration files should be mounted
configDir: "/home/dco2/.config/dco2"

# Configuration file name mounted for the dco2-server binary
configFileName: "dco2-server.yml"

# DCO2 server configuration
server:
# Configuration passed to the application via a secret
config:
# Address to listen on
addr: "0.0.0.0:9000"

# GitHub application configuration
githubApp:
# Optional GitHub API host override
apiHost: ""
# GitHub application identifier
appId: 0
# GitHub application private key
privateKey: ""
# GitHub webhook secret
webhookSecret: ""

# Log output format [json|pretty]
logFormat: json

# Deployment configuration
deploy:
containerSecurityContext: {}
image:
repository: ghcr.io/cncf/dco2/server
podAnnotations: {}
podSecurityContext: {}
readinessProbe:
httpGet:
path: /health-check
port: 9000
replicaCount: 1
resources: {}

# Ingress configuration
ingress:
annotations: {}
backendServicePort: 80
className: ""
enabled: false
hosts: []
tls: []

# Service configuration
service:
allocateLoadBalancerNodePorts: true
annotations: {}
ports:
- name: http
port: 80
protocol: TCP
targetPort: 9000
type: ClusterIP