与 K8 合并于 GKE
法学研究
示例
- 此示例将在默认名称空间中打印所有服务并创建mongo
Project(关于以下项目的更多信息) - 获得集群证书:
- 运行
export CURRENT_CONTEXT=$(kubectl config current-context) && export CURRENT_CLUSTER=$(kubectl config view -o go-template="{{\$curr_context := \"$CURRENT_CONTEXT\" }}{{range .contexts}}{{if eq .name \$curr_context}}{{.context.cluster}}{{end}}{{end}}") && export KUBE_HOST=$(kubectl config view -o go-template="{{\$cluster_context := \"$CURRENT_CLUSTER\"}}{{range .clusters}}{{if eq .name \$cluster_context}}{{.cluster.server}}{{end}}{{end}}") - 运行 :
export KUBE_CA_CERT=$(kubectl get secret -o go-template='{{index .data "ca.crt" }}' $(kubectl get sa default -o go-template="{{range .secrets}}{{.name}}{{end}}")) - 运行 :
export KUBE_ACCOUNT_TOKEN=$(kubectl get secret -o go-template='{{index .data "token" }}' $(kubectl get sa default -o go-template="{{range .secrets}}{{.name}}{{end}}"))
- 运行
- 运行
example.js
最新的api相容版本(参见 api 使用 Node.js v10.15.3) :
- 1.15.18 联合国
- 1.6.4 (中文(简体) )
项目
定义
项目是一组资源的一种抽象,它们共同具有实用性的目的.
目前,项目必须有一个服务
结构
{
selector,
namespace,
stauts,
resources,
name,
metadata
}
- 选择器 - 以 Codefresh 为代表的组逻辑名称
- 命名空间 - 项目所在的命名空间
- 现况 -- -- 项目现况
{type: String("SUCCESS", "FAILED", "WARNING", "IN_PROGRESS" ,"UNKNOWN")}(中文(简体) ) - 资源 - 确定项目的一组资源
- 元数据 -- -- 可能的话,从资源中和从重新编码的其他服务中分析和汇总额外数据(
{labels: Object, projectSelectors: Object, containers: Object[{image: String, name: String, status: Object[]}]}) (中文(简体) ).
项目 API (REST 呼叫)
* GET `/projects` - returns an array of all projects with minimal information about the project
* GET `/projects/:name` - return specific project with full description
* POST `/projects` - create a project
* DELETE `/projects/:name` - delete a project (deletion means, delete all the resources)
* PUT `/projects/:name` - update project resources
工程 API( 作为对象)
* Evenets:
* ['SERVICE.ADDED', 'DEPLOYMENT.ADDED', 'REPLICASET.SET.ADDED', 'POD.SET.ADDED']
* Functions:
* setName(name: String) - Set the project name, project automatically sets his name when adding service
* getName - return the projects name
* getNamespace - return the projects namespace
* analyzeStatus - traverse all the current resources and analyze the project status
* setService(svc: Service) - set the projects service
* setDeployment(deploy: Deployment) - set the projects deployment
* setPods(pods: Pod || Pod[]) - set the projects pods
* setReplicaSets(rss: Replicaset || Replicaset[]) - set the projects
* toMinifiedJson - return minified representation of project (`{name, namespace, selector, metadata, status}`)
* toJson - return full representation of the project