配置kazoo及其组件的便利库
kzconfig的Python项目详细描述
#kzconfig
kazoo通用配置包装和帮助程序。包装以下库:
*python couchdb
*kazoo sdk
*pyrkube
*dnsimple
在本例中,我选择显示除了使用不同的dns提供程序之外,希望使用默认约定的用户是如何使用的。
``python
from kzconfig import context,meta
u configs=(“environment”,)
u secrets=(“couchdb”,“rabbitmq”,“master account”,'dns.coredns'dns.coredns')
def-init(self,domain'example.org'):
self.domain=domain
@meta.lazy\u属性
>def-dns(self):
>返回mydns(self,self.domain)
self.context=context
>self.domain=domain
creds=self.context.secrets['dns.coredns']
username=creds['email'],
password=creds['password']
)
```````
不使用dns实现子类化的快速示例。
``python
meta
类myContext(上下文):
u configs=(“environment”,)
u secrets=(“couchdb”、“rabbitmq”、“master account”、“dns.coredns”)
u domain=“example.org”
def\uu init(self,domain='example.org'):
self.domain=domain
def dns(self):
raise notimplemented
`````
``python
meta
context=context()
````
```python
````python
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `获取一个名为rabbitmq的豆荚
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` pods
all_system_pods=context.kube.api.get('pod',
使用标签选择器app=couchdb获取第一个pod使用标签选择器app=couchdb
first-pod
first-couchdb=context.kube.api.get _first('pod',selector=dict(app'couchdb')
```
<
<
<
<获取系统配置数据库,获取系统配置数据库
br/>db=context.couchdb['系统配置]
doc=dict('u id='hello')
将新文档保存到
db.save(doc)
````
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `;35; dns
`` python
context.dns.add('a','192.168.0.1')
```
### Sup
```python
context.sup.kz_nodes.status()
```
## CLI Commands
### `sup`
#### Usage
```
Usage: sup [OPTIONS] MODULE FUNCTION [ARGS]...
Options:
--help Show this message and exit.
```
### `install-kubectl`
#### 使用< BR/> 'BR/>用法:安装Kubttl [选项] < BR> > BR/>选项:帮助显示此信息并退出。
'BR/> BR/>安装Kubbtl版本=KubBurtVelux1.1.7.8BR/>
如果使用环境变量重写版本,确保也覆盖kubectl_u sha256。
```
kazoo通用配置包装和帮助程序。包装以下库:
*python couchdb
*kazoo sdk
*pyrkube
*dnsimple
在本例中,我选择显示除了使用不同的dns提供程序之外,希望使用默认约定的用户是如何使用的。
``python
from kzconfig import context,meta
u secrets=(“couchdb”,“rabbitmq”,“master account”,'dns.coredns'dns.coredns')
def-init(self,domain'example.org'):
self.domain=domain
@meta.lazy\u属性
>def-dns(self):
>返回mydns(self,self.domain)
self.context=context
>self.domain=domain
creds=self.context.secrets['dns.coredns']
password=creds['password']
)
```````
不使用dns实现子类化的快速示例。
``python
meta
类myContext(上下文):
u configs=(“environment”,)
u secrets=(“couchdb”、“rabbitmq”、“master account”、“dns.coredns”)
u domain=“example.org”
def\uu init(self,domain='example.org'):
self.domain=domain
def dns(self):
raise notimplemented
`````
``python
meta
context=context()
````
```python
````python
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `获取一个名为rabbitmq的豆荚
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` pods
all_system_pods=context.kube.api.get('pod',
使用标签选择器app=couchdb获取第一个pod使用标签选择器app=couchdb
first-pod
first-couchdb=context.kube.api.get _first('pod',selector=dict(app'couchdb')
```
<
<
<
<获取系统配置数据库,获取系统配置数据库
br/>db=context.couchdb['系统配置]
doc=dict('u id='hello')
将新文档保存到
db.save(doc)
````
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `;35; dns
`` python
context.dns.add('a','192.168.0.1')
```
### Sup
```python
context.sup.kz_nodes.status()
```
## CLI Commands
### `sup`
#### Usage
```
Usage: sup [OPTIONS] MODULE FUNCTION [ARGS]...
Options:
--help Show this message and exit.
```
### `install-kubectl`
#### 使用< BR/> 'BR/>用法:安装Kubttl [选项] < BR> > BR/>选项:帮助显示此信息并退出。
'BR/> BR/>安装Kubbtl版本=KubBurtVelux1.1.7.8BR/>
如果使用环境变量重写版本,确保也覆盖kubectl_u sha256。
```