@codefresh-io/kube-integration

中文文档
2.1.19发布于 2026/11/03ISCCommonJS近 30 天下载 1863
  • 此示例将在默认名称空间中打印所有服务并创建mongo Project * 获取集群证书: * 运行“ 出口 CURRENT CONTEXT = $( kubectl 配置当前文本) + 输出 CURRENT CLUSTER = $( kubectl conf)
中文使用文档
文档目录4 节
  1. 法学研究
  2. 示例
  3. 最新的api相容版本(参见 api 使用 Node.js v10.15.3) :
  4. 项目

与 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

版本与发布记录

@codefresh-io/kube-integration 共发布 209 个版本,首次发布于 2017/10/24;过去 12 个月发布了 19 个版本。

版本发布日期距今
2.1.19latest2026/11/037 天前
2.1.182026/11/037 天前
2.1.172026/10/3010 天前
2.1.142026/10/081 个月前
2.1.132026/10/071 个月前
2.1.122026/10/061 个月前

其他发布通道:sec-deploy → 1.6.7,api → 1.15.18,alpha → 1.15.28,1.22.3-CR-965 → 1.22.4-CR-965,1.22.5-CR-965 → 1.22.5-CR-965,1.22.3 → 1.22.3-CR-965-b。

关于 @codefresh-io/kube-integration 的常见问题

@codefresh-io/kube-integration 是什么?

此示例将在默认名称空间中打印所有服务并创建mongo Project * 获取集群证书: * 运行“ 出口 CURRENT CONTEXT = $( kubectl 配置当前文本) + 输出 CURRENT CLUSTER = $( kubectl conf)

如何安装 @codefresh-io/kube-integration?

在项目目录运行 npm install @codefresh-io/kube-integration,或使用 pnpm add / yarn add / bun add。

@codefresh-io/kube-integration 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/codefresh-io__kube-integration 是否存在。

@codefresh-io/kube-integration 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@codefresh-io/kube-integration 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@codefresh-io/kube-integration 可以商用吗?

@codefresh-io/kube-integration 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@codefresh-io/kube-integration 的下载量有多少?

根据 npm 官方下载统计,@codefresh-io/kube-integration 在 2026/10/10 – 2026/11/08 这 30 天内被下载 1,863 次,日均约 62 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@codefresh-io/kube-integration 还在维护吗?

最新版本 2.1.19 发布于 2026/11/03(7 天前);至今共发布 209 个版本,其中过去 12 个月发布了 19 个;首次发布于 2017/10/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。