blob: 8e3788ffbb7ed052cd390c564dc1b9834d5e657d [file] [log] [blame]
// The simple deployment of FerretDB proxy to be a bit more fluent with hscloud.
// - kubectl -n personal-noisersup create secret generic ferretdb --from-literal=pg_password=password --from-literal=secret_key=pg_password
// - kubecfg update personal/noisersup/ferretdb.jsonnet
// - nix run nixpkgs#mongosh "mongodb://username:password@185.236.240.50/ferretdb?authMechanism=PLAIN"
local kube = import '../../kube/kube.libsonnet';
local postgres = import '../../kube/postgres.libsonnet';
{
local top = self,
local cfg = self.cfg,
cfg:: {
name: 'ferretdb',
image: 'ghcr.io/ferretdb/ferretdb:latest',
namespace: 'personal-noisersup',
},
ns: kube.Namespace(cfg.namespace),
deployment: top.ns.Contain(kube.Deployment(cfg.name)) {
spec+: {
replicas: 1,
template+: {
spec+: {
containers_: {
default: kube.Container(cfg.name) {
image: cfg.image,
ports_: {
http: { containerPort: 27017 },
},
env: [
{ name: 'FERRETDB_POSTGRESQL_URL', value: 'postgres://postgres:5432/ferretdb' },
],
},
},
},
},
},
},
postgres: postgres {
cfg+: {
namespace: cfg.namespace,
appName: 'ferretdb-postgres',
database: 'ferretdb',
username: 'username',
password: { secretKeyRef: { name: top.cfg.name, key: 'pg_password' } },
storageClassName: 'waw-hdd-redundant-3',
},
},
service: top.ns.Contain(kube.Service(cfg.name)) {
target_pod:: top.deployment.spec.template,
spec+: {
ports: [
{ name: 'http', port: 27017, targetPort: 27017, protocol: 'TCP' },
],
type: 'LoadBalancer',
externalTrafficPolicy: 'Local',
},
},
}