7 Commits

Author SHA1 Message Date
Greg Karékinian
0a60d8831c Merge branch 'master' into feature/4-label_sets 2019-02-27 12:43:45 +01:00
Greg Karékinian
cc6f31b4b9 Update Gitea to 1.7.2
Closes #18
2019-02-25 16:54:59 +01:00
Greg Karékinian
069502d056 Bump the gitea data storage to 20GB 2019-02-25 13:29:09 +01:00
Greg Karékinian
278e6a9cd7 Use a 10GB persistent storage volume for gitea data 2019-02-25 13:18:45 +01:00
Greg Karékinian
eba722992f Copy the labels to the persistent data volume
Move the custom label definitions to a custom folder in the kubernetes
folder, as well as the config files
2019-02-05 20:29:08 +01:00
Greg Karékinian
871d47fff8 Merge branch 'master' into feature/4-label_sets 2019-02-05 20:16:27 +01:00
21238a032d Add default and Kosmos label sets
Adds custom label set configs, overriding the default set and adding a
new one for Kosmos (that includes kredits labels).

closes #4
2019-01-27 16:19:19 +08:00
10 changed files with 43 additions and 119 deletions

2
.gitignore vendored
View File

@@ -1 +1 @@
/kubernetes/config/
/kubernetes/custom/config/

View File

@@ -0,0 +1,11 @@
#db231d bug ; Something is not working
#76db1d enhancement ; Improving existing functionality
#1d76db feature ; New functionality
#db1d76 idea ; Something to consider
#db1d76 question ; Looking for an answer
#fbca04 security ; All your base are belong to us
#1dd5db ui/ux ; User interface, process design, etc.
#333333 dev environment ; Config, builds, CI, deployment, etc.
#cccccc duplicate ; This issue or pull request already exists
#cccccc invalid ; Not a bug
#cccccc wontfix ; This won't be fixed

View File

@@ -0,0 +1,14 @@
#db231d bug ; Something is not working
#76db1d enhancement ; Improving existing functionality
#1d76db feature ; New functionality
#db1d76 idea ; Something to consider
#db1d76 question ; Looking for an answer
#fbca04 security ; All your base are belong to us
#1dd5db ui/ux ; User interface, process design, etc.
#333333 dev environment ; Config, builds, CI, deployment, etc.
#008080 kredits-1 ; Small contribution
#008080 kredits-2 ; Medium contribution
#008080 kredits-3 ; Large contribution
#cccccc duplicate ; This issue or pull request already exists
#cccccc invalid ; Not a bug
#cccccc wontfix ; This won't be fixed

View File

@@ -1,12 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kosmos-drone-rbac
subjects:
- kind: ServiceAccount
name: default
namespace: kosmos
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io

View File

@@ -1,91 +0,0 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kosmos-drone-server
namespace: kosmos
labels:
app: kosmos-drone
spec:
replicas: 1
template:
metadata:
labels:
name: kosmos-drone-server
app: kosmos-drone
spec:
containers:
- name: kosmos-drone-server
image: drone/drone:latest
imagePullPolicy: Always
env:
- name: DRONE_KUBERNETES_ENABLED
value: "true"
- name: DRONE_KUBERNETES_NAMESPACE
value: kosmos
- name: DRONE_GITEA_SERVER
value: https://gitea.kosmos.org
- name: DRONE_RPC_SECRET
value: 0500c55b6ae97a7f1e7c207477698b6d
- name: DRONE_SERVER_HOST
value: drone.kosmos.org
- name: DRONE_SERVER_PROTO
value: https
- name: DRONE_TLS_AUTOCERT
value: "true"
- name: DRONE_ADMIN
value: raucao,gregkare,galfert
- name: DRONE_LOGS_DEBUG
value: "true"
volumeMounts:
- mountPath: /var/lib/drone
name: kosmos-drone-data
ports:
- containerPort: 80
- containerPort: 443
resources:
requests:
cpu: 50m
memory: 50Mi
limits:
cpu: 100m
memory: 100Mi
volumes:
- name: kosmos-drone-data
persistentVolumeClaim:
claimName: kosmos-drone-data
restartPolicy: Always
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: kosmos-drone-data
namespace: kosmos
labels:
app: kosmos-drone
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3000Mi
status: {}
---
apiVersion: v1
kind: Service
metadata:
name: kosmos-drone-server
namespace: kosmos
labels:
name: kosmos-drone-server
app: kosmos-drone
spec:
type: LoadBalancer
ports:
- name: "http"
port: 80
targetPort: 80
- name: "https"
port: 443
targetPort: 443
selector:
name: kosmos-drone-server

