内容简介:This is a third-party adapter forThis allows us to use the etcd instance used by kubernetes itself to store our data.It creates a custom resource type called
endb-k8s
This is a third-party adapter for endb to use kubernetes as a backing store.
This allows us to use the etcd instance used by kubernetes itself to store our data.
It creates a custom resource type called EtcdData
, and all data is saved in objects of this type.
Usage
The default exported value is a function that initializes a store.
The function accepts an optional options object with the following fields:
-
kubeconfig: passed directly tok8s.KubeConfig.loadFromOptions -
skipApplyingCRD: if true, the crd will be assumed to exist and be correct, and will not be applied on application start.
Kubernetes permission model
In kubernetes, by default the service account is not allowed to change anything.
We need to enable the following permissions using an RBAC role:
-
PATCHing CustomResourceDefinition.If you don't want to give your app this permission, you can create the crd directly by running
kubectl apply -f crd.jsonwith the crd.json provided in this project. Then, pass the optionskipApplyingCRD: truein the options object -
Full access to the
endbdata.hubc.appdata type.This permission model allows you to create read-only and read-write roles by using kubernetes's built-in RBAC.
Usage example
const Endb = require('endb');
const k8s = require('endb-k8s');
(async () => {
try {
const endb = new Endb({ store: await k8s(), namespace: 'endb-test' });
await endb.set('dor', 'test');
await endb.set('hello', 'world');
console.log(`Hello ${await endb.get('hello')}`);
console.log(await endb.all());
console.log(await endb.has('dor'));
console.log(await endb.has('not dor'));
} catch (e) {
console.error(e);
}
})();
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
.NET设计规范
克瓦林纳 / 葛子昴 / 人民邮电出版社 / 2006-7 / 49.00元
本书为框架设计师和广大开发人员设计高质量的软件提供了权威的指南。书中介绍了在设计框架时的最佳实践,提供了自顶向下的规范,其中所描述的规范普遍适用于规模不同、可重用程度不同的框架和软件。这些规范历经.net框架三个版本的长期开发,凝聚了数千名开发人员的经验和智慧。微软的各开发组正在使用这些规范开发下一代影响世界的软件产品。. 本书适用于框架设计师以及相关的专业技术人员,也适用于高等院校相关专业......一起来看看 《.NET设计规范》 这本书的介绍吧!
XML、JSON 在线转换
在线XML、JSON转换工具
RGB HSV 转换
RGB HSV 互转工具