Add initial Kubernetes config files

This includes all the resources currently running on https://gitea.kosmos.org

It sets up a persistent data volume for the MySQL database, one for the
Gitea data, that Gitea calls the custom folder (config, attachment,
avatars, logs, etc). We mount that persistent data volume as
/data/gitea. It also creates a Let's Encrypt certificate for
gitea.kosmos.org, also saved to the custom folder.

This also includes two scripts:

* `./script/get_secrets` downloads the secrets to the local filesystem so
they can be edited
* `./script/replace_secrets` deletes the remote secrets and creates them
again from the local ones in kubernetes/config/*

Closes #6
This commit is contained in:
Greg Karékinian
2018-12-14 17:14:00 +01:00
parent bdc9294260
commit 4c463adcda
7 changed files with 234 additions and 0 deletions

15
script/get_secrets Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
require 'yaml'
require 'base64'
secret = `kubectl get secret gitea-config -o yaml`
yaml = YAML.load(secret)
yaml['data'].each do |key, data|
filename = File.join('kubernetes', 'config', key)
File.open(filename, "w+") do |f|
puts "Writing #{filename}"
f.write Base64.decode64(data)
end
end