diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1f1248e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +values-test.yaml \ No newline at end of file diff --git a/README.md b/README.md index 7c952af..5b1e716 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/charts/gitlab-mr-combiner/.helmignore b/charts/gitlab-mr-combiner/.helmignore new file mode 100644 index 0000000..f0c1319 --- /dev/null +++ b/charts/gitlab-mr-combiner/.helmignore @@ -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 diff --git a/charts/gitlab-mr-combiner/Chart.yaml b/charts/gitlab-mr-combiner/Chart.yaml new file mode 100644 index 0000000..1d322d2 --- /dev/null +++ b/charts/gitlab-mr-combiner/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +name: gitlab-mr-combiner +appVersion: "1.0.0" +description: Gitlab MR Combiner +version: 1.0.0 diff --git a/charts/gitlab-mr-combiner/templates/NOTES.txt b/charts/gitlab-mr-combiner/templates/NOTES.txt new file mode 100644 index 0000000..e69de29 diff --git a/charts/gitlab-mr-combiner/templates/_helpers.tpl b/charts/gitlab-mr-combiner/templates/_helpers.tpl new file mode 100644 index 0000000..8f59c8a --- /dev/null +++ b/charts/gitlab-mr-combiner/templates/_helpers.tpl @@ -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 -}} \ No newline at end of file diff --git a/charts/gitlab-mr-combiner/templates/config-map.yaml b/charts/gitlab-mr-combiner/templates/config-map.yaml new file mode 100644 index 0000000..f2d9350 --- /dev/null +++ b/charts/gitlab-mr-combiner/templates/config-map.yaml @@ -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 }} \ No newline at end of file diff --git a/charts/gitlab-mr-combiner/templates/deployment.yaml b/charts/gitlab-mr-combiner/templates/deployment.yaml new file mode 100644 index 0000000..b3dcf73 --- /dev/null +++ b/charts/gitlab-mr-combiner/templates/deployment.yaml @@ -0,0 +1,55 @@ +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 + resources: +{{ toYaml .Values.resources | indent 12 }} + volumeMounts: + - name: ssh-key + mountPath: /root/.ssh/id_rsa + subPath: SSH_KEY + volumes: + - name: ssh-key + configMap: + name: {{ .Chart.Name }}-config + {{- with .Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} diff --git a/charts/gitlab-mr-combiner/templates/ingress.yaml b/charts/gitlab-mr-combiner/templates/ingress.yaml new file mode 100644 index 0000000..0186554 --- /dev/null +++ b/charts/gitlab-mr-combiner/templates/ingress.yaml @@ -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.tls }} + tls: + - hosts: + - {{ .Values.ingress.host }} + secretName: {{ .Values.ingress.tlsSecretName }} + {{- end }} +{{- end }} diff --git a/charts/gitlab-mr-combiner/templates/service.yaml b/charts/gitlab-mr-combiner/templates/service.yaml new file mode 100644 index 0000000..f1bcec5 --- /dev/null +++ b/charts/gitlab-mr-combiner/templates/service.yaml @@ -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.kubernetes.io/name: {{ include "gitlab-mr-combiner.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} \ No newline at end of file diff --git a/charts/gitlab-mr-combiner/values.yaml b/charts/gitlab-mr-combiner/values.yaml new file mode 100644 index 0000000..7ac4569 --- /dev/null +++ b/charts/gitlab-mr-combiner/values.yaml @@ -0,0 +1,74 @@ +# 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" + gitlabToken: "" + gitlabUrl: "" + gitEmail: "vcs@example.com" + gitUser: "vcs" + sshKey: | + -----BEGIN OPENSSH PRIVATE KEY----- + your ssh key here + -----END OPENSSH PRIVATE KEY----- + +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: {}