Skip to content

Commit

Permalink
Merge pull request #4 from foomo/contentserver
Browse files Browse the repository at this point in the history
Contentserver
  • Loading branch information
franklinkim authored Mar 18, 2024
2 parents 26bd2cd + bf84b62 commit 9c00c62
Show file tree
Hide file tree
Showing 27 changed files with 1,557 additions and 12 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ lint:
## Generate README
## https://github.com/norwoodj/helm-docs
docs:
@docker run --rm --volume "$$(pwd):/helm-docs" jnorwood/helm-docs:v1.12.0 --template-files ./README.md.gotmpl
@for dir in ./charts/* ; do \
docker run --rm --volume "$$(pwd)/$${dir}:/helm-docs/$${dir}" jnorwood/helm-docs:v1.12.0 --template-files "$${dir}/README.md.gotmpl" ;\
done

.PHONY: schema
## Generate values JSON schema
Expand Down
23 changes: 23 additions & 0 deletions charts/contentserver/.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/contentserver/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
type: application
name: contentserver
description: Helm chart for the foomo Content Server.
icon: https://avatars.githubusercontent.com/u/889755?s=200&v=4
home: https://www.foomo.org
keywords:
- foomo
- foomo-contentserver
sources:
- https://github.com/foomo/helm-charts
- https://github.com/foomo/contentserver
annotations:
"artifacthub.io/links": |
- name: Chart Source
url: https://github.com/foomo/helm-charts
- name: Image Source
url: https://github.com/foomo/contentserver
version: 0.0.1
appVersion: 1.10.2
109 changes: 109 additions & 0 deletions charts/contentserver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# contentserver

![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.10.2](https://img.shields.io/badge/AppVersion-1.10.2-informational?style=flat-square)

Helm chart for the foomo Content Server.

**Homepage:** <https://www.foomo.org>

## Resources

- [Source](https://github.com/foomo/helm-charts)
- [GTM Changelog](https://developers.google.com/tag-platform/tag-manager/server-side/release-notes)

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| contentserver.affinity | object | `{}` | Affinity settings for pods. |
| contentserver.autoscaling.behavior.enabled | bool | `false` | Enable autoscaling behaviours |
| contentserver.autoscaling.behavior.scaleDown | object | `{}` | Scale down policies, must conform to HPAScalingRules |
| contentserver.autoscaling.behavior.scaleUp | object | `{}` | Scale up policies, must conform to HPAScalingRules |
| contentserver.autoscaling.customMetrics | list | `[]` | Custom metrics using the HPA/v2 schema (for example, Pods, Object or External metrics) |
| contentserver.autoscaling.enabled | bool | `false` | Enable autoscaling |
| contentserver.autoscaling.maxReplicas | int | `100` | Maximum autoscaling replicas |
| contentserver.autoscaling.minReplicas | int | `1` | Minimum autoscaling replicas |
| contentserver.autoscaling.targetCPUUtilizationPercentage | int | `80` | Target CPU utilisation percentage |
| contentserver.autoscaling.targetMemoryUtilizationPercentage | string | `nil` | Target memory utilisation percentage |
| contentserver.dnsConfig | object | `{}` | DNSConfig settings for pods. |
| contentserver.extraArgs | list | `[]` | Arguements to add |
| contentserver.extraEnv | list | `[]` | Environment variables to add |
| contentserver.extraEnvFrom | list | `[]` | Environment variables from secrets or configmaps to add |
| contentserver.extraPorts | list | `[]` | Port definitions to add |
| contentserver.extraVolumeMounts | list | `[]` | Volume mounts to add |
| contentserver.extraVolumes | list | `[]` | Volumes to add |
| contentserver.hostAliases | list | `[]` | Host aliases to add |
| contentserver.image.pullPolicy | string | `"IfNotPresent"` | The image pull policy |
| contentserver.image.repository | string | `"foomo/contentserver"` | The image repository |
| contentserver.image.tag | string | `"1.10.2"` | The image tag |
| contentserver.imagePullSecrets | list | `[]` | Image pull secrets |
| contentserver.livenessProbe | object | `{"tcpSocket":{"port":8080}}` | Liveness probe settings for pods. |
| contentserver.maxUnavailable | string | `nil` | Pod Disruption Budget maxUnavailable |
| contentserver.nodeSelector | object | `{}` | Tolerations settings for pods. |
| contentserver.podAnnotations | object | `{}` | Annotations for pods |
| contentserver.podLabels | object | `{}` | Labels for pods |
| contentserver.podSecurityContext | object | `{}` | The SecurityContext for pods |
| contentserver.readinessProbe | object | `{"tcpSocket":{"port":8080}}` | Readiness probe settings for pods. |
| contentserver.replicaCount | int | `1` | Number of replicas |
| contentserver.resources | object | `{}` | Resource request & limits. |
| contentserver.roll | bool | `false` | Always roll your deployment |
| contentserver.securityContext | object | `{}` | |
| contentserver.service.annotations | object | `{}` | Annotations for the service |
| contentserver.service.labels | object | `{}` | Labels for service |
| contentserver.service.port | int | `8080` | Port of the service |
| contentserver.service.type | string | `"ClusterIP"` | Type of the service |
| contentserver.startupProbe | object | `{"tcpSocket":{"port":8080}}` | Startup probe settings for pods. |
| contentserver.tolerations | list | `[]` | Tolerations settings for pods. |
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
| ingress.annotations | object | `{}` | |
| ingress.className | string | `""` | |
| ingress.enabled | bool | `false` | |
| ingress.hosts[0] | string | `"example.com"` | |
| ingress.paths.contentserver[0].path | string | `"/contentserver"` | |
| ingress.paths.contentserver[0].pathType | string | `"Prefix"` | |
| ingress.paths.contentserver[0].port | int | `8080` | |
| ingress.tls | list | `[]` | |
| nameOverride | string | `""` | Overrides the chart's name |
| namespaceOverride | string | `""` | The name of the Namespace to deploy If not set, `.Release.Namespace` is used |
| networkPolicy.discovery.namespaceSelector | object | `{}` | Specifies the namespace the discovery Pods are running in |
| networkPolicy.discovery.podSelector | object | `{}` | Specifies the Pods labels used for discovery. As this is cross-namespace communication, you also need the namespaceSelector. |
| networkPolicy.discovery.port | string | `nil` | Specify the port used for discovery |
| networkPolicy.enabled | bool | `false` | Specifies whether Network Policies should be created |
| networkPolicy.externalStorage.cidrs | list | `[]` | Specifies specific network CIDRs you want to limit access to |
| networkPolicy.externalStorage.ports | list | `[]` | Specify the port used for external storage, e.g. AWS S3 |
| networkPolicy.ingress.namespaceSelector | object | `{}` | Specifies the namespaces which are allowed to access the http port |
| networkPolicy.ingress.podSelector | object | `{}` | Specifies the Pods which are allowed to access the http port. As this is cross-namespace communication, you also need the namespaceSelector. |
| networkPolicy.metrics.cidrs | list | `[]` | Specifies specific network CIDRs which are allowed to access the metrics port. In case you use namespaceSelector, you also have to specify your kubelet networks here. The metrics ports are also used for probes. |
| networkPolicy.metrics.namespaceSelector | object | `{}` | Specifies the namespaces which are allowed to access the metrics port |
| networkPolicy.metrics.podSelector | object | `{}` | Specifies the Pods which are allowed to access the metrics port. As this is cross-namespace communication, you also need the namespaceSelector. |
| persistence.accessModes | list | `["ReadWriteOnce"]` | Access modes for the PVC |
| persistence.annotations | object | `{}` | Annotations for the PVC |
| persistence.enabled | bool | `false` | Enable persistent storage |
| persistence.labels | object | `{}` | Labels for the PVC |
| persistence.path | string | `"/var/lib/contentserver"` | - File storage location |
| persistence.size | string | `"1Gi"` | Storage size |
| persistence.storageClass | string | `""` | - Storage class to be used |
| rbac.enabled | bool | `false` | Create PodSecurityPolicy. |
| repository.poll | bool | `false` | - If true, the address arg will be used to periodically poll the content url e.g. http://contentserverexport:8080/poll-revision |
| repository.timeout | string | `"2m"` | - Timeout duration for the contentserver |
| repository.url | string | `""` | Repository server url e.g. http://contentserverexport:8080 |
| revisionHistoryLimit | int | `10` | Number of revisions to retain to allow rollback |
| server.address | string | `":8080"` | - Address to bind web server host:port, when empty no webserver will be spawned |
| server.path | string | `"/contentserver"` | Path to export the webserver on - useful when behind a proxy e.g. /contentserver |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | If not set and create is true, a name is generated using the fullname template |
| serviceMonitor.annotations | object | `{}` | ServiceMonitor annotations |
| serviceMonitor.enabled | bool | `false` | If enabled, ServiceMonitor resources for Prometheus Operator are created |
| serviceMonitor.interval | string | `nil` | ServiceMonitor scrape interval |
| serviceMonitor.labels | object | `{}` | Additional ServiceMonitor labels |
| serviceMonitor.matchExpressions | list | `[]` | Optional expressions to match on |
| serviceMonitor.metricRelabelings | list | `[]` | ServiceMonitor metric relabel configs to apply to samples before ingestion https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint |
| serviceMonitor.namespace | string | `nil` | Alternative namespace for ServiceMonitor resources |
| serviceMonitor.namespaceSelector | object | `{}` | Namespace selector for ServiceMonitor resources |
| serviceMonitor.relabelings | list | `[]` | ServiceMonitor relabel configs to apply to samples before scraping https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#relabelconfig |
| serviceMonitor.scheme | string | `"http"` | ServiceMonitor will use http by default, but you can pick https as well |
| serviceMonitor.scrapeTimeout | string | `nil` | ServiceMonitor scrape timeout in Go duration format (e.g. 15s) |
| serviceMonitor.targetLabels | list | `[]` | |
| serviceMonitor.tlsConfig | string | `nil` | ServiceMonitor will use these tlsConfig settings to make the health check requests |
19 changes: 19 additions & 0 deletions charts/contentserver/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.badgesSection" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

{{ template "chart.maintainersSection" . }}

## Resources

- [Source](https://github.com/foomo/helm-charts)
- [GTM Changelog](https://developers.google.com/tag-platform/tag-manager/server-side/release-notes)

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}
69 changes: 69 additions & 0 deletions charts/contentserver/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "contentserver.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 "contentserver.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 "contentserver.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "contentserver.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "contentserver.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the namespace
*/}}
{{- define "contentserver.namespace" -}}
{{- default .Release.Namespace .Values.namespaceOverride }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/contentserver/templates/contentserver/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{/*
default fullname
*/}}
{{- define "contentserver.contentserver.fullname" -}}
{{ include "contentserver.fullname" . }}
{{- end }}

