@madhouselabs/konfig v1.1.43
How to use
pnpx @madhouselabs/konfig generate
pnpx @madhouselabs/konfig make
konfig - JS Powered k8s application manifest templating
You can specify values configurations for deployment, services in various formats. The currently supported ones are js
,json
and yml
.
following is a working example of configuration
const config = {
appName: 'auth-api',
namespace: 'hotspot',
replica: 1,
serviceAccount: 'hotspot-admin',
containers: [
{
name: 'auth-api',
image: {
name: 'registry.madhouselabs.io/hotspot/api/auth:latest',
pullPolicy: 'Always' // defaults to 'Always'
},
env: {
NODE_ENV: 'production',
CONFIG_FILE: '/hotspot/config.yml',
SECRET_FILE: '/hotspot/secret.yml',
GITLAB_INSTANCE_CALLBACK_URL:
'https://git.madhouselabs.io/users/auth/jwt/callback',
SLACK_WEBHOOK_URL:
'https://hooks.slack.com/services/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',
},
resources: {
cpu: {
min: 150,
max: 300,
},
memory: {
min: 200,
max: 400,
},
},
liveness: {
path: '/api/auth/healthy',
port: 3000,
initDelay: 15, // defaults to 20
period: 10, // defaults to 10
},
volumes: {
secret: [
{
mountPath: '/example',
name: 'auth-api-secret',
items: [
{
key: 'value',
path: 'secret.yml',
},
],
},
],
configMap: [
{
mountPath: '/example',
name: 'auth-api-config',
items: [
{
key: 'value',
path: 'config.yml',
},
],
},
{
mountPath: '/sample-example',
name: 'auth-api-config-2',
items: [
{
key: 'value-2',
path: 'config.yml2',
},
],
},
],
},
},
],
expose: {
tcp: {
// externalPort: internalPort (pod port)
// here 3000 is the externalPort, and 80 is the port exposed on the pod. ie. service would accept requests on port 3000, and then route it to port 80 of that pod internally
3000: 80,
4000: 8000,
},
udp: {
4242: 12800,
},
},
configMap: [
{
name: 'app-config',
data: [
{
key: 'NODE_ENV',
value: 'development',
},
{
key: 'value',
value: yaml.dump({
NODE_ENV: 'development',
}),
},
],
},
],
secret: [
{
name: 'app-secret',
data: [
{
key: 'value',
value: yaml.dump({
mongo: {
uri: 'safkjsasakfjsaldjflksao',
db: 'hotspot',
},
}),
},
],
},
],
};
export default config;
v1.1.1: added support to add env, secret and configmap from contents of a local file
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago