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
12 changes: 12 additions & 0 deletions incubator/gitea/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
description: A Helm chart for Gitea
name: gitea
version: 0.1.0
appVersion: 1.2
home: https://gitea.io/
icon: https://gitea.io/images/gitea.png
sources:
- https://github.com/go-gitea/gitea
maintainers:
- name: jpds
email: [email protected]
45 changes: 45 additions & 0 deletions incubator/gitea/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Gitea Helm Chart

This directory contains a Kubernetes chart to deploy Gitea, a painless
self-hosted Git server.

## Prerequisites Details

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

## Chart Details

This chart will do the following:

* Implement a Gitea deployment

## Installing the Chart

To install the chart, use the following:

```console
$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
$ helm install incubator/gitea
```

Please note that the default database used is SQLite3. If another database is
desired, that must be deployed beforehand and the `gitea.database.*`
variables must be configured.

## Configuration

The following tables lists the configurable parameters of the vault chart and
their default values.

| Parameter | Description | Default |
|-------------------------|-------------------------------------|-----------------------------------------------------|
| `image.pullPolicy` | Container pull policy | `IfNotPresent` |
| `image.repository` | Container image to use | `gitea/gitea` |
| `image.tag` | Container image tag to deploy | `1.2` |
| `gitea.*` | Gitea configuration | Please see `values.yaml` |
| `replicaCount` | k8s replicas | `1` |
| `resources.limits.cpu` | Container requested CPU | `nil` |
| `resources.limits.memory` | Container requested memory | `nil` |

Specify each parameter using the `--set key=value[,key=value]` argument to
`helm install`.
19 changes: 19 additions & 0 deletions incubator/gitea/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http://{{ . }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "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.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:{{ .Values.service.port }}
{{- end }}
16 changes: 16 additions & 0 deletions incubator/gitea/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "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).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
128 changes: 128 additions & 0 deletions incubator/gitea/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
kind: ConfigMap
apiVersion: v1
metadata:
labels:
app: {{ template "fullname" . }}-config
Copy link
Member

Choose a reason for hiding this comment

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

app label should be {{ template "name" . }} on all resources.

chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
component: {{ default "gitea" .Values.service.nameOverride }}
Copy link
Member

Choose a reason for hiding this comment

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

I don't see why a component label on the configmap would make sense. I'd suggest you remove it.

heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "fullname" . }}-config
Copy link
Member

Choose a reason for hiding this comment

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

All other resources are named {{ template "fullname" . }}. So should be the configmap.

data:
app.ini: |-
APP_NAME = {{ .Values.gitea.appName }}
RUN_MODE = {{ .Values.gitea.runMode }}
RUN_USER = {{ .Values.gitea.runUser }}

[repository]
ROOT = {{ .Values.gitea.repository.root }}
SCRIPT_TYPE = {{ .Values.gitea.repository.scriptType }}
ANSI_CHARSET = {{ .Values.gitea.repository.ansiCharset }}
FORCE_PRIVATE = {{ .Values.gitea.repository.forcePrivate }}
MAX_CREATION_LIMIT = {{ .Values.gitea.repository.maxCreationLimit }}
PULL_REQUEST_QUEUE_LENGTH = {{ .Values.gitea.repository.pullRequestQueueLength }}

[ui]
EXPLORE_PAGING_NUM = {{ .Values.gitea.ui.explorePagingNum }}
ISSUE_PAGING_NUM = {{ .Values.gitea.ui.issuePagingNum }}
FEED_MAX_COMMIT_NUM = {{ .Values.gitea.ui.feedMaxCommitNum }}

[ui.admin]
USER_PAGING_NUM = {{ .Values.gitea.uiAdmin.userPagingNum }}
REPO_PAGING_NUM = {{ .Values.gitea.uiAdmin.repoPagingNum }}
NOTICE_PAGING_NUM = {{ .Values.gitea.uiAdmin.noticePagingNum }}
ORG_PAGING_NUM = {{ .Values.gitea.uiAdmin.orgPagingNum }}

[markdown]
ENABLE_HARD_LINE_BREAK = {{ .Values.gitea.markdown.enableHardLineBreak }}

[server]
PROTOCOL = http
DOMAIN = {{ .Values.gitea.server.domain }}
ROOT_URL = {{ .Values.gitea.server.rootUrl }}
HTTP_ADDR = {{ .Values.gitea.server.httpAddr }}
HTTP_PORT = {{ .Values.gitea.server.httpPort }}
UNIX_SOCKET_PERMISSION = {{ .Values.gitea.server.unixSocketPermission }}
DISABLE_SSH = {{ .Values.gitea.server.disableSsh }}
START_SSH_SERVER = {{ .Values.gitea.server.startSshServer }}
SSH_DOMAIN = {{ .Values.gitea.server.sshDomain }}
SSH_PORT = {{ .Values.gitea.server.sshPort }}
SSH_LISTEN_PORT = {{ .Values.gitea.server.sshListenPort }}
OFFLINE_MODE = {{ .Values.gitea.server.offlineMode }}
DISABLE_ROUTER_LOG = {{ .Values.gitea.server.disableRouterLog }}
CERT_FILE = {{ .Values.gitea.server.certFile }}
KEY_FILE = {{ .Values.gitea.server.keyFile }}
STATIC_ROOT_PATH = {{ .Values.gitea.server.staticRootPath }}
ENABLE_GZIP = {{ .Values.gitea.server.enableGzip }}
LANDING_PAGE = {{ .Values.gitea.server.landingPage }}
LFS_START_SERVER = {{ .Values.gitea.server.lfsStartServer }}
LFS_CONTENT_PATH = {{ .Values.gitea.server.lfsContentPath }}
LFS_JWT_SECRET = {{ .Values.gitea.server.lfsJwtSecret }}