{{/*
default common labels
*/}}
{{- define "contentserver.contentserver.labels" -}}
{{ include "contentserver.labels" . }}
{{- end }}

{{/*
default selector labels
*/}}
{{- define "contentserver.contentserver.selectorLabels" -}}
{{ include "contentserver.selectorLabels" . }}
{{- end }}
118 changes: 118 additions & 0 deletions charts/contentserver/templates/contentserver/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "contentserver.contentserver.fullname" . }}
labels:
{{- include "contentserver.contentserver.labels" . | nindent 4 }}
namespace: {{ include "contentserver.namespace" . }}
spec:
{{- if not .Values.contentserver.autoscaling.enabled }}
replicas: {{ .Values.contentserver.replicaCount }}
{{- end }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
selector:
matchLabels:
{{- include "contentserver.contentserver.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "contentserver.contentserver.labels" . | nindent 8 }}
{{- with .Values.contentserver.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.contentserver.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "contentserver.serviceAccountName" . }}
{{- with .Values.contentserver.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.contentserver.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.contentserver.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: contentserver
{{- with .Values.contentserver.image }}
image: "{{ .repository }}:{{ .tag }}"
imagePullPolicy: {{ .pullPolicy }}
{{- end }}
{{- with .Values.contentserver.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.contentserver.service.port }}
protocol: TCP
args:
- -var-dir
- {{ .Values.persistence.path }}
{{- if .Values.server.address }}
- -webserver-address
- {{ .Values.server.address }}
- -webserver-path
- {{ .Values.server.path }}
{{- end }}
{{- if .Values.repository.poll }}
- -poll
{{- end }}
- -repository-timeout-duration
- {{ .Values.repository.timeout }}
{{- with .Values.contentserver.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
- {{ .Values.repository.url }}
env:
{{- with .Values.contentserver.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.contentserver.extraEnvFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
readinessProbe:
{{- toYaml .Values.contentserver.readinessProbe | nindent 12 }}
livenessProbe:
{{- toYaml .Values.contentserver.livenessProbe | nindent 12 }}
{{- with .Values.contentserver.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.contentserver.extraVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{- if .Values.persistence.enabled }}
- name: storage
persistentVolumeClaim:
claimName: {{ include "contentserver.contentserver.fullname" . }}
readOnly: false
{{- end }}
{{- with .Values.contentserver.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.contentserver.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.contentserver.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.contentserver.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.contentserver.dnsConfig }}
dnsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}
Loading

0 comments on commit 9c00c62

Please sign in to comment.