forked from hswaw/hscloud
Sergiusz Bazanski
d0ec2c6ac7
This breaks up hswaw.jsonnet into a component-per-file pattern. Change-Id: I1b83d44146ae6c3d3f7c5d02abc2c9b764cc0e8e
105 lines
4 KiB
Text
105 lines
4 KiB
Text
local mirko = import "../../kube/mirko.libsonnet";
|
|
local kube = import "../../kube/kube.libsonnet";
|
|
|
|
{
|
|
cfg:: {
|
|
# Manually built from code.hackerspace.pl/q3k/ldap-web-public.
|
|
image: "registry.k0.hswaw.net/q3k/ldap-web:1571402374",
|
|
webFQDN: error "webFQDN must be set!",
|
|
},
|
|
|
|
component(cfg, env): mirko.Component(env, "ldapweb") {
|
|
local ldapweb = self,
|
|
cfg+: {
|
|
image: cfg.image,
|
|
volumes+: {
|
|
config: kube.ConfigMapVolume(ldapweb.configmap),
|
|
},
|
|
container: ldapweb.Container("main") {
|
|
# Starts by default on port 8000.
|
|
volumeMounts_+: {
|
|
config: { mountPath: "/app/webapp/config.py", subPath: "config.py", },
|
|
},
|
|
},
|
|
ports+: {
|
|
publicHTTP: {
|
|
web: {
|
|
port: 8000,
|
|
dns: cfg.webFQDN,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
configmap: kube.ConfigMap(ldapweb.makeName("config")) {
|
|
metadata+: ldapweb.metadata,
|
|
data: {
|
|
"config.py": |||
|
|
# -*- coding: utf-8 -*-
|
|
import flask_wtf
|
|
import wtforms
|
|
ldap_url = 'ldap://ldap.hackerspace.pl'
|
|
dn_format = "uid=%s,ou=people,dc=hackerspace,dc=pl"
|
|
|
|
admin_dn = 'cn=ldapweb,ou=Services,dc=hackerspace,dc=pl'
|
|
admin_pw = 'unused'
|
|
|
|
hackerspace_name = 'Warsaw Hackerspace'
|
|
|
|
readable_names = {
|
|
'commonname': u'Common Name',
|
|
'givenname': u'Given Name',
|
|
'gecos': u'GECOS (public name)',
|
|
'surname': u'Surname',
|
|
'loginshell': u'Shell',
|
|
'telephonenumber': 'Phone Number',
|
|
'mobiletelephonenumber': 'Mobile Number',
|
|
'sshpublickey': 'SSH Public Key',
|
|
}
|
|
|
|
full_name = {
|
|
'cn': 'commonname',
|
|
'gecos': 'gecos',
|
|
'sn': 'surname',
|
|
'mobile': 'mobiletelephonenumber',
|
|
'l': 'locality',
|
|
}
|
|
|
|
can_add = set([
|
|
'telephonenumber',
|
|
'mobiletelephonenumber',
|
|
'sshpublickey',
|
|
])
|
|
can_delete = can_add
|
|
can_modify = can_add | set([
|
|
'givenname', 'surname', 'commonname', 'gecos',
|
|
])
|
|
can = { 'add':can_add, 'mod':can_modify, 'del':can_delete }
|
|
admin_required = set()
|
|
|
|
|
|
perm_errors = {
|
|
'add': 'You cannot add this attribute!',
|
|
'mod': 'You cannot change this attribute!',
|
|
'del': 'You cannot delete this attribute!',
|
|
}
|
|
std_templates = {
|
|
'add': 'ops/add.html',
|
|
'mod': 'ops/mod.html',
|
|
'del': 'ops/del.html',
|
|
}
|
|
|
|
|
|
|
|
default_field = (wtforms.fields.StringField, {})
|
|
fields = { 'telephonenumber': (wtforms.fields.StringField, {'validators': [wtforms.validators.Regexp(r'[+0-9 ]+')]})}
|
|
|
|
kadmin_passwd = True
|
|
kadmin_principal_map = "{}@HACKERSPACE.PL"
|
|
|
|
TOKEN_LENGTH = 32
|
|
|||,
|
|
},
|
|
},
|
|
},
|
|
}
|