View File

@@ -15,18 +15,23 @@ spec:
initContainers:
- name: init-config
image: busybox
command: ['sh', '-c', 'mkdir -p /data/gitea/conf && mkdir -p /data/gitea/https && cp /root/conf/app.ini /data/gitea/conf/app.ini && chown 1000:1000 /data/gitea/conf/app.ini && chmod 660 /data/gitea/conf/app.ini && cp /root/conf/*.pem /data/gitea/https && chmod 600 /data/gitea/https/*.pem && chown -R 1000:1000 /data/gitea']
command: [
'sh', '-c',
'mkdir -p /data/gitea/conf && mkdir -p /data/gitea/https && mkdir -p /data/gitea/options/label && cp /root/conf/app.ini /data/gitea/conf/app.ini && chown 1000:1000 /data/gitea/conf/app.ini && chmod 660 /data/gitea/conf/app.ini && cp /root/conf/*.pem /data/gitea/https && chmod 600 /data/gitea/https/*.pem && cp /root/options/label/* /data/gitea/options/label/ && chown -R 1000:1000 /data/gitea'
]
volumeMounts:
- mountPath: /data
name: gitea-server-data
- mountPath: /root/conf
name: config
# The labels have been created as a ConfigMap from local files using this command:
#
# kubectl create configmap gitea-options-label --from-file=custom/options/label/
- mountPath: /root/options/label
name: label
containers:
# This is only used for the initial setup, it does nothing once a app.ini
# file exists in the conf/ directory of the data directory
# (/data/gitea/conf in our case)
- name: gitea-server
image: gitea/gitea:1.7.1
image: gitea/gitea:1.7.2
ports:
- containerPort: 3000
- containerPort: 3001
@@ -52,6 +57,9 @@ spec:
- key: key.pem
path: key.pem
mode: 256
- name: label
configMap:
name: gitea-options-label
---
apiVersion: v1
kind: PersistentVolumeClaim
@@ -64,7 +72,7 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storage: 20Gi
---
apiVersion: v1
kind: Service

View File

@@ -1,6 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: kosmos
labels:
app: kosmos

View File

@@ -7,7 +7,7 @@ secret = `kubectl get secret gitea-config -o yaml`
yaml = YAML.load(secret)
yaml['data'].each do |key, data|
filename = File.join('kubernetes', 'config', key)
filename = File.join('kubernetes', 'custom', 'config', key)
File.open(filename, "w+") do |f|
puts "Writing #{filename}"
f.write Base64.decode64(data)

View File

@@ -2,8 +2,8 @@
# Delete the gitea-config secrets
kubectl delete secret gitea-config
# Replace it from the local files in kubernetes/config/* (acquired by running
# Replace it from the local files in kubernetes/custom/config/* (acquired by running
# ./script/get_secrets)
kubectl create secret generic gitea-config --from-file=cert.pem=kubernetes/config/cert.pem --from-file=key.pem=kubernetes/config/key.pem --from-file=app.ini=kubernetes/config/app.ini
kubectl create secret generic gitea-config --from-file=cert.pem=kubernetes/custom/config/cert.pem --from-file=key.pem=kubernetes/custom/config/key.pem --from-file=app.ini=kubernetes/custom/config/app.ini
# Force the pod to restart by patching the deployment resource
kubectl patch deployment gitea-server -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"