Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.
Closed
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
21 changes: 21 additions & 0 deletions incubator/gitea/.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
9 changes: 9 additions & 0 deletions incubator/gitea/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
appVersion: 1.4.2
description: Git with a cup of tea, painless self-hosted git service
home: https://gitea.io
keywords:
- git
- gitea
name: gitea
version: 0.1.0
72 changes: 72 additions & 0 deletions incubator/gitea/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Gitea Helm Chart

[Gitea][] is a painless self-hosted Git service.

## TL;DR;

```console
$ helm install incubator/gitea
```

## Introduction

This chart bootstraps a [Gitea][] deployment on a [Kubernetes][] cluster using
the [Helm][] package manager.

## Prerequisites Details

* PV support on underlying infrastructure (if persistence is required)

## Installing the Chart

To install the chart with the release name `my-release`:

```console
$ helm install --name my-release incubator/gitea
```

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```console
$ helm delete my-release
```

The command removes nearly all the Kubernetes components associated with the
chart and deletes the release.

## Configuration

The following table lists some of the configurable parameters of the Gitea
chart and their default values.

| Parameter | Description | Default |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sure what it's worth, but usually other Charts list every possible configuration settings of values.yaml. I'm not sure if that's really a benefit, because your values.yaml seems to have enough comments. Anyway, that's just my 2 cents

