WIP gitea
This commit is contained in:
parent
7670dfe469
commit
3dc27886cb
12 changed files with 218 additions and 45 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
my_context: minikube
|
my_context: minikube
|
||||||
#traefik_version: "2.1"
|
#traefik_version: "2.1"
|
||||||
#traefik_namespace: traefik
|
#traefik_namespace: traefik
|
||||||
|
#drone_certificate: certificate_secret_name
|
||||||
|
#drone_storage_classname:
|
||||||
|
#gitea_certificate: certificate_secret_name
|
||||||
|
#drone_storage_classname:
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ spec:
|
||||||
name: git-ssh
|
name: git-ssh
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /data
|
- mountPath: /data
|
||||||
name: git-data
|
name: gitea-data
|
||||||
- name: gitea-config
|
- name: gitea-config
|
||||||
mountPath: /data/gitea/conf
|
mountPath: /data/gitea/conf
|
||||||
resources:
|
resources:
|
||||||
|
|
@ -51,13 +51,10 @@ spec:
|
||||||
cpu: 1
|
cpu: 1
|
||||||
memory: 200Mi
|
memory: 200Mi
|
||||||
volumes:
|
volumes:
|
||||||
- name: git-data
|
- name: gitea-data
|
||||||
# hostPath:
|
persistentVolumeClaim:
|
||||||
# path: /mnt/kube-data/gitea
|
claimName: gitea
|
||||||
# type: Directory
|
# emptyDir: {}
|
||||||
# persistentVolumeClaim:
|
|
||||||
# claimName: gitea
|
|
||||||
emptyDir: {}
|
|
||||||
- name: gitea-config
|
- name: gitea-config
|
||||||
configMap:
|
configMap:
|
||||||
name: gitea
|
name: gitea
|
||||||
|
|
@ -4,7 +4,7 @@ metadata:
|
||||||
name: gitea
|
name: gitea
|
||||||
namespace: gitea
|
namespace: gitea
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: nginx
|
kubernetes.io/ingress.class: traefik
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
spec:
|
spec:
|
||||||
tls:
|
tls:
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
apiVersion: v1
|
|
||||||
metadata:
|
|
||||||
name: gitea
|
|
||||||
namespace: gitea
|
|
||||||
annotations:
|
|
||||||
volume.beta.kubernetes.io/storage-class: "managed-nfs-storage"
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 10Gi
|
|
||||||
|
|
@ -1,3 +1,30 @@
|
||||||
|
---
|
||||||
|
- name: Gitea setup
|
||||||
|
block:
|
||||||
|
- name: Install Gitea dynamic files
|
||||||
|
k8s:
|
||||||
|
state: present
|
||||||
|
context: "{{ my_context }}"
|
||||||
|
merge_type: merge
|
||||||
|
resource_definition: "{{ lookup('template', 'gitea/' + item) | from_yaml }}"
|
||||||
|
with_items:
|
||||||
|
- gitea-Namespace.yaml.j2
|
||||||
|
- gitea-pvc.yml.j2
|
||||||
|
- gitea-IngressRoute.yml.j2
|
||||||
|
# - gitea-IngressRouteTCP.yml.j2
|
||||||
|
- name: Install Gitea static files
|
||||||
|
k8s:
|
||||||
|
state: present
|
||||||
|
context: "{{ my_context }}"
|
||||||
|
merge_type: merge
|
||||||
|
resource_definition: "{{ lookup('file', 'gitea/' + item) | from_yaml }}"
|
||||||
|
with_items:
|
||||||
|
- gitea-ConfigMap.yaml
|
||||||
|
- gitea-Deployment.yaml
|
||||||
|
- gitea-Service.yaml
|
||||||
|
tags:
|
||||||
|
- gitea
|
||||||
|
|
||||||
- name: Drone setup
|
- name: Drone setup
|
||||||
block:
|
block:
|
||||||
- name: Configure environnement
|
- name: Configure environnement
|
||||||
|
|
@ -9,7 +36,6 @@
|
||||||
with_items:
|
with_items:
|
||||||
- drone-Namespace.yaml.j2
|
- drone-Namespace.yaml.j2
|
||||||
tags:
|
tags:
|
||||||
# - drone
|
|
||||||
- drone-server
|
- drone-server
|
||||||
- drone-runner
|
- drone-runner
|
||||||
|
|
||||||
|
|
@ -22,8 +48,9 @@
|
||||||
merge_type: merge
|
merge_type: merge
|
||||||
resource_definition: "{{ lookup('template', item) | from_yaml }}"
|
resource_definition: "{{ lookup('template', item) | from_yaml }}"
|
||||||
with_items:
|
with_items:
|
||||||
- drone/drone-PersistentVolumeClaim.yaml
|
- drone/drone-PersistentVolumeClaim.yml.j2
|
||||||
- drone/drone-Secret.yaml.j2
|
- drone/drone-Secret.yaml.j2
|
||||||
|
- drone/drone-IngressRoute.yml.j2
|
||||||
- name: Install Drone Static files
|
- name: Install Drone Static files
|
||||||
k8s:
|
k8s:
|
||||||
state: present
|
state: present
|
||||||
|
|
@ -64,4 +91,4 @@
|
||||||
tags:
|
tags:
|
||||||
- drone-runner
|
- drone-runner
|
||||||
tags:
|
tags:
|
||||||
- drone
|
- drone
|
||||||
|
|
|
||||||
53
templates/drone/drone-IngressRoute.yml.j2
Normal file
53
templates/drone/drone-IngressRoute.yml.j2
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
apiVersion: traefik.containo.us/v1alpha1
|
||||||
|
kind: IngressRoute
|
||||||
|
metadata:
|
||||||
|
name: drone
|
||||||
|
namespace: drone
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: drone
|
||||||
|
app.kubernetes.io/instance: drone
|
||||||
|
app.kubernetes.io/component: server
|
||||||
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: "traefik"
|
||||||
|
spec:
|
||||||
|
entryPoints:
|
||||||
|
- https
|
||||||
|
routes:
|
||||||
|
# Match is the rule corresponding to an underlying router.
|
||||||
|
# Later on, match could be the simple form of a path prefix, e.g. just "/bar",
|
||||||
|
# but for now we only support a traefik style matching rule.
|
||||||
|
- match: Host(`drone.{{ traefik_domain }}`)
|
||||||
|
# kind could eventually be one of "Rule", "Path", "Host", "Method", "Header",
|
||||||
|
# "Parameter", etc, to support simpler forms of rule matching, but for now we
|
||||||
|
# only support "Rule".
|
||||||
|
kind: Rule
|
||||||
|
# (optional) Priority disambiguates rules of the same length, for route matching.
|
||||||
|
priority: 12
|
||||||
|
{% if basic_auth is defined or ingress_whitelist is defined %}
|
||||||
|
middlewares:
|
||||||
|
{% if ingress_whitelist is defined %}
|
||||||
|
- name: traefik-ipwhitelist
|
||||||
|
{% endif %}
|
||||||
|
{% if basic_auth is defined %}
|
||||||
|
- name: basic-auth
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
services:
|
||||||
|
- name: drone
|
||||||
|
port: 3000
|
||||||
|
# (default 1) A weight used by the weighted round-robin strategy (WRR).
|
||||||
|
weight: 1
|
||||||
|
# (default true) PassHostHeader controls whether to leave the request's Host
|
||||||
|
# Header as it was before it reached the proxy, or whether to let the proxy set it
|
||||||
|
# to the destination (backend) host.
|
||||||
|
passHostHeader: true
|
||||||
|
responseForwarding:
|
||||||
|
# (default 100ms) Interval between flushes of the buffered response body to the client.
|
||||||
|
flushInterval: 100ms
|
||||||
|
tls:
|
||||||
|
{% if drone_certificate is defined %}
|
||||||
|
secretName: {{ drone_certificate }}
|
||||||
|
{% endif %}
|
||||||
|
options:
|
||||||
|
name: default
|
||||||
|
namespace: {{ traefik_namespace }}
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
# Source: drone/templates/pvc.yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
helm.sh/chart: drone-0.1.5
|
|
||||||
app.kubernetes.io/name: drone
|
|
||||||
app.kubernetes.io/instance: drone
|
|
||||||
app.kubernetes.io/component: server
|
|
||||||
app.kubernetes.io/version: "1.6.5"
|
|
||||||
app.kubernetes.io/managed-by: Helm
|
|
||||||
name: drone
|
|
||||||
namespace: drone
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: "8Gi"
|
|
||||||
32
templates/drone/drone-PersistentVolumeClaim.yml.j2
Normal file
32
templates/drone/drone-PersistentVolumeClaim.yml.j2
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
# Source: drone/templates/pvc.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
helm.sh/chart: drone-0.1.5
|
||||||
|
app.kubernetes.io/name: drone
|
||||||
|
app.kubernetes.io/instance: drone
|
||||||
|
app.kubernetes.io/component: server
|
||||||
|
app.kubernetes.io/version: "1.6.5"
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
name: drone
|
||||||
|
namespace: drone
|
||||||
|
spec:
|
||||||
|
{% if drone_storage_classname is defined %}
|
||||||
|
{% if drone_storage_classname == "manual" %}
|
||||||
|
storageClassName: manual
|
||||||
|
{% elif drone_storage_classname == "local" %}
|
||||||
|
storageClassName: local-path
|
||||||
|
{% elif drone_storage_classname == "do-block-storage" %}
|
||||||
|
storageClassName: do-block-storage
|
||||||
|
{% elif drone_storage_classname == "linode-block-storage" %}
|
||||||
|
storageClassName: linode-block-storage
|
||||||
|
{% elif drone_storage_classname == "nfs" %}
|
||||||
|
storageClassName: nfs
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: "8Gi"
|
||||||
49
templates/gitea/gitea-IngressRoute.yml.j2
Normal file
49
templates/gitea/gitea-IngressRoute.yml.j2
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
apiVersion: traefik.containo.us/v1alpha1
|
||||||
|
kind: IngressRoute
|
||||||
|
metadata:
|
||||||
|
name: gitea
|
||||||
|
namespace: gitea
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: drone
|
||||||
|
app.kubernetes.io/instance: gitea
|
||||||
|
app.kubernetes.io/component: server
|
||||||
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: "traefik"
|
||||||
|
|
||||||
|
spec:
|
||||||
|
entryPoints:
|
||||||
|
- https
|
||||||
|
routes:
|
||||||
|
# Match is the rule corresponding to an underlying router.
|
||||||
|
# Later on, match could be the simple form of a path prefix, e.g. just "/bar",
|
||||||
|
# but for now we only support a traefik style matching rule.
|
||||||
|
- match: Host(`gitea.{{ traefik_domain }}`)
|
||||||
|
# kind could eventually be one of "Rule", "Path", "Host", "Method", "Header",
|
||||||
|
# "Parameter", etc, to support simpler forms of rule matching, but for now we
|
||||||
|
# only support "Rule".
|
||||||
|
kind: Rule
|
||||||
|
# (optional) Priority disambiguates rules of the same length, for route matching.
|
||||||
|
priority: 12
|
||||||
|
{% if ingress_whitelist is defined %}
|
||||||
|
middlewares:
|
||||||
|
- name: traefik-ipwhitelist
|
||||||
|
{% endif %}
|
||||||
|
services:
|
||||||
|
- name: gitea
|
||||||
|
port: 3000
|
||||||
|
# (default 1) A weight used by the weighted round-robin strategy (WRR).
|
||||||
|
weight: 1
|
||||||
|
# (default true) PassHostHeader controls whether to leave the request's Host
|
||||||
|
# Header as it was before it reached the proxy, or whether to let the proxy set it
|
||||||
|
# to the destination (backend) host.
|
||||||
|
passHostHeader: true
|
||||||
|
responseForwarding:
|
||||||
|
# (default 100ms) Interval between flushes of the buffered response body to the client.
|
||||||
|
flushInterval: 100ms
|
||||||
|
tls:
|
||||||
|
{% if gitea_certificate is defined %}
|
||||||
|
secretName: {{ gitea_certificate }}
|
||||||
|
{% endif %}
|
||||||
|
options:
|
||||||
|
name: default
|
||||||
|
namespace: {{ traefik_namespace }}
|
||||||
14
templates/gitea/gitea-IngressRouteTCP.yml.j2
Normal file
14
templates/gitea/gitea-IngressRouteTCP.yml.j2
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
kind: IngressRouteTCP
|
||||||
|
metadata:
|
||||||
|
name: gitea-ssh
|
||||||
|
namespace: gitea
|
||||||
|
spec:
|
||||||
|
entryPoints:
|
||||||
|
- gitea-ssh
|
||||||
|
routes:
|
||||||
|
- match: HostSNI(`*`)
|
||||||
|
services:
|
||||||
|
- name: gitea-ssh
|
||||||
|
port: 2222
|
||||||
|
weight: 10
|
||||||
|
terminationDelay: 400
|
||||||
5
templates/gitea/gitea-Namespace.yaml.j2
Normal file
5
templates/gitea/gitea-Namespace.yaml.j2
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: gitea
|
||||||
|
|
||||||
24
templates/gitea/gitea-pvc.yml.j2
Normal file
24
templates/gitea/gitea-pvc.yml.j2
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: gitea
|
||||||
|
namespace: gitea
|
||||||
|
spec:
|
||||||
|
{% if gitea_storage_classname is defined %}
|
||||||
|
{% if gitea_storage_classname == "manual" %}
|
||||||
|
storageClassName: manual
|
||||||
|
{% elif gitea_storage_classname == "local" %}
|
||||||
|
storageClassName: local-path
|
||||||
|
{% elif gitea_storage_classname == "do-block-storage" %}
|
||||||
|
storageClassName: do-block-storage
|
||||||
|
{% elif gitea_storage_classname == "linode-block-storage" %}
|
||||||
|
storageClassName: linode-block-storage
|
||||||
|
{% elif gitea_storage_classname == "nfs" %}
|
||||||
|
storageClassName: nfs
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 10Gi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue