Skip to content

Commit

Permalink
feat: add gitlab-combiner
Browse files Browse the repository at this point in the history
  • Loading branch information
RozmarinUS committed Oct 22, 2024
1 parent 17c45fa commit 9795e34
Show file tree
Hide file tree
Showing 12 changed files with 288 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
values-test.yaml
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
This repository contains [Helm](https://helm.sh) charts for various projects

* [CertManager Webhook ISP Manager](https://github.com/GlobalArtInc/cert-manager-webhook-ispmanager)
* [Gitlab MR Combiner](https://github.com/GlobalArtInc/gitlab-mr-combiner)

## Usage

Expand Down
21 changes: 21 additions & 0 deletions charts/gitlab-mr-combiner/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
5 changes: 5 additions & 0 deletions charts/gitlab-mr-combiner/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
name: gitlab-mr-combiner
appVersion: "1.0.0"
description: Gitlab MR Combiner
version: 1.0.0
Empty file.
56 changes: 56 additions & 0 deletions charts/gitlab-mr-combiner/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "gitlab-mr-combiner.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 "gitlab-mr-combiner.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 "gitlab-mr-combiner.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "gitlab-mr-combiner.labels" -}}
app.kubernetes.io/name: {{ include "gitlab-mr-combiner.name" . }}
helm.sh/chart: {{ include "gitlab-mr-combiner.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "gitlab-mr-combiner.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "gitlab-mr-combiner.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
8 changes: 8 additions & 0 deletions charts/gitlab-mr-combiner/templates/config-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Chart.Name }}-config
data:
{{ range $key, $val := index .Values.configMap }}
{{ $key | snakecase | upper }}: {{ quote $val }}
{{ end }}
64 changes: 64 additions & 0 deletions charts/gitlab-mr-combiner/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "gitlab-mr-combiner.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ include "gitlab-mr-combiner.name" . }}
chart: {{ include "gitlab-mr-combiner.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "gitlab-mr-combiner.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ include "gitlab-mr-combiner.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
envFrom:
- configMapRef:
name: {{ .Chart.Name }}-config
env:
- name: GITLAB_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Chart.Name }}-secrets
key: gitlabToken
resources:
{{ toYaml .Values.resources | indent 12 }}
volumeMounts:
- name: ssh-keys
mountPath: /root/.ssh/id_rsa
subPath: sshKey
securityContext:
privileged: true
volumes:
- name: ssh-keys
secret:
secretName: {{ .Chart.Name }}-secrets
defaultMode: 0600
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
31 changes: 31 additions & 0 deletions charts/gitlab-mr-combiner/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-ingress
namespace: {{ .Release.Namespace }}
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className | default "nginx" }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}
port:
number: {{ .Values.service.port }}
{{- if .Values.ingress.tlsSecretName }}
tls:
- hosts:
- {{ .Values.ingress.host }}
secretName: {{ .Values.ingress.tlsSecretName }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/gitlab-mr-combiner/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Chart.Name }}-secrets
namespace: {{ .Release.Namespace | quote }}
type: Opaque
data:
gitlabToken: {{ .Values.secret.gitlabToken | b64enc | quote }}
sshKey: {{ .Values.secret.sshKey | b64enc | quote }}
16 changes: 16 additions & 0 deletions charts/gitlab-mr-combiner/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "gitlab-mr-combiner.fullname" . }}
labels:
{{ include "gitlab-mr-combiner.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ include "gitlab-mr-combiner.name" . }}
release: {{ .Release.Name }}
76 changes: 76 additions & 0 deletions charts/gitlab-mr-combiner/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Default values for example.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: globalartltd/gitlab-mr-combiner
tag: latest
pullPolicy: IfNotPresent

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
# Specifies whether a service account should be created
create: true
# The name of the service account to use.
# If not set and create Ff true, a name is generated using the fullname template
name:

configMap:
triggerMessage: "/specific-message"
triggerTag: "specific_tag"
targetBranch: "target_branch"
gitlabUrl: "<your_gitlab_url>"
gitEmail: "[email protected]"
gitUser: "vcs"

secret:
sshKey: |
-----BEGIN OPENSSH PRIVATE KEY-----
your ssh key here
-----END OPENSSH PRIVATE KEY-----
gitlabToken: "<your access_token>"

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
type: ClusterIP
port: 8080

ingress:
enabled: false
annotations: {}
className: nginx
host: chart-example.local
tlsSecretName: chart-example-tls

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit 9795e34

Please sign in to comment.