| ----------------------- | ---------------------------------- | ---------------------------------------------------------- |
| `imageRepository` | Gitea image | `gitea/gitea` |
| `imageTag` | Gitea image version | `1.4.2` |
| `imagePullPolicy` | Gitea image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` |
| `postgresql.install` | Weather or not to install PostgreSQL dependency | `true` |
| `postgresql.postgresHost` | PostgreSQL host (if `postgresql.install == false`) | `nil` |
| `postgresql.postgresUser` | PostgreSQL User to create | `gitea` |
| `postgresql.postgresPassword` | PostgreSQL Password for the new user | `gitea` |
| `postgresql.postgresDatabase` | PostgreSQL Database to create | `gitea` |
| `postgresql.persistence.enabled` | Enable PostgreSQL persistence using Persistent Volume Claims | `true` |

See [values.yaml](values.yaml) for a more complete list, and links to the Gitea documentation.

Specify each parameter using the `--set key=value[,key=value]` argument to
`helm install`.

Alternatively, a YAML file that specifies the values for the parameters can be
provided while installing the chart. For example,

```console
$ helm install --name my-release -f values.yaml incubator/gitea
```

> **Tip**: You can use the default [values.yaml](values.yaml)

[Gitea]: https://github.com/go-gitea/gitea
[Kubernetes]: https://kubernetes.io
[Helm]: https://helm.sh
7 changes: 7 additions & 0 deletions incubator/gitea/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencies:
- name: postgresql
version: 0.6.0
repository: https://kubernetes-charts.storage.googleapis.com/
condition: postgresql.install
tags:
- postgresql
23 changes: 23 additions & 0 deletions incubator/gitea/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
1. Get the Gitea URL by running:

{{- if contains "NodePort" .Values.serviceType }}

export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "gitea.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT/

{{- else if contains "LoadBalancer" .Values.serviceType }}

NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "gitea.fullname" . }}'

export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "gitea.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP/
{{- else if contains "ClusterIP" .Values.serviceType }}

export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "gitea.fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
echo http://127.0.0.1:8080/
kubectl port-forward $POD_NAME 8080:80
{{- end }}

2. Register a user. The first user registered will be the administrator.
78 changes: 78 additions & 0 deletions incubator/gitea/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "gitea.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 "gitea.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 a default fully qualified postgresql name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "gitea.postgresql.fullname" -}}
{{- $name := default "postgresql" .Values.postgresql.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Determine database user based on use of postgresql dependency.
*/}}
{{- define "gitea.database.host" -}}
{{- if .Values.postgresql.install -}}
{{- template "gitea.postgresql.fullname" . -}}
{{- else -}}
{{- .Values.service.gitea.databaseHost | quote -}}
{{- end -}}
{{- end -}}

{{/*
Determine database user based on use of postgresql dependency.
*/}}
{{- define "gitea.database.user" -}}
{{- if .Values.postgresql.install -}}
{{- .Values.postgresql.postgresUser | quote -}}
{{- else -}}
{{- .Values.service.gitea.databaseUser | quote -}}
{{- end -}}
{{- end -}}

{{/*
Determine database password based on use of postgresql dependency.
*/}}
{{- define "gitea.database.password" -}}
{{- if .Values.postgresql.install -}}
{{- .Values.postgresql.postgresPassword | quote -}}
{{- else -}}
{{- .Values.service.gitea.databasePassword | quote -}}
{{- end -}}
{{- end -}}

{{/*
Determine database name based on use of postgresql dependency.
*/}}
{{- define "gitea.database.name" -}}
{{- if .Values.postgresql.install -}}
{{- .Values.postgresql.postgresDatabase | quote -}}
{{- else -}}
{{- .Values.service.gitea.databaseName | quote -}}
{{- end -}}
{{- end -}}
13 changes: 13 additions & 0 deletions incubator/gitea/templates/configmap-tcp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kind: ConfigMap
apiVersion: v1
metadata:
labels:
app: {{ template "gitea.fullname" . }}-tcp
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
component: {{ default "gitea" .Values.service.nameOverride }}
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
name: tcp-{{ template "gitea.fullname" . }}-ssh
data:
2222: default/{{ template "gitea.fullname" . }}:ssh

80 changes: 80 additions & 0 deletions incubator/gitea/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
kind: ConfigMap
apiVersion: v1
metadata:
labels:
app: {{ template "gitea.fullname" . }}-config
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
component: {{ default "gitea" .Values.service.nameOverride }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "gitea.fullname" . }}-config
data:
app.ini: |-
APP_NAME = {{ .Values.service.gitea.appName }}
RUN_MODE = {{ .Values.service.gitea.runMode }}

[repository.upload]
ENABLED = {{ .Values.service.gitea.repositoryUploadEnabled }}
ALLOWED_TYPES = {{ .Values.service.gitea.repositoryUploadAllowedTypes }}
MAX_FILE_SIZE = {{ .Values.service.gitea.repositoryUploadMaxFileSize }}
MAX_FILES = {{ .Values.service.gitea.repositoryUploadMaxFiles }}

[server]
PROTOCOL = http
DOMAIN = {{ .Values.service.gitea.serverDomain }}
ROOT_URL = {{ .Values.service.gitea.serverRootUrl }}
LANDING_PAGE = {{ .Values.service.gitea.serverLandingPage }}
SSH_DOMAIN = {{ default .Values.service.gitea.serverDomain .Values.service.sshDomain }}
SSH_PORT = {{ .Values.service.sshPort }}
SSH_LISTEN_PORT = {{ .Values.service.sshPort }}

[service]
ENABLE_CAPTCHA = {{ .Values.service.gitea.serviceEnableCaptcha }}
ACTIVE_CODE_LIVE_MINUTES = 180
RESET_PASSWD_CODE_LIVE_MINUTES = 180
REGISTER_EMAIL_CONFIRM = {{ .Values.service.gitea.serviceRegisterEmailConfirm }}
DISABLE_REGISTRATION = {{ .Values.service.gitea.serviceDisableRegistration }}
REQUIRE_SIGNIN_VIEW = {{ .Values.service.gitea.serviceRequireSignInView }}
ENABLE_NOTIFY_MAIL = {{ .Values.service.gitea.serviceEnableNotifyMail }}
ENABLE_REVERSE_PROXY_AUTHENTICATION = false
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false

[database]
DB_TYPE = {{ .Values.service.gitea.databaseType | quote }}
HOST = {{ template "gitea.database.host" . }}
NAME = {{ template "gitea.database.name" . }}
USER = {{ template "gitea.database.user" . }}
PASSWD = {{ template "gitea.database.password" . }}
PATH = {{ .Values.service.gitea.databasePath | quote }}

[security]
INSTALL_LOCK = true
SECRET_KEY = {{ default "" .Values.service.gitea.securitySecretKey | b64enc | quote }}

[ui]
EXPLORE_PAGING_NUM = {{ .Values.service.gitea.uiExplorePagingNum }}
ISSUE_PAGING_NUM = {{ .Values.service.gitea.uiIssuePagingNum }}
FEED_MAX_COMMIT_NUM = {{ .Values.service.gitea.uiFeedMaxCommitNum }}

[cache]
ADAPTER = {{ .Values.service.gitea.cacheAdapter }}
INTERVAL = {{ .Values.service.gitea.cacheInterval }}
HOST = {{ .Values.service.gitea.cacheHost }}

[webhook]
QUEUE_LENGTH = {{ .Values.service.gitea.webhookQueueLength }}
DELIVER_TIMEOUT = {{ .Values.service.gitea.webhookDeliverTimeout }}
SKIP_TLS_VERIFY = {{ .Values.service.gitea.webhookSkipTlsVerify }}
PAGING_NUM = {{ .Values.service.gitea.webhookPagingNum }}

[log]
MODE = {{ .Values.service.gitea.logMode }}
LEVEL = {{ .Values.service.gitea.logLevel }}

[other]
SHOW_FOOTER_BRANDING = {{ .Values.service.gitea.otherShowFooterBranding }}
SHOW_FOOTER_VERSION = {{ .Values.service.gitea.otherShowFooterVersion }}
SHOW_FOOTER_TEMPLATE_LOAD_TIME = {{ .Values.service.gitea.otherShowFooterTemplateLoadTime }}

[indexer]
ISSUE_INDEXER_PATH = {{ .Values.service.gitea.indexerIssuePath }}
64 changes: 64 additions & 0 deletions incubator/gitea/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "gitea.fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
strategy:
type: RollingUpdate
selector:
matchLabels:
app: {{ template "gitea.fullname" . }}
template:
metadata:
labels:
app: {{ template "gitea.fullname" . }}
spec:
initContainers:
- name: copy-app-ini
image: alpine:3.7
command: ["/bin/sh"]
args: ["-c", "cp /config/* /config-rw/ ; chmod 777 /config-rw/*"]
volumeMounts:
- name: config
mountPath: /config
- name: config-rw
mountPath: /config-rw
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 3000
- containerPort: {{ .Values.service.sshPort | int }}
livenessProbe:
httpGet:
path: /
port: 3000
readinessProbe:
httpGet:
path: /
port: 3000
env:
resources:
{{ toYaml .Values.resources | indent 12 }}
volumeMounts:
- name: data
mountPath: /data
- name: config-rw
mountPath: /etc/gitea/conf

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect you mean to mount this to /etc/templates/ so that it gets consumed by https://github.com/go-gitea/gitea/blob/6e03390aa8fa096206457962db1955d642860b57/docker/etc/s6/gitea/setup#L39 on initial start up

volumes:
- name: config
configMap:
name: {{ template "gitea.fullname" . }}-config
- name: config-rw
emptyDir: {}
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "gitea.fullname" . }}
{{- else }}
emptyDir: {}
{{- end -}}
Loading