[database]
DB_TYPE = {{ .Values.gitea.database.dbType | quote }}
HOST = {{ .Values.gitea.database.host | quote }}
NAME = {{ .Values.gitea.database.name | quote }}
USER = {{ .Values.gitea.database.user | quote }}
PASSWD = {{ .Values.gitea.database.password | quote }}
SSL_MODE = {{ .Values.gitea.database.sslMode }}
PATH = {{ .Values.gitea.database.path }}

[security]
INSTALL_LOCK = true
SECRET_KEY = {{ default "" .Values.gitea.security.secretKey | b64enc | quote }}
LOGIN_REMEMBER_DAYS = {{ .Values.gitea.security.loginRememberDays }}
COOKIE_USERNAME = {{ .Values.gitea.security.cookieUsername }}
COOKIE_REMEMBER_NAME = {{ .Values.gitea.security.cookieRememberName }}
REVERSE_PROXY_AUTHENTICATION_USER = {{ .Values.gitea.security.reverseProxyAuthenticationUser }}

[openid]
ENABLE_OPENID_SIGNIN = {{ .Values.gitea.openid.enableOpenidSignin }}
ENABLE_OPENID_SIGNUP = {{ .Values.gitea.openid.enableOpenidSignup }}
WHITELISTED_URIS = {{ .Values.gitea.openid.whitelistedUris }}
BLACKLISTED_URIS = {{ .Values.gitea.openid.blacklistedUris }}

[service]
ACTIVE_CODE_LIVE_MINUTES = {{ .Values.gitea.service.activeCodeLiveMinutes }}
RESET_PASSWD_CODE_LIVE_MINUTES = {{ .Values.gitea.service.resetPasswdCodeLiveMinutes }}
REGISTER_EMAIL_CONFIRM = {{ .Values.gitea.service.registerEmailConfirm }}
DISABLE_REGISTRATION = {{ .Values.gitea.service.disableRegistration }}
SHOW_REGISTRATION_BUTTON = {{ .Values.gitea.service.showRegistrationButton }}
REQUIRE_SIGNIN_VIEW = {{ .Values.gitea.service.requireSignInView }}
ENABLE_CACHE_AVATAR = {{ .Values.gitea.service.enableCacheAvatar }}
ENABLE_NOTIFY_MAIL = {{ .Values.gitea.service.enableNotifyMail }}
ENABLE_REVERSE_PROXY_AUTHENTICATION = {{ .Values.gitea.service.enableReverseProxyAuthentication }}
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = {{ .Values.gitea.service.enableReverseProxyAutoRegistration }}
DISABLE_MINIMUM_KEY_SIZE_CHECK = {{ .Values.gitea.service.disableMinimumKeySizeCheck }}
ENABLE_CAPTCHA = {{ .Values.gitea.service.enableCaptcha }}

[webhook]
QUEUE_LENGTH = {{ .Values.gitea.webhook.queueLength }}
DELIVER_TIMEOUT = {{ .Values.gitea.webhook.deliverTimeout }}
SKIP_TLS_VERIFY = {{ .Values.gitea.webhook.skipTlsVerify }}
PAGING_NUM = {{ .Values.gitea.webhook.pagingNum }}

[mailer]

[cache]
ADAPTER = {{ .Values.gitea.cache.adapter }}
INTERVAL = {{ .Values.gitea.cache.interval }}
HOST = {{ .Values.gitea.cache.host }}

[session]

[picture]

[attachment]

[log]
MODE = {{ .Values.gitea.log.mode }}
LEVEL = {{ .Values.gitea.log.level }}

[cron]

[other]
SHOW_FOOTER_BRANDING = {{ .Values.gitea.other.showFooterBranding }}
SHOW_FOOTER_VERSION = {{ .Values.gitea.other.showFooterVersion }}
SHOW_FOOTER_TEMPLATE_LOAD_TIME = {{ .Values.gitea.other.showFooterTemplateLoadTime }}

56 changes: 56 additions & 0 deletions incubator/gitea/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.port }}
livenessProbe:
httpGet:
path: /
port: {{ .Values.service.port }}
initialDelaySeconds: 30
readinessProbe:
httpGet:
path: /
port: {{ .Values.service.port }}
initialDelaySeconds: 30
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
volumeMounts:
- name: data
mountPath: /data
- name: config
mountPath: /data/gitea/conf/app.ini
subPath: app.ini
volumes:
- name: config
configMap:
name: {{ template "fullname" . }}-config
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}
{{- else }}
emptyDir: {}
{{- end -}}
32 changes: 32 additions & 0 deletions incubator/gitea/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "fullname" . -}}
{{- $servicePort := .Values.service.port -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host }}
http:
paths:
- path: /
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
24 changes: 24 additions & 0 deletions incubator/gitea/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.persistence.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions incubator/gitea/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
protocol: TCP
name: {{ .Values.service.name }}
selector:
app: {{ template "name" . }}
release: {{ .Release.Name }}
